Core/Movement: ported time synchronization (commits: 975f1e364a6a68be2beca261a64ea8aecc16f6f6 and 50d32fe49386598c7cd876e51cf02478669cc252)
This commit is contained in:
1 parent
433bd5a1bb
commit
ee69943717
10 files changed
+212
-127
No files matched your search
@@ -381,10 +381,6 @@ Player::Player(WorldSession* session): Unit(true)
|
||||
|
||||
m_ChampioningFaction = 0;
|
||||
|
||||
m_timeSyncTimer = 0;
|
||||
m_timeSyncClient = 0;
|
||||
m_timeSyncServer = 0;
|
||||
|
||||
for (uint8 i = 0; i < MAX_POWERS_PER_CLASS; ++i)
|
||||
m_powerFraction[i] = 0;
|
||||
|
||||
@@ -1260,14 +1256,6 @@ void Player::Update(uint32 p_time)
|
||||
m_zoneUpdateTimer -= p_time;
|
||||
}
|
||||
|
||||
if (m_timeSyncTimer > 0)
|
||||
{
|
||||
if (p_time >= m_timeSyncTimer)
|
||||
SendTimeSync();
|
||||
else
|
||||
m_timeSyncTimer -= p_time;
|
||||
}
|
||||
|
||||
if (IsAlive())
|
||||
{
|
||||
m_regenTimer += p_time;
|
||||
@@ -23850,8 +23838,8 @@ void Player::SendInitialPacketsAfterAddToMap()
|
||||
GetZoneAndAreaId(newzone, newarea);
|
||||
UpdateZone(newzone, newarea); // also call SendInitWorldStates();
|
||||
|
||||
ResetTimeSync();
|
||||
SendTimeSync();
|
||||
GetSession()->ResetTimeSync();
|
||||
GetSession()->SendTimeSync();
|
||||
|
||||
GetSession()->SendLoadCUFProfiles();
|
||||
|
||||
@@ -27417,29 +27405,6 @@ void Player::LoadActions(PreparedQueryResult result)
|
||||
SendActionButtons(1);
|
||||
}
|
||||
|
||||
void Player::ResetTimeSync()
|
||||
{
|
||||
m_timeSyncTimer = 0;
|
||||
m_timeSyncClient = 0;
|
||||
m_timeSyncServer = GameTime::GetGameTimeMS();
|
||||
}
|
||||
|
||||
void Player::SendTimeSync()
|
||||
{
|
||||
m_timeSyncQueue.push(m_movementCounter++);
|
||||
|
||||
WorldPacket data(SMSG_TIME_SYNC_REQ, 4);
|
||||
data << uint32(m_timeSyncQueue.back());
|
||||
SendDirectMessage(&data);
|
||||
|
||||
// Schedule next sync in 10 sec
|
||||
m_timeSyncTimer = 10000;
|
||||
m_timeSyncServer = GameTime::GetGameTimeMS();
|
||||
|
||||
if (m_timeSyncQueue.size() > 3)
|
||||
TC_LOG_ERROR("network", "Not received CMSG_TIME_SYNC_RESP for over 30 seconds from player %u (%s), possible cheater", GetGUID().GetCounter(), GetName().c_str());
|
||||
}
|
||||
|
||||
void Player::SetReputation(uint32 factionentry, uint32 value)
|
||||
{
|
||||
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
|
||||
|
||||
Reference in new issue
Block a user