View Single Post
10-29-11, 11:34 PM   #1
ikomiko
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 9
Adding Classcolor to default ArenaFrames

Hi, i have a question.

I can't test atm. this little code in arena, thats why i want to know if it's right.

lua Code:
  1. local function whoa_arenaColors()
  2.     if not InCombatLockdown() then
  3.         local numOpponents = GetNumArenaOpponents()
  4.         if numOpponents > 0 then
  5.             for i = 1, numOpponents do
  6.                 color = RAID_CLASS_COLORS[select(2, UnitClass("arena"..i))]
  7.                 if color then
  8.                     _G["ArenaEnemyFrame"..i.."HealthBar"]:SetStatusBarColor(color.r, color.g, color.b)
  9.                     _G["ArenaEnemyFrame"..i.."HealthBar"].lockColor = true
  10.                 end
  11.             end    
  12.         end
  13.     end
  14. end
  15.  
  16. local w = CreateFrame("Frame", nil, UIParent)
  17. w:RegisterEvent("PLAYER_ENTERING_WORLD")
  18.  
  19.  
  20.  
  21. function w:OnEvent(event, ...)
  22.     if event == "PLAYER_ENTERING_WORLD" then
  23.        
  24.         whoa_arenaColors()
  25.  
  26. end
  27. w:SetScript("OnEvent", w.OnEvent)
  Reply With Quote