Aura status firing indicator:Update too often #4


  • New
  • Patch
Closed
Assigned to _ForgeUser117147
  • _ForgeUser1539023 created this issue Feb 18, 2009

    I tried to setup some aura statuses, and was unsuccessful at first, so I added some debug-messages to the indicators and statuses. After they finally worked, I saw from the messages, that the indicator:Update functions were called far too often, in fact every time the UNIT_AURA event fired for that player, and not just when the watched buff(s) changed.
    I did some further research and found that in the status_HasStateChanged function the condition (self.new_count ~= self.prev_count ) is always met when the watched buff is not on the unit, because self.prev_count is changed in status_Reset (from nil, set in status_HasStateChanged), but self.new_count never changes from its nil-value if status_UpdateState is not called, i.e. the buff is not there.
    My solution to this is not to reset self.new_count to nil. This will work, because if the buff is up, the count is overwritten anyway, and if it's not up, its value doesn't matter, because a change can be seen just from comparing new_state and prev_state values.

    So this are my modified functions:

    local function status_Reset(self, unit)
        self.prev_state = self:IsActive(unit)
        self.new_state = nil
        self.prev_count = self.counts[unit]
        self.states[unit] = nil
        self.expirations[unit] = nil
    end

    local function status_HasStateChanged(self, unit)
        return (self.new_state ~= self.prev_state ) or (self.new_count ~= self.prev_count )
    end

    I tested this with my priests inner fire, and it fired the indicator:Update function  when the buff was applied, removed or the stack count changed (from being hit or rebuffing), but not when any other aura was applied or removed.

  • _ForgeUser1539023 added the tags New Patch Feb 18, 2009
  • _ForgeUser117147 posted a comment Feb 19, 2009

    Patch applied in Revision 49. Thanks


To post a comment, please login or register a new account.