Skip to content

Commit dd98559

Browse files
Turnur based routing as an option
1 parent 0dbcdd3 commit dd98559

10 files changed

+523
-97
lines changed

EVEData/EveManager.cs

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,18 @@ public static EveManager Instance
208208
/// </summary>
209209
public event TheraUpdatedHandler TheraUpdateEvent;
210210

211+
212+
/// <summary>
213+
/// Turnur Connections Updated Event Handler
214+
/// </summary>
215+
public delegate void TurnurUpdatedHandler();
216+
217+
/// <summary>
218+
/// Turnur Updated Added Events
219+
/// </summary>
220+
public event TurnurUpdatedHandler TurnurUpdateEvent;
221+
222+
211223
/// <summary>
212224
/// Storms Updated Event Handler
213225
/// </summary>
@@ -327,6 +339,12 @@ public static EveManager Instance
327339
/// </summary>
328340
public List<TheraConnection> TheraConnections { get; set; }
329341

342+
/// <summary>
343+
/// Gets or sets the current list of Turnur connections
344+
/// </summary>
345+
public List<TurnurConnection> TurnurConnections { get; set; }
346+
347+
330348
public bool UseESIForCharacterPositions { get; set; }
331349

332350
public List<Storm> MetaliminalStorms { get; set; }
@@ -2354,6 +2372,89 @@ public async void UpdateTheraConnections()
23542372
}
23552373
}
23562374

2375+
/// <summary>
2376+
/// Update the current Turnur Connections from EVE-Scout
2377+
/// </summary>
2378+
public async void UpdateTurnurConnections()
2379+
{
2380+
string turnurApiURL = "https://api.eve-scout.com/v2/public/signatures?system_name=Turnur";
2381+
string strContent = string.Empty;
2382+
2383+
try
2384+
{
2385+
HttpClient hc = new HttpClient();
2386+
var response = await hc.GetAsync(turnurApiURL);
2387+
response.EnsureSuccessStatusCode();
2388+
strContent = await response.Content.ReadAsStringAsync();
2389+
2390+
JsonTextReader jsr = new JsonTextReader(new StringReader(strContent));
2391+
2392+
TurnurConnections.Clear();
2393+
2394+
/*
2395+
new format
2396+
2397+
"id": "46",
2398+
"created_at": "2023-12-02T11:24:49.000Z",
2399+
"created_by_id": 93027866,
2400+
"created_by_name": "Das d'Alembert",
2401+
"updated_at": "2023-12-02T11:27:01.000Z",
2402+
"updated_by_id": 93027866,
2403+
"updated_by_name": "Das d'Alembert",
2404+
"completed_at": "2023-12-02T11:27:01.000Z",
2405+
"completed_by_id": 93027866,
2406+
"completed_by_name": "Das d'Alembert",
2407+
"completed": true,
2408+
"wh_exits_outward": true,
2409+
"wh_type": "Q063",
2410+
"max_ship_size": "medium",
2411+
"expires_at": "2023-12-03T04:24:49.000Z",
2412+
"remaining_hours": 14,
2413+
"signature_type": "wormhole",
2414+
"out_system_id": 31000005,
2415+
"out_system_name": "Thera",
2416+
"out_signature": "HMM-222",
2417+
"in_system_id": 30001715,
2418+
"in_system_class": "hs",
2419+
"in_system_name": "Moutid",
2420+
"in_region_id": 10000020,
2421+
"in_region_name": "Tash-Murkon",
2422+
"in_signature": "LPI-677"
2423+
*/
2424+
2425+
while (jsr.Read())
2426+
{
2427+
if (jsr.TokenType == JsonToken.StartObject)
2428+
{
2429+
JObject obj = JObject.Load(jsr);
2430+
string inSignatureId = obj["in_signature"].ToString();
2431+
string outSignatureId = obj["out_signature"].ToString();
2432+
long solarSystemId = long.Parse(obj["in_system_id"].ToString());
2433+
string wormHoleEOL = obj["expires_at"].ToString();
2434+
string type = obj["signature_type"].ToString();
2435+
2436+
if (type != null && type == "wormhole" && solarSystemId != 0 && wormHoleEOL != null && SystemIDToName.ContainsKey(solarSystemId))
2437+
{
2438+
System turnurConnectionSystem = GetEveSystemFromID(solarSystemId);
2439+
2440+
TurnurConnection tc = new TurnurConnection(turnurConnectionSystem.Name, turnurConnectionSystem.Region, inSignatureId, outSignatureId, wormHoleEOL);
2441+
TurnurConnections.Add(tc);
2442+
}
2443+
}
2444+
}
2445+
}
2446+
catch
2447+
{
2448+
return;
2449+
}
2450+
2451+
if (TurnurUpdateEvent != null)
2452+
{
2453+
TurnurUpdateEvent();
2454+
}
2455+
}
2456+
2457+
23572458
public void UpdateMetaliminalStorms()
23582459
{
23592460
MetaliminalStorms.Clear();
@@ -2567,6 +2668,7 @@ private void Init()
25672668
LoadCharacters();
25682669

25692670
InitTheraConnections();
2671+
InitTurnurConnections();
25702672

25712673
InitMetaliminalStorms();
25722674
InitFactionWarfareInfo();
@@ -2638,6 +2740,17 @@ private void InitTheraConnections()
26382740
UpdateTheraConnections();
26392741
}
26402742

2743+
/// <summary>
2744+
/// Initialise the Turnur Connection Data from EVE-Scout
2745+
/// </summary>
2746+
private void InitTurnurConnections()
2747+
{
2748+
TurnurConnections = new List<TurnurConnection>();
2749+
UpdateTurnurConnections();
2750+
}
2751+
2752+
2753+
26412754
/// <summary>
26422755
/// Initialise the Zarzakh Connection Data
26432756
/// </summary>
@@ -3167,6 +3280,7 @@ private void StartBackgroundThread()
31673280
UpdateESIUniverseData();
31683281
UpdateServerInfo();
31693282
UpdateTheraConnections();
3283+
UpdateTurnurConnections();
31703284
}
31713285

31723286
if ((NextDotlanUpdate - DateTime.Now).Minutes < 0)

EVEData/LocalCharacter.cs

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public class LocalCharacter : Character, INotifyPropertyChanged
4949

5050
private bool m_UseZarzakhRouting;
5151

52+
private bool m_UseTurnurRouting;
53+
5254
private bool m_isOnline;
5355

5456
private bool m_ObservatoryDecloakWarningEnabled;
@@ -420,6 +422,26 @@ public bool UseZarzakhRouting
420422
}
421423
}
422424

425+
public bool UseTurnurRouting
426+
{
427+
get
428+
{
429+
return m_UseTurnurRouting;
430+
}
431+
set
432+
{
433+
if (m_UseTurnurRouting == value)
434+
{
435+
return;
436+
}
437+
438+
m_UseTurnurRouting = value;
439+
routeNeedsUpdate = true;
440+
esiRouteNeedsUpdate = true;
441+
OnPropertyChanged("UseTurnurRouting");
442+
}
443+
}
444+
423445

424446
public int DangerZoneRange { get; set; }
425447

@@ -778,12 +800,21 @@ private async void UpdateActiveRoute()
778800

779801
// grab the simple list of thera connections
780802
List<string> currentActiveTheraConnections = new List<string>();
781-
foreach (TheraConnection tc in EveManager.Instance.TheraConnections)
803+
foreach (TheraConnection tc in EveManager.Instance.TheraConnections.ToList())
782804
{
783805
currentActiveTheraConnections.Add(tc.System);
784806
}
785807
Navigation.UpdateTheraConnections(currentActiveTheraConnections);
786808

809+
// grab the simple list of turnur connections
810+
List<string> currentActiveTurnurConnections = new List<string>();
811+
foreach (TurnurConnection tc in EveManager.Instance.TurnurConnections.ToList())
812+
{
813+
currentActiveTurnurConnections.Add(tc.System);
814+
}
815+
Navigation.UpdateTurnurConnections(currentActiveTurnurConnections);
816+
817+
787818
lock (ActiveRouteLock)
788819
{
789820
if (Location == Waypoints[0])
@@ -800,7 +831,7 @@ private async void UpdateActiveRoute()
800831
start = end;
801832
end = Waypoints[i];
802833

803-
List<Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, UseTheraRouting, UseZarzakhRouting, NavigationMode);
834+
List<Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, UseTheraRouting, UseZarzakhRouting, UseTurnurRouting, NavigationMode);
804835

805836
if (sysList != null)
806837
{
@@ -829,7 +860,8 @@ private async void UpdateActiveRoute()
829860
// explicitly add interim waypoints for ansiblex gates or actual waypoints
830861
if (
831862
rp.GateToTake == Navigation.GateType.Ansiblex ||
832-
rp.GateToTake == Navigation.GateType.Thera ||
863+
rp.GateToTake == Navigation.GateType.Thera ||
864+
rp.GateToTake == Navigation.GateType.Turnur ||
833865
rp.GateToTake == Navigation.GateType.Zarzakh||
834866
Waypoints.Contains(rp.SystemName)
835867
)

0 commit comments

Comments
 (0)