mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 03:06:01 +00:00
nameplates: add several health text format options
This commit is contained in:
+1
-1
@@ -668,7 +668,7 @@ function pfUI:LoadConfig()
|
||||
|
||||
pfUI:UpdateConfig("nameplates", nil, "showhp", "0")
|
||||
pfUI:UpdateConfig("nameplates", nil, "hptextpos", "RIGHT")
|
||||
pfUI:UpdateConfig("nameplates", nil, "alwaysperc", "0")
|
||||
pfUI:UpdateConfig("nameplates", nil, "hptextformat", "curmaxs")
|
||||
pfUI:UpdateConfig("nameplates", nil, "vpos", "-10")
|
||||
pfUI:UpdateConfig("nameplates", nil, "width", "120")
|
||||
pfUI:UpdateConfig("nameplates", nil, "debuffsize", "14")
|
||||
|
||||
+11
-1
@@ -1043,6 +1043,16 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
|
||||
"powermiss:" .. T["Mana - Missing"],
|
||||
"powerminmax:" .. T["Mana - Min/Max"],
|
||||
},
|
||||
["hpformat"] = {
|
||||
"percent:" .. T["Percent"],
|
||||
"cur:" .. T["Current HP"],
|
||||
"curperc:" .. T["Current HP | Percent"],
|
||||
"curmax:" .. T["Current HP - Max HP"],
|
||||
"curmaxs:" .. T["Current HP / Max HP"],
|
||||
"curmaxperc:" .. T["Current HP - Max HP | Percent"],
|
||||
"curmaxpercs:" .. T["Current HP / Max HP | Percent"],
|
||||
"deficit:" .. T["Deficit"],
|
||||
},
|
||||
["panel_values"] = {
|
||||
"none:" .. T["Disable"],
|
||||
"time:" .. T["Clock"],
|
||||
@@ -2165,7 +2175,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
|
||||
CreateConfig(U["nameplates"], T["Healthbar Texture"], C.nameplates, "healthtexture", "dropdown", pfUI.gui.dropdowns.uf_bartexture)
|
||||
CreateConfig(U["nameplates"], T["Show Health Points"], C.nameplates, "showhp", "checkbox")
|
||||
CreateConfig(U["nameplates"], T["Health Text Position"], C.nameplates, "hptextpos", "dropdown", pfUI.gui.dropdowns.textalign)
|
||||
CreateConfig(U["nameplates"], T["Always Show Health In Percent"], C.nameplates, "alwaysperc", "checkbox")
|
||||
CreateConfig(U["nameplates"], T["Health Text Format"], C.nameplates, "hptextformat", "dropdown", pfUI.gui.dropdowns.hpformat)
|
||||
CreateConfig(U["nameplates"], T["Hide Healthbar On Enemy NPCs"], C.nameplates, "enemynpc", "checkbox")
|
||||
CreateConfig(U["nameplates"], T["Hide Healthbar On Enemy Players"], C.nameplates, "enemyplayer", "checkbox")
|
||||
CreateConfig(U["nameplates"], T["Hide Healthbar On Neutral NPCs"], C.nameplates, "neutralnpc", "checkbox")
|
||||
|
||||
+17
-2
@@ -555,9 +555,24 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
|
||||
rhp, rhpmax, estimated = pfUI.libhealth:GetUnitHealthByName(name,level,tonumber(hp),tonumber(hpmax))
|
||||
end
|
||||
|
||||
if C.nameplates.alwaysperc == "0" and ( estimated or hpmax > 100 or (round(hpmax/100*hp) ~= hp) ) then
|
||||
local setting = C.nameplates.hptextformat
|
||||
local hasdata = ( estimated or hpmax > 100 or (round(hpmax/100*hp) ~= hp) )
|
||||
|
||||
if setting == "curperc" and hasdata then
|
||||
plate.health.text:SetText(string.format("%s | %s%%", Abbreviate(rhp), ceil(hp/hpmax*100)))
|
||||
elseif setting == "cur" and hasdata then
|
||||
plate.health.text:SetText(string.format("%s", Abbreviate(rhp)))
|
||||
elseif setting == "curmax" and hasdata then
|
||||
plate.health.text:SetText(string.format("%s - %s", Abbreviate(rhp), Abbreviate(rhpmax)))
|
||||
elseif setting == "curmaxs" and hasdata then
|
||||
plate.health.text:SetText(string.format("%s / %s", Abbreviate(rhp), Abbreviate(rhpmax)))
|
||||
else
|
||||
elseif setting == "curmaxperc" and hasdata then
|
||||
plate.health.text:SetText(string.format("%s - %s | %s%%", Abbreviate(rhp), Abbreviate(rhpmax), ceil(hp/hpmax*100)))
|
||||
elseif setting == "curmaxpercs" and hasdata then
|
||||
plate.health.text:SetText(string.format("%s / %s | %s%%", Abbreviate(rhp), Abbreviate(rhpmax), ceil(hp/hpmax*100)))
|
||||
elseif setting == "deficit" then
|
||||
plate.health.text:SetText(string.format("-%s" .. (hasdata and "" or "%%"), Abbreviate(rhpmax) - Abbreviate(rhp)))
|
||||
else -- "percent" as fallback
|
||||
plate.health.text:SetText(string.format("%s%%", ceil(hp/hpmax*100)))
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user