Core/Packets: converted MSG_MOVE_TELEPORT, MSG_MOVE_TELEPORT_ACK, CMSG_SET_ACTIVE_MOVER and SMSG_MOVE_UPDATE_TELEPORT to packet class and send SMSG_MOVE_UPDATE_TELEPORT for players after receiving MSG_MOVE_TELEPORT_ACK instead of sending it alongside MSG_MOVE_TELEPORT

This commit is contained in:
Ovahlord committed 2020-07-16 15:26:12 +02:00
1 parent 101f57c835
commit d371c9d1f6
9 files changed
+342 -205

No files matched your search

+12 -54
View File
@@ -232,41 +232,16 @@ void WorldSession::HandleSuspendTokenResponse(WorldPackets::Movement::SuspendTok
_player->SendSavedInstances();
}
void WorldSession::HandleMoveTeleportAck(WorldPacket& recvPacket)
void WorldSession::HandleMoveTeleportAck(WorldPackets::Movement::MoveTeleportAck& packet)
{
TC_LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK");
ObjectGuid guid;
uint32 flags, time;
recvPacket >> flags >> time;
guid[5] = recvPacket.ReadBit();
guid[0] = recvPacket.ReadBit();
guid[1] = recvPacket.ReadBit();
guid[6] = recvPacket.ReadBit();
guid[3] = recvPacket.ReadBit();
guid[7] = recvPacket.ReadBit();
guid[2] = recvPacket.ReadBit();
guid[4] = recvPacket.ReadBit();
recvPacket.ReadByteSeq(guid[4]);
recvPacket.ReadByteSeq(guid[2]);
recvPacket.ReadByteSeq(guid[7]);
recvPacket.ReadByteSeq(guid[6]);
recvPacket.ReadByteSeq(guid[5]);
recvPacket.ReadByteSeq(guid[1]);
recvPacket.ReadByteSeq(guid[3]);
recvPacket.ReadByteSeq(guid[0]);
TC_LOG_DEBUG("network", "Guid " UI64FMTD, uint64(guid));
TC_LOG_DEBUG("network", "Flags %u, time %u", flags, time/IN_MILLISECONDS);
TC_LOG_DEBUG("network", "CMSG_MOVE_TELEPORT_ACK: Guid: %s, Sequence: %u, Time: %u", packet.MoverGUID.ToString().c_str(), packet.AckIndex, packet.MoveTime);
Player* plMover = _player->m_unitMovedByMe->ToPlayer();
if (!plMover || !plMover->IsBeingTeleportedNear())
return;
if (guid != plMover->GetGUID())
if (packet.MoverGUID != plMover->GetGUID())
return;
plMover->SetSemaphoreTeleportNear(false);
@@ -275,8 +250,13 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvPacket)
WorldLocation const& dest = plMover->GetTeleportDest();
WorldPackets::Movement::MoveUpdateTeleport moveUpdateTeleport;
moveUpdateTeleport.Status = &plMover->m_movementInfo;
moveUpdateTeleport.Status->pos.Relocate(dest);
plMover->SendMessageToSet(moveUpdateTeleport.Write(), false);
plMover->UpdatePosition(dest, true);
plMover->SetFallInformation(0, GetPlayer()->GetPositionZ());
plMover->SetFallInformation(0, plMover->GetPositionZ());
uint32 newzone, newarea;
plMover->GetZoneAndAreaId(newzone, newarea);
@@ -580,33 +560,11 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
}
}
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetActiveMoverOpcode(WorldPackets::Movement::SetActiveMover& packet)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
ObjectGuid guid;
guid[7] = recvPacket.ReadBit();
guid[2] = recvPacket.ReadBit();
guid[1] = recvPacket.ReadBit();
guid[0] = recvPacket.ReadBit();
guid[4] = recvPacket.ReadBit();
guid[5] = recvPacket.ReadBit();
guid[6] = recvPacket.ReadBit();
guid[3] = recvPacket.ReadBit();
recvPacket.ReadByteSeq(guid[3]);
recvPacket.ReadByteSeq(guid[2]);
recvPacket.ReadByteSeq(guid[4]);
recvPacket.ReadByteSeq(guid[0]);
recvPacket.ReadByteSeq(guid[5]);
recvPacket.ReadByteSeq(guid[1]);
recvPacket.ReadByteSeq(guid[6]);
recvPacket.ReadByteSeq(guid[7]);
if (GetPlayer()->IsInWorld())
if (_player->m_unitMovedByMe->GetGUID() != guid)
TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s" , guid.ToString().c_str(), _player->m_unitMovedByMe->GetGUID().ToString().c_str());
if (_player->m_unitMovedByMe->GetGUID() != packet.ActiveMover)
TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s" , packet.ActiveMover.ToString().c_str(), _player->m_unitMovedByMe->GetGUID().ToString().c_str());
}
void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData)