From 914aa43d33000e9b4812f485cc633db8662e853e Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Sat, 3 Dec 2022 14:33:09 +0100 Subject: [PATCH] lay ground work for supporting thargoid combat zones --- EDPlayerJournal/BGS/CombatZone.cs | 40 +++++++----------------- EDPlayerJournal/BGS/TransactionParser.cs | 26 +++++++-------- EDPlayerJournal/CombatZones.cs | 36 +++++++++++++++++++++ EliteBGS/MainWindow.xaml.cs | 10 +++--- 4 files changed, 65 insertions(+), 47 deletions(-) create mode 100644 EDPlayerJournal/CombatZones.cs diff --git a/EDPlayerJournal/BGS/CombatZone.cs b/EDPlayerJournal/BGS/CombatZone.cs index ed23054..09be364 100644 --- a/EDPlayerJournal/BGS/CombatZone.cs +++ b/EDPlayerJournal/BGS/CombatZone.cs @@ -3,40 +3,15 @@ using System.Linq; namespace EDPlayerJournal.BGS; public class CombatZone : Transaction { - /// - /// Type string for ground combat zone - /// - public static readonly string GroundCombatZone = "Ground"; - - /// - /// Type string for ship combat zones - /// - public static readonly string ShipCombatZone = "Ship"; - - /// - /// Difficulty low - /// - public static readonly string DifficultyLow = "Low"; - - /// - /// Difficulty medium - /// - public static readonly string DifficultyMedium = "Medium"; - - /// - /// Difficulty high - /// - public static readonly string DifficultyHigh = "High"; - /// /// Type, either on foot or ship /// - public string Type { get; set; } = ShipCombatZone; + public string Type { get; set; } = CombatZones.ShipCombatZone; /// /// Difficulty type, low, medium or high. /// - public string Grade { get; set; } = DifficultyLow; + public string Grade { get; set; } = CombatZones.DifficultyLow; /// /// Whether spec ops were won. @@ -77,14 +52,21 @@ public class CombatZone : Transaction { /// Returns true if it is an on foot/ground combat zone /// public bool IsGround { - get { return string.Compare(Type, GroundCombatZone) == 0; } + get { return string.Compare(Type, CombatZones.GroundCombatZone) == 0; } } /// /// Returns true if it is an on foot combat zone /// public bool IsShip { - get { return string.Compare(Type, ShipCombatZone) == 0; } + get { return string.Compare(Type, CombatZones.ShipCombatZone) == 0; } + } + + /// + /// Returns true if it is a thargoid combat zone + /// + public bool IsThargoid { + get { return string.Compare(Type, CombatZones.ThargoidCombatZone) == 0; } } public override int CompareTo(Transaction? obj) { diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs index 3f74b27..ec37d2e 100644 --- a/EDPlayerJournal/BGS/TransactionParser.cs +++ b/EDPlayerJournal/BGS/TransactionParser.cs @@ -57,7 +57,7 @@ internal class TransactionParserContext { public Dictionary BuyCost = new(); public void DiscernCombatZone(TransactionList transactions, Entry e) { - string grade = CombatZone.DifficultyLow; + string grade = CombatZones.DifficultyLow; string cztype; ulong? highest = HighestCombatBond; @@ -66,40 +66,40 @@ internal class TransactionParserContext { } if (OnFootKills > 0) { - cztype = CombatZone.GroundCombatZone; + cztype = CombatZones.GroundCombatZone; // High on foot combat zones have enforcers that bring 80k a pop if (highest >= 80000) { - grade = CombatZone.DifficultyHigh; + grade = CombatZones.DifficultyHigh; } else if (highest >= 40000) { - grade = CombatZone.DifficultyMedium; + grade = CombatZones.DifficultyMedium; } else { - grade = CombatZone.DifficultyLow; + grade = CombatZones.DifficultyLow; } } else if (ShipKills > 0) { // Ship combat zones can be identified by the amount of kills if (ShipKills > 20) { - grade = CombatZone.DifficultyHigh; + grade = CombatZones.DifficultyHigh; } else if (ShipKills > 10) { - grade = CombatZone.DifficultyMedium; + grade = CombatZones.DifficultyMedium; } // Cap ship, means a high conflict zone if (HaveSeenCapShip) { - grade = CombatZone.DifficultyHigh; + grade = CombatZones.DifficultyHigh; } else { int warzoneNpcs = new List() { HaveSeenCaptain, HaveSeenCorrespondent, HaveSeenSpecOps } .Where(x => x == true) .Count() ; - if (warzoneNpcs >= 2 && grade != CombatZone.DifficultyHigh) { + if (warzoneNpcs >= 2 && grade != CombatZones.DifficultyHigh) { // Only large combat zones have two NPCs - grade = CombatZone.DifficultyHigh; - } else if (warzoneNpcs >= 1 && grade == CombatZone.DifficultyLow) { - grade = CombatZone.DifficultyMedium; + grade = CombatZones.DifficultyHigh; + } else if (warzoneNpcs >= 1 && grade == CombatZones.DifficultyLow) { + grade = CombatZones.DifficultyMedium; } } - cztype = CombatZone.ShipCombatZone; + cztype = CombatZones.ShipCombatZone; } else { transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type"); return; diff --git a/EDPlayerJournal/CombatZones.cs b/EDPlayerJournal/CombatZones.cs new file mode 100644 index 0000000..786642f --- /dev/null +++ b/EDPlayerJournal/CombatZones.cs @@ -0,0 +1,36 @@ +namespace EDPlayerJournal; + +/// +/// Static strings related to combat zones +/// +public class CombatZones { + /// + /// Type string for ground combat zone + /// + public static readonly string GroundCombatZone = "Ground"; + + /// + /// Type string for ship combat zones + /// + public static readonly string ShipCombatZone = "Ship"; + + /// + /// Thargoid combat zone + /// + public static readonly string ThargoidCombatZone = "Thargoid"; + + /// + /// Difficulty low + /// + public static readonly string DifficultyLow = "Low"; + + /// + /// Difficulty medium + /// + public static readonly string DifficultyMedium = "Medium"; + + /// + /// Difficulty high + /// + public static readonly string DifficultyHigh = "High"; +} diff --git a/EliteBGS/MainWindow.xaml.cs b/EliteBGS/MainWindow.xaml.cs index 329fc1c..d7223fb 100644 --- a/EliteBGS/MainWindow.xaml.cs +++ b/EliteBGS/MainWindow.xaml.cs @@ -285,7 +285,7 @@ public partial class MainWindow : Window { return; } - transaction.Grade = CombatZone.DifficultyLow; + transaction.Grade = CombatZones.DifficultyLow; RefreshView(); } @@ -295,7 +295,7 @@ public partial class MainWindow : Window { return; } - transaction.Grade = CombatZone.DifficultyMedium; + transaction.Grade = CombatZones.DifficultyMedium; RefreshView(); } @@ -305,7 +305,7 @@ public partial class MainWindow : Window { return; } - transaction.Grade = CombatZone.DifficultyHigh; + transaction.Grade = CombatZones.DifficultyHigh; RefreshView(); } @@ -315,7 +315,7 @@ public partial class MainWindow : Window { return; } - transaction.Type = CombatZone.GroundCombatZone; + transaction.Type = CombatZones.GroundCombatZone; RefreshView(); } @@ -325,7 +325,7 @@ public partial class MainWindow : Window { return; } - transaction.Type = CombatZone.ShipCombatZone; + transaction.Type = CombatZones.ShipCombatZone; RefreshView(); }