diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 218e2b3a4..4e8d23b58 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -25,6 +25,11 @@ #include "WorldPacket.h" #include "WorldSession.h" +static constexpr Milliseconds BG_RV_PILLAR_SWITCH_TIMER = 25s; +static constexpr Milliseconds BG_RV_FIRE_TO_PILLAR_TIMER = 20s; +static constexpr Milliseconds BG_RV_CLOSE_FIRE_TIMER = 5s; +static constexpr Milliseconds BG_RV_FIRST_TIMER = 20500ms; // elevators rise in 20133ms + BattlegroundRV::BattlegroundRV() { BgObjects.resize(BG_RV_OBJECT_MAX); @@ -72,14 +77,14 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) if (GetStatus() != STATUS_IN_PROGRESS) return; - if (getTimer() < diff) + if (GetTimer() < Milliseconds(diff)) { switch (getState()) { case BG_RV_STATE_OPEN_FENCES: for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) DoorOpen(i); - setTimer(BG_RV_CLOSE_FIRE_TIMER); + SetTimer(BG_RV_CLOSE_FIRE_TIMER); setState(BG_RV_STATE_CLOSE_FIRE); for (auto itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -128,17 +133,17 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) DoorClose(i); // Fire got closed after five seconds, leaves twenty seconds before toggling pillars - setTimer(BG_RV_FIRE_TO_PILLAR_TIMER); + SetTimer(BG_RV_FIRE_TO_PILLAR_TIMER); setState(BG_RV_STATE_SWITCH_PILLARS); break; case BG_RV_STATE_SWITCH_PILLARS: UpdatePillars(); - setTimer(BG_RV_PILLAR_SWITCH_TIMER); + SetTimer(BG_RV_PILLAR_SWITCH_TIMER); break; } } else - setTimer(getTimer() - diff); + SetTimer(GetTimer() - Milliseconds(diff)); if (getState() == BG_RV_STATE_OPEN_FENCES) return; @@ -173,7 +178,7 @@ void BattlegroundRV::StartingEventOpenDoors() DoorOpen(BG_RV_OBJECT_ELEVATOR_2); setState(BG_RV_STATE_OPEN_FENCES); - setTimer(BG_RV_FIRST_TIMER); + SetTimer(BG_RV_FIRST_TIMER); } void BattlegroundRV::AddPlayer(Player* player) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 62a20a831..a5c00f850 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -77,10 +77,6 @@ enum BattlegroundRVData BG_RV_STATE_SWITCH_PILLARS, BG_RV_STATE_CLOSE_FIRE, - BG_RV_PILLAR_SWITCH_TIMER = 25000, - BG_RV_FIRE_TO_PILLAR_TIMER = 20000, - BG_RV_CLOSE_FIRE_TIMER = 5000, - BG_RV_FIRST_TIMER = 20500, // elevators rise in 20133ms BG_RV_WORLD_STATE_A = 0xe11, BG_RV_WORLD_STATE_H = 0xe10, BG_RV_WORLD_STATE = 0xe1a, @@ -108,15 +104,15 @@ public: GameObject* GetPillarAtPosition(Position* p); private: - uint32 Timer; + Milliseconds Timer; uint32 State; uint16 CheckPlayersTimer; void PostUpdateImpl(uint32 diff) override; protected: - uint32 getTimer() { return Timer; } - void setTimer(uint32 timer) { Timer = timer; } + Milliseconds GetTimer() { return Timer; } + void SetTimer(Milliseconds timer) { Timer = timer; } uint32 getState() { return State; }; void setState(uint32 state) { State = state; }