mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Channel.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include "Formulas.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
@@ -57,7 +58,7 @@ void Player::Update(uint32 p_time)
|
||||
sScriptMgr->OnBeforePlayerUpdate(this, p_time);
|
||||
|
||||
// undelivered mail
|
||||
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(nullptr))
|
||||
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= GameTime::GetGameTime().count())
|
||||
{
|
||||
SendNewMail();
|
||||
++unReadMails;
|
||||
@@ -82,7 +83,7 @@ void Player::Update(uint32 p_time)
|
||||
Unit::Update(p_time);
|
||||
SetMustDelayTeleport(false);
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
|
||||
UpdatePvPFlag(now);
|
||||
UpdateFFAPvPFlag(now);
|
||||
@@ -239,7 +240,7 @@ void Player::Update(uint32 p_time)
|
||||
{
|
||||
if (now > lastTick && _restTime > 0) // freeze update
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
time_t timeDiff = currTime - _restTime;
|
||||
if (timeDiff >= 10) // freeze update
|
||||
{
|
||||
@@ -434,7 +435,7 @@ void Player::UpdateMirrorTimers()
|
||||
void Player::UpdateNextMailTimeAndUnreads()
|
||||
{
|
||||
// Update the next delivery time and unread mails
|
||||
time_t cTime = time(nullptr);
|
||||
time_t cTime = GameTime::GetGameTime().count();
|
||||
// Get the next delivery time
|
||||
CharacterDatabasePreparedStatement* stmtNextDeliveryTime =
|
||||
CharacterDatabase.GetPreparedStatement(CHAR_SEL_NEXT_MAIL_DELIVERYTIME);
|
||||
@@ -1126,8 +1127,8 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation,
|
||||
void Player::UpdateHonorFields()
|
||||
{
|
||||
/// called when rewarding honor and at each save
|
||||
time_t now = time_t(time(nullptr));
|
||||
time_t today = time_t(time(nullptr) / DAY) * DAY;
|
||||
time_t now = time_t(GameTime::GetGameTime().count());
|
||||
time_t today = time_t(GameTime::GetGameTime().count() / DAY) * DAY;
|
||||
|
||||
if (m_lastHonorUpdateTime < today)
|
||||
{
|
||||
@@ -1384,7 +1385,7 @@ void Player::UpdatePvPState()
|
||||
{
|
||||
if (IsPvP() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) &&
|
||||
pvpInfo.EndTimer == 0)
|
||||
pvpInfo.EndTimer = time(nullptr); // start toggle-off
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime().count(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1450,7 +1451,7 @@ void Player::UpdateFFAPvPState(bool reset /*= true*/)
|
||||
!pvpInfo.FFAPvPEndTimer)
|
||||
{
|
||||
pvpInfo.FFAPvPEndTimer =
|
||||
sWorld->GetGameTime() +
|
||||
GameTime::GetGameTime().count() +
|
||||
sWorld->getIntConfig(CONFIG_FFA_PVP_TIMER);
|
||||
}
|
||||
}
|
||||
@@ -1466,7 +1467,7 @@ void Player::UpdatePvP(bool state, bool _override)
|
||||
}
|
||||
else
|
||||
{
|
||||
pvpInfo.EndTimer = time(nullptr);
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime().count();
|
||||
SetPvP(state);
|
||||
}
|
||||
|
||||
@@ -1958,7 +1959,7 @@ void Player::UpdateCorpseReclaimDelay()
|
||||
(!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
|
||||
return;
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
|
||||
if (now < m_deathExpireTime)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user