Core/Creatures: Taxi improvements
* Fixed flight master minimap icon * Fixed crash on Argus * Implemented teleport taxi nodes Port From (https://github.com/TrinityCore/TrinityCore/commit/73e0b3e77c04a7821f58d79211f344b9129602f1)
This commit is contained in:
@@ -84,7 +84,7 @@ namespace Game.Entities
|
||||
|
||||
static uint GetVertexIDFromNodeID(TaxiNodesRecord node)
|
||||
{
|
||||
return m_verticesByNode.ContainsKey(node.Id) ? m_verticesByNode[node.Id] : uint.MaxValue;
|
||||
return m_verticesByNode.LookupByKey(node.Id);
|
||||
}
|
||||
|
||||
static uint GetNodeIDFromVertexID(uint vertexID)
|
||||
@@ -107,7 +107,7 @@ namespace Game.Entities
|
||||
{
|
||||
TaxiNodesRecord from = CliDB.TaxiNodesStorage.LookupByKey(path.FromTaxiNode);
|
||||
TaxiNodesRecord to = CliDB.TaxiNodesStorage.LookupByKey(path.ToTaxiNode);
|
||||
if (from != null && to != null && from.Flags.HasAnyFlag(TaxiNodeFlags.Alliance | TaxiNodeFlags.Horde) && to.Flags.HasAnyFlag(TaxiNodeFlags.Alliance | TaxiNodeFlags.Horde))
|
||||
if (from != null && to != null && from.IsPartOfTaxiNetwork() && to.IsPartOfTaxiNetwork())
|
||||
AddVerticeAndEdgeFromNodeInfo(from, to, path.Id, edges);
|
||||
}
|
||||
|
||||
@@ -141,25 +141,30 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
shortestPath.Clear();
|
||||
// We want to use Dijkstra on this graph
|
||||
DijkstraShortestPath g = new(m_graph, (int)GetVertexIDFromNodeID(from));
|
||||
var path = g.PathTo((int)GetVertexIDFromNodeID(to));
|
||||
// found a path to the goal
|
||||
shortestPath.Add(from.Id);
|
||||
foreach (var edge in path)
|
||||
{
|
||||
//todo test me No clue about this....
|
||||
var To = m_nodesByVertex[(int)edge.To];
|
||||
TaxiNodeFlags requireFlag = (player.GetTeam() == Team.Alliance) ? TaxiNodeFlags.Alliance : TaxiNodeFlags.Horde;
|
||||
if (!To.Flags.HasAnyFlag(requireFlag))
|
||||
continue;
|
||||
|
||||
PlayerConditionRecord condition = CliDB.PlayerConditionStorage.LookupByKey(To.ConditionID);
|
||||
if (condition != null)
|
||||
if (!ConditionManager.IsPlayerMeetingCondition(player, condition))
|
||||
uint fromVertexId = GetVertexIDFromNodeID(from);
|
||||
uint toVertexId = GetVertexIDFromNodeID(to);
|
||||
if (fromVertexId != 0 && toVertexId != 0)
|
||||
{
|
||||
// We want to use Dijkstra on this graph
|
||||
DijkstraShortestPath dijkstra = new(m_graph, (int)fromVertexId);
|
||||
var path = dijkstra.PathTo((int)toVertexId);
|
||||
// found a path to the goal
|
||||
shortestPath.Add(from.Id);
|
||||
foreach (var edge in path)
|
||||
{
|
||||
var To = m_nodesByVertex[(int)edge.To];
|
||||
TaxiNodeFlags requireFlag = (player.GetTeam() == Team.Alliance) ? TaxiNodeFlags.ShowOnAllianceMap : TaxiNodeFlags.ShowOnHordeMap;
|
||||
if (!To.GetFlags().HasFlag(requireFlag))
|
||||
continue;
|
||||
|
||||
shortestPath.Add(GetNodeIDFromVertexID(edge.To));
|
||||
PlayerConditionRecord condition = CliDB.PlayerConditionStorage.LookupByKey(To.ConditionID);
|
||||
if (condition != null)
|
||||
if (!ConditionManager.IsPlayerMeetingCondition(player, condition))
|
||||
continue;
|
||||
|
||||
shortestPath.Add(GetNodeIDFromVertexID(edge.To));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +174,11 @@ namespace Game.Entities
|
||||
//todo test me
|
||||
public static void GetReachableNodesMask(TaxiNodesRecord from, byte[] mask)
|
||||
{
|
||||
DepthFirstSearch depthFirst = new(m_graph, GetVertexIDFromNodeID(from), vertex =>
|
||||
uint vertexId = GetVertexIDFromNodeID(from);
|
||||
if (vertexId == 0)
|
||||
return;
|
||||
|
||||
DepthFirstSearch depthFirst = new(m_graph, vertexId, vertex =>
|
||||
{
|
||||
TaxiNodesRecord taxiNode = CliDB.TaxiNodesStorage.LookupByKey(GetNodeIDFromVertexID(vertex));
|
||||
if (taxiNode != null)
|
||||
|
||||
Reference in New Issue
Block a user