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

@@ -21,6 +21,7 @@
#include "Chat.h"
#include "DisableMgr.h"
#include "DynamicTree.h"
#include "GameTime.h"
#include "Geometry.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -2946,7 +2947,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// increase current instances (hourly limit)
// xinef: specific instances are still limited
if (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())
player->AddInstanceEnterTime(GetInstanceId(), time(nullptr));
player->AddInstanceEnterTime(GetInstanceId(), GameTime::GetGameTime().count());
if (!playerBind->perm && !mapSave->CanReset() && group && !group->isLFGGroup() && !group->IsLfgRandomInstance())
{
@@ -3297,7 +3298,7 @@ void Map::SaveCreatureRespawnTime(ObjectGuid::LowType spawnId, time_t& respawnTi
return;
}
time_t now = time(nullptr);
time_t now = GameTime::GetGameTime().count();
if (GetInstanceResetPeriod() > 0 && respawnTime - now + 5 >= GetInstanceResetPeriod())
respawnTime = now + YEAR;
@@ -3331,7 +3332,7 @@ void Map::SaveGORespawnTime(ObjectGuid::LowType spawnId, time_t& respawnTime)
return;
}
time_t now = time(nullptr);
time_t now = GameTime::GetGameTime().count();
if (GetInstanceResetPeriod() > 0 && respawnTime - now + 5 >= GetInstanceResetPeriod())
respawnTime = now + YEAR;
@@ -3622,7 +3623,7 @@ Corpse* Map::ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia /*=
void Map::RemoveOldCorpses()
{
time_t now = time(nullptr);
time_t now = GameTime::GetGameTime().count();
std::vector<ObjectGuid> corpses;
corpses.reserve(_corpsesByPlayer.size());