mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
committed by
Giacomo Pozzoni
parent
46c7446bd4
commit
f9ed72e351
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user