You want sth like this.
Lua Code:
--functions
local postUpdateDebuff = function(element, unit, button, index, offset)
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitAura(unit, index, "HARMFUL")
if not name then return end
local _, class = UnitClass(caster)
if not class then return end
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if not color then return end
--print(color)
button.border:SetBackdropBorderColor(color.r, color.g, color.b,1)
end
local postUpdateBuff = function(element, unit, button, index, offset)
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitAura(unit, index, "HELPFUL")
if not name then return end
local _, class = UnitClass(caster)
if not class then return end
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if not color then return end
--print(color)
button.border:SetBackdropBorderColor(color.r, color.g, color.b,1)
end
local postUpdateAura = function(element, unit, button, index, offset)
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitAura(unit, index)
if not name then return end
local _, class = UnitClass(caster)
if not class then return end
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if not color then return end
--print(color)
button.border:SetBackdropBorderColor(color.r, color.g, color.b,1)
end
--post update aura icon
--self.Buffs.PostUpdateIcon = postUpdateBuff
--self.Debuffs.PostUpdateIcon = postUpdateDebuff
self.Auras.PostUpdateIcon = postUpdateAura
Which function you need to call depends on how you created your aura icons. If you used self.Buffs you use postUdateBuff ... etc.
Regarding UnitAura check:
http://wowprogramming.com/docs/api/UnitAura
For the oUF documentation on auras read:
https://github.com/haste/oUF/wiki/element---auras
I'm currently not sure. It may actually be possible to work with CreateAura instead of PostUpdateIcon because you can extract the unit from element:GetParent().unit.
That would look like this for Auras:
Lua Code:
--function
local createIcon = function(element, index)
local unit = element:GetParent().unit
if not unit then return end
local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitAura(unit, index)
if not name then return end
local _, class = UnitClass(caster)
if not class then return end
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if not color then return end
--print(color)
button.border:SetBackdropBorderColor(color.r, color.g, color.b,1)
end
self.Auras.CreateIcon = createIcon
The benefit is that CreateIcon is only used once. But I'm not sure if it is sufficient (means if it is called each time a new aura is created, even if an aura existed already for the same index)