@Kraut
There are events to track the druid shapeshift.
Your arrow frame needs to hook them and change it's color accordingly.
The unit powertype colors of oUF are initiated on login.
By the time it loads it may be possible that UnitPowerType("player") still returns nil. But not sure about that. I think it should work, at least UnitClass etc. does.
Basically...register the event to your arrow frame and then call UnitPowerType player and set the color of the arrow.
I recommend registering PLAYER_LOGIN aswell. By that time the function will be working and you should be able to set the color correctly.
Sth like this should work...
lua Code:
--set color
lib.setArrowColor = function(self)
local _, pType = UnitPowerType("player")
local pcolor = oUF.colors.power[pType] or {.3,.45,.65}
self.arrow:SetVertexColor(unpack(pcolor))
end
--hook events
self:RegisterEvent("PLAYER_LOGIN", lib.setArrowColor)
self:RegisterEvent("PLAYER_ENTERING_WORLD", lib.setArrowColor)
self:RegisterEvent("UNIT_DISPLAYPOWER", lib.setArrowColor)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Btw I found a neat trick for threat coloring (I guess I'm the last one to find out about forceUpdate O_O).
It is awesome because if color is set via
self.Health.colorHealth = true then if you don't have aggro the color will stay and the color is updated as soon as any of the events if fired.
lua Code:
--update health func
lib.updateHealth = function(bar, unit, min, max)
--color the hp bar in red if the unit has aggro
if unit and UnitThreatSituation(unit) == 3 then
bar:SetStatusBarColor(1,0,0)
if bar.bg then bar.bg:SetVertexColor(1*bar.bg.multiplier,0,0) end
end
end
--check threat
lib.checkThreat = function(self,event,unit)
--force an update on the health frame
self.Health:ForceUpdate()
end
self.Health.PostUpdate = lib.updateHealth
self:RegisterEvent("PLAYER_TARGET_CHANGED", lib.checkThreat)
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", lib.checkThreat)