WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Healthbar (https://www.wowinterface.com/forums/showthread.php?t=36238)

Quokka 10-25-10 02:30 PM

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?

haste 10-25-10 03:53 PM

You don't have an fallback color. It's basically just color be tapped or color me disconnected.

Quokka 10-26-10 12:42 AM

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?

drdead 10-26-10 02:14 AM

isn't it better to do such things via tag?


All times are GMT -6. The time now is 11:41 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI