mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[8295] Remove single target auras at caster/target shift to not accessable phase.
This must fix another source of "Couldn't find the caster of the single target aura" errors.
This commit is contained in:
parent
4841fae910
commit
822a34e2c7
3 changed files with 22 additions and 5 deletions
|
|
@ -3878,13 +3878,24 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flags)
|
|||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveNotOwnSingleTargetAuras()
|
||||
void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
||||
{
|
||||
// single target auras from other casters
|
||||
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
|
||||
{
|
||||
if (iter->second->GetCasterGUID()!=GetGUID() && IsSingleTargetSpell(iter->second->GetSpellProto()))
|
||||
RemoveAura(iter);
|
||||
{
|
||||
if(!newPhase)
|
||||
RemoveAura(iter);
|
||||
else
|
||||
{
|
||||
Unit* caster = iter->second->GetCaster();
|
||||
if(!caster || !caster->InSamePhase(newPhase))
|
||||
RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
|
@ -3894,7 +3905,7 @@ void Unit::RemoveNotOwnSingleTargetAuras()
|
|||
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end(); )
|
||||
{
|
||||
Aura* aura = *iter;
|
||||
if (aura->GetTarget() != this)
|
||||
if (aura->GetTarget() != this && !aura->GetTarget()->InSamePhase(newPhase))
|
||||
{
|
||||
scAuras.erase(iter); // explicitly remove, instead waiting remove in RemoveAura
|
||||
aura->GetTarget()->RemoveAura(aura);
|
||||
|
|
@ -11823,6 +11834,12 @@ void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo)
|
|||
|
||||
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
{
|
||||
if(newPhaseMask==GetPhaseMask())
|
||||
return;
|
||||
|
||||
if(IsInWorld())
|
||||
RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target
|
||||
|
||||
WorldObject::SetPhaseMask(newPhaseMask,update);
|
||||
|
||||
if(IsInWorld())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue