- check for the player interrupting the spell locally before it's had a chance to come back from the server

This commit is contained in:
Parnic
2008-01-22 01:12:44 +00:00
parent 0ed70570e8
commit 134e0802e8

View File

@ -2,6 +2,7 @@ local AceOO = AceLibrary("AceOO-2.0")
local deformat = AceLibrary("Deformat-2.0")
local SPELLINTERRUPTOTHERSELF = SPELLINTERRUPTOTHERSELF
local SPELLFAILCASTSELF = SPELLFAILCASTSELF
IceCastBar = AceOO.Class(IceBarElement)
@ -45,6 +46,7 @@ function IceCastBar.prototype:Enable(core)
self:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE", "CheckChatInterrupt")
self:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE", "CheckChatInterrupt")
self:RegisterEvent("CHAT_MSG_SPELL_FAILED_LOCALPLAYER", "CheckChatInterrupt")
self:RegisterEvent("UNIT_SPELLCAST_DELAYED", "SpellCastDelayed") -- unit
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "SpellCastSucceeded") -- "player", spell, rank
@ -265,6 +267,10 @@ function IceCastBar.prototype:CheckChatInterrupt(msg)
local player, spell = deformat(msg, SPELLINTERRUPTOTHERSELF)
--IceHUD:Debug("CheckChatInterrupt", msg)
if not player then
player, spell = deformat(msg, SPELLFAILCASTSELF)
end
if player then
self.current = nil
self:StartBar(IceCastBar.Actions.Failure, "Interrupted")
@ -280,7 +286,6 @@ function IceCastBar.prototype:SpellCastInterrupted(unit)
self:StartBar(IceCastBar.Actions.Failure, "Interrupted")
end
function IceCastBar.prototype:SpellCastDelayed(unit, delay)
if (unit ~= self.unit) then return end
--IceHUD:Debug("SpellCastDelayed", unit, UnitCastingInfo(unit))