diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-25 21:53:55 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-23 23:34:52 +0100 |
commit | 5f5d32888ac97b24b46a9c2d08f028583faaa911 (patch) | |
tree | 9351aa165dc91347ef25a1b2d18ed3f990d5e814 /src | |
parent | 14e9513cea0a3b4ce58bdcc8d5ce785c9417c35a (diff) |
Core/EscortAI: std::chrono-ify SetPauseTimer
(cherry picked from commit cdaf890af4b5bb7ce256752b49bba2c0f3ed9264)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 16 | ||||
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 4 | ||||
-rw-r--r-- | src/server/scripts/Northrend/zone_borean_tundra.cpp | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index e02902ec4bb..a5ec66c7252 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -33,7 +33,7 @@ enum Points POINT_HOME = 0xFFFFFE }; -EscortAI::EscortAI(Creature* creature) : ScriptedAI(creature), _pauseTimer(2500), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), +EscortAI::EscortAI(Creature* creature) : ScriptedAI(creature), _pauseTimer(2500ms), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), _escortQuest(nullptr), _activeAttacker(true), _running(false), _instantRespawn(false), _returnToStart(false), _despawnAtEnd(true), _despawnAtFar(true), _manualPath(false), _hasImmuneToNPCFlags(false), _started(false), _ended(false), _resume(false) { @@ -77,7 +77,7 @@ void EscortAI::InitializeAI() SetCombatMovement(true); // add a small delay before going to first waypoint, normal in near all cases - _pauseTimer = 2000; + _pauseTimer = 2s; if (me->GetFaction() != me->GetCreatureTemplate()->faction) me->RestoreFaction(); @@ -121,8 +121,8 @@ void EscortAI::MovementInform(uint32 type, uint32 id) if (type == POINT_MOTION_TYPE) { - if (!_pauseTimer) - _pauseTimer = 2000; + if (_pauseTimer == 0s) + _pauseTimer = 2s; // continue waypoint movement if (id == POINT_LAST_POINT) @@ -149,7 +149,7 @@ void EscortAI::MovementInform(uint32 type, uint32 id) { _started = false; _ended = true; - _pauseTimer = 1000; + _pauseTimer = 1s; } } } @@ -159,11 +159,11 @@ void EscortAI::UpdateAI(uint32 diff) // Waypoint Updating if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->IsEngaged() && !HasEscortState(STATE_ESCORT_RETURNING)) { - if (_pauseTimer <= diff) + if (_pauseTimer.count() <= diff) { if (!HasEscortState(STATE_ESCORT_PAUSED)) { - _pauseTimer = 0; + _pauseTimer = 0s; if (_ended) { @@ -206,7 +206,7 @@ void EscortAI::UpdateAI(uint32 diff) } } else - _pauseTimer -= diff; + _pauseTimer -= Milliseconds(diff); } // Check if player or any member of his group is within range diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index ef0a3ec47f5..ce37b3dfe73 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -53,7 +53,7 @@ struct TC_GAME_API EscortAI : public ScriptedAI void SetRun(bool on = true); void SetEscortPaused(bool on); - void SetPauseTimer(uint32 Timer) { _pauseTimer = Timer; } + void SetPauseTimer(Milliseconds timer) { _pauseTimer = timer; } bool HasEscortState(uint32 escortState) { return (_escortState & escortState) != 0; } bool IsEscorted() const override { return !_playerGUID.IsEmpty(); } void SetMaxPlayerDistance(float newMax) { _maxPlayerDistance = newMax; } @@ -76,7 +76,7 @@ struct TC_GAME_API EscortAI : public ScriptedAI void RemoveEscortState(uint32 escortState) { _escortState &= ~escortState; } ObjectGuid _playerGUID; - uint32 _pauseTimer; + Milliseconds _pauseTimer; uint32 _playerCheckTimer; uint32 _escortState; float _maxPlayerDistance; diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 42728c5747b..95916854710 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -1621,7 +1621,7 @@ public: _events.ScheduleEvent(EVENT_TALK_1, Seconds(2)); _events.CancelEvent(EVENT_OOC_TALK); Start(true, true, player->GetGUID()); - SetPauseTimer(12 * IN_MILLISECONDS); + SetPauseTimer(12s); } } |