WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Debuff Skinning (https://www.wowinterface.com/forums/showthread.php?t=57841)

Terenna 02-26-20 11:34 PM

Debuff Skinning
 
As many of you may know, the wow code uses an overlay for debuffs that controls the color its border is. This border is really ugly. I wanted to reskin this border and wrote the following:

Lua Code:
  1. local debuffSkinFrame = CreateFrame('Frame', nil, UIParent)
  2. debuffSkinFrame:RegisterUnitEvent('UNIT_AURA', 'player')
  3. debuffSkinFrame:SetScript('OnEvent', function(self, event, ...)
  4.     for i = 1, 40 do
  5.         local name, _, _, debuffType = UnitAura('player', i, 'HARMFUL')
  6.         if not name then break end
  7.        
  8.         local debuffSlot = _G['DebuffButton'..i]
  9.         if debuffSlot then _G['DebuffButton'..i..'Border']:Hide() end
  10.         local overlay = debuffSlot:CreateTexture(nil, 'OVERLAY')
  11.         overlay:SetTexture([[Interface\AddOns\oUF_Terenna\Overlaytexture.tga]])
  12.         overlay:SetAllPoints()
  13.        
  14.         local color
  15.         if debuffType then
  16.             color = DebuffTypeColor[debuffType]
  17.         else
  18.             color = DebuffTypeColor['none']
  19.         end
  20.        
  21.         overlay:SetVertexColor(color.r, color.g, color.b)
  22.     end
  23. end)

This works beautifully. However, I wonder how efficient this method is? If there's a more CPU or memory efficient way to do this, I'd greatly appreciate it.


All times are GMT -6. The time now is 06:55 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI