I was experimenting to update secure aura headers without the "UNIT_AURA" event and without updating every auras every time unnecessary.
I came up with this:
Lua Code:
buff:SetScript("OnAttributeChanged", function(self, name, value)
if name == "index" then
--print(self:GetName(), name, value)
if value then
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, shouldConsolidate, spellId, canApplyAura, isBossDebuff, isCastByPlayer = UnitAura(self.unit, value, buff.filter)
if self.index ~= value or self.spellId ~= spellId or self.count ~= count or self.expirationTime ~= expirationTime then
if self.index ~= value then
print("INDEX", name, self.index, value)
elseif self.spellId ~= spellId then
print("ID", value, name, self.spellId, spellId)
elseif self.count ~= count then
print("COUNT", value, name, self.count, count)
elseif self.expirationTime ~= expirationTime then
print("EXP", value, name, self.expirationTime, expirationTime)
end
if type(module.UpdateBuff) == "function" then
module:UpdateBuff(self, value)
end
end
else
self.index = nil
self.spellId = nil
self.count = nil
self.expirationTime = nil
end
end
end)
With this method only the changed buffs are gonna get updated and it will leave out the ones which did not changed, so you can save a lot of unnecessary calls. You only need to do a full force update when you: on a loading screen, or when the unit attribute changes.
So what do you guys think could this be a valid solution?