Thread: Healthbar
View Single Post
10-26-10, 12:42 AM   #3
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Code:
local PostUpdateHealth = function(Health, unit, min, max)
	local self = Health:GetParent()
    local d =(round(min/max, 2)*100)
	local c = UnitClassification(unit)
	
	if(UnitIsDead(unit)) then
		Health:SetValue(0)
		Health.value:SetText"Dead"	
		Health.value:SetTextColor(1,0,0)
		Health.percent:SetText""
	elseif(UnitIsGhost(unit)) then
		Health:SetValue(0)
		Health.value:SetText"Ghost"	
		Health.value:SetTextColor(1,0,0)
	elseif(not UnitIsConnected(unit)) then	
		Health.value:SetText"d/c"	
	elseif(unit == "player" or unit == "target") then
		Health.value:SetText(CoolNumber(min))
		Health.value:SetTextColor(1,1,1))

		if (min ~= max) then
			local r, g, b = oUF.ColorGradient(min / max, unpack(oUF.colors.smooth))
			Health.percent:SetText(floor(min / max * 100).."%")
			Health.percent:SetTextColor(r,g,b)
		else
			Health.percent:SetText""
			self.Health.bg:SetVertexColor(.3,.3,.3)
		end
	else
		local r, g, b = oUF.ColorGradient(min / max, unpack(oUF.colors.smooth))
		Health.value:SetText(CoolNumber(min))
		Health.value:SetTextColor(r,g,b)
		self.Health:SetStatusBarColor(0.09, 0.09, 0.09)
		self.Health.bg:SetVertexColor(.3,.3,.3)
	end
end
so If I add this (marked green above)
Code:
self.Health:SetStatusBarColor(0.09, 0.09, 0.09)
I'd be save. since there is a failback am I right?
__________________
  Reply With Quote