mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[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:
parent
031f2b00f1
commit
c3254c88ca
4 changed files with 23 additions and 19 deletions
|
|
@ -2930,7 +2930,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
|
||||||
case FORM_MOONKIN:
|
case FORM_MOONKIN:
|
||||||
{
|
{
|
||||||
// remove movement affects
|
// 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);
|
Unit::AuraList const& slowingAuras = target->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
|
||||||
for (Unit::AuraList::const_iterator iter = slowingAuras.begin(); iter != slowingAuras.end();)
|
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)
|
//dismount polymorphed target (after patch 2.4.2)
|
||||||
if (target->IsMounted())
|
if (target->IsMounted())
|
||||||
target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
|
target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED, GetHolder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3639,11 +3639,9 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||||
|
|
||||||
if( apply )
|
if( apply )
|
||||||
{
|
{
|
||||||
if (!target->GetCharmerGuid().IsEmpty())
|
// is it really need after spell check checks?
|
||||||
{
|
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM, GetHolder());
|
||||||
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
|
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS, GetHolder());
|
||||||
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
target->SetCharmerGuid(GetCasterGuid());
|
target->SetCharmerGuid(GetCasterGuid());
|
||||||
target->setFaction(caster->getFaction());
|
target->setFaction(caster->getFaction());
|
||||||
|
|
|
||||||
|
|
@ -456,21 +456,26 @@ bool Unit::canReachWithAttack(Unit *pVictim) const
|
||||||
|
|
||||||
void Unit::RemoveSpellsCausingAura(AuraType auraType)
|
void Unit::RemoveSpellsCausingAura(AuraType auraType)
|
||||||
{
|
{
|
||||||
if (auraType >= TOTAL_AURAS) return;
|
for (AuraList::const_iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
||||||
AuraList::const_iterator iter, next;
|
|
||||||
for (iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next)
|
|
||||||
{
|
{
|
||||||
next = iter;
|
RemoveAurasDueToSpell((*iter)->GetId());
|
||||||
++next;
|
iter = m_modAuras[auraType].begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (*iter)
|
void Unit::RemoveSpellsCausingAura(AuraType auraType, SpellAuraHolder* except)
|
||||||
|
{
|
||||||
|
for (AuraList::const_iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
||||||
|
{
|
||||||
|
// skip `except` aura
|
||||||
|
if ((*iter)->GetHolder() == except)
|
||||||
{
|
{
|
||||||
RemoveAurasDueToSpell((*iter)->GetId());
|
++iter;
|
||||||
if (!m_modAuras[auraType].empty())
|
continue;
|
||||||
next = m_modAuras[auraType].begin();
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemoveAurasDueToSpell((*iter)->GetId(), except);
|
||||||
|
iter = m_modAuras[auraType].begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1602,6 +1602,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
|
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
|
||||||
void RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId, bool non_positive = false);
|
void RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId, bool non_positive = false);
|
||||||
void RemoveSpellsCausingAura(AuraType auraType);
|
void RemoveSpellsCausingAura(AuraType auraType);
|
||||||
|
void RemoveSpellsCausingAura(AuraType auraType, SpellAuraHolder* except);
|
||||||
void RemoveRankAurasDueToSpell(uint32 spellId);
|
void RemoveRankAurasDueToSpell(uint32 spellId);
|
||||||
bool RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder);
|
bool RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder);
|
||||||
void RemoveAurasWithInterruptFlags(uint32 flags);
|
void RemoveAurasWithInterruptFlags(uint32 flags);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10832"
|
#define REVISION_NR "10833"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue