Compare commits
5 Commits
bb74d72b13
...
d79ee5a153
Author | SHA1 | Date | |
---|---|---|---|
d79ee5a153 | |||
f683bc372e | |||
12ba6d4d96 | |||
dd1d7ff091 | |||
65fec2cd1e |
@ -3,9 +3,52 @@ using System.Linq;
|
||||
|
||||
namespace EDPlayerJournal.BGS;
|
||||
public class CombatZone : Transaction {
|
||||
public string Type { get; set; } = "";
|
||||
public string Grade { get; set; } = "";
|
||||
public int Amount { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Type, either on foot or ship
|
||||
/// </summary>
|
||||
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) {
|
||||
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
||||
|
@ -1,7 +1,4 @@
|
||||
using EDPlayerJournal.Entries;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Transactions;
|
||||
|
||||
namespace EDPlayerJournal.BGS;
|
||||
|
||||
@ -17,7 +14,10 @@ internal class TransactionParserContext {
|
||||
|
||||
public ulong? HighestCombatBond { get; set; }
|
||||
|
||||
public bool HaveSeenWarzoneNPC { get; set; } = false;
|
||||
public bool HaveSeenCapShip { get; set; } = false;
|
||||
public bool HaveSeenCaptain { get; set; } = false;
|
||||
public bool HaveSeenSpecOps { get; set; } = false;
|
||||
public bool HaveSeenCorrespondent { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// How many on foot kills were done.
|
||||
@ -65,8 +65,10 @@ internal class TransactionParserContext {
|
||||
// High on foot combat zones have enforcers that bring 80k a pop
|
||||
if (highest >= 80000) {
|
||||
grade = "High";
|
||||
} else if (highest >= 4000) {
|
||||
} else if (highest >= 40000) {
|
||||
grade = "Medium";
|
||||
} else {
|
||||
grade = "Low";
|
||||
}
|
||||
} else if (ShipKills > 0) {
|
||||
// Ship combat zones can be identified by the amount of kills
|
||||
@ -75,10 +77,23 @@ internal class TransactionParserContext {
|
||||
} else if (ShipKills > 10) {
|
||||
grade = "Medium";
|
||||
}
|
||||
if (HaveSeenWarzoneNPC && grade == "Low") {
|
||||
// We have seen a warzone NPC so we know its at least medium
|
||||
|
||||
// Cap ship, means a high conflict zone
|
||||
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";
|
||||
}
|
||||
}
|
||||
cztype = "Ship";
|
||||
} else {
|
||||
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
|
||||
@ -90,6 +105,11 @@ internal class TransactionParserContext {
|
||||
Faction = LastRecordedAwardingFaction,
|
||||
Grade = grade,
|
||||
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,
|
||||
};
|
||||
zone.Entries.Add(e);
|
||||
@ -112,7 +132,10 @@ internal class TransactionParserContext {
|
||||
|
||||
public void ResetCombatZone() {
|
||||
HighestCombatBond = null;
|
||||
HaveSeenWarzoneNPC = false;
|
||||
HaveSeenCapShip = false;
|
||||
HaveSeenCaptain = false;
|
||||
HaveSeenCorrespondent = false;
|
||||
HaveSeenSpecOps = false;
|
||||
LastRecordedAwardingFaction = null;
|
||||
OnFootKills = 0;
|
||||
ShipKills = 0;
|
||||
@ -290,9 +313,19 @@ internal class ShipTargetedParser : TransactionParserPart {
|
||||
context.NPCFaction.TryAdd(entry.PilotNameLocalised, entry.Faction);
|
||||
}
|
||||
|
||||
// We have seen a spec ops, so we know its medium or higher
|
||||
if (NPCs.IsWarzoneNPC(entry.PilotName)) {
|
||||
context.HaveSeenWarzoneNPC = true;
|
||||
// We have seen a captain?
|
||||
if (NPCs.IsWarzoneCaptain(entry.PilotName)) {
|
||||
context.HaveSeenCaptain = true;
|
||||
}
|
||||
|
||||
// Spec ops?
|
||||
if (NPCs.IsSpecOps(entry.PilotName)) {
|
||||
context.HaveSeenSpecOps = true;
|
||||
}
|
||||
|
||||
// Correspondent?
|
||||
if (NPCs.IsWarzoneCorrespondent(entry.PilotName)) {
|
||||
context.HaveSeenCorrespondent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -754,9 +787,20 @@ 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 {
|
||||
private static Dictionary<string, TransactionParserPart> ParserParts { get; } = new()
|
||||
{
|
||||
{ Events.CapShipBond, new CapShipBondParser() },
|
||||
{ Events.CommitCrime, new CommitCrimeParser() },
|
||||
{ Events.Disembark, new EmbarkDisembarkParser() },
|
||||
{ Events.Docked, new DockedParser() },
|
||||
|
24
EDPlayerJournal/Entries/CapShipBondEntry.cs
Normal file
24
EDPlayerJournal/Entries/CapShipBondEntry.cs
Normal file
@ -0,0 +1,24 @@
|
||||
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,6 +13,7 @@ namespace EDPlayerJournal.Entries;
|
||||
public class Entry {
|
||||
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
|
||||
{ Events.Bounty, typeof(BountyEntry) },
|
||||
{ Events.CapShipBond, typeof(CapShipBondEntry) },
|
||||
{ Events.Commander, typeof(CommanderEntry) },
|
||||
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
|
||||
{ Events.Died, typeof(DiedEntry) },
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
public class Events {
|
||||
public static readonly string Bounty = "Bounty";
|
||||
public static readonly string CapShipBond = "CapShipBond";
|
||||
public static readonly string Commander = "Commander";
|
||||
public static readonly string CommitCrime = "CommitCrime";
|
||||
public static readonly string Died = "Died";
|
||||
|
Loading…
Reference in New Issue
Block a user