Core/Arenas: Remove doors in RL, NA and BE when arena has begun (#23606)

(cherry picked from commit 6d2cd7f687)
This commit is contained in:
Gildor
2019-07-25 12:55:42 +02:00
committed by Shauren
parent 529ca2dd5d
commit 46c0f0d8fe
6 changed files with 114 additions and 0 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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