private void HandleConnections(MeshTile tile) { if (tile.Header.OffMeshConCount <= 0) { return; } var count = tile.Header.OffMeshConCount; for (int i = 0; i < count; i++) { var con = tile.GetOffMeshConnection(i); if (con == null) { continue; } var path = TaxiHelper.GetPath((int)con.UserID); if (path == null) { DisableConnection(tile, i); continue; } var from = TaxiHelper.GetNode(path.From); var to = TaxiHelper.GetNode(path.To); if (from == null || to == null) { DisableConnection(tile, i); continue; } var data = new ConnectionData { Alliance = from.IsAlliance || to.IsAlliance, Horde = from.IsHorde || to.IsHorde, Cost = path.Cost, From = from.Name, To = to.Name, Id = (int)con.UserID }; if (!ConnectionHandler(data)) { DisableConnection(tile, i); } } }
private static Hop BuildFlightmasterHop(int pathId) { var path = TaxiHelper.GetPath(pathId); if (path == null) { throw new NavMeshException(DetourStatus.Failure, "FindStraightPath returned a hop with an invalid path id"); } var from = TaxiHelper.GetNode(path.From); var to = TaxiHelper.GetNode(path.To); if (from == null || to == null) { throw new NavMeshException(DetourStatus.Failure, "FindStraightPath returned a hop with unresolvable flight path"); } return(new Hop { Location = from.Location, FlightTarget = to.Name, Type = HopType.Flightmaster }); }