Core/Spells: fix Global Cooldown reset on spell cast interrupt.

This commit is contained in:
SimonDMII
2011-04-11 16:35:31 +06:00
committed by Azazel
parent 5357b1ba77
commit e38634186c
2 changed files with 7 additions and 9 deletions
+3 -5
View File
@@ -2981,17 +2981,15 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
if (!spell->IsInterruptable()) if (!spell->IsInterruptable())
return; return;
m_currentSpells[spellType] = NULL;
// send autorepeat cancel message for autorepeat spells // send autorepeat cancel message for autorepeat spells
if (spellType == CURRENT_AUTOREPEAT_SPELL) if (spellType == CURRENT_AUTOREPEAT_SPELL)
{
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
this->ToPlayer()->SendAutoRepeatCancel(this); ToPlayer()->SendAutoRepeatCancel(this);
}
if (spell->getState() != SPELL_STATE_FINISHED) if (spell->getState() != SPELL_STATE_FINISHED)
spell->cancel(); spell->cancel();
m_currentSpells[spellType] = NULL;
spell->SetReferencedFromCurrent(false); spell->SetReferencedFromCurrent(false);
} }
} }
+4 -4
View File
@@ -3015,10 +3015,6 @@ void Spell::cancel()
if (m_spellState == SPELL_STATE_FINISHED) if (m_spellState == SPELL_STATE_FINISHED)
return; return;
SetReferencedFromCurrent(false);
if (m_selfContainer && *m_selfContainer == this)
*m_selfContainer = NULL;
uint32 oldState = m_spellState; uint32 oldState = m_spellState;
m_spellState = SPELL_STATE_FINISHED; m_spellState = SPELL_STATE_FINISHED;
@@ -3053,6 +3049,10 @@ void Spell::cancel()
break; break;
} }
SetReferencedFromCurrent(false);
if (m_selfContainer && *m_selfContainer == this)
*m_selfContainer = NULL;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->RemoveGlobalCooldown(m_spellInfo); m_caster->ToPlayer()->RemoveGlobalCooldown(m_spellInfo);