Quantcast

Precision change, fixed Priest threshold

Scott King [01-20-14 - 05:23]
Precision change, fixed Priest threshold
Filename
PortraitHealth.lua
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index 452c967..ee26472 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -10,7 +10,7 @@ PH_p[1] = "20" 		-- Warrior 			1
 PH_p[2] = "20" 		-- Paladin 			2
 PH_p[3] = "20" 		-- Hunter 			3
 PH_p[4] = "35" 		-- Rogue			4
-PH_p[5] = "25" 		-- Priest			5
+PH_p[5] = "20" 		-- Priest			5
 PH_p[6] = "35" 		-- Death Knight		6
 PH_p[7] = "10" 		-- Shaman			7
 PH_p[8] = "10" 		-- Mage				8
@@ -47,7 +47,7 @@ function HealthPercentage()
 		elseif PlayerClass == 4 and TargetPercentHealth < 35 then 	-- Rogue
 				PortraitHealth_Health:SetTextColor(1,0,0);

-		elseif PlayerClass == 5 and TargetPercentHealth <= 25 then 	-- Priest
+		elseif PlayerClass == 5 and TargetPercentHealth < 20 then 	-- Priest
 				PortraitHealth_Health:SetTextColor(1,0,0);

 		elseif PlayerClass == 6 and TargetPercentHealth < 35 then 	-- Death Knight
@@ -71,12 +71,16 @@ function HealthPercentage()

 	-- reformat health without decimals
 	local h = string.format("%.0f",TargetPercentHealth);
+	local i = string.format("%.1f",TargetPercentHealth);

 	-- change the portrait to show current health
 	if UnitIsDead("target") then
 		PortraitHealth_Health:SetText('Dead');
-	else
-		PortraitHealth_Health:SetText(h .. '%');
+	elseif
+		TargetPercentHealth <= 1 then PortraitHealth_Health:SetText(h .. '%');
+	elseif
+		TargetPercentHealth > 1 then PortraitHealth_Health:SetText(i .. '%');
+
 	end

 end