diff options
| author | Shauren <shauren.trinity@gmail.com> | 2015-09-13 17:23:37 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2015-09-13 17:23:37 +0200 |
| commit | 04de58c8d3beb393233071650c65d50967b45266 (patch) | |
| tree | cac7d1a8bd4b77c65e4e634b2a644134d27318e1 /src/server/game/Entities | |
| parent | 3109ab2da08d094df97724355bff681d7951e576 (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/Entities')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 33 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Transport/Transport.cpp | 1 |
3 files changed, 21 insertions, 15 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b00b18f2f4f..9689144ebc9 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -21038,6 +21038,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc // fill destinations path tail uint32 sourcepath = 0; uint32 totalcost = 0; + uint32 firstcost = 0; uint32 prevnode = sourcenode; uint32 lastnode = 0; @@ -21056,6 +21057,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc } totalcost += cost; + if (i == 1) + firstcost = cost; if (prevnode == sourcenode) sourcepath = path; @@ -21094,8 +21097,6 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc } //Checks and preparations done, DO FLIGHT - ModifyMoney(-int64(totalcost)); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1); // prevent stealth flight @@ -21106,11 +21107,15 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]); ASSERT(lastPathNode); m_taxi.ClearTaxiDestinations(); + ModifyMoney(-int64(totalcost)); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost); TeleportTo(lastPathNode->MapID, lastPathNode->Pos.X, lastPathNode->Pos.Y, lastPathNode->Pos.Z, GetOrientation()); return false; } else { + ModifyMoney(-int64(firstcost)); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, firstcost); GetSession()->SendActivateTaxiReply(ERR_TAXIOK); GetSession()->SendDoFlight(mount_display_id, sourcepath); } @@ -21161,30 +21166,30 @@ void Player::ContinueTaxiFlight() float distPrev = MAP_SIZE*MAP_SIZE; float distNext = - (nodeList[0].Loc.X-GetPositionX())*(nodeList[0].Loc.X-GetPositionX())+ - (nodeList[0].Loc.Y-GetPositionY())*(nodeList[0].Loc.Y-GetPositionY())+ - (nodeList[0].Loc.Z-GetPositionZ())*(nodeList[0].Loc.Z-GetPositionZ()); + (nodeList[0]->Loc.X - GetPositionX())*(nodeList[0]->Loc.X - GetPositionX()) + + (nodeList[0]->Loc.Y - GetPositionY())*(nodeList[0]->Loc.Y - GetPositionY()) + + (nodeList[0]->Loc.Z - GetPositionZ())*(nodeList[0]->Loc.Z - GetPositionZ()); for (uint32 i = 1; i < nodeList.size(); ++i) { - TaxiPathNodeEntry const& node = nodeList[i]; - TaxiPathNodeEntry const& prevNode = nodeList[i-1]; + TaxiPathNodeEntry const* node = nodeList[i]; + TaxiPathNodeEntry const* prevNode = nodeList[i-1]; // skip nodes at another map - if (node.MapID != GetMapId()) + if (node->MapID != GetMapId()) continue; distPrev = distNext; distNext = - (node.Loc.X-GetPositionX())*(node.Loc.X-GetPositionX())+ - (node.Loc.Y-GetPositionY())*(node.Loc.Y-GetPositionY())+ - (node.Loc.Z-GetPositionZ())*(node.Loc.Z-GetPositionZ()); + (node->Loc.X - GetPositionX()) * (node->Loc.X - GetPositionX()) + + (node->Loc.Y - GetPositionY()) * (node->Loc.Y - GetPositionY()) + + (node->Loc.Z - GetPositionZ()) * (node->Loc.Z - GetPositionZ()); float distNodes = - (node.Loc.X-prevNode.Loc.X)*(node.Loc.X-prevNode.Loc.X)+ - (node.Loc.Y-prevNode.Loc.Y)*(node.Loc.Y-prevNode.Loc.Y)+ - (node.Loc.Z-prevNode.Loc.Z)*(node.Loc.Z-prevNode.Loc.Z); + (node->Loc.X - prevNode->Loc.X) * (node->Loc.X - prevNode->Loc.X) + + (node->Loc.Y - prevNode->Loc.Y) * (node->Loc.Y - prevNode->Loc.Y) + + (node->Loc.Z - prevNode->Loc.Z) * (node->Loc.Z - prevNode->Loc.Z); if (distNext + distPrev < distNodes) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index d4973e0f332..559f1f28570 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1129,6 +1129,8 @@ class PlayerTaxi m_TaxiDestinations.pop_front(); return GetTaxiDestination(); } + + std::deque<uint32> const& GetPath() const { return m_TaxiDestinations; } bool empty() const { return m_TaxiDestinations.empty(); } friend std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 0be9a205e5b..e6b3067cc2a 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -20,7 +20,6 @@ #include "Transport.h" #include "MapManager.h" #include "ObjectMgr.h" -#include "Path.h" #include "ScriptMgr.h" #include "DBCStores.h" #include "GameObjectAI.h" |
