View Single Post
10-30-11, 02:16 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,334
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:
  1. local function HookArenaUI()
  2.     hooksecurefunc("ArenaEnemyFrame_Unlock",function(self)
  3.         local color=RAID_CLASS_COLORS[select(2,UnitClass(self.unit)) or ""];
  4.         if color then
  5.             self.healthbar:SetStatusBarColor(color.r,color.g,color.b);
  6.             self.healthbar.lockColor=true;
  7.         end
  8.     end);
  9. end
  10.  
  11. if IsAddOnLoaded("Blizzard_ArenaUI") then
  12.     HookArenaUI();
  13. else
  14.     local hookframe=CreateFrame("Frame");
  15.     hookframe:RegisterEvent("ADDON_LOADED");
  16.     hookframe:SetScript("OnEvent",function(self,event,arg)
  17.         if arg=="Blizzard_ArenaUI" then
  18.             self:UnregisterEvent(event);
  19.             self:SetScript("OnEvent",nil);
  20.             HookArenaUI();
  21.         end
  22.     );
  23. 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:
  1. hooksecurefunc("ArenaEnemyFrame_Unlock",function(self)
  2.     local color=RAID_CLASS_COLORS[select(2,UnitClass(self.unit)) or ""];
  3.     if color then
  4.         self.healthbar:SetStatusBarColor(color.r,color.g,color.b);
  5.         self.healthbar.lockColor=true;
  6.     end
  7. end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote