Thread: Debuff Skinning
View Single Post
02-26-20, 11:34 PM   #1
Terenna
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 105
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.
  Reply With Quote