Quantcast WoWInterface - View Single Post - Getting error spammed from a small addon. Can anyone help?
View Single Post
09-21-15, 12:09 AM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
Lua Code:
  1. local frame = CreateFrame("FRAME")
  2. frame:RegisterEvent("GROUP_ROSTER_UPDATE")
  3. frame:RegisterEvent("PLAYER_TARGET_CHANGED")
  4. frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
  5. frame:RegisterEvent("UNIT_FACTION")
  6.  
  7. local function eventHandler(self, event, ...)
  8.         if UnitIsPlayer("target") then
  9.                 local c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
  10.                 if c then
  11.                     TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
  12.                 end
  13.         end
  14.         if UnitIsPlayer("focus") then
  15.                 local c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
  16.                 if c then
  17.                     FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
  18.                 end
  19.         end
  20. end
  21.  
  22. frame:SetScript("OnEvent", eventHandler)
  23.  
  24. for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do
  25.         BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
  26. end
  Reply With Quote