Skip to content

Commit

Permalink
Merge pull request #93 from EDCD/Temp-Tkael-StationServices
Browse files Browse the repository at this point in the history
Updates to station services
  • Loading branch information
richardbuckle authored Sep 23, 2017
2 parents cc3acde + 18ee817 commit 56d561b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
35 changes: 35 additions & 0 deletions EDDI/EDDI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,41 @@ private bool eventDocked(DockedEvent theEvent)
station.faction = theEvent.faction;
station.government = theEvent.government;

if (theEvent.stationservices != null)
{
foreach (var service in theEvent.stationservices)
{
if (service == "Refuel")
{
station.hasrefuel = true;
}
else if (service == "Rearm")
{
station.hasrearm = true;
}
else if (service == "Repair")
{
station.hasrepair = true;
}
else if (service == "Outfitting")
{
station.hasoutfitting = true;
}
else if (service == "Shipyard")
{
station.hasshipyard = true;
}
else if (service == "Commodities")
{
station.hasmarket = true;
}
else if (service == "BlackMarket")
{
station.hasblackmarket = true;
}
}
}

CurrentStation = station;

// Kick off the profile refresh if the companion API is available
Expand Down
37 changes: 0 additions & 37 deletions JournalMonitor/JournalMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,43 +87,6 @@ public static List<Event> ParseJournalEntry(string line)
data.TryGetValue("StationServices", out val);
List<string> stationservices = (val as List<object>)?.Cast<string>()?.ToList();

// Update the local station object (not entirely sure this is necessary, but we have the data)
if (stationservices != null)
{
Station Station = new Station();
foreach (var service in stationservices)
{
if (service == "Refuel")
{
Station.hasrefuel = (bool?)true;
}
else if (service == "Rearm")
{
Station.hasrearm = (bool?)true;
}
else if (service == "Repair")
{
Station.hasrepair = (bool?)true;
}
else if (service == "Outfitting")
{
Station.hasoutfitting = (bool?)true;
}
else if (service == "Shipyard")
{
Station.hasshipyard = (bool?)true;
}
else if (service == "Commodities")
{
Station.hasmarket = (bool?)true;
}
else if (service == "BlackMarket")
{
Station.hasblackmarket = (bool?)true;
}
}
}

events.Add(new DockedEvent(timestamp, systemName, stationName, stationModel, faction, factionState, economy, government, distancefromstar, stationservices) { raw = line });
}
handled = true;
Expand Down

0 comments on commit 56d561b

Please sign in to comment.