mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 17:13:47 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "Formulas.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameTime.h"
|
||||
#include "Map.h"
|
||||
#include "MapMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -138,11 +139,11 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
{
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if (time(nullptr) > m_NextAutoDistributionTime)
|
||||
if (GameTime::GetGameTime() > m_NextAutoDistributionTime)
|
||||
{
|
||||
sArenaTeamMgr->DistributeArenaPoints();
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime));
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + 1_days * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, m_NextAutoDistributionTime.count());
|
||||
}
|
||||
m_AutoDistributionTimeChecker = 600000; // 10 minutes check
|
||||
}
|
||||
@@ -631,16 +632,21 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
||||
if (!sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
return;
|
||||
|
||||
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
time_t curtime = time(nullptr);
|
||||
Seconds wstime = Seconds(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
Seconds curtime = GameTime::GetGameTime();
|
||||
|
||||
LOG_INFO("server.loading", "Initializing Automatic Arena Point Distribution");
|
||||
|
||||
if (wstime < curtime)
|
||||
{
|
||||
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
|
||||
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
|
||||
LOG_INFO("server.loading", "Next arena point distribution time in the past, reseting it now.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextAutoDistributionTime = wstime;
|
||||
}
|
||||
|
||||
LOG_INFO("server.loading", "Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
|
||||
@@ -1012,10 +1018,10 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
|
||||
|
||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
ginfo->RemoveInviteTime = GameTime::GetGameTimeMS().count() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for (auto itr : ginfo->Players)
|
||||
for (auto& itr : ginfo->Players)
|
||||
{
|
||||
// get the player
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(itr);
|
||||
|
||||
Reference in New Issue
Block a user