mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 19:31:59 +01:00
Merge pull request #4641 from Subv/fix001
Core/Vehicles: Vehicles with SAI should not kick their passengers when resetting
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -193,6 +193,8 @@ class SmartAI : public CreatureAI
|
||||
mDespawnState = t ? 1 : 0;
|
||||
}
|
||||
void StartDespawn() { mDespawnState = 2; }
|
||||
|
||||
void RemoveAuras();
|
||||
|
||||
private:
|
||||
uint32 mFollowCreditType;
|
||||
|
||||
Reference in New Issue
Block a user