Compare commits
No commits in common. "d79ee5a1538f8685cf9d27ef8cc8c44d5b16d8df" and "bb74d72b13c154fb7eaeb46ecd159fae6d992a0c" have entirely different histories.
d79ee5a153
...
bb74d72b13
@ -3,52 +3,9 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace EDPlayerJournal.BGS;
|
namespace EDPlayerJournal.BGS;
|
||||||
public class CombatZone : Transaction {
|
public class CombatZone : Transaction {
|
||||||
/// <summary>
|
public string Type { get; set; } = "";
|
||||||
/// Type, either on foot or ship
|
public string Grade { get; set; } = "";
|
||||||
/// </summary>
|
public int Amount { get; set; } = 0;
|
||||||
public string Type { get; set; } = "Ship";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Difficulty type, low, medium or high.
|
|
||||||
/// </summary>
|
|
||||||
public string Grade { get; set; } = "Low";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How many?
|
|
||||||
/// </summary>
|
|
||||||
public int Amount { get; set; } = 1;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether spec ops were won.
|
|
||||||
/// </summary>
|
|
||||||
public bool? SpecOps { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether captain was won
|
|
||||||
/// </summary>
|
|
||||||
public bool? Captain { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether correspondent objective was won
|
|
||||||
/// </summary>
|
|
||||||
public bool? Correspondent { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether cap ship objective was won
|
|
||||||
/// </summary>
|
|
||||||
public bool? CapitalShip { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How many optional objectives were completed?
|
|
||||||
/// </summary>
|
|
||||||
public int OptionalObjectivesCompleted {
|
|
||||||
get {
|
|
||||||
return new List<bool?>() { SpecOps, Captain, Correspondent, CapitalShip }
|
|
||||||
.Where(x => x != null && x == true)
|
|
||||||
.Count()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int CompareTo(Transaction? obj) {
|
public override int CompareTo(Transaction? obj) {
|
||||||
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
using EDPlayerJournal.Entries;
|
using EDPlayerJournal.Entries;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Transactions;
|
||||||
|
|
||||||
namespace EDPlayerJournal.BGS;
|
namespace EDPlayerJournal.BGS;
|
||||||
|
|
||||||
@ -14,10 +17,7 @@ internal class TransactionParserContext {
|
|||||||
|
|
||||||
public ulong? HighestCombatBond { get; set; }
|
public ulong? HighestCombatBond { get; set; }
|
||||||
|
|
||||||
public bool HaveSeenCapShip { get; set; } = false;
|
public bool HaveSeenWarzoneNPC { get; set; } = false;
|
||||||
public bool HaveSeenCaptain { get; set; } = false;
|
|
||||||
public bool HaveSeenSpecOps { get; set; } = false;
|
|
||||||
public bool HaveSeenCorrespondent { get; set; } = false;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many on foot kills were done.
|
/// How many on foot kills were done.
|
||||||
@ -65,10 +65,8 @@ internal class TransactionParserContext {
|
|||||||
// High on foot combat zones have enforcers that bring 80k a pop
|
// High on foot combat zones have enforcers that bring 80k a pop
|
||||||
if (highest >= 80000) {
|
if (highest >= 80000) {
|
||||||
grade = "High";
|
grade = "High";
|
||||||
} else if (highest >= 40000) {
|
} else if (highest >= 4000) {
|
||||||
grade = "Medium";
|
grade = "Medium";
|
||||||
} else {
|
|
||||||
grade = "Low";
|
|
||||||
}
|
}
|
||||||
} else if (ShipKills > 0) {
|
} else if (ShipKills > 0) {
|
||||||
// Ship combat zones can be identified by the amount of kills
|
// Ship combat zones can be identified by the amount of kills
|
||||||
@ -77,23 +75,10 @@ internal class TransactionParserContext {
|
|||||||
} else if (ShipKills > 10) {
|
} else if (ShipKills > 10) {
|
||||||
grade = "Medium";
|
grade = "Medium";
|
||||||
}
|
}
|
||||||
|
if (HaveSeenWarzoneNPC && grade == "Low") {
|
||||||
// Cap ship, means a high conflict zone
|
// We have seen a warzone NPC so we know its at least medium
|
||||||
if (HaveSeenCapShip) {
|
|
||||||
grade = "High";
|
|
||||||
} else {
|
|
||||||
int warzoneNpcs = new List<bool>() { HaveSeenCaptain, HaveSeenCorrespondent, HaveSeenSpecOps }
|
|
||||||
.Where(x => x == true)
|
|
||||||
.Count()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (warzoneNpcs >= 2 && grade != "High") {
|
|
||||||
// Only large combat zones have two NPCs
|
|
||||||
grade = "High";
|
|
||||||
} else if (warzoneNpcs >= 1 && grade == "Low") {
|
|
||||||
grade = "Medium";
|
grade = "Medium";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
cztype = "Ship";
|
cztype = "Ship";
|
||||||
} else {
|
} else {
|
||||||
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
|
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
|
||||||
@ -105,11 +90,6 @@ internal class TransactionParserContext {
|
|||||||
Faction = LastRecordedAwardingFaction,
|
Faction = LastRecordedAwardingFaction,
|
||||||
Grade = grade,
|
Grade = grade,
|
||||||
Type = cztype,
|
Type = cztype,
|
||||||
// Sad truth is, if HaveSeenXXX is false, we just don't know for certain
|
|
||||||
CapitalShip = HaveSeenCapShip ? true : null,
|
|
||||||
SpecOps = HaveSeenSpecOps ? true : null,
|
|
||||||
Correspondent = HaveSeenCorrespondent ? true : null,
|
|
||||||
Captain = HaveSeenCaptain ? true : null,
|
|
||||||
Amount = 1,
|
Amount = 1,
|
||||||
};
|
};
|
||||||
zone.Entries.Add(e);
|
zone.Entries.Add(e);
|
||||||
@ -132,10 +112,7 @@ internal class TransactionParserContext {
|
|||||||
|
|
||||||
public void ResetCombatZone() {
|
public void ResetCombatZone() {
|
||||||
HighestCombatBond = null;
|
HighestCombatBond = null;
|
||||||
HaveSeenCapShip = false;
|
HaveSeenWarzoneNPC = false;
|
||||||
HaveSeenCaptain = false;
|
|
||||||
HaveSeenCorrespondent = false;
|
|
||||||
HaveSeenSpecOps = false;
|
|
||||||
LastRecordedAwardingFaction = null;
|
LastRecordedAwardingFaction = null;
|
||||||
OnFootKills = 0;
|
OnFootKills = 0;
|
||||||
ShipKills = 0;
|
ShipKills = 0;
|
||||||
@ -313,19 +290,9 @@ internal class ShipTargetedParser : TransactionParserPart {
|
|||||||
context.NPCFaction.TryAdd(entry.PilotNameLocalised, entry.Faction);
|
context.NPCFaction.TryAdd(entry.PilotNameLocalised, entry.Faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have seen a captain?
|
// We have seen a spec ops, so we know its medium or higher
|
||||||
if (NPCs.IsWarzoneCaptain(entry.PilotName)) {
|
if (NPCs.IsWarzoneNPC(entry.PilotName)) {
|
||||||
context.HaveSeenCaptain = true;
|
context.HaveSeenWarzoneNPC = true;
|
||||||
}
|
|
||||||
|
|
||||||
// Spec ops?
|
|
||||||
if (NPCs.IsSpecOps(entry.PilotName)) {
|
|
||||||
context.HaveSeenSpecOps = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Correspondent?
|
|
||||||
if (NPCs.IsWarzoneCorrespondent(entry.PilotName)) {
|
|
||||||
context.HaveSeenCorrespondent = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -787,20 +754,9 @@ internal class ShutdownParser : TransactionParserPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class CapShipBondParser : TransactionParserPart {
|
|
||||||
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
|
||||||
if (entry.GetType() != typeof(CapShipBondEntry)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
context.HaveSeenCapShip = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TransactionParser {
|
public class TransactionParser {
|
||||||
private static Dictionary<string, TransactionParserPart> ParserParts { get; } = new()
|
private static Dictionary<string, TransactionParserPart> ParserParts { get; } = new()
|
||||||
{
|
{
|
||||||
{ Events.CapShipBond, new CapShipBondParser() },
|
|
||||||
{ Events.CommitCrime, new CommitCrimeParser() },
|
{ Events.CommitCrime, new CommitCrimeParser() },
|
||||||
{ Events.Disembark, new EmbarkDisembarkParser() },
|
{ Events.Disembark, new EmbarkDisembarkParser() },
|
||||||
{ Events.Docked, new DockedParser() },
|
{ Events.Docked, new DockedParser() },
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
namespace EDPlayerJournal.Entries;
|
|
||||||
|
|
||||||
public class CapShipBondEntry : Entry {
|
|
||||||
/// <summary>
|
|
||||||
/// Reward gained
|
|
||||||
/// </summary>
|
|
||||||
public ulong Reward { get; set; } = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Victim faction, i.e. to whom the cap ship belongs
|
|
||||||
/// </summary>
|
|
||||||
public string? VictimFaction { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Awarding faction.
|
|
||||||
/// </summary>
|
|
||||||
public string? AwardingFaction { get; set; }
|
|
||||||
|
|
||||||
protected override void Initialise() {
|
|
||||||
Reward = JSON.Value<ulong?>("Reward") ?? 0;
|
|
||||||
VictimFaction = JSON.Value<string?>("VictimFaction");
|
|
||||||
AwardingFaction = JSON.Value<string?>("AwardingFaction");
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ namespace EDPlayerJournal.Entries;
|
|||||||
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.Bounty, typeof(BountyEntry) },
|
{ Events.Bounty, typeof(BountyEntry) },
|
||||||
{ Events.CapShipBond, typeof(CapShipBondEntry) },
|
|
||||||
{ Events.Commander, typeof(CommanderEntry) },
|
{ Events.Commander, typeof(CommanderEntry) },
|
||||||
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
|
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
|
||||||
{ Events.Died, typeof(DiedEntry) },
|
{ Events.Died, typeof(DiedEntry) },
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
public class Events {
|
public class Events {
|
||||||
public static readonly string Bounty = "Bounty";
|
public static readonly string Bounty = "Bounty";
|
||||||
public static readonly string CapShipBond = "CapShipBond";
|
|
||||||
public static readonly string Commander = "Commander";
|
public static readonly string Commander = "Commander";
|
||||||
public static readonly string CommitCrime = "CommitCrime";
|
public static readonly string CommitCrime = "CommitCrime";
|
||||||
public static readonly string Died = "Died";
|
public static readonly string Died = "Died";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user