Scripts/Ulduar: Fix Flame Leviathan instance lock

Fix Flame Leviathan instance lock not being granted to players because they were ejected from the vehicles as soon as boss died.
Players are now ejected some seconds later.
Close https://github.com/TrinityCore/TrinityCore/issues/15005

(cherry picked from commit b574c99549)
This commit is contained in:
jackpoz
2015-07-05 17:16:35 +02:00
committed by DDuarte
parent 0c09d6311a
commit 4479cbf170
2 changed files with 18 additions and 16 deletions

View File

@@ -690,22 +690,7 @@ class instance_ulduar : public InstanceMapScript
{
case BOSS_LEVIATHAN:
if (state == DONE)
{
// Eject all players from vehicles and make them untargetable.
// They will be despawned after a while
for (auto const& vehicleGuid : LeviathanVehicleGUIDs)
{
if (Creature* vehicleCreature = instance->GetCreature(vehicleGuid))
{
if (Vehicle* vehicle = vehicleCreature->GetVehicleKit())
{
vehicle->RemoveAllPassengers();
vehicleCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
vehicleCreature->DespawnOrUnsummon(5 * MINUTE * IN_MILLISECONDS);
}
}
}
}
_events.ScheduleEvent(EVENT_DESPAWN_LEVIATHAN_VEHICLES, 5 * IN_MILLISECONDS);
break;
case BOSS_IGNIS:
case BOSS_RAZORSCALE:
@@ -1164,6 +1149,22 @@ class instance_ulduar : public InstanceMapScript
algalon->AI()->DoAction(EVENT_DESPAWN_ALGALON);
}
break;
case EVENT_DESPAWN_LEVIATHAN_VEHICLES:
// Eject all players from vehicles and make them untargetable.
// They will be despawned after a while
for (auto const& vehicleGuid : LeviathanVehicleGUIDs)
{
if (Creature* vehicleCreature = instance->GetCreature(vehicleGuid))
{
if (Vehicle* vehicle = vehicleCreature->GetVehicleKit())
{
vehicle->RemoveAllPassengers();
vehicleCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
vehicleCreature->DespawnOrUnsummon(5 * MINUTE * IN_MILLISECONDS);
}
}
}
break;
}
}
}

View File

@@ -404,6 +404,7 @@ enum UlduarEvents
EVENT_DESPAWN_ALGALON = 1,
EVENT_UPDATE_ALGALON_TIMER = 2,
ACTION_INIT_ALGALON = 6,
EVENT_DESPAWN_LEVIATHAN_VEHICLES = 7
};
enum YoggSaronIllusions