mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7663] Fixed crash at interrupting channeled spell. Cleanup spell interrupt code.
This commit is contained in:
parent
b143a300cb
commit
56350b32ed
4 changed files with 18 additions and 52 deletions
|
|
@ -3726,20 +3726,8 @@ void Aura::HandleAuraModSilence(bool apply, bool Real)
|
||||||
m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
|
m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
|
||||||
// Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
|
// Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
|
||||||
for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL;i++)
|
for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL;i++)
|
||||||
{
|
if (m_target->m_currentSpells[i] && m_target->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
|
||||||
Spell* currentSpell = m_target->m_currentSpells[i];
|
m_target->InterruptSpell(i,false); // Stop spells on prepare or casting state
|
||||||
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();
|
|
||||||
currentSpell->SetReferencedFromCurrent(false);
|
|
||||||
m_target->m_currentSpells[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (GetId())
|
switch (GetId())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -374,15 +374,9 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
|
||||||
// channeled spell case (it currently casted then)
|
// channeled spell case (it currently casted then)
|
||||||
if (IsChanneledSpell(spellInfo))
|
if (IsChanneledSpell(spellInfo))
|
||||||
{
|
{
|
||||||
if(Spell* spell = _player->m_currentSpells[CURRENT_CHANNELED_SPELL])
|
if (_player->m_currentSpells[CURRENT_CHANNELED_SPELL] &&
|
||||||
{
|
_player->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spellId)
|
||||||
if(spell->m_spellInfo->Id==spellId)
|
_player->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||||
{
|
|
||||||
spell->cancel();
|
|
||||||
spell->SetReferencedFromCurrent(false);
|
|
||||||
_player->m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3054,10 +3054,15 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed)
|
||||||
|
|
||||||
if (m_currentSpells[spellType]->getState() != SPELL_STATE_FINISHED)
|
if (m_currentSpells[spellType]->getState() != SPELL_STATE_FINISHED)
|
||||||
m_currentSpells[spellType]->cancel();
|
m_currentSpells[spellType]->cancel();
|
||||||
|
|
||||||
|
// cancel can interrupt spell already (caster cancel ->target aura remove -> caster iterrupt)
|
||||||
|
if (m_currentSpells[spellType])
|
||||||
|
{
|
||||||
m_currentSpells[spellType]->SetReferencedFromCurrent(false);
|
m_currentSpells[spellType]->SetReferencedFromCurrent(false);
|
||||||
m_currentSpells[spellType] = NULL;
|
m_currentSpells[spellType] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skipAutorepeat) const
|
bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skipAutorepeat) const
|
||||||
{
|
{
|
||||||
|
|
@ -3086,36 +3091,15 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||||
{
|
{
|
||||||
// generic spells are interrupted if they are not finished or delayed
|
// 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))
|
if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id==spell_id))
|
||||||
{
|
InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed);
|
||||||
if ( (m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_FINISHED) &&
|
|
||||||
(withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED) )
|
|
||||||
m_currentSpells[CURRENT_GENERIC_SPELL]->cancel();
|
|
||||||
m_currentSpells[CURRENT_GENERIC_SPELL]->SetReferencedFromCurrent(false);
|
|
||||||
m_currentSpells[CURRENT_GENERIC_SPELL] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// autorepeat spells are interrupted if they are not finished or delayed
|
// 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))
|
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id==spell_id))
|
||||||
{
|
InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed);
|
||||||
// send disable autorepeat packet in any case
|
|
||||||
if(GetTypeId()==TYPEID_PLAYER)
|
|
||||||
((Player*)this)->SendAutoRepeatCancel();
|
|
||||||
|
|
||||||
if ( (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->getState() != SPELL_STATE_FINISHED) &&
|
|
||||||
(withDelayed || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->getState() != SPELL_STATE_DELAYED) )
|
|
||||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->cancel();
|
|
||||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->SetReferencedFromCurrent(false);
|
|
||||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// channeled spells are interrupted if they are not finished, even if they are delayed
|
// 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))
|
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id))
|
||||||
{
|
InterruptSpell(CURRENT_CHANNELED_SPELL,true);
|
||||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
|
|
||||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
|
||||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false);
|
|
||||||
m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
|
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7662"
|
#define REVISION_NR "7663"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue