summaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/TaxiHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/TaxiHandler.cpp')
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp82
1 files changed, 49 insertions, 33 deletions
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 8a76a2bd63..03a5ba89cf 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -198,54 +198,70 @@ void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
- ObjectGuid guid; // used only for proper packet read
- recvData >> guid.ReadAsPacked();
-
- MovementInfo movementInfo; // used only for proper packet read
- movementInfo.guid = guid;
- ReadMovementInfo(recvData, &movementInfo);
+ ObjectGuid guid; // used only for proper packet read
+ MovementInfo movementInfo; // used only for proper packet read
+ uint32 movementCounter; // spline counter
- recvData.read_skip<uint32>(); // spline id
+ Unit* mover = _player->m_mover;
- // 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)
+ recvData >> guid.ReadAsPacked();
+ ReadMovementInfo(recvData, &movementInfo);
+ recvData >> movementCounter;
- 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)