aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp14
-rw-r--r--src/game/SpellHandler.cpp12
-rw-r--r--src/game/Unit.cpp36
3 files changed, 12 insertions, 50 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 275b7153e43..c1e2dba1973 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -3825,18 +3825,8 @@ void AuraEffect::HandleAuraModSilence(bool apply, bool Real)
m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
// Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL;i++)
- {
- Spell* currentSpell = m_target->m_currentSpells[i];
- if (currentSpell && currentSpell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
- {
- uint32 state = currentSpell->getState();
- // Stop spells on prepare or casting state
- if ( state == SPELL_STATE_PREPARING || state == SPELL_STATE_CASTING )
- {
- currentSpell->cancel();
- }
- }
- }
+ if (m_target->m_currentSpells[i] && m_target->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
+ m_target->InterruptSpell(i,false); // Stop spells on prepare or casting state
switch (GetId())
{
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 0efc4cb0ee4..19a33dff75a 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -380,15 +380,11 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
return;
// channeled spell case (it currently casted then)
- if(IsChanneledSpell(spellInfo))
+ if (IsChanneledSpell(spellInfo))
{
- if(Spell* spell = _player->m_currentSpells[CURRENT_CHANNELED_SPELL])
- {
- if(spell->m_spellInfo->Id==spellId)
- {
- spell->cancel();
- }
- }
+ if (_player->m_currentSpells[CURRENT_CHANNELED_SPELL] &&
+ _player->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spellId)
+ _player->InterruptSpell(CURRENT_CHANNELED_SPELL);
return;
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index fa9f1840a6c..e26eb7705c1 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3477,40 +3477,16 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
{
// generic spells are interrupted if they are not finished or delayed
- Spell *spell = m_currentSpells[CURRENT_GENERIC_SPELL];
- if (spell && (!spell_id || spell->m_spellInfo->Id==spell_id))
- {
- m_currentSpells[CURRENT_GENERIC_SPELL] = NULL;
-
- if ( (spell->getState() != SPELL_STATE_FINISHED) &&
- (withDelayed || spell->getState() != SPELL_STATE_DELAYED) )
- spell->cancel();
- spell->SetReferencedFromCurrent(false);
- }
+ if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id==spell_id))
+ InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed);
- spell = m_currentSpells[CURRENT_AUTOREPEAT_SPELL];
// autorepeat spells are interrupted if they are not finished or delayed
- if (spell && (!spell_id || spell->m_spellInfo->Id==spell_id))
- {
- m_currentSpells[CURRENT_AUTOREPEAT_SPELL] = NULL;
- // send disable autorepeat packet in any case
- if(GetTypeId()==TYPEID_PLAYER)
- ((Player*)this)->SendAutoRepeatCancel();
- if ( (spell->getState() != SPELL_STATE_FINISHED) &&
- (withDelayed || spell->getState() != SPELL_STATE_DELAYED) )
- spell->cancel();
- spell->SetReferencedFromCurrent(false);
- }
+ if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id==spell_id))
+ InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed);
// channeled spells are interrupted if they are not finished, even if they are delayed
- spell = m_currentSpells[CURRENT_CHANNELED_SPELL];
- if (spell && (!spell_id || spell->m_spellInfo->Id==spell_id))
- {
- m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
- if (spell->getState() != SPELL_STATE_FINISHED)
- spell->cancel();
- spell->SetReferencedFromCurrent(false);
- }
+ if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id))
+ InterruptSpell(CURRENT_CHANNELED_SPELL,true);
}
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const