add support for DropshipDeploy

This commit is contained in:
2022-12-09 17:36:26 +01:00
parent ef8e71cd8a
commit bf43262a8e
7 changed files with 150 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ internal class TransactionParserContext {
return;
}
if (OnFootKills > 0) {
if (OnFootKills > 0 || IsOnFoot == true) {
cztype = CombatZones.GroundCombatZone;
// High on foot combat zones have enforcers that bring 80k a pop
if (highest >= 80000) {
@@ -93,7 +93,7 @@ internal class TransactionParserContext {
} else {
grade = CombatZones.DifficultyLow;
}
} else if (ShipKills > 0) {
} else if (ShipKills > 0 && !IsOnFoot) {
// Ship combat zones can be identified by the amount of kills
if (ShipKills > 20) {
grade = CombatZones.DifficultyHigh;
@@ -832,6 +832,8 @@ internal class EmbarkDisembarkParser : TransactionParserPart {
internal class SupercruiseEntryParser : TransactionParserPart {
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
// After a super cruise entry we are no longer on foot.
context.IsOnFoot = false;
context.DiscernCombatZone(transactions, entry);
context.ResetCombatZone();
}
@@ -892,6 +894,13 @@ internal class DiedParser : TransactionParserPart {
}
}
internal class DropshipDeployParser : TransactionParserPart {
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
// On drop ship deploy we are now on foot
context.IsOnFoot = true;
}
}
public class TransactionParser {
private static Dictionary<string, TransactionParserPart> ParserParts { get; } = new()
{
@@ -900,6 +909,7 @@ public class TransactionParser {
{ Events.Died, new DiedParser() },
{ Events.Disembark, new EmbarkDisembarkParser() },
{ Events.Docked, new DockedParser() },
{ Events.DropshipDeploy, new DropshipDeployParser() },
{ Events.Embark, new EmbarkDisembarkParser() },
{ Events.FactionKillBond, new FactionKillBondParser() },
{ Events.FileHeader, new FileHeaderParser() },

View File

@@ -0,0 +1,42 @@
namespace EDPlayerJournal.Entries;
public class DropshipDeployEntry : Entry {
/// <summary>
/// Star system this drop happened in.
/// </summary>
public string? StarSystem { get; set; }
/// <summary>
/// System address
/// </summary>
public ulong? SystemAddress { get; set; }
/// <summary>
/// Planetary body
/// </summary>
public string? Body { get; set; }
/// <summary>
/// Body ID
/// </summary>
public ulong? BodyID { get; set; }
/// <summary>
/// Whether it happened on station.
/// </summary>
public bool? OnStation { get; set; }
/// <summary>
/// Whether it happened on a planet.
/// </summary>
public bool? OnPlanet { get; set; }
protected override void Initialise() {
StarSystem = JSON.Value<string?>("StarSystem");
SystemAddress = JSON.Value<ulong?>("SystemAddress");
Body = JSON.Value<string?>("Body");
BodyID = JSON.Value<ulong?>("BodyID");
OnStation = JSON.Value<bool?>("OnStation");
OnPlanet = JSON.Value<bool?>("OnPlanet");
}
}

View File

@@ -19,6 +19,7 @@ public class Entry {
{ Events.Died, typeof(DiedEntry) },
{ Events.Disembark, typeof(DisembarkEntry) },
{ Events.Docked, typeof(DockedEntry) },
{ Events.DropshipDeploy, typeof(DropshipDeployEntry) },
{ Events.Embark, typeof(EmbarkEntry) },
{ Events.FactionKillBond, typeof(FactionKillBondEntry) },
{ Events.FileHeader, typeof(FileHeaderEntry) },

View File

@@ -8,6 +8,7 @@ public class Events {
public static readonly string Died = "Died";
public static readonly string Disembark = "Disembark";
public static readonly string Docked = "Docked";
public static readonly string DropshipDeploy = "DropshipDeploy";
public static readonly string Embark = "Embark";
public static readonly string FactionKillBond = "FactionKillBond";
public static readonly string FighterDestroyed = "FighterDestroyed";