From 519fd3dfd2df52315537f88f12837f684265fa0c Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 18 Apr 2022 19:37:30 +0200 Subject: [PATCH] fix(Scripts/Ulduar): Fixed console errors of uninstalling vehicles. (#11334) Fixes #11314 --- .../Ulduar/Ulduar/instance_ulduar.cpp | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 9672f8f95..b6fa60fda 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -664,8 +664,12 @@ public: { Map::PlayerList const& pList = instance->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Vehicle* veh = itr->GetSource()->GetVehicle()) - veh->Dismiss(); + { + if (Creature* vehicleCreature = itr->GetSource()->GetVehicleCreatureBase()) + { + vehicleCreature->DespawnOrUnsummon(); + } + } } break; case TYPE_IGNIS: @@ -837,8 +841,12 @@ public: { Map::PlayerList const& pList = instance->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Vehicle* veh = itr->GetSource()->GetVehicle()) - veh->Dismiss(); + { + if (Creature* vehicleCreature = itr->GetSource()->GetVehicleCreatureBase()) + { + vehicleCreature->DespawnOrUnsummon(); + } + } } } @@ -1239,9 +1247,12 @@ void instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanEncounter if (!_leviathanVehicles.empty()) { for (ObjectGuid const& guid : _leviathanVehicles) + { if (Creature* cr = instance->GetCreature(guid)) - if (Vehicle* veh = cr->GetVehicleKit()) - veh->Dismiss(); + { + cr->DespawnOrUnsummon(); + } + } _leviathanVehicles.clear(); }