1717
1818#include " WorldSession.h"
1919#include " Common.h"
20+ #include " Chat.h"
21+
22+ #define TAXI_FLY_HINT_0 " Right-click the flight icon (top right) to land at the next known flight point."
23+ #define TAXI_FLY_HINT_6 " Haz clic derecho en el icono de vuelo (arriba a la derecha) para aterrizar en el pr\xC3\xB3 ximo punto conocido."
24+ #define TAXI_FLY_HINT_7 " Haz clic derecho en el icono de vuelo (arriba a la derecha) para aterrizar en el pr\xC3\xB3 ximo punto conocido."
25+
2026#include " Creature.h"
2127#include " DatabaseEnv.h"
2228#include " DBCStores.h"
29+ #include < queue>
30+ #include < unordered_map>
31+ #include < vector>
2332#include " FlightPathMovementGenerator.h"
2433#include " Log.h"
2534#include " MotionMaster.h"
@@ -39,6 +48,69 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
3948 SendTaxiStatus (guid);
4049}
4150
51+ namespace
52+ {
53+ bool CanTeamUseTaxiNode (TaxiNodesEntry const * node, uint32 team)
54+ {
55+ if (!node)
56+ return false ;
57+
58+ if (team == HORDE )
59+ return node->MountCreatureID [0 ] != 0 ;
60+ if (team == ALLIANCE )
61+ return node->MountCreatureID [1 ] != 0 ;
62+
63+ return true ;
64+ }
65+
66+ void BuildBridgedTaxiMask (Player const * player, uint32 startNode, PlayerTaxi& outTaxi)
67+ {
68+ if (!player || !startNode || player->isTaxiCheater ())
69+ return ;
70+
71+ uint32 team = player->GetTeam ();
72+ std::queue<uint32> frontier;
73+ std::unordered_map<uint32, uint32> parent;
74+
75+ frontier.push (startNode);
76+ parent[startNode] = 0 ;
77+
78+ while (!frontier.empty ())
79+ {
80+ uint32 curr = frontier.front ();
81+ frontier.pop ();
82+
83+ // If player already knows this node, mark all intermediate nodes back to startNode in outTaxi
84+ if (curr != startNode && player->m_taxi .IsTaximaskNodeKnown (curr))
85+ {
86+ uint32 step = curr;
87+ while (step != 0 && step != startNode)
88+ {
89+ outTaxi.SetTaximaskNode (step);
90+ step = parent[step];
91+ }
92+ }
93+
94+ auto itr = sTaxiPathSetBySource .find (curr);
95+ if (itr == sTaxiPathSetBySource .end ())
96+ continue ;
97+
98+ for (auto const & [destNode, pathInfo] : itr->second )
99+ {
100+ if (parent.find (destNode) != parent.end ())
101+ continue ;
102+
103+ TaxiNodesEntry const * destEntry = sTaxiNodesStore .LookupEntry (destNode);
104+ if (!CanTeamUseTaxiNode (destEntry, team))
105+ continue ;
106+
107+ parent[destNode] = curr;
108+ frontier.push (destNode);
109+ }
110+ }
111+ }
112+ }
113+
42114void WorldSession::SendTaxiStatus (ObjectGuid guid)
43115{
44116 Player* const player = GetPlayer ();
@@ -100,11 +172,14 @@ void WorldSession::SendTaxiMenu(Creature* unit)
100172
101173 TC_LOG_DEBUG (" network" , " WORLD: CMSG_TAXINODE_STATUS_QUERY {} " , curloc);
102174
175+ PlayerTaxi displayTaxi = GetPlayer ()->m_taxi ;
176+ BuildBridgedTaxiMask (GetPlayer (), curloc, displayTaxi);
177+
103178 WorldPacket data (SMSG_SHOWTAXINODES , (4 + 8 + 4 + 8 * 4 ));
104179 data << uint32 (1 );
105180 data << unit->GetGUID ();
106181 data << uint32 (curloc);
107- GetPlayer ()-> m_taxi .AppendTaximaskTo (data, GetPlayer ()->isTaxiCheater ());
182+ displayTaxi .AppendTaximaskTo (data, GetPlayer ()->isTaxiCheater ());
108183 SendPacket (&data);
109184
110185 TC_LOG_DEBUG (" network" , " WORLD: Sent SMSG_SHOWTAXINODES" );
@@ -122,6 +197,19 @@ void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathN
122197 GetPlayer ()->Mount (mountDisplayId);
123198
124199 GetPlayer ()->GetMotionMaster ()->MoveTaxiFlight (path, pathNode);
200+
201+ if (GetPlayer ()->m_taxi .GetPath ().size () > 2 )
202+ {
203+ GetPlayer ()->AddAura (26393 , GetPlayer ());
204+ char const * hintMsg = TAXI_FLY_HINT_0 ;
205+ switch (GetSessionDbcLocale ())
206+ {
207+ case 6 : hintMsg = TAXI_FLY_HINT_6 ; break ;
208+ case 7 : hintMsg = TAXI_FLY_HINT_7 ; break ;
209+ default : break ;
210+ }
211+ ChatHandler (this ).SendSysMessage (hintMsg);
212+ }
125213}
126214
127215bool WorldSession::SendLearnNewTaxiNode (Creature* unit)
@@ -180,7 +268,8 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
180268 uint32 node;
181269 recvData >> node;
182270
183- if (!GetPlayer ()->m_taxi .IsTaximaskNodeKnown (node) && !GetPlayer ()->isTaxiCheater ())
271+ bool isEndpoint = (i == 0 || i + 1 == node_count);
272+ if (isEndpoint && !GetPlayer ()->m_taxi .IsTaximaskNodeKnown (node) && !GetPlayer ()->isTaxiCheater ())
184273 {
185274 SendActivateTaxiReply (ERR_TAXINOTVISITED );
186275 recvData.rfinish ();
0 commit comments