aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/TaxiHandler.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-09-13 17:23:37 +0200
committerShauren <shauren.trinity@gmail.com>2015-09-13 17:23:37 +0200
commit04de58c8d3beb393233071650c65d50967b45266 (patch)
treecac7d1a8bd4b77c65e4e634b2a644134d27318e1 /src/server/game/Handlers/TaxiHandler.cpp
parent3109ab2da08d094df97724355bff681d7951e576 (diff)
Core/Players: Changed multi-segment taxi paths to fly nearby
flight masters along the way, not directly through them * Taxi cost on multi-segment paths is now charged per segment when it is started Cherry-picked from commit 2056961aae208c5da094f3bf8fbca599b5ebac40 (+fixes)
Diffstat (limited to 'src/server/game/Handlers/TaxiHandler.cpp')
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp64
1 files changed, 18 insertions, 46 deletions
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 20a8ba70f76..1669bc306d6 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -24,7 +24,6 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "Path.h"
#include "WaypointMovementGenerator.h"
void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
@@ -198,7 +197,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
- recvData.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // spline id
MovementInfo movementInfo; // used only for proper packet read
_player->ValidateMovementInfo(&movementInfo);
@@ -209,59 +208,32 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
// we need process only (1)
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
- if (!curDest)
- return;
-
- TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
-
- // far teleport case
- if (curDestNode && curDestNode->MapID != GetPlayer()->GetMapId())
+ if (curDest)
{
- if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
- {
- // short preparations to continue flight
- FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
-
- flight->SetCurrentNodeAfterTeleport();
- TaxiPathNodeEntry const& node = flight->GetPath()[flight->GetCurrentNode()];
- flight->SkipCurrentNode();
+ TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
- GetPlayer()->TeleportTo(curDestNode->MapID, node.Loc.X, node.Loc.Y, node.Loc.Z, GetPlayer()->GetOrientation());
- }
- return;
- }
-
- uint32 destinationnode = GetPlayer()->m_taxi.NextTaxiDestination();
- if (destinationnode > 0) // if more destinations to go
- {
- // current source node for next destination
- uint32 sourcenode = GetPlayer()->m_taxi.GetTaxiSource();
-
- // Add to taximask middle hubs in taxicheat mode (to prevent having player with disabled taxicheat and not having back flight path)
- if (GetPlayer()->isTaxiCheater())
+ // far teleport case
+ if (curDestNode && curDestNode->MapID != GetPlayer()->GetMapId())
{
- if (GetPlayer()->m_taxi.SetTaximaskNode(sourcenode))
+ if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
- WorldPacket data(SMSG_NEW_TAXI_PATH, 0);
- _player->GetSession()->SendPacket(&data);
- }
- }
+ // short preparations to continue flight
+ FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
- TC_LOG_DEBUG("network", "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode);
+ flight->SetCurrentNodeAfterTeleport();
+ TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
+ flight->SkipCurrentNode();
- uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam());
-
- uint32 path, cost;
- sObjectMgr->GetTaxiPath(sourcenode, destinationnode, path, cost);
+ GetPlayer()->TeleportTo(curDestNode->MapID, node->Loc.X, node->Loc.Y, node->Loc.Z, GetPlayer()->GetOrientation());
+ }
+ }
- if (path && mountDisplayId)
- SendDoFlight(mountDisplayId, path, 1); // skip start fly node
- else
- GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next
return;
}
- else
- GetPlayer()->m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
+
+ // at this point only 1 node is expected (final destination)
+ if (GetPlayer()->m_taxi.GetPath().size() != 1)
+ return;
GetPlayer()->CleanupAfterTaxiFlight();
GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ());