Thread Tools Display Modes
10-25-10, 02:30 PM   #1
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Healthbar

I have some problems with my healthbars.
After leaving a vehicle it stays gray my (d/c) color.
Same happens to my pet once I mount-up and dismount.

Code:
			local hp = CreateFrame("StatusBar", nil, self)
	hp:SetHeight(cfg.heightHP)	
	hp:SetStatusBarTexture(cfg.Gentex)
	hp:SetPoint"TOP"
	hp:SetPoint"LEFT"
	hp:SetPoint"RIGHT"
	hp:SetStatusBarColor(0.09, 0.09, 0.09)
	hp.colorDisconnected = true
	hp.colorTapping = true
	hp:GetStatusBarTexture():SetHorizTile(true)
	
	hp.frequentUpdates = true
	self.Health = hp
	self.Health.PostUpdate = PostUpdateHealth
the code that does coloring, I don't have a clue what is causing this.
any suggestions?
__________________
  Reply With Quote
10-25-10, 03:53 PM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
You don't have an fallback color. It's basically just color be tapped or color me disconnected.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
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
10-26-10, 02:14 AM   #4
drdead
A Murloc Raider
Join Date: Oct 2008
Posts: 6
isn't it better to do such things via tag?
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Healthbar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off