mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-28 22:45:55 +00:00
refactor(Core/BattlegroundRV): Convert to std::chrono (#8498)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user