diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs index 67bc20e..699b68c 100644 --- a/EDPlayerJournal/BGS/TransactionParser.cs +++ b/EDPlayerJournal/BGS/TransactionParser.cs @@ -17,6 +17,8 @@ internal class TransactionParserContext { public ulong? HighestCombatBond { get; set; } + public bool HaveSeenWarzoneNPC { get; set; } = false; + /// /// How many on foot kills were done. /// @@ -73,6 +75,10 @@ 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 + grade = "Medium"; + } cztype = "Ship"; } else { transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type"); @@ -106,6 +112,7 @@ internal class TransactionParserContext { public void ResetCombatZone() { HighestCombatBond = null; + HaveSeenWarzoneNPC = false; LastRecordedAwardingFaction = null; OnFootKills = 0; ShipKills = 0; @@ -276,6 +283,11 @@ internal class ShipTargetedParser : TransactionParserPart { !string.IsNullOrEmpty(entry.Faction)) { 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; + } } } diff --git a/EDPlayerJournal/NPC.cs b/EDPlayerJournal/NPC.cs new file mode 100644 index 0000000..794b73c --- /dev/null +++ b/EDPlayerJournal/NPC.cs @@ -0,0 +1,117 @@ +namespace EDPlayerJournal; + +public class NPCs { + /// + /// Internal name of Spec Ops Wing Alpha + /// + public static string SpecOpsAInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_A;"; + + /// + /// Internal name of Spec Ops Wing Beta + /// + public static string SpecOpsBInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_B;"; + + /// + /// Internal name of Spec Ops Wing Gamma + /// + public static string SpecOpsGInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_G;"; + + /// + /// Internal name of Spec Ops Wing Delta + /// + public static string SpecOpsDInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_D;"; + + /// + /// Empire captain + /// + public static string EmpireCaptain = "$LUASC_Scenario_Warzone_NPC_WarzoneGeneral_Emp;"; + + /// + /// Federation captain + /// + public static string FederationCaptain = "$LUASC_Scenario_Warzone_NPC_WarzoneGeneral_Fed;"; + + /// + /// Federation captain + /// + public static string IndependentCaptain = "$LUASC_Scenario_Warzone_NPC_WarzoneGeneral_Ind;"; + + /// + /// Warzone correspondant + /// + public static string WarzoneCorrespondent = "$LUASC_Scenario_Warzone_NPC_WarzoneCorrespondent;"; + + /// + /// Returns true if the pilotname is either a captain, specops, or correspondent + /// + /// + /// + public static bool IsWarzoneNPC(string? pilotname) { + if (IsWarzoneCaptain(pilotname) || + IsWarzoneCorrespondent(pilotname) || + IsSpecOps(pilotname)) { + return true; + } + + return false; + } + + /// + /// Returns true if the given pilot name is a warzone correspondent + /// + /// + /// + public static bool IsWarzoneCorrespondent(string? pilotname) { + if (pilotname == null) { + return false; + } + + if (string.Compare(pilotname, WarzoneCorrespondent) == 0) { + return true; + } + + return false; + } + + /// + /// Returns true if the given pilot name is a spec ops wing. + /// + /// + /// + public static bool IsSpecOps(string? pilotname) { + if (pilotname == null) { + return false; + } + + if (string.Compare(pilotname, SpecOpsAInternal) == 0 || + string.Compare(pilotname, SpecOpsBInternal) == 0 || + string.Compare(pilotname, SpecOpsGInternal) == 0 || + string.Compare(pilotname, SpecOpsDInternal) == 0) { + return true; + } + + return false; + } + + /// + /// Returns true if the given pilot name is a warzone captain + /// + /// + /// + public static bool IsWarzoneCaptain(string? pilotname) { + if (pilotname == null) { + return false; + } + + if (string.Compare(pilotname, EmpireCaptain) == 0 || + string.Compare(pilotname, FederationCaptain) == 0 || + string.Compare(pilotname, IndependentCaptain) == 0) { + return true; + } + + return false; + } +} + +public class NPC { +}