Skip to content

Commit

Permalink
Zarzakh based navigation options
Browse files Browse the repository at this point in the history
  • Loading branch information
BitBaboonSteve committed Oct 12, 2023
1 parent c423cde commit da7d388
Show file tree
Hide file tree
Showing 11 changed files with 3,725 additions and 483 deletions.
22 changes: 22 additions & 0 deletions EVEData/EveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,9 @@ public void InitNavigation()
}
jumpRangeCache = Serialization.DeserializeFromDisk<SerializableDictionary<string, List<string>>>(JRC);
Navigation.InitNavigation(NameToSystem.Values.ToList(), JumpBridges, jumpRangeCache);

InitZarzakhConnections();

}

/// <summary>
Expand Down Expand Up @@ -2398,6 +2401,7 @@ private void Init()
LoadCharacters();

InitTheraConnections();

InitMetaliminalStorms();
InitFactionWarfareInfo();
InitPOI();
Expand Down Expand Up @@ -2468,6 +2472,24 @@ private void InitTheraConnections()
UpdateTheraConnections();
}

/// <summary>
/// Initialise the Zarzakh Connection Data
/// </summary>
private void InitZarzakhConnections()
{
List<string> zcon = new List<string>();
foreach (System s in Systems)
{
if (s.HasJoveGate)
{
zcon.Add(s.Name);
}
}

Navigation.UpdateZarzakhConnections(zcon);
}


private void InitMetaliminalStorms()
{
MetaliminalStorms = new List<Storm>();
Expand Down
32 changes: 30 additions & 2 deletions EVEData/LocalCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class LocalCharacter : Character, INotifyPropertyChanged

private bool m_UseTheraRouting;

private bool m_UseZarzakhRouting;

private bool m_isOnline;

private bool m_ObservatoryDecloakWarningEnabled;
Expand Down Expand Up @@ -360,6 +362,27 @@ public bool UseTheraRouting
}
}

public bool UseZarzakhRouting
{
get
{
return m_UseZarzakhRouting;
}
set
{
if (m_UseZarzakhRouting == value)
{
return;
}

m_UseZarzakhRouting = value;
routeNeedsUpdate = true;
esiRouteNeedsUpdate = true;
OnPropertyChanged("UseZarzakhRouting");
}
}


public int DangerZoneRange { get; set; }

[XmlIgnoreAttribute]
Expand Down Expand Up @@ -739,7 +762,7 @@ private async void UpdateActiveRoute()
start = end;
end = Waypoints[i];

List<Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, UseTheraRouting, NavigationMode);
List<Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, UseTheraRouting, UseZarzakhRouting, NavigationMode);

if (sysList != null)
{
Expand All @@ -766,7 +789,12 @@ private async void UpdateActiveRoute()
foreach (Navigation.RoutePoint rp in ActiveRoute)
{
// explicitly add interim waypoints for ansiblex gates or actual waypoints
if (rp.GateToTake == Navigation.GateType.Ansiblex || rp.GateToTake == Navigation.GateType.Thera || Waypoints.Contains(rp.SystemName))
if (
rp.GateToTake == Navigation.GateType.Ansiblex ||
rp.GateToTake == Navigation.GateType.Thera ||
rp.GateToTake == Navigation.GateType.Zarzakh||
Waypoints.Contains(rp.SystemName)
)
{
long wayPointSysID = EveManager.Instance.GetEveSystem(rp.SystemName).ID;

Expand Down
72 changes: 71 additions & 1 deletion EVEData/Navigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ public enum GateType
Ansiblex,
JumpTo,
Thera,
Zarzakh,
}

private static Dictionary<string, MapNode> MapNodes { get; set; }
private static List<string> TheraLinks { get; set; }
private static List<string> ZarzakhLinks { get; set; }

public static void ClearJumpBridges()
{
Expand All @@ -38,6 +40,14 @@ public static void ClearTheraConnections()
}
}

public static void ClearZarzakhConnections()
{
foreach (MapNode mn in MapNodes.Values)
{
mn.ZarzakhConnection = null;
}
}

public static void UpdateTheraConnections(List<string> theraSystems)
{
ClearTheraConnections();
Expand All @@ -48,6 +58,16 @@ public static void UpdateTheraConnections(List<string> theraSystems)
}
}

public static void UpdateZarzakhConnections(List<string> zazahkSystems)
{
ClearZarzakhConnections();

foreach (string ts in zazahkSystems)
{
MapNodes[ts].ZarzakhConnection = zazahkSystems;
}
}

public static List<string> GetSystemsWithinXLYFrom(string start, double LY, bool includeHighSecSystems, bool includePochvenSystems)
{
List<string> inRange = new List<string>();
Expand Down Expand Up @@ -165,6 +185,12 @@ public static SerializableDictionary<string, List<string>> CreateStaticNavigatio
continue;
}

// cant jump into Zarzakh
if (sysb.Name == "Zarzakh")
{
continue;
}

decimal Distance = EveManager.Instance.GetRangeBetweenSystems(sysa.Name, sysb.Name);
if (Distance < maxRange && Distance > 0)
{
Expand All @@ -186,6 +212,7 @@ public static void InitNavigation(List<System> eveSystems, List<JumpBridge> jump
MapNodes = new Dictionary<string, MapNode>();

TheraLinks = new List<string>();
ZarzakhLinks = new List<string>();

// build up the nav structures
foreach (System sys in eveSystems)
Expand Down Expand Up @@ -235,7 +262,7 @@ public static void InitNavigation(List<System> eveSystems, List<JumpBridge> jump
}
}

public static List<RoutePoint> Navigate(string From, string To, bool UseJumpGates, bool UseThera, RoutingMode routingMode)
public static List<RoutePoint> Navigate(string From, string To, bool UseJumpGates, bool UseThera, bool UseZarzakh, RoutingMode routingMode)
{
if (!(MapNodes.ContainsKey(From)) || !(MapNodes.ContainsKey(To)) || From == "" || To == "")

Expand Down Expand Up @@ -349,6 +376,27 @@ public static List<RoutePoint> Navigate(string From, string To, bool UseJumpGate
}
}

if (UseZarzakh && CurrentNode.ZarzakhConnection != null)
{
foreach (string ZarzakhConnection in CurrentNode.ZarzakhConnection)
{
MapNode CMN = MapNodes[ZarzakhConnection];

if (CMN.Visited)
continue;

if (CMN.MinCostToStart == 0 || CurrentNode.MinCostToStart + CMN.Cost < CMN.MinCostToStart)
{
CMN.MinCostToStart = CurrentNode.MinCostToStart + CMN.Cost;
CMN.NearestToStart = CurrentNode;
if (!OpenList.Contains(CMN))
{
OpenList.Add(CMN);
}
}
}
}

/* Todo : Additional error checking
if (UseThera && !string.IsNullOrEmptyCurrent(Node.TheraInSig))
{
Expand Down Expand Up @@ -405,6 +453,11 @@ public static List<RoutePoint> Navigate(string From, string To, bool UseJumpGate
{
RP.GateToTake = GateType.Thera;
}

if(UseZarzakh && mn.ZarzakhConnection != null && mn.ZarzakhConnection.Contains(Route[i + 1]))
{
RP.GateToTake = GateType.Zarzakh;
}
}
ActualRoute.Add(RP);
}
Expand Down Expand Up @@ -558,6 +611,17 @@ public static void UpdateTheraInfo(List<TheraConnection> theraList)
}
}

public static void UpdateZarzakhInfo(List<string> zarzakhList)
{
ZarzakhLinks.Clear();

foreach (string zc in zarzakhList)
{
ZarzakhLinks.Add(zc);
}
}


private struct JumpLink
{
public decimal RangeLY;
Expand Down Expand Up @@ -585,6 +649,11 @@ public override string ToString()
s += " (Thera)";
}

if (GateToTake == GateType.Zarzakh)
{
s += " (Zarzakh)";
}

if (GateToTake == GateType.JumpTo && LY > 0.0m)
{
s += " (Jump To, Range " + LY.ToString("0.##") + " )";
Expand All @@ -600,6 +669,7 @@ private class MapNode
public double F;
public string JBConnection;
public List<string> TheraConnections;
public List<string> ZarzakhConnection;
public double MinCostToStart;
public MapNode NearestToStart;
public string TheraInSig;
Expand Down
Loading

0 comments on commit da7d388

Please sign in to comment.