feat(Core/Time): Implement saparated manager for game time (#8630)

This commit is contained in:
Kargatum
2022-01-24 17:55:00 +07:00
committed by GitHub
parent 12da792a90
commit 8b7df23f06
129 changed files with 1147 additions and 817 deletions

View File

@@ -25,6 +25,7 @@
#include "CharacterPackets.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
@@ -219,13 +220,13 @@ void WorldSession::SendPacket(WorldPacket const* packet)
static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0;
static time_t firstTime = time(nullptr);
static time_t firstTime = GameTime::GetGameTime().count();
static time_t lastTime = firstTime; // next 60 secs start time
static uint64 sendLastPacketCount = 0;
static uint64 sendLastPacketBytes = 0;
time_t cur_time = time(nullptr);
time_t cur_time = GameTime::GetGameTime().count();
if ((cur_time - lastTime) < 60)
{
@@ -306,7 +307,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
bool deletePacket = true;
std::vector<WorldPacket*> requeuePackets;
uint32 processedPackets = 0;
time_t currentTime = time(nullptr);
time_t currentTime = GameTime::GetGameTime().count();
while (m_Socket && _recvQueue.next(packet, updater))
{
@@ -510,7 +511,7 @@ void WorldSession::HandleTeleportTimeout(bool updateInSessions)
// pussywizard: handle teleport ack timeout
if (m_Socket && m_Socket->IsOpen() && GetPlayer() && GetPlayer()->IsBeingTeleported())
{
time_t currTime = time(nullptr);
time_t currTime = GameTime::GetGameTime().count();
if (updateInSessions) // session update from World::UpdateSessions
{
if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar() + sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime)
@@ -897,7 +898,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
void WorldSession::SendAccountDataTimes(uint32 mask)
{
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + 8 * 4); // changed in WotLK
data << uint32(time(nullptr)); // unix time of something
data << uint32(GameTime::GetGameTime().count()); // unix time of something
data << uint8(1);
data << uint32(mask); // type mask
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)