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:
local debuffSkinFrame = CreateFrame('Frame', nil, UIParent)
debuffSkinFrame:RegisterUnitEvent('UNIT_AURA', 'player')
debuffSkinFrame:SetScript('OnEvent', function(self, event, ...)
for i = 1, 40 do
local name, _, _, debuffType = UnitAura('player', i, 'HARMFUL')
if not name then break end
local debuffSlot = _G['DebuffButton'..i]
if debuffSlot then _G['DebuffButton'..i..'Border']:Hide() end
local overlay = debuffSlot:CreateTexture(nil, 'OVERLAY')
overlay:SetTexture([[Interface\AddOns\oUF_Terenna\Overlaytexture.tga]])
overlay:SetAllPoints()
local color
if debuffType then
color = DebuffTypeColor[debuffType]
else
color = DebuffTypeColor['none']
end
overlay:SetVertexColor(color.r, color.g, color.b)
end
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.