fix(Core/Vehicle): Fix invisible vehicle passengers (#23406)

This commit is contained in:
killerwife
2025-10-26 02:25:43 +01:00
committed by GitHub
parent dfd21be75b
commit 1b2db00701
7 changed files with 77 additions and 38 deletions

View File

@@ -376,6 +376,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
return;
}
if (opcode == CMSG_MOVE_FALL_RESET || opcode == CMSG_MOVE_CHNG_TRANSPORT)
return;
/* process position-change */
WorldPacket data(opcode, recvData.size());
WriteMovementInfo(&data, &movementInfo);
@@ -516,7 +519,10 @@ bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, Player*
}
if (!mover->movespline->Finalized())
return false;
{
if (!mover->movespline->isBoarding() || (opcode != CMSG_FORCE_MOVE_UNROOT_ACK && opcode != CMSG_FORCE_MOVE_ROOT_ACK))
return false;
}
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
@@ -958,7 +964,8 @@ void WorldSession::ComputeNewClockDelta()
void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging((Opcodes)recvData.GetOpcode()));
Opcodes opcode = (Opcodes)recvData.GetOpcode();
LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging(opcode));
ObjectGuid guid;
uint32 counter;
@@ -973,7 +980,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
if (mover->GetGUID() != guid)
return;
if (recvData.GetOpcode() == CMSG_FORCE_MOVE_UNROOT_ACK) // unroot case
if (opcode == CMSG_FORCE_MOVE_UNROOT_ACK) // unroot case
{
if (!mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT))
return;
@@ -987,7 +994,10 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
if (!ProcessMovementInfo(movementInfo, mover, _player, recvData))
return;
WorldPacket data(recvData.GetOpcode() == CMSG_FORCE_MOVE_UNROOT_ACK ? MSG_MOVE_UNROOT : MSG_MOVE_ROOT);
if (_player->IsExpectingChangeTransport())
return;
WorldPacket data(opcode == CMSG_FORCE_MOVE_UNROOT_ACK ? MSG_MOVE_UNROOT : MSG_MOVE_ROOT);
WriteMovementInfo(&data, &movementInfo);
mover->SendMessageToSet(&data, _player);
}

View File

@@ -198,54 +198,70 @@ void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
ObjectGuid guid; // used only for proper packet read
ObjectGuid guid; // used only for proper packet read
MovementInfo movementInfo; // used only for proper packet read
uint32 movementCounter; // spline counter
Unit* mover = _player->m_mover;
recvData >> guid.ReadAsPacked();
MovementInfo movementInfo; // used only for proper packet read
movementInfo.guid = guid;
ReadMovementInfo(recvData, &movementInfo);
recvData >> movementCounter;
recvData.read_skip<uint32>(); // spline id
// in taxi flight packet received in 2 case:
// 1) end taxi path in far (multi-node) flight
// 2) switch from one map to other in case multim-map taxi path
// we need process only (1)
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
if (curDest)
if (_player->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT)) // taxi spline case
{
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
// in taxi flight packet received in 2 case:
// 1) end taxi path in far (multi-node) flight
// 2) switch from one map to other in case multim-map taxi path
// we need process only (1)
// far teleport case
if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
if (curDest)
{
if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
{
// short preparations to continue flight
flight->SetCurrentNodeAfterTeleport();
TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
flight->SkipCurrentNode();
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
// far teleport case
if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
{
// short preparations to continue flight
flight->SetCurrentNodeAfterTeleport();
TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
flight->SkipCurrentNode();
GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
}
}
return;
}
// at this point only 1 node is expected (final destination)
if (GetPlayer()->m_taxi.GetPath().size() != 1)
{
return;
}
GetPlayer()->CleanupAfterTaxiFlight();
GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
if (GetPlayer()->pvpInfo.IsHostile)
{
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
return;
}
// at this point only 1 node is expected (final destination)
if (GetPlayer()->m_taxi.GetPath().size() != 1)
{
if (mover->GetGUID() != guid)
return;
}
GetPlayer()->CleanupAfterTaxiFlight();
GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
if (GetPlayer()->pvpInfo.IsHostile)
{
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
if (!_player->IsExpectingChangeTransport() || !mover->movespline || mover->movespline->GetId() != movementCounter)
return;
_player->SetExpectingChangeTransport(false);
WorldPacket data(_player->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) ? MSG_MOVE_ROOT : MSG_MOVE_UNROOT, recvData.size());
WriteMovementInfo(&data, &movementInfo);
mover->SendMessageToSet(&data, _player);
}
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)