Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-15-16, 12:49 PM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
SecureAuraHeaderTemplate

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:
  1. buff:SetScript("OnAttributeChanged", function(self, name, value)
  2.     if name == "index" then
  3.         --print(self:GetName(), name, value)
  4.         if value then
  5.             local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, shouldConsolidate, spellId, canApplyAura, isBossDebuff, isCastByPlayer = UnitAura(self.unit, value, buff.filter)
  6.             if self.index ~= value or self.spellId ~= spellId or self.count ~= count or self.expirationTime ~= expirationTime then
  7.                 if self.index ~= value then
  8.                     print("INDEX", name, self.index, value)
  9.                 elseif self.spellId ~= spellId then
  10.                     print("ID", value, name, self.spellId, spellId)
  11.                 elseif self.count ~= count then
  12.                     print("COUNT", value, name, self.count, count)
  13.                 elseif self.expirationTime ~= expirationTime then
  14.                     print("EXP", value, name, self.expirationTime, expirationTime)
  15.                 end
  16.  
  17.                 if type(module.UpdateBuff) == "function" then
  18.                     module:UpdateBuff(self, value)
  19.                 end
  20.             end
  21.         else
  22.             self.index = nil
  23.             self.spellId = nil
  24.             self.count = nil
  25.             self.expirationTime = nil
  26.         end
  27.     end
  28. 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?

Last edited by Resike : 02-16-16 at 05:25 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » SecureAuraHeaderTemplate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off