diff --git a/EDPlayerJournal/BGS/CombatZone.cs b/EDPlayerJournal/BGS/CombatZone.cs
index 67655f7..4f6d8ed 100644
--- a/EDPlayerJournal/BGS/CombatZone.cs
+++ b/EDPlayerJournal/BGS/CombatZone.cs
@@ -43,6 +43,12 @@ public class CombatZone : Transaction {
///
public bool? CapitalShip { get; set; }
+ ///
+ /// If we have a combat zone, this might point to the settlement
+ /// in question.
+ ///
+ public string? Settlement { get; set; }
+
///
/// How many optional objectives were completed?
///
diff --git a/EDPlayerJournal/BGS/Parsers/ApproachSettlementParser.cs b/EDPlayerJournal/BGS/Parsers/ApproachSettlementParser.cs
new file mode 100644
index 0000000..dcf39b1
--- /dev/null
+++ b/EDPlayerJournal/BGS/Parsers/ApproachSettlementParser.cs
@@ -0,0 +1,15 @@
+using EDPlayerJournal.Entries;
+
+namespace EDPlayerJournal.BGS.Parsers;
+
+internal class ApproachSettlementParser : ITransactionParserPart {
+ public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
+ ApproachSettlementEntry? approach = entry as ApproachSettlementEntry;
+ if (approach == null || string.IsNullOrEmpty(approach.Name)) {
+ return;
+ }
+
+ context.Settlement = approach.Name;
+ }
+}
+
diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs
index 9064f85..8199a42 100644
--- a/EDPlayerJournal/BGS/TransactionParser.cs
+++ b/EDPlayerJournal/BGS/TransactionParser.cs
@@ -663,6 +663,7 @@ internal class CommanderParser : ITransactionParserPart {
public class TransactionParser {
private static Dictionary ParserParts { get; } = new()
{
+ { Events.ApproachSettlement, new ApproachSettlementParser() },
{ Events.CapShipBond, new CapShipBondParser() },
{ Events.Commander, new CommanderParser() },
{ Events.CommitCrime, new CommitCrimeParser() },
diff --git a/EDPlayerJournal/BGS/TransactionParserContext.cs b/EDPlayerJournal/BGS/TransactionParserContext.cs
index 4049ba4..34624e0 100644
--- a/EDPlayerJournal/BGS/TransactionParserContext.cs
+++ b/EDPlayerJournal/BGS/TransactionParserContext.cs
@@ -57,6 +57,11 @@ internal class TransactionParserContext {
public bool HaveSeenAlliedCorrespondent { get; set; } = false;
public bool HaveSeenEnemyCorrespondent { get; set; } = false;
+ ///
+ /// Current Odyssey settlement.
+ ///
+ public string? Settlement { get; set; } = null;
+
///
/// Returns true if the current session is legacy
///
@@ -115,6 +120,7 @@ internal class TransactionParserContext {
///
public void LeftInstance() {
CurrentInstanceType = null;
+ Settlement = null;
}
public void DiscernCombatZone(TransactionList transactions, Entry e) {
@@ -223,6 +229,7 @@ internal class TransactionParserContext {
System = CurrentSystem,
Faction = faction,
IsLegacy = IsLegacy,
+ Settlement = Settlement,
Grade = grade,
Type = cztype,
// Sad truth is, if HaveSeenXXX is false, we just don't know for certain
diff --git a/EDPlayerJournal/Entries/ApproachSettlementEntry.cs b/EDPlayerJournal/Entries/ApproachSettlementEntry.cs
new file mode 100644
index 0000000..95f7629
--- /dev/null
+++ b/EDPlayerJournal/Entries/ApproachSettlementEntry.cs
@@ -0,0 +1,48 @@
+namespace EDPlayerJournal.Entries;
+
+public class ApproachSettlementEntry : Entry {
+ ///
+ /// Settlement name
+ ///
+ public string? Name { get; set; } = null;
+
+ ///
+ /// Market ID of the settlement
+ ///
+ public long? MarketID { get; set; } = null;
+
+ ///
+ /// System ID
+ ///
+ public long? SystemAddress { get; set; } = null;
+
+ ///
+ /// Body ID
+ ///
+ public long? BodyID { get; set; } = null;
+
+ ///
+ /// Name of the planet
+ ///
+ public string? BodyName { get; set; } = null;
+
+ ///
+ /// Planet latitude
+ ///
+ public double Latitude { get; set; } = 0.0;
+
+ ///
+ /// Planet longitude
+ ///
+ public double Longitude { get; set; } = 0.0;
+
+ protected override void Initialise() {
+ Name = JSON.Value("Name");
+ MarketID = JSON.Value("MarketID");
+ SystemAddress = JSON.Value("SystemID");
+ BodyID = JSON.Value("BodyID");
+ BodyName = JSON.Value("BodyName");
+ Longitude = JSON.Value("Longitude") ?? 0.0;
+ Latitude = JSON.Value("Latitude") ?? 0.0;
+ }
+}
diff --git a/EDPlayerJournal/Entries/Entry.cs b/EDPlayerJournal/Entries/Entry.cs
index 5c27877..bc2f09b 100644
--- a/EDPlayerJournal/Entries/Entry.cs
+++ b/EDPlayerJournal/Entries/Entry.cs
@@ -12,6 +12,7 @@ namespace EDPlayerJournal.Entries;
///
public class Entry {
private static readonly Dictionary classes = new Dictionary {
+ { Events.ApproachSettlement, typeof(ApproachSettlementEntry) },
{ Events.Bounty, typeof(BountyEntry) },
{ Events.CapShipBond, typeof(CapShipBondEntry) },
{ Events.Commander, typeof(CommanderEntry) },
diff --git a/EDPlayerJournal/Entries/Events.cs b/EDPlayerJournal/Entries/Events.cs
index 3562a8d..88afa82 100644
--- a/EDPlayerJournal/Entries/Events.cs
+++ b/EDPlayerJournal/Entries/Events.cs
@@ -1,6 +1,7 @@
namespace EDPlayerJournal.Entries;
public class Events {
+ public static readonly string ApproachSettlement = "ApproachSettlement";
public static readonly string Bounty = "Bounty";
public static readonly string CapShipBond = "CapShipBond";
public static readonly string Commander = "Commander";
diff --git a/EliteBGS/LogGenerator/CombatZoneFormat.cs b/EliteBGS/LogGenerator/CombatZoneFormat.cs
index 9c798f2..256e750 100644
--- a/EliteBGS/LogGenerator/CombatZoneFormat.cs
+++ b/EliteBGS/LogGenerator/CombatZoneFormat.cs
@@ -10,7 +10,7 @@ class CombatZoneFormat : LogFormatter {
var logs = objective
.EnabledOfType()
.OrderBy(x => (CombatZones.DifficultyRank(x.Grade) ?? 0))
- .GroupBy(x => new { x.Type, x.Grade })
+ .GroupBy(x => new { x.Type, x.Grade, x.Settlement })
.ToDictionary(x => x.Key, x => x.ToList())
;
StringBuilder builder = new StringBuilder();
@@ -23,6 +23,11 @@ class CombatZoneFormat : LogFormatter {
int optionals = log.Value
.Sum(x => x.OptionalObjectivesCompleted)
;
+ var settlements = log.Value
+ .Select(x => x.Settlement)
+ .Distinct()
+ ;
+ string settl = string.Join(", ", settlements);
if (!string.IsNullOrEmpty(log.Key.Grade)) {
builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)",
log.Value.Count,
@@ -39,6 +44,9 @@ class CombatZoneFormat : LogFormatter {
if (optionals > 0) {
builder.AppendFormat(" (with {0} optional objectives)", optionals);
}
+ if (!string.IsNullOrEmpty(settl)) {
+ builder.AppendFormat(" (at {0})", settl);
+ }
builder.Append("\n");
}