mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
Core/SAI: Rewrite SmartAI::RemoveAuras in a safer way
This commit is contained in:
@@ -430,13 +430,14 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
||||
|
||||
void SmartAI::RemoveAuras()
|
||||
{
|
||||
// Only loop throught the applied auras, because here is where all auras on the current unit are stored
|
||||
Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end(); ++iter)
|
||||
Unit::AuraApplicationMap& appliedAuras = me->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
|
||||
{
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (!aura->GetSpellInfo()->IsPassive() && !aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCaster() != me)
|
||||
me->RemoveAurasDueToSpell(aura->GetId());
|
||||
if (!aura->IsPassive() && !aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCasterGUID() != me->GetGUID())
|
||||
me->RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user