diff options
Diffstat (limited to 'src')
14 files changed, 69 insertions, 60 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index 008ec447f6a..020c7819460 100755 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -317,8 +317,6 @@ void VehicleAI::UpdateAI(const uint32 diff) void VehicleAI::Reset() { me->SetVisible(true); - - m_vehicle->Reset(); } void VehicleAI::OnCharmed(bool apply) diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 92a2227fe8b..09640661fd5 100755 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -155,7 +155,7 @@ void CreatureAI::EnterEvadeMode() Reset(); if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons! - me->GetVehicleKit()->Reset(); + me->GetVehicleKit()->Reset(true); } /*void CreatureAI::AttackedBy(Unit* attacker) diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 4619c6f9f79..cc3bfad4f86 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -549,8 +549,13 @@ inline bool CreatureAI::_EnterEvadeMode() if (!me->isAlive()) return false; + // call specialized vehicle remove auras if creature is one + if (!me->IsVehicle()) + me->RemoveAllAuras(); + else + me->RemoveAllAurasExceptVehicle(); + // sometimes bosses stuck in combat? - me->RemoveAllAuras(); me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 78ea3d9c5e6..75ba3790e54 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -516,9 +516,6 @@ void BossAI::_Reset() if (!me->isAlive()) return; - if (me->GetVehicleKit()) - me->GetVehicleKit()->Reset(); - me->ResetLootMode(); events.Reset(); summons.DespawnAll(); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index ae39ef0fae5..7080e35538c 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -431,6 +431,8 @@ void Creature::Update(uint32 diff) { TriggerJustRespawned = false; AI()->JustRespawned(); + if (m_vehicleKit) + m_vehicleKit->Reset(); } switch(m_deathState) @@ -712,6 +714,9 @@ bool Creature::AIM_Initialize(CreatureAI* ai) delete oldAI; IsAIEnabled = true; i_AI->InitializeAI(); + // Initialize vehicle + if (GetVehicleKit()) + GetVehicleKit()->Reset(); return true; } @@ -1553,7 +1558,6 @@ void Creature::setDeathState(DeathState s) Motion_Initialize(); if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask) SetPhaseMask(GetCreatureData()->phaseMask, false); - if (m_vehicleKit) m_vehicleKit->Reset(); Unit::setDeathState(ALIVE); } } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 719ff4a726d..22cecbc983e 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4010,6 +4010,27 @@ void Unit::RemoveAllAurasRequiringDeadTarget() } } +void Unit::RemoveAllAurasExceptVehicle() +{ + for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) + { + Aura const* aura = iter->second->GetBase(); + if (!IsSpellHaveAura(aura->GetSpellProto(), SPELL_AURA_CONTROL_VEHICLE)) + _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); + else + ++iter; + } + + for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) + { + Aura* aura = iter->second; + if (!IsSpellHaveAura(aura->GetSpellProto(), SPELL_AURA_CONTROL_VEHICLE)) + RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); + else + ++iter; + } +} + void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime) { for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);++iter) @@ -11755,7 +11776,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) plr->GetSession()->SendPacket(&data); // mounts can also have accessories - GetVehicleKit()->InstallAllAccessories(); + GetVehicleKit()->InstallAllAccessories(false); } } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 6a6cd82af15..2dfcc4412cb 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1664,6 +1664,7 @@ class Unit : public WorldObject void RemoveArenaAuras(bool onleave = false); void RemoveAllAurasOnDeath(); void RemoveAllAurasRequiringDeadTarget(); + void RemoveAllAurasExceptVehicle(); void DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime); void _RemoveAllAuraStatMods(); diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 546048fc8d6..162faa52fe5 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -118,16 +118,18 @@ void Vehicle::Install() sScriptMgr->OnInstall(this); } -void Vehicle::InstallAllAccessories() +void Vehicle::InstallAllAccessories(bool evading) { - RemoveAllPassengers(); // We might have aura's saved in the DB with now invalid casters - remove + if (GetBase()->GetTypeId() == TYPEID_PLAYER || !evading) + RemoveAllPassengers(); // We might have aura's saved in the DB with now invalid casters - remove - VehicleAccessoryList const* mVehicleList = sObjectMgr->GetVehicleAccessoryList(this); - if (!mVehicleList) + VehicleAccessoryList const* accessories = sObjectMgr->GetVehicleAccessoryList(this); + if (!accessories) return; - for (VehicleAccessoryList::const_iterator itr = mVehicleList->begin(); itr != mVehicleList->end(); ++itr) - InstallAccessory(itr->uiAccessory, itr->uiSeat, itr->bMinion, itr->uiSummonType, itr->uiSummonTime); + for (VehicleAccessoryList::const_iterator itr = accessories->begin(); itr != accessories->end(); ++itr) + if (!evading || itr->IsMinion) // only install minions on evade mode + InstallAccessory(itr->AccessoryEntry, itr->SeatId, itr->IsMinion, itr->SummonedType, itr->SummonTime); } void Vehicle::Uninstall() @@ -139,7 +141,7 @@ void Vehicle::Uninstall() sScriptMgr->OnUninstall(this); } -void Vehicle::Reset() +void Vehicle::Reset(bool evading /*= false*/) { sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Reset Entry: %u, GuidLow: %u", m_creatureEntry, me->GetGUIDLow()); if (me->GetTypeId() == TYPEID_PLAYER) @@ -149,7 +151,7 @@ void Vehicle::Reset() } else { - InstallAllAccessories(); + InstallAllAccessories(evading); if (m_usableSeatNum) me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); } @@ -222,7 +224,7 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime) { sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId); - if (Unit *passenger = GetPassenger(seatId)) + if (Unit* passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) @@ -239,22 +241,24 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ passenger->ExitVehicle(); // this should not happen } - if (Creature *accessory = me->SummonCreature(entry, *me, TempSummonType(type), summonTime)) + if (TempSummon *accessory = me->SummonCreature(entry, *me, TempSummonType(type), summonTime)) { if (minion) accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); if (!me->HandleSpellClick(accessory, seatId)) { - accessory->AddObjectToRemoveList(); + accessory->UnSummon(); return; } - if (!accessory->IsOnVehicle(me)) - { - accessory->AddObjectToRemoveList(); - return; // Something went wrong in the spellsystem - } + // this cannot be checked instantly like this + // spellsystem is delaying everything to next update tick + //if (!accessory->IsOnVehicle(me)) + //{ + // accessory->UnSummon(); + // return; // Something went wrong in the spellsystem + //} // This is not good, we have to send update twice accessory->SendMovementFlagUpdate(); diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 413d2e24bf2..4592c67e3fd 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -86,13 +86,13 @@ struct VehicleSeat struct VehicleAccessory { - explicit VehicleAccessory(uint32 _uiAccessory, int8 _uiSeat, bool _bMinion, uint8 _uiSummonType, uint32 _uiSummonTime) : - uiAccessory(_uiAccessory), uiSeat(_uiSeat), bMinion(_bMinion), uiSummonType(_uiSummonType), uiSummonTime(_uiSummonTime) {} - uint32 uiAccessory; - int8 uiSeat; - uint32 bMinion; - uint8 uiSummonType; - uint32 uiSummonTime; + VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) : + AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {} + uint32 AccessoryEntry; + int8 SeatId; + uint32 IsMinion; + uint8 SummonedType; + uint32 SummonTime; }; struct VehicleScalingInfo @@ -118,8 +118,8 @@ class Vehicle void Install(); void Uninstall(); - void Reset(); - void InstallAllAccessories(); + void Reset(bool evading = false); + void InstallAllAccessories(bool evading); Unit *GetBase() const { return me; } VehicleEntry const *GetVehicleInfo() const { return m_vehicleInfo; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 1876c6fbaf9..d5254a0b706 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -172,9 +172,6 @@ public: uiChargeTimer = 5000; uiShieldBreakerTimer = 8000; uiBuffTimer = urand(30000,60000); - - if (me->GetVehicleKit()) - me->GetVehicleKit()->Reset(); } void SetData(uint32 uiType, uint32 /*uiData*/) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 7a1a97539a4..6019952c559 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -162,8 +162,6 @@ class boss_ick : public CreatureScript void EnterCombat(Unit * /*who*/) { - _vehicle->InstallAllAccessories(); - if (Creature* krick = GetKrick()) DoScriptText(SAY_KRICK_AGGRO, krick); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 440666581c0..168c2844330 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -301,7 +301,7 @@ class boss_rimefang : public CreatureScript void JustReachedHome() { - _vehicle->InstallAllAccessories(); + _vehicle->InstallAllAccessories(false); } void DoAction(const int32 actionId) diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 6c73120c0aa..c2a9afc3788 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -874,12 +874,6 @@ public: instance = creature->GetInstanceScript(); } - void Reset() - { - if (Vehicle* veh = me->GetVehicleKit()) - veh->Reset(); - } - void PassengerBoarded(Unit* unit, int8 seat, bool apply) { if (apply) diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp index 6f0c8ec2bd3..352af769f59 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -221,7 +221,8 @@ class boss_flame_leviathan : public CreatureScript void InitializeAI() { ASSERT(vehicle); - Reset(); + if (!me->isDead()) + Reset(); ActiveTowersCount = 4; Shutdown = 0; ActiveTowers = false; @@ -255,12 +256,6 @@ class boss_flame_leviathan : public CreatureScript _Reset(); Shutdown = 0; me->SetReactState(REACT_DEFENSIVE); - if (me->GetVehicleKit()) - { - me->GetVehicleKit()->Reset(); - if (me->GetVehicleKit()->GetPassenger(SEAT_CANNON)) - me->CastSpell(me->GetVehicleKit()->GetPassenger(SEAT_CANNON),AURA_STEALTH_DETECTION,false); - } } void EnterCombat(Unit* /*who*/) @@ -344,7 +339,7 @@ class boss_flame_leviathan : public CreatureScript void SpellHit(Unit* /*caster*/, SpellEntry* const spell) { if (spell->Id == SPELL_START_THE_ENGINE) - vehicle->InstallAllAccessories(); + vehicle->InstallAllAccessories(false); if (spell->Id == SPELL_ELECTROSHOCK) me->InterruptSpell(CURRENT_CHANNELED_SPELL); @@ -594,12 +589,6 @@ class boss_flame_leviathan_seat : public CreatureScript InstanceScript* instance; Vehicle* vehicle; - void Reset() - { - if (me->GetVehicleKit()) - me->GetVehicleKit()->Reset(); - } - void PassengerBoarded(Unit* who, int8 seatId, bool apply) { if (!me->GetVehicle()) @@ -662,6 +651,7 @@ class boss_flame_leviathan_defense_cannon : public CreatureScript void Reset () { NapalmTimer = 5000; + DoCast(me, AURA_STEALTH_DETECTION); } void UpdateAI(uint32 const diff) |