mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Scripts/Ulduar: Fix some Flame Leviathan issues
Fix some Flame Leviathan issues: - Fix boss evading all the time due to bad Doors check - Opened "Lightning Door" to other bosses only after boss dies - Eject players from the vehicles when boss dies, make them untargetable and despawn them after 5 minutes (adjust the time to the blizzlike time of choice)
This commit is contained in:
@@ -191,6 +191,12 @@ void InstanceScript::UpdateDoorState(GameObject* door)
|
||||
door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
}
|
||||
|
||||
BossInfo* InstanceScript::GetBossInfo(uint32 id)
|
||||
{
|
||||
ASSERT(id < bosses.size());
|
||||
return &bosses[id];
|
||||
}
|
||||
|
||||
void InstanceScript::AddObject(Creature* obj, bool add)
|
||||
{
|
||||
ObjectInfoMap::const_iterator j = _creatureInfo.find(obj->GetEntry());
|
||||
|
||||
@@ -254,12 +254,16 @@ class InstanceScript : public ZoneScript
|
||||
void AddObject(GameObject* obj, bool add);
|
||||
void AddObject(WorldObject* obj, uint32 type, bool add);
|
||||
|
||||
void AddDoor(GameObject* door, bool add);
|
||||
virtual void AddDoor(GameObject* door, bool add);
|
||||
void AddMinion(Creature* minion, bool add);
|
||||
|
||||
void UpdateDoorState(GameObject* door);
|
||||
virtual void UpdateDoorState(GameObject* door);
|
||||
void UpdateMinionState(Creature* minion, EncounterState state);
|
||||
|
||||
// Exposes private data that should never be modified unless exceptional cases.
|
||||
// Pay very much attention at how the returned BossInfo data is modified to avoid issues.
|
||||
BossInfo* GetBossInfo(uint32 id);
|
||||
|
||||
// Instance Load and Save
|
||||
bool ReadSaveDataHeaders(std::istringstream& data);
|
||||
void ReadSaveDataBossStates(std::istringstream& data);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "InstanceScript.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -91,6 +92,7 @@ class instance_ulduar : public InstanceMapScript
|
||||
|
||||
// Creatures
|
||||
ObjectGuid LeviathanGUID;
|
||||
GuidVector LeviathanVehicleGUIDs;
|
||||
ObjectGuid IgnisGUID;
|
||||
ObjectGuid RazorscaleGUID;
|
||||
ObjectGuid RazorscaleController;
|
||||
@@ -217,6 +219,11 @@ class instance_ulduar : public InstanceMapScript
|
||||
case NPC_LEVIATHAN:
|
||||
LeviathanGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_SALVAGED_DEMOLISHER:
|
||||
case NPC_SALVAGED_SIEGE_ENGINE:
|
||||
case NPC_SALVAGED_CHOPPER:
|
||||
LeviathanVehicleGUIDs.push_back(creature->GetGUID());
|
||||
break;
|
||||
case NPC_IGNIS:
|
||||
IgnisGUID = creature->GetGUID();
|
||||
break;
|
||||
@@ -682,6 +689,24 @@ class instance_ulduar : public InstanceMapScript
|
||||
switch (type)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BOSS_IGNIS:
|
||||
case BOSS_RAZORSCALE:
|
||||
case BOSS_XT002:
|
||||
@@ -1143,6 +1168,34 @@ class instance_ulduar : public InstanceMapScript
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateDoorState(GameObject* door) override
|
||||
{
|
||||
// Leviathan doors are set to DOOR_TYPE_ROOM except the one it uses to enter the room
|
||||
// which has to be set to DOOR_TYPE_PASSAGE
|
||||
if (door->GetEntry() == GO_LEVIATHAN_DOOR && door->GetPositionX() > 400.f)
|
||||
door->SetGoState(GetBossState(BOSS_LEVIATHAN) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
else
|
||||
InstanceScript::UpdateDoorState(door);
|
||||
}
|
||||
|
||||
void AddDoor(GameObject* door, bool add) override
|
||||
{
|
||||
// Leviathan doors are South except the one it uses to enter the room
|
||||
// which is North and should not be used for boundary checks in BossAI::CheckBoundary()
|
||||
if (door->GetEntry() == GO_LEVIATHAN_DOOR && door->GetPositionX() > 400.f)
|
||||
{
|
||||
if (add)
|
||||
GetBossInfo(BOSS_LEVIATHAN)->door[DOOR_TYPE_PASSAGE].insert(door->GetGUID());
|
||||
else
|
||||
GetBossInfo(BOSS_LEVIATHAN)->door[DOOR_TYPE_PASSAGE].erase(door->GetGUID());
|
||||
|
||||
if (add)
|
||||
UpdateDoorState(door);
|
||||
}
|
||||
else
|
||||
InstanceScript::AddDoor(door, add);
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
uint32 _algalonTimer;
|
||||
|
||||
@@ -54,6 +54,7 @@ enum UlduarNPCs
|
||||
NPC_LEVIATHAN = 33113,
|
||||
NPC_SALVAGED_DEMOLISHER = 33109,
|
||||
NPC_SALVAGED_SIEGE_ENGINE = 33060,
|
||||
NPC_SALVAGED_CHOPPER = 33062,
|
||||
NPC_IGNIS = 33118,
|
||||
NPC_RAZORSCALE = 33186,
|
||||
NPC_RAZORSCALE_CONTROLLER = 33233,
|
||||
|
||||
Reference in New Issue
Block a user