[10833] Avoid use unsafe remove auras in aura apply code.

Specailly example Aura::HandleModCharm code where old code
call RemoveSpellsCausingAura or (a) dead and not called,
or (b) will remove aura self at call.

* Added safe for aura holder context version of RemoveSpellsCausingAura
* Cleanup old simple RemoveSpellsCausingAura code also.
This commit is contained in:
VladimirMangos 2010-12-07 12:26:20 +03:00
parent 031f2b00f1
commit c3254c88ca
4 changed files with 23 additions and 19 deletions

View file

@ -2930,7 +2930,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
case FORM_MOONKIN:
{
// remove movement affects
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT);
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT, GetHolder());
Unit::AuraList const& slowingAuras = target->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
for (Unit::AuraList::const_iterator iter = slowingAuras.begin(); iter != slowingAuras.end();)
{
@ -3227,7 +3227,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
//dismount polymorphed target (after patch 2.4.2)
if (target->IsMounted())
target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED, GetHolder());
}
}
else
@ -3639,11 +3639,9 @@ void Aura::HandleModCharm(bool apply, bool Real)
if( apply )
{
if (!target->GetCharmerGuid().IsEmpty())
{
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
}
// is it really need after spell check checks?
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM, GetHolder());
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS, GetHolder());
target->SetCharmerGuid(GetCasterGuid());
target->setFaction(caster->getFaction());