diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 30209cc81..d812daa38 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -24,6 +24,10 @@ #include "WorldPacket.h" #include "WorldSession.h" +constexpr Milliseconds BG_SA_BOAT_START = 1min; +constexpr Milliseconds BG_SA_WARMUPLENGTH = 2min; +constexpr Milliseconds BG_SA_ROUNDLENGTH = 10min; + BattlegroundSA::BattlegroundSA() { StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; @@ -38,8 +42,8 @@ BattlegroundSA::BattlegroundSA() SignaledRoundTwoHalfMin = false; InitSecondRound = false; Attackers = TEAM_ALLIANCE; - TotalTime = 0; - EndRoundTimer = 0; + TotalTime = 0s; + EndRoundTimer = 0s; ShipsStarted = false; Status = BG_SA_NOTSTARTED; @@ -49,7 +53,7 @@ BattlegroundSA::BattlegroundSA() for (uint8 i = 0; i < 2; i++) { RoundScores[i].winner = TEAM_ALLIANCE; - RoundScores[i].time = 0; + RoundScores[i].time = 0s; } //! This is here to prevent an uninitialised variable warning @@ -66,7 +70,7 @@ void BattlegroundSA::Init() { Battleground::Init(); - TotalTime = 0; + TotalTime = 0s; Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE); for (uint8 i = 0; i <= 5; i++) GateStatus[i] = BG_SA_GATE_OK; @@ -169,7 +173,7 @@ bool BattlegroundSA::ResetObjs() GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF); GetBGObject(BG_SA_TITAN_RELIC)->Refresh(); - TotalTime = 0; + TotalTime = 0s; ShipsStarted = false; //Graveyards! @@ -322,14 +326,14 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) return; } } - TotalTime += diff; + TotalTime += Milliseconds(diff); if (Status == BG_SA_WARMUP) { EndRoundTimer = BG_SA_ROUNDLENGTH; if (TotalTime >= BG_SA_WARMUPLENGTH) { - TotalTime = 0; + TotalTime = 0s; ToggleTimer(); DemolisherStartState(false); Status = BG_SA_ROUND_ONE; @@ -346,10 +350,10 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) else EndRoundTimer = BG_SA_ROUNDLENGTH; - if (TotalTime >= 60000) + if (TotalTime >= 1min) { SendWarningToAll(LANG_BG_SA_HAS_BEGUN); - TotalTime = 0; + TotalTime = 0s; ToggleTimer(); DemolisherStartState(false); Status = BG_SA_ROUND_TWO; @@ -360,7 +364,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) itr->second->RemoveAurasDueToSpell(SPELL_PREPARATION); } - if (TotalTime >= 30000) + if (TotalTime >= 30s) { if (!SignaledRoundTwoHalfMin) { @@ -400,7 +404,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) _relicClicked = false; Attackers = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE; Status = BG_SA_SECOND_WARMUP; - TotalTime = 0; + TotalTime = 0s; ToggleTimer(); SendWarningToAll(LANG_BG_SA_ROUND_ONE_END); UpdateWaitTimer = 5000; @@ -818,10 +822,10 @@ GraveyardStruct const* BattlegroundSA::GetClosestGraveyard(Player* player) void BattlegroundSA::SendTime() { - uint32 end_of_round = (EndRoundTimer - TotalTime); - UpdateWorldState(BG_SA_TIMER_MINS, end_of_round / 60000); - UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round % 60000) / 10000); - UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round % 60000) % 10000) / 1000); + Milliseconds end_of_round = (EndRoundTimer - TotalTime); + UpdateWorldState(BG_SA_TIMER_MINS, end_of_round / 1min); + UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round % 1min) / 10s); + UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round % 1min) % 10s) / 1s); } bool BattlegroundSA::CanInteractWithObject(uint32 objectId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 0e39ba434..337e158b8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -52,13 +52,6 @@ enum BG_SA_GateState BG_SA_GATE_DESTROYED = 3 }; -enum BG_SA_Timers -{ - BG_SA_BOAT_START = 60 * IN_MILLISECONDS, - BG_SA_WARMUPLENGTH = 120 * IN_MILLISECONDS, - BG_SA_ROUNDLENGTH = 600 * IN_MILLISECONDS -}; - enum BG_SA_WorldStates { BG_SA_TIMER_MINS = 3559, @@ -415,7 +408,7 @@ float const BG_SA_GYOrientation[BG_SA_MAX_GY] = struct BG_SA_RoundScore { TeamId winner; - uint32 time; + Milliseconds time; }; const float SOTADefPortalDest[5][4] = @@ -598,9 +591,9 @@ private: /// Id of attacker team TeamId Attackers; /// Totale elapsed time of current round - uint32 TotalTime; + Milliseconds TotalTime; /// Max time of round - uint32 EndRoundTimer; + Milliseconds EndRoundTimer; /// For know if boats has start moving or not yet bool ShipsStarted; /// Status of each gate (Destroy/Damage/Intact)