diff options
author | Subv2112 <s.v.h21@hotmail.com> | 2012-01-05 15:09:55 -0500 |
---|---|---|
committer | Subv2112 <s.v.h21@hotmail.com> | 2012-01-05 15:09:55 -0500 |
commit | d889edb4361a79d7d1a8a93796dd9e10be025829 (patch) | |
tree | c4941bf2fc5525da621c68aab3b7b261e084579a /src | |
parent | 8197c37a92f891374760c79a2ee418bd6ec7d612 (diff) |
Core/SAI: Self-casted auras should not be removed when the NPC resets
Signed-off-by: Subv2112 <s.v.h21@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 28 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 1755c36562f..8c762a73e43 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -431,13 +431,37 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) MovepointReached(Data); } +void SmartAI::RemoveAuras() +{ + Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras(); + for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();) + { + Aura const* aura = iter->second->GetBase(); + if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !(iter->second->GetTarget() == me && aura->GetCaster() == me)) + me->_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); + else + ++iter; + } + + Unit::AuraMap ownedAuras = me->GetOwnedAuras(); + for (Unit::AuraMap::iterator iter = ownedAuras.begin(); iter != ownedAuras.end();) + { + Aura* aura = iter->second; + if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE)) + me->RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); + else + ++iter; + } + + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); +} + void SmartAI::EnterEvadeMode() { if (!me->isAlive()) return; - // Vehicles should not dismount their passengers on evade mode - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + RemoveAuras(); me->DeleteThreatList(); me->CombatStop(true); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 1059e2a01c4..b33bfebf912 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -193,6 +193,8 @@ class SmartAI : public CreatureAI mDespawnState = t ? 1 : 0; } void StartDespawn() { mDespawnState = 2; } + + void RemoveAuras(); private: uint32 mFollowCreditType; |