aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Player.cpp29
-rw-r--r--src/game/Player.h6
2 files changed, 32 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);
diff --git a/src/game/Player.h b/src/game/Player.h
index cac6e889345..b2f1798c36f 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -2437,6 +2437,9 @@ Spell * m_spellModTakingSpell;
EnchantDurationList m_enchantDuration;
ItemDurationList m_itemDuration;
+ void ResetTimeSync();
+ void SendTimeSync();
+
uint64 m_resurrectGUID;
uint32 m_resurrectMap;
float m_resurrectX, m_resurrectY, m_resurrectZ;
@@ -2572,6 +2575,9 @@ Spell * m_spellModTakingSpell;
SpellCooldowns m_spellCooldowns;
uint32 m_ChampioningFaction;
+
+ uint32 m_timeSyncCount;
+ uint32 m_timeSyncTimer;
};
void AddItemsSetItem(Player*player,Item *item);