mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/EscortAI: std::chrono-ify SetPauseTimer
(cherry picked from commit cdaf890af4)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user