add settlements for ground CZs to the combat log
This commit is contained in:
parent
dab39b9a4e
commit
cdd7eb33de
@ -43,6 +43,12 @@ public class CombatZone : Transaction {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? CapitalShip { get; set; }
|
public bool? CapitalShip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If we have a combat zone, this might point to the settlement
|
||||||
|
/// in question.
|
||||||
|
/// </summary>
|
||||||
|
public string? Settlement { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many optional objectives were completed?
|
/// How many optional objectives were completed?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
15
EDPlayerJournal/BGS/Parsers/ApproachSettlementParser.cs
Normal file
15
EDPlayerJournal/BGS/Parsers/ApproachSettlementParser.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -663,6 +663,7 @@ internal class CommanderParser : ITransactionParserPart {
|
|||||||
public class TransactionParser {
|
public class TransactionParser {
|
||||||
private static Dictionary<string, ITransactionParserPart> ParserParts { get; } = new()
|
private static Dictionary<string, ITransactionParserPart> ParserParts { get; } = new()
|
||||||
{
|
{
|
||||||
|
{ Events.ApproachSettlement, new ApproachSettlementParser() },
|
||||||
{ Events.CapShipBond, new CapShipBondParser() },
|
{ Events.CapShipBond, new CapShipBondParser() },
|
||||||
{ Events.Commander, new CommanderParser() },
|
{ Events.Commander, new CommanderParser() },
|
||||||
{ Events.CommitCrime, new CommitCrimeParser() },
|
{ Events.CommitCrime, new CommitCrimeParser() },
|
||||||
|
@ -57,6 +57,11 @@ internal class TransactionParserContext {
|
|||||||
public bool HaveSeenAlliedCorrespondent { get; set; } = false;
|
public bool HaveSeenAlliedCorrespondent { get; set; } = false;
|
||||||
public bool HaveSeenEnemyCorrespondent { get; set; } = false;
|
public bool HaveSeenEnemyCorrespondent { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current Odyssey settlement.
|
||||||
|
/// </summary>
|
||||||
|
public string? Settlement { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the current session is legacy
|
/// Returns true if the current session is legacy
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -115,6 +120,7 @@ internal class TransactionParserContext {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void LeftInstance() {
|
public void LeftInstance() {
|
||||||
CurrentInstanceType = null;
|
CurrentInstanceType = null;
|
||||||
|
Settlement = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DiscernCombatZone(TransactionList transactions, Entry e) {
|
public void DiscernCombatZone(TransactionList transactions, Entry e) {
|
||||||
@ -223,6 +229,7 @@ internal class TransactionParserContext {
|
|||||||
System = CurrentSystem,
|
System = CurrentSystem,
|
||||||
Faction = faction,
|
Faction = faction,
|
||||||
IsLegacy = IsLegacy,
|
IsLegacy = IsLegacy,
|
||||||
|
Settlement = Settlement,
|
||||||
Grade = grade,
|
Grade = grade,
|
||||||
Type = cztype,
|
Type = cztype,
|
||||||
// Sad truth is, if HaveSeenXXX is false, we just don't know for certain
|
// Sad truth is, if HaveSeenXXX is false, we just don't know for certain
|
||||||
|
48
EDPlayerJournal/Entries/ApproachSettlementEntry.cs
Normal file
48
EDPlayerJournal/Entries/ApproachSettlementEntry.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
namespace EDPlayerJournal.Entries;
|
||||||
|
|
||||||
|
public class ApproachSettlementEntry : Entry {
|
||||||
|
/// <summary>
|
||||||
|
/// Settlement name
|
||||||
|
/// </summary>
|
||||||
|
public string? Name { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Market ID of the settlement
|
||||||
|
/// </summary>
|
||||||
|
public long? MarketID { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// System ID
|
||||||
|
/// </summary>
|
||||||
|
public long? SystemAddress { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Body ID
|
||||||
|
/// </summary>
|
||||||
|
public long? BodyID { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the planet
|
||||||
|
/// </summary>
|
||||||
|
public string? BodyName { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Planet latitude
|
||||||
|
/// </summary>
|
||||||
|
public double Latitude { get; set; } = 0.0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Planet longitude
|
||||||
|
/// </summary>
|
||||||
|
public double Longitude { get; set; } = 0.0;
|
||||||
|
|
||||||
|
protected override void Initialise() {
|
||||||
|
Name = JSON.Value<string?>("Name");
|
||||||
|
MarketID = JSON.Value<long?>("MarketID");
|
||||||
|
SystemAddress = JSON.Value<long?>("SystemID");
|
||||||
|
BodyID = JSON.Value<long?>("BodyID");
|
||||||
|
BodyName = JSON.Value<string?>("BodyName");
|
||||||
|
Longitude = JSON.Value<double?>("Longitude") ?? 0.0;
|
||||||
|
Latitude = JSON.Value<double?>("Latitude") ?? 0.0;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ namespace EDPlayerJournal.Entries;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Entry {
|
public class Entry {
|
||||||
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
|
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
|
||||||
|
{ Events.ApproachSettlement, typeof(ApproachSettlementEntry) },
|
||||||
{ Events.Bounty, typeof(BountyEntry) },
|
{ Events.Bounty, typeof(BountyEntry) },
|
||||||
{ Events.CapShipBond, typeof(CapShipBondEntry) },
|
{ Events.CapShipBond, typeof(CapShipBondEntry) },
|
||||||
{ Events.Commander, typeof(CommanderEntry) },
|
{ Events.Commander, typeof(CommanderEntry) },
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
namespace EDPlayerJournal.Entries;
|
namespace EDPlayerJournal.Entries;
|
||||||
|
|
||||||
public class Events {
|
public class Events {
|
||||||
|
public static readonly string ApproachSettlement = "ApproachSettlement";
|
||||||
public static readonly string Bounty = "Bounty";
|
public static readonly string Bounty = "Bounty";
|
||||||
public static readonly string CapShipBond = "CapShipBond";
|
public static readonly string CapShipBond = "CapShipBond";
|
||||||
public static readonly string Commander = "Commander";
|
public static readonly string Commander = "Commander";
|
||||||
|
@ -10,7 +10,7 @@ class CombatZoneFormat : LogFormatter {
|
|||||||
var logs = objective
|
var logs = objective
|
||||||
.EnabledOfType<CombatZone>()
|
.EnabledOfType<CombatZone>()
|
||||||
.OrderBy(x => (CombatZones.DifficultyRank(x.Grade) ?? 0))
|
.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())
|
.ToDictionary(x => x.Key, x => x.ToList())
|
||||||
;
|
;
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
@ -23,6 +23,11 @@ class CombatZoneFormat : LogFormatter {
|
|||||||
int optionals = log.Value
|
int optionals = log.Value
|
||||||
.Sum(x => x.OptionalObjectivesCompleted)
|
.Sum(x => x.OptionalObjectivesCompleted)
|
||||||
;
|
;
|
||||||
|
var settlements = log.Value
|
||||||
|
.Select(x => x.Settlement)
|
||||||
|
.Distinct()
|
||||||
|
;
|
||||||
|
string settl = string.Join(", ", settlements);
|
||||||
if (!string.IsNullOrEmpty(log.Key.Grade)) {
|
if (!string.IsNullOrEmpty(log.Key.Grade)) {
|
||||||
builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)",
|
builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)",
|
||||||
log.Value.Count,
|
log.Value.Count,
|
||||||
@ -39,6 +44,9 @@ class CombatZoneFormat : LogFormatter {
|
|||||||
if (optionals > 0) {
|
if (optionals > 0) {
|
||||||
builder.AppendFormat(" (with {0} optional objectives)", optionals);
|
builder.AppendFormat(" (with {0} optional objectives)", optionals);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(settl)) {
|
||||||
|
builder.AppendFormat(" (at {0})", settl);
|
||||||
|
}
|
||||||
builder.Append("\n");
|
builder.Append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user