[8994] Re-implement remove auras from channeled target

* Old way have problem with auras that have last tick avent at one from caster/target:
  depndent from auras update order in caster/target pair ti can wrongly not triggered.
* Fxied possible problem with remove same spell non-caster auras at target/caster at spell cast cancel
* Also fix memory lost in old deleted auras cleanup.
This commit is contained in:
VladimirMangos 2009-12-15 18:45:27 +03:00
parent 8211bcd218
commit be79375b56
4 changed files with 25 additions and 42 deletions

View file

@ -2417,11 +2417,10 @@ void Spell::cancel()
{
Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if( unit && unit->isAlive() )
unit->RemoveAurasDueToSpell(m_spellInfo->Id);
unit->RemoveAurasByCasterSpell(m_spellInfo->Id,m_caster->GetGUID());
}
}
m_caster->RemoveAurasDueToSpell(m_spellInfo->Id);
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
@ -3441,6 +3440,13 @@ void Spell::SendChannelUpdate(uint32 time)
{
if(time == 0)
{
m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id,m_caster->GetGUID());
if(uint64 target_guid = m_caster->GetChannelObjectGUID())
if(target_guid != m_caster->GetGUID() && IS_UNIT_GUID(target_guid))
if(Unit* target = ObjectAccessor::GetUnit(*m_caster, target_guid))
target->RemoveAurasByCasterSpell(m_spellInfo->Id,m_caster->GetGUID());
m_caster->SetChannelObjectGUID(0);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}