mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[8742] Avoid aura remove triggered casts and packets send at logout/delete
This is must speedup logout and solve some crash cases or unexpected effects. Also fix some nonsense code with memory lost possibility.
This commit is contained in:
parent
7b6f4accd1
commit
15ab6794d3
6 changed files with 117 additions and 121 deletions
|
|
@ -4021,7 +4021,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
|||
|
||||
}
|
||||
|
||||
void Unit::RemoveAura(Aura* aura)
|
||||
void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode /*= AURA_REMOVE_BY_DEFAULT*/)
|
||||
{
|
||||
AuraMap::iterator i = m_Auras.lower_bound(spellEffectPair(aura->GetId(), aura->GetEffIndex()));
|
||||
AuraMap::iterator upperBound = m_Auras.upper_bound(spellEffectPair(aura->GetId(), aura->GetEffIndex()));
|
||||
|
|
@ -4029,7 +4029,7 @@ void Unit::RemoveAura(Aura* aura)
|
|||
{
|
||||
if (i->second == aura)
|
||||
{
|
||||
RemoveAura(i);
|
||||
RemoveAura(i,mode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -4079,12 +4079,13 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||
}
|
||||
|
||||
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
||||
Aur->ApplyModifier(false,true);
|
||||
if (mode != AURA_REMOVE_BY_DELETE) // not unapply if target will deleted
|
||||
Aur->ApplyModifier(false,true);
|
||||
|
||||
if(Aur->_RemoveAura())
|
||||
if (Aur->_RemoveAura())
|
||||
{
|
||||
// last aura in stack removed
|
||||
if(IsSpellLastAuraEffect(Aur->GetSpellProto(),Aur->GetEffIndex()))
|
||||
if (mode != AURA_REMOVE_BY_DELETE && IsSpellLastAuraEffect(Aur->GetSpellProto(),Aur->GetEffIndex()))
|
||||
Aur->HandleSpellSpecificBoosts(false);
|
||||
}
|
||||
|
||||
|
|
@ -4108,12 +4109,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||
i = m_Auras.begin();
|
||||
}
|
||||
|
||||
void Unit::RemoveAllAuras()
|
||||
void Unit::RemoveAllAuras(AuraRemoveMode mode /*= AURA_REMOVE_BY_DEFAULT*/)
|
||||
{
|
||||
while (!m_Auras.empty())
|
||||
{
|
||||
AuraMap::iterator iter = m_Auras.begin();
|
||||
RemoveAura(iter);
|
||||
RemoveAura(iter,mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11105,7 +11106,7 @@ void Unit::CleanupsBeforeDelete()
|
|||
ClearComboPointHolders();
|
||||
DeleteThreatList();
|
||||
getHostileRefManager().setOnlineOfflineState(false);
|
||||
RemoveAllAuras();
|
||||
RemoveAllAuras(AURA_REMOVE_BY_DELETE);
|
||||
RemoveAllGameObjects();
|
||||
RemoveAllDynObjects();
|
||||
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue