Quantcast

Generalize SpellAddBuff to allow more than "refresh" or a number.

Johnny C. Lam [04-23-13 - 17:21]
Generalize SpellAddBuff to allow more than "refresh" or a number.

Also fix ticket #240 "Monk keg smash LUA error" by sanity checking that
the aura specified in SpellAddBuff is followed by a number before assuming
it's a new aura applied by the spell.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@908 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleState.lua
diff --git a/OvaleState.lua b/OvaleState.lua
index c9a2b3f..39a9820 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -393,6 +393,7 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ
 						for auraSpellId, spellData in pairs(filterInfo) do

 							local auraSpellInfo = OvaleData.spellInfo[auraSpellId]
+							-- An aura is treated as a periodic aura if it sets "tick" explicitly in SpellInfo.
 							local isDoT = auraSpellInfo and auraSpellInfo.tick
 							local duration = spellData
 							local stacks = duration
@@ -409,7 +410,7 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ
 							end

 							-- If aura is specified with a duration, then assume stacks == 1.
-							if stacks ~= "refresh" and stacks > 0 then
+							if type(stacks) == "number" and stacks > 0 then
 								stacks = 1
 							end

@@ -418,7 +419,7 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ

 							newAura.mine = true

-							if stacks ~= "refresh" and stacks == 0 then
+							if type(stacks) == "number" and stacks == 0 then
 								Ovale:Logf("Aura %d is completely removed", auraSpellId)
 								newAura.stacks = 0
 								newAura.ending = 0	-- self.currentTime?
@@ -453,7 +454,7 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ
 										newAura.ending = 0	-- self.currentTime?
 									end
 								end
-							else
+							elseif type(stacks) == "number" and type(duration) == "number" then
 								Ovale:Logf("New aura %d at %f on %s %s", auraSpellId, endCast, target, auraGUID)
 								newAura.stacks = stacks
 								newAura.start = endCast