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
This commit is contained in:
Shauren committed 2015-09-12 20:15:34 +02:00
1 parent 497aa4425b
commit 2056961aae
13 files changed
+162 -231

No files matched your search

+19 -14
View File
@@ -21158,6 +21158,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;
@@ -21176,6 +21177,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
}
totalcost += cost;
if (i == 1)
firstcost = cost;
if (prevnode == sourcenode)
sourcepath = path;
@@ -21214,8 +21217,6 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
}
//Checks and preparations done, DO FLIGHT
ModifyMoney(-(int32)totalcost);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1);
// prevent stealth flight
@@ -21226,11 +21227,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(-(int32)totalcost);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost);
TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation());
return false;
}
else
{
ModifyMoney(-(int32)firstcost);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, firstcost);
GetSession()->SendActivateTaxiReply(ERR_TAXIOK);
GetSession()->SendDoFlight(mount_display_id, sourcepath);
}
@@ -21281,30 +21286,30 @@ void Player::ContinueTaxiFlight()
float distPrev = MAP_SIZE*MAP_SIZE;
float distNext =
(nodeList[0].LocX-GetPositionX())*(nodeList[0].LocX-GetPositionX())+
(nodeList[0].LocY-GetPositionY())*(nodeList[0].LocY-GetPositionY())+
(nodeList[0].LocZ-GetPositionZ())*(nodeList[0].LocZ-GetPositionZ());
(nodeList[0]->LocX - GetPositionX())*(nodeList[0]->LocX - GetPositionX()) +
(nodeList[0]->LocY - GetPositionY())*(nodeList[0]->LocY - GetPositionY()) +
(nodeList[0]->LocZ - GetPositionZ())*(nodeList[0]->LocZ - 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.LocX-GetPositionX())*(node.LocX-GetPositionX())+
(node.LocY-GetPositionY())*(node.LocY-GetPositionY())+
(node.LocZ-GetPositionZ())*(node.LocZ-GetPositionZ());
(node->LocX - GetPositionX())*(node->LocX - GetPositionX()) +
(node->LocY - GetPositionY())*(node->LocY - GetPositionY()) +
(node->LocZ - GetPositionZ())*(node->LocZ - GetPositionZ());
float distNodes =
(node.LocX-prevNode.LocX)*(node.LocX-prevNode.LocX)+
(node.LocY-prevNode.LocY)*(node.LocY-prevNode.LocY)+
(node.LocZ-prevNode.LocZ)*(node.LocZ-prevNode.LocZ);
(node->LocX - prevNode->LocX)*(node->LocX - prevNode->LocX) +
(node->LocY - prevNode->LocY)*(node->LocY - prevNode->LocY) +
(node->LocZ - prevNode->LocZ)*(node->LocZ - prevNode->LocZ);
if (distNext + distPrev < distNodes)
{