So I'm looking for a way to do this but they all seem kind of hack-y. I originally tried adding it to my frames OnEnter script but oUF seems to ignore changing a tag.
I tried moving it to the health tag and adding UPDATE_MOUSEOVER_UNIT to the tag events, but... It doesn't actually fire for the tag. It fires fine if I register the event on a frame of my own, but not for my tag.
Code:
oUF.TagEvents['[magsshealthperc]'] = 'UPDATE_MOUSEOVER_UNIT UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['[magsshealthperc]'] = function(unit)
local cur, max = UnitHealth(unit), UnitHealthMax(unit)
local r, g, b = oUF.ColorGradient(cur / max, unpack(oUF.colors.smooth))
if _G[GetMouseFocus():GetName()].unit == 'target' then
return oUF.Tags['[curhp]'](unit)
else
return format('|cff%02x%02x%02x%s%%|r', r * 255, g * 255, b * 255, floor(cur / max * 100))
end
end
I can get the code to work if I set my tag to frequently update but that's a lot of unnecessary processing I'd rather avoid. Are there any more elegant alternatives to this?