diff --git a/api/config.lua b/api/config.lua index 081de7d3..0f58a2e6 100644 --- a/api/config.lua +++ b/api/config.lua @@ -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") diff --git a/modules/gui.lua b/modules/gui.lua index ff432c86..983e7dc8 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -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") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 1a1c7220..07527023 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -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