mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 23:26:23 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
@@ -86,7 +87,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||
else // No more vacant places
|
||||
{
|
||||
// TODO: Send a packet to announce it to player
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + (player->IsGameMaster() ? 30 * MINUTE : 10);
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime().count() + (player->IsGameMaster() ? 30 * MINUTE : 10);
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
}
|
||||
@@ -176,7 +177,7 @@ bool Battlefield::Update(uint32 diff)
|
||||
// Kick players who chose not to accept invitation to the battle
|
||||
if (m_uiKickDontAcceptTimer <= diff)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
for (int team = 0; team < 2; team++)
|
||||
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
|
||||
if (itr->second <= now)
|
||||
@@ -261,7 +262,7 @@ void Battlefield::InvitePlayersInZoneToWar()
|
||||
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
|
||||
InvitePlayerToWar(player);
|
||||
else if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)// Battlefield is full of players
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime().count() + 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,7 +286,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
|
||||
if (player->getLevel() < m_MinLevel)
|
||||
{
|
||||
if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime().count() + 10;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -294,7 +295,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
|
||||
return;
|
||||
|
||||
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
|
||||
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(nullptr) + m_TimeForAcceptInvite;
|
||||
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime().count() + m_TimeForAcceptInvite;
|
||||
player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user