All pastes #114421 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-08-04 01:58 UTC
rendered paste body
Index: ag_UnitClass.lua
===================================================================
--- ag_UnitClass.lua	(revision 6827)
+++ ag_UnitClass.lua	(working copy)
@@ -671,6 +671,25 @@
 						self.HealthText:SetText(currValue.."/"..maxValue)
 					end
 				end
+			elseif ( style == "Smart" ) then
+				-- Courtesy of Sairen!
+				if ( self.unit == "target" or self.unit == "targettarget") then
+					if ( MHfound == true or UnitIsUnit(self.unit,"pet") or UnitInParty(self.unit) or UnitIsUnit(self.unit, "player") or UnitInRaid(self.unit) ) then
+						if ( hpDiff > 0 ) then
+							self.HealthText:SetText("|cffff7f7f-"..hpDiff.."|r")
+						else
+							self.HealthText:SetText("")
+						end
+					else
+						self.HealthText:SetText(percValue)
+					end
+				else
+					if ( hpDiff > 0 ) then
+						self.HealthText:SetText("|cffff7f7f-"..hpDiff.."|r")
+					else
+						self.HealthText:SetText("")
+					end
+				end
 			else
 				self.HealthText:SetText(percValue)
 			end
@@ -728,9 +747,9 @@
 				self.ManaText:SetText(currValue.."/"..maxValue)
 			elseif ( maxValue == 0 ) then
 				self.ManaText:SetText("0%")
-			elseif (style == "Difference" and hpDiff > 0) then
+			elseif ( (style == "Smart" or style == "Difference") and hpDiff > 0 ) then
 				self.ManaText:SetText(currValue.."|cffff7f7f-"..hpDiff.."|r")
-			elseif (style == "Difference") then
+			elseif ( style == "Smart" or style == "Difference" ) then
 				self.ManaText:SetText(currValue.."/"..maxValue)			
 			end
 		else
Index: ag_UnitFrames.lua
===================================================================
--- ag_UnitFrames.lua	(revision 6827)
+++ ag_UnitFrames.lua	(working copy)
@@ -569,7 +569,7 @@
 					self:CallUnitMethods("UpdateHealth",true,class,"type")				
 					self:CallUnitMethods("UpdatePower",true,class,"type")
 				end,
-				validate = {"Absolute", "Difference", "Percent", "Hide"},
+				validate = {"Absolute", "Difference", "Percent", "Hide", "Smart"},
 				order = 5,				
 			},
 			Scale = {