mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-16 21:20:01 -04:00
*Do not allow client to interrupt instant spells. By thenecromancer
--HG-- branch : trunk
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user