From be6b7d0e1e6f4880272651a80c393d7a7a28c972 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 10 Nov 2013 00:32:17 +0000 Subject: [PATCH] More complete fix to problem noted in r1108 with auras that don't expire. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1154 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index 3877199..070095a 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -96,21 +96,23 @@ local function UnitGainedAura(guid, spellId, filter, casterGUID, icon, count, de aura.gain = now self_aura[guid][filter][spellId][casterGUID] = aura end - aura.serial = self_serial[guid] - if count == 0 then - count = 1 - end + + -- UnitAura() can return zero count for auras that are present. + count = (count > 0) and count or 1 + -- "Zero" duration and expiration actually mean the aura never expires. + duration = (duration > 0) and duration or math.huge + expirationTime = (expirationTime > 0) and expirationTime or math.huge -- Only overwrite an existing aura's information if the aura has changed. -- An aura's "fingerprint" is its: -- caster, duration, expiration time, stack count. local auraIsUnchanged = ( - existingAura and - (aura.source == casterGUID) and - ((not aura.duration and duration == 0) or aura.duration == duration) and - ((not aura.ending and expirationTime == 0) or aura.ending == expirationTime) and - (aura.stacks == count) + existingAura + and aura.source == casterGUID + and aura.duration == duration + and aura.ending == expirationTime + and aura.stacks == count ) local addAura = not existingAura or not auraIsUnchanged if addAura then @@ -119,15 +121,13 @@ local function UnitGainedAura(guid, spellId, filter, casterGUID, icon, count, de aura.icon = icon aura.stacks = count aura.debuffType = debuffType - if duration > 0 then + if duration < math.huge and expirationTime < math.huge then aura.start = expirationTime - duration - aura.duration = duration - aura.ending = expirationTime else aura.start = now - aura.duration = math.huge - aura.ending = math.huge end + aura.duration = duration + aura.ending = expirationTime aura.stealable = isStealable aura.mine = mine aura.source = casterGUID -- 1.7.9.5