aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShocker <shocker@freakz.ro>2012-01-05 19:20:13 -0800
committerShocker <shocker@freakz.ro>2012-01-05 19:20:13 -0800
commit33de07e2dc72166d35b8ac839ac048934838e795 (patch)
treeb950c3e9e3f4d296e860a58b05f495505f78bf11 /src
parente0bafc73f8ef581e7d7a6969d00828ac44f7ac3e (diff)
parent235b9419643a22266eabed89b674ca26c9d9bfc1 (diff)
Merge pull request #4641 from Subv/fix001
Core/Vehicles: Vehicles with SAI should not kick their passengers when resetting
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp26
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h2
2 files changed, 27 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index af6bf6cf6ce..b5fdf38a4b6 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -431,12 +431,36 @@ 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;
+ }
+}
+
void SmartAI::EnterEvadeMode()
{
if (!me->isAlive())
return;
- me->RemoveAllAuras();
+ RemoveAuras();
+
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon();
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;