aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellHandler.cpp6
-rw-r--r--src/game/Unit.cpp14
-rw-r--r--src/game/Unit.h4
3 files changed, 11 insertions, 13 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 3da05d37f3d..efa9c6feebd 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -339,12 +339,8 @@ void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket)
uint32 spellId;
recvPacket >> spellId;
- //FIXME: hack, ignore unexpected client cancel Deadly Throw cast
- if(spellId==26679)
- return;
-
if(_player->IsNonMeleeSpellCasted(false))
- _player->InterruptNonMeleeSpells(false,spellId);
+ _player->InterruptNonMeleeSpells(false,spellId,false);
}
void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 8d619f4922f..1bda587f89e 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3433,12 +3433,14 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
pSpell->SetReferencedFromCurrent(true);
}
-void Unit::InterruptSpell(uint32 spellType, bool withDelayed)
+void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
{
assert(spellType < CURRENT_MAX_SPELL);
Spell *spell = m_currentSpells[spellType];
- if(spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) )
+ if(spell
+ && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
+ && (withInstant || spell->GetCastTime() > 0))
{
// for example, do not let self-stun aura interrupt itself
if(!spell->IsInterruptable())
@@ -3482,19 +3484,19 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip
return(false);
}
-void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
+void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant)
{
// generic spells are interrupted if they are not finished or delayed
if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id==spell_id))
- InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed);
+ InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed,withInstant);
// autorepeat spells are interrupted if they are not finished or delayed
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id==spell_id))
- InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed);
+ InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed,withInstant);
// channeled spells are interrupted if they are not finished, even if they are delayed
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id))
- InterruptSpell(CURRENT_CHANNELED_SPELL,true);
+ InterruptSpell(CURRENT_CHANNELED_SPELL,true,true);
}
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 0179097de77..79fff7a7351 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1194,7 +1194,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SetCurrentCastedSpell(Spell * pSpell);
virtual void ProhibitSpellScholl(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/ ) { }
- void InterruptSpell(uint32 spellType, bool withDelayed = true);
+ void InterruptSpell(uint32 spellType, bool withDelayed = true, bool withInstant = true);
// set withDelayed to true to account delayed spells as casted
// delayed+channeled spells are always accounted as casted
@@ -1203,7 +1203,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// set withDelayed to true to interrupt delayed spells too
// delayed+channeled spells are always interrupted
- void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0);
+ void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0, bool withInstant = true);
Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;