Would it be possible to incorporate this in a tag?
I'm currently trying to get my head around it, but can't really get to it. Thing is I don't use any bars and therefore no hp or pp functions at all, just tags.
Code:
For instance, this is my health percent tag
oUF.Tags.Methods['GhostHPPerc'] = function(u)
local m = UnitHealthMax(u)
local hp_perc = math.floor(UnitHealth(u)/m*100+.5)
-- set text color and info
if(UnitIsDead(u)) then
return "|CFFB80D20".. "RIP" .."|r"
elseif(UnitIsGhost(u)) then
return "|CFFB80D20".. "GHO" .."|r"
elseif(not UnitIsConnected(u)) then
return "|CFFFFFFFF".. "OFF" .."|r"
elseif(UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) then
return "|CFF969696".. "TPD" .."|r"
elseif(hp_perc <= 60 and hp_perc > 35) then
return format('|CFFF7F774 %d|r', hp_perc)
elseif(hp_perc <= 35 and hp_perc >= 25) then
return format('|CFFFDEE50 %d|r', hp_perc)
elseif(hp_perc < 25 and hp_perc >= 20) then
return format('|CFFFA8200 %d|r', hp_perc)
elseif(hp_perc < 20) then
return format('|CFFB80D20 %d|r', hp_perc)
else
return format('|CFFFFFFFF %d|r', hp_perc)
end
end
oUF.Tags.Events['GhostHPPerc'] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION"