From what I see in the ArenaUI code, you'll need to stop
ArenaEnemyFrame_Unlock() from clearing the color lock. You also need to actually check if ArenaUI is loaded since it is LoD. Here's code I would suggest running.
lua Code:
local function HookArenaUI()
hooksecurefunc("ArenaEnemyFrame_Unlock",function(self)
local color=RAID_CLASS_COLORS[select(2,UnitClass(self.unit)) or ""];
if color then
self.healthbar:SetStatusBarColor(color.r,color.g,color.b);
self.healthbar.lockColor=true;
end
end);
end
if IsAddOnLoaded("Blizzard_ArenaUI") then
HookArenaUI();
else
local hookframe=CreateFrame("Frame");
hookframe:RegisterEvent("ADDON_LOADED");
hookframe:SetScript("OnEvent",function(self,event,arg)
if arg=="Blizzard_ArenaUI" then
self:UnregisterEvent(event);
self:SetScript("OnEvent",nil);
HookArenaUI();
end
);
end
Optionally, if this is all the code you'll have in an addon, you should add these to your ToC and use the following snip of code from the one above.
Code:
## LoadOnDemand: 1
## LoadWith: Blizzard_ArenaUI
lua Code:
hooksecurefunc("ArenaEnemyFrame_Unlock",function(self)
local color=RAID_CLASS_COLORS[select(2,UnitClass(self.unit)) or ""];
if color then
self.healthbar:SetStatusBarColor(color.r,color.g,color.b);
self.healthbar.lockColor=true;
end
end);