mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-22 20:10:50 +00:00
nameplates: switch to libhealth by name function
This commit is contained in:
+11
-4
@@ -394,11 +394,18 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
|
|||||||
plate.health:SetValue(hp)
|
plate.health:SetValue(hp)
|
||||||
|
|
||||||
if C.nameplates.showhp == "1" then
|
if C.nameplates.showhp == "1" then
|
||||||
local realhp, realhpmax
|
local rhp, rhpmax, estimated
|
||||||
if pfUI.libhealth and pfUI.libhealth.enabled then
|
if hpmax > 100 then
|
||||||
realhp, realhpmax = pfUI.libhealth:GetDBHealth(name .. ":" .. level)
|
rhp, rhpmax = hp, hpmax
|
||||||
|
elseif pfUI.libhealth and pfUI.libhealth.enabled then
|
||||||
|
rhp, rhpmax, estimated = pfUI.libhealth:GetUnitHealthByName(name,level,tonumber(hp),tonumber(hpmax))
|
||||||
|
end
|
||||||
|
|
||||||
|
if estimated or hpmax > 100 then
|
||||||
|
plate.health.text:SetText(string.format("%s / %s", Abbreviate(rhp), Abbreviate(rhpmax)))
|
||||||
|
else
|
||||||
|
plate.health.text:SetText(string.format("%s%%", hp))
|
||||||
end
|
end
|
||||||
plate.health.text:SetText(string.format("%s / %s", realhp and ceil(realhp*hp) or hp, realhpmax or hpmax))
|
|
||||||
else
|
else
|
||||||
plate.health.text:SetText()
|
plate.health.text:SetText()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user