aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authorthenecromancer <none@none>2010-01-13 11:19:16 +0100
committerthenecromancer <none@none>2010-01-13 11:19:16 +0100
commite00fd0791b38d78da80d32b4a683612a88e01198 (patch)
tree27b9f8401616c6f5d01c90abcfe51bc7fdc7e276 /src/game/Player.cpp
parentea4e25f3aaa10efeacf0849bcb1583ad78ee2b28 (diff)
Send SMSG_TIME_SYNC_REQ periodicly (period guessed though)
--HG-- branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index b5846b3b980..05615c610fb 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1323,6 +1323,14 @@ 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;
@@ -20204,9 +20212,8 @@ void Player::SendInitialPacketsAfterAddToMap()
GetZoneAndAreaId(newzone,newarea);
UpdateZone(newzone,newarea); // also call SendInitWorldStates();
- WorldPacket data(SMSG_TIME_SYNC_REQ, 4); // new 2.0.x, enable movement
- data << uint32(0x00000000); // on blizz it increments periodically
- GetSession()->SendPacket(&data);
+ ResetTimeSync();
+ SendTimeSync();
CastSpell(this, SPELL_LOGINEFFECT_836, true); // LOGINEFFECT
@@ -23026,6 +23033,22 @@ void Player::ActivateSpec(uint8 spec)
SetPower(pw, 0);
}
+void Player::ResetTimeSync()
+{
+ m_timeSyncCount = 0;
+ m_timeSyncTimer = 0;
+}
+
+void Player::SendTimeSync()
+{
+ WorldPacket data(SMSG_TIME_SYNC_REQ, 4);
+ data << uint32(m_timeSyncCount++);
+ GetSession()->SendPacket(&data);
+
+ // Send another opcode in 10s again
+ m_timeSyncTimer = 10000;
+}
+
void Player::SetReputation(uint32 factionentry, uint32 value)
{
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry),value);