From b544fa7204aa6739fb69be419946675294b6e3a6 Mon Sep 17 00:00:00 2001 From: Sidoine De Wispelaere Date: Mon, 24 May 2010 11:17:18 +0000 Subject: [PATCH] bug fix for interrupted spells git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@250 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Ovale.lua | 40 ++++++++++++++++++++++++++++------------ OvaleCompile.lua | 3 +++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Ovale.lua b/Ovale.lua index f6c5203..4300d3a 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -386,7 +386,7 @@ end function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...) local time, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...) - --self:Print("event="..event.." source="..nilstring(sourceName).." destName="..nilstring(destName).." " ..GetTime()) + self:Print("event="..event.." source="..nilstring(sourceName).." destName="..nilstring(destName).." " ..GetTime()) if sourceName == UnitName("player") then if string.find(event, "SPELL_CAST_SUCCESS") == 1 or string.find(event, "SPELL_DAMAGE")==1 or string.find(event, "SPELL_MISSED") == 1 @@ -618,6 +618,7 @@ function Ovale:OnEnable() self:RegisterEvent("UNIT_AURA"); self:RegisterEvent("ACTIONBAR_PAGE_CHANGED") self:RegisterEvent("UNIT_SPELLCAST_SENT") + self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") self:RegisterEvent("PLAYER_TARGET_CHANGED") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("CHAT_MSG_ADDON") @@ -647,6 +648,7 @@ function Ovale:OnDisable() self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:UnregisterEvent("CHAT_MSG_ADDON") self:UnregisterEvent("GLYPH_UPDATED") + self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED") self.frame:Hide() end @@ -662,6 +664,18 @@ function Ovale:GLYPH_UPDATED(event) self.needCompile = true end +function Ovale:UNIT_SPELLCAST_INTERRUPTED(event, unit, name, rank) + if unit=="player" then + for i,v in ipairs(self.lastSpell) do + if v.name == name then + table.remove(self.lastSpell, i) + --self:Print("on supprime "..name) + break + end + end + end +end + function Ovale:UNIT_SPELLCAST_SENT(event,unit,name,rank,target) -- self:Print("UNIT_SPELLCAST_SENT"..event.." unit="..unit.." name="..name.." tank="..rank.." target="..target) if unit=="player" then @@ -1029,7 +1043,7 @@ function Ovale:AddSpellToStack(spellName, startCast, endCast, nextCast, nocd) end --Coût du sort (uniquement si dans le futur, dans le passé l'énergie est déjà dépensée) - if startCast > Ovale.maintenant then + if startCast >= self.maintenant then --Mana local _, _, _, cost = GetSpellInfo(spellName) if cost then @@ -1108,15 +1122,17 @@ function Ovale:AddSpellToStack(spellName, startCast, endCast, nextCast, nocd) duration = self.spellInfo[auraSpellName].duration end if stacks<0 and newAura.ending then - newAura.stacks = newAura.stacks + stacks - if Ovale.trace then - self:Print("removing aura "..auraSpellName.." because of ".. spellName) - end - --Plus de stacks, on supprime l'aura - if newAura.stacks<=0 then - newAura.stacks = 0 - newAura.ending = 0 - end + --if filter~="HELPFUL" or target~="player" or startCast>=Ovale.maintenant then + newAura.stacks = newAura.stacks + stacks + if Ovale.trace then + self:Print("removing aura "..auraSpellName.." because of ".. spellName) + end + --Plus de stacks, on supprime l'aura + if newAura.stacks<=0 then + newAura.stacks = 0 + newAura.ending = 0 + end + --end elseif newAura.ending and newAura.ending >= endCast then newAura.ending = endCast + duration newAura.stacks = newAura.stacks + 1 @@ -1127,7 +1143,7 @@ function Ovale:AddSpellToStack(spellName, startCast, endCast, nextCast, nocd) end if Ovale.trace then if auraSpellName then - self:Print("adding "..stacks.." aura "..auraSpellName.." to "..target.." "..newAura.start..","..newAura.ending) + self:Print(spellName.." adding "..stacks.." aura "..auraSpellName.." to "..target.." "..filter.." "..newAura.start..","..newAura.ending) else self:Print("adding nil aura") end diff --git a/OvaleCompile.lua b/OvaleCompile.lua index a948451..e0e8826 100644 --- a/OvaleCompile.lua +++ b/OvaleCompile.lua @@ -49,6 +49,7 @@ local function ParseSpellAddDebuff(params) local paramList = ParseParameters(params) local spell = Ovale:GetSpellInfoOrNil(paramList[1]) if (spell) then + paramList[1] = nil Ovale:GetSpellInfo(spell).aura.player.HARMFUL = paramList end return "" @@ -58,6 +59,7 @@ local function ParseSpellAddBuff(params) local paramList = ParseParameters(params) local spell = Ovale:GetSpellInfoOrNil(paramList[1]) if (spell) then + paramList[1] = nil Ovale:GetSpellInfo(spell).aura.player.HELPFUL = paramList end return "" @@ -67,6 +69,7 @@ local function ParseSpellAddTargetDebuff(params) local paramList = ParseParameters(params) local spell = Ovale:GetSpellInfoOrNil(paramList[1]) if (spell) then + paramList[1] = nil Ovale:GetSpellInfo(spell).aura.target.HARMFUL = paramList end return "" -- 1.7.9.5