aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp22
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBE.h16
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp22
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundNA.h16
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp22
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRL.h16
6 files changed, 114 insertions, 0 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index 57b77332ff2..dc0e96b2d52 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
@@ -25,6 +25,27 @@ BattlegroundBE::BattlegroundBE(BattlegroundTemplate const* battlegroundTemplate)
BgObjects.resize(BG_BE_OBJECT_MAX);
}
+void BattlegroundBE::PostUpdateImpl(uint32 diff)
+{
+ if (GetStatus() != STATUS_IN_PROGRESS)
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case BG_BE_EVENT_REMOVE_DOORS:
+ for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i)
+ DelObject(i);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
void BattlegroundBE::StartingEventCloseDoors()
{
for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; ++i)
@@ -38,6 +59,7 @@ void BattlegroundBE::StartingEventOpenDoors()
{
for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i)
DoorOpen(i);
+ _events.ScheduleEvent(BG_BE_EVENT_REMOVE_DOORS, BG_BE_REMOVE_DOORS_TIMER);
for (uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i)
SpawnBGObject(i, 60);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index 81060b5b8dd..5aaa03380a1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
@@ -19,6 +19,7 @@
#define __BATTLEGROUNDBE_H
#include "Arena.h"
+#include "EventMap.h"
enum BattlegroundBEObjectTypes
{
@@ -41,6 +42,16 @@ enum BattlegroundBEGameObjects
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
};
+enum BattlegroundBEData
+{
+ BG_BE_REMOVE_DOORS_TIMER = 5000
+};
+
+enum BattlegroundBEEvents
+{
+ BG_BE_EVENT_REMOVE_DOORS = 1
+};
+
class BattlegroundBE : public Arena
{
public:
@@ -53,5 +64,10 @@ class BattlegroundBE : public Arena
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
+
+ private:
+ void PostUpdateImpl(uint32 diff) override;
+
+ EventMap _events;
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 16d9f272361..0482be0812c 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
@@ -25,6 +25,27 @@ BattlegroundNA::BattlegroundNA(BattlegroundTemplate const* battlegroundTemplate)
BgObjects.resize(BG_NA_OBJECT_MAX);
}
+void BattlegroundNA::PostUpdateImpl(uint32 diff)
+{
+ if (GetStatus() != STATUS_IN_PROGRESS)
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case BG_NA_EVENT_REMOVE_DOORS:
+ for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i)
+ DelObject(i);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
void BattlegroundNA::StartingEventCloseDoors()
{
for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i)
@@ -35,6 +56,7 @@ void BattlegroundNA::StartingEventOpenDoors()
{
for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i)
DoorOpen(i);
+ _events.ScheduleEvent(BG_NA_EVENT_REMOVE_DOORS, BG_NA_REMOVE_DOORS_TIMER);
for (uint32 i = BG_NA_OBJECT_BUFF_1; i <= BG_NA_OBJECT_BUFF_2; ++i)
SpawnBGObject(i, 60);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
index 187623a2dd7..a509f16f2a9 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
@@ -18,6 +18,7 @@
#define __BATTLEGROUNDNA_H
#include "Arena.h"
+#include "EventMap.h"
enum BattlegroundNAObjectTypes
{
@@ -40,6 +41,16 @@ enum BattlegroundNAGameObjects
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
};
+enum BattlegroundNAData
+{
+ BG_NA_REMOVE_DOORS_TIMER = 5000
+};
+
+enum BattlegroundNAEvents
+{
+ BG_NA_EVENT_REMOVE_DOORS = 1
+};
+
class BattlegroundNA : public Arena
{
public:
@@ -52,5 +63,10 @@ class BattlegroundNA : public Arena
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
+
+ private:
+ void PostUpdateImpl(uint32 diff) override;
+
+ EventMap _events;
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index 4a31fd302d5..f4d13b28d45 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
@@ -25,6 +25,27 @@ BattlegroundRL::BattlegroundRL(BattlegroundTemplate const* battlegroundTemplate)
BgObjects.resize(BG_RL_OBJECT_MAX);
}
+void BattlegroundRL::PostUpdateImpl(uint32 diff)
+{
+ if (GetStatus() != STATUS_IN_PROGRESS)
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case BG_RL_EVENT_REMOVE_DOORS:
+ for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
+ DelObject(i);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
void BattlegroundRL::StartingEventCloseDoors()
{
for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
@@ -35,6 +56,7 @@ void BattlegroundRL::StartingEventOpenDoors()
{
for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
DoorOpen(i);
+ _events.ScheduleEvent(BG_RL_EVENT_REMOVE_DOORS, BG_RL_REMOVE_DOORS_TIMER);
for (uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; ++i)
SpawnBGObject(i, 60);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
index 5fcb42853e5..d553a1f6aca 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
@@ -18,6 +18,7 @@
#define __BATTLEGROUNDRL_H
#include "Arena.h"
+#include "EventMap.h"
enum BattlegroundRLObjectTypes
{
@@ -36,6 +37,16 @@ enum BattlegroundRLGameObjects
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
};
+enum BattlegroundRLData
+{
+ BG_RL_REMOVE_DOORS_TIMER = 5000
+};
+
+enum BattlegroundRLEvents
+{
+ BG_RL_EVENT_REMOVE_DOORS = 1
+};
+
class BattlegroundRL : public Arena
{
public:
@@ -48,5 +59,10 @@ class BattlegroundRL : public Arena
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
+
+ private:
+ void PostUpdateImpl(uint32 diff) override;
+
+ EventMap _events;
};
#endif