From fbc34717d45bccf5cffc0d29c7fae59759633233 Mon Sep 17 00:00:00 2001 From: Scott King Date: Wed, 15 Jan 2014 21:19:45 -0700 Subject: [PATCH] Calculation precision change --- PortraitHealth.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PortraitHealth.lua b/PortraitHealth.lua index 77b16c6..cebb9b1 100755 --- a/PortraitHealth.lua +++ b/PortraitHealth.lua @@ -31,7 +31,7 @@ end function HealthPercentage() -- Health value to display. Whole numbers only. - TargetPercentHealth = math.ceil((UnitHealth("target") / UnitHealthMax("target") * 100)); + TargetPercentHealth = (UnitHealth("target") / UnitHealthMax("target") * 100); -- Class detection @@ -69,12 +69,14 @@ function HealthPercentage() PortraitHealth_Health:SetTextColor(1,1,0); end + -- reformat health without decimals + local h = string.format("%0f",TargetPercentHealth); -- change the portrait to show current health if UnitIsDead("target") then PortraitHealth_Health:SetText('Dead'); else - PortraitHealth_Health:SetText(TargetPercentHealth .. '%'); + PortraitHealth_Health:SetText(h .. '%'); end end -- 1.7.9.5