From 267c38ab11c391ffd664fca4f4e28c0782d80591 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 3 May 2020 13:30:53 +0200 Subject: [PATCH] nameplates: switch to libhealth by name function --- modules/nameplates.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 848cb242..b1087093 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -394,11 +394,18 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () plate.health:SetValue(hp) if C.nameplates.showhp == "1" then - local realhp, realhpmax - if pfUI.libhealth and pfUI.libhealth.enabled then - realhp, realhpmax = pfUI.libhealth:GetDBHealth(name .. ":" .. level) + local rhp, rhpmax, estimated + if hpmax > 100 then + 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 - plate.health.text:SetText(string.format("%s / %s", realhp and ceil(realhp*hp) or hp, realhpmax or hpmax)) else plate.health.text:SetText() end