aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Instances/InstanceScript.cpp6
-rw-r--r--src/server/game/Instances/InstanceScript.h8
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp53
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h1
4 files changed, 66 insertions, 2 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index b8f95b9407c..5da79a0a898 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -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());
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index acd511a402b..8c34e37976c 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -261,12 +261,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);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 56148480e11..32d3b35f35c 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -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;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index ddf293dd8b8..d40fb698658 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -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,