Core/Movement: Implement move time skipped handler (#22994)

* Implement CMSG_MOVE_TIME_SKIPPED handler and move it to MovementHandler.cpp

* Add better error handling

* Update MovementHandler.cpp
This commit is contained in:
Chaouki Dhib
2019-02-02 21:15:19 +01:00
committed by Giacomo Pozzoni
parent 46c7446bd4
commit f9ed72e351
2 changed files with 32 additions and 23 deletions

View File

@@ -871,29 +871,6 @@ void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recvData*/)
GetPlayer()->GetCinematicMgr()->BeginCinematic();
}
void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
{
/* WorldSession::Update(getMSTime());*/
TC_LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_TIME_SKIPPED");
ObjectGuid guid;
recvData >> guid.ReadAsPacked();
recvData.read_skip<uint32>();
/*
uint64 guid;
uint32 time_skipped;
recvData >> guid;
recvData >> time_skipped;
TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_TIME_SKIPPED");
//// @todo
must be need use in Trinity
We substract server Lags to move time (AntiLags)
for exmaple
GetPlayer()->ModifyLastMoveTime(-int32(time_skipped));
*/
}
void WorldSession::HandleFeatherFallAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_FEATHER_FALL_ACK");

View File

@@ -608,3 +608,35 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
_player->SummonIfPossible(agree);
}
void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_TIME_SKIPPED");
ObjectGuid guid;
uint32 timeSkipped;
recvData >> guid.ReadAsPacked();
recvData >> timeSkipped;
Unit* mover = GetPlayer()->m_unitMovedByMe;
if (!mover)
{
TC_LOG_WARN("entities.player", "WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player %s", GetPlayer()->GetGUID().ToString().c_str());
return;
}
// prevent tampered movement data
if (guid != mover->GetGUID())
{
TC_LOG_WARN("entities.player", "WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player %s", GetPlayer()->GetGUID().ToString().c_str());
return;
}
mover->m_movementInfo.time += timeSkipped;
WorldPacket data(MSG_MOVE_TIME_SKIPPED, recvData.size());
data << guid.WriteAsPacked();
data << timeSkipped;
GetPlayer()->SendMessageToSet(&data, false);
}