diff --git a/EDPlayerJournal/BGS/CombatZone.cs b/EDPlayerJournal/BGS/CombatZone.cs index 0f6fbf5..ed23054 100644 --- a/EDPlayerJournal/BGS/CombatZone.cs +++ b/EDPlayerJournal/BGS/CombatZone.cs @@ -3,15 +3,40 @@ 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; } = "Ship"; + public string Type { get; set; } = ShipCombatZone; /// /// Difficulty type, low, medium or high. /// - public string Grade { get; set; } = "Low"; + public string Grade { get; set; } = DifficultyLow; /// /// Whether spec ops were won. @@ -52,14 +77,14 @@ public class CombatZone : Transaction { /// Returns true if it is an on foot/ground combat zone /// public bool IsGround { - get { return string.Compare(Type, "On Foot") == 0; } + get { return string.Compare(Type, GroundCombatZone) == 0; } } /// /// Returns true if it is an on foot combat zone /// public bool IsShip { - get { return string.Compare(Type, "Ship") == 0; } + get { return string.Compare(Type, ShipCombatZone) == 0; } } public override int CompareTo(Transaction? obj) { diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs index 2afe1b7..3f971d6 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 = "Low"; + string grade = CombatZone.DifficultyLow; string cztype; ulong? highest = HighestCombatBond; @@ -66,40 +66,40 @@ internal class TransactionParserContext { } if (OnFootKills > 0) { - cztype = "On Foot"; + cztype = CombatZone.GroundCombatZone; // High on foot combat zones have enforcers that bring 80k a pop if (highest >= 80000) { - grade = "High"; + grade = CombatZone.DifficultyHigh; } else if (highest >= 40000) { - grade = "Medium"; + grade = CombatZone.DifficultyMedium; } else { - grade = "Low"; + grade = CombatZone.DifficultyLow; } } else if (ShipKills > 0) { // Ship combat zones can be identified by the amount of kills if (ShipKills > 20) { - grade = "High"; + grade = CombatZone.DifficultyHigh; } else if (ShipKills > 10) { - grade = "Medium"; + grade = CombatZone.DifficultyMedium; } // Cap ship, means a high conflict zone if (HaveSeenCapShip) { - grade = "High"; + grade = CombatZone.DifficultyHigh; } else { int warzoneNpcs = new List() { HaveSeenCaptain, HaveSeenCorrespondent, HaveSeenSpecOps } .Where(x => x == true) .Count() ; - if (warzoneNpcs >= 2 && grade != "High") { + if (warzoneNpcs >= 2 && grade != CombatZone.DifficultyHigh) { // Only large combat zones have two NPCs - grade = "High"; - } else if (warzoneNpcs >= 1 && grade == "Low") { - grade = "Medium"; + grade = CombatZone.DifficultyHigh; + } else if (warzoneNpcs >= 1 && grade == CombatZone.DifficultyLow) { + grade = CombatZone.DifficultyMedium; } } - cztype = "Ship"; + cztype = CombatZone.ShipCombatZone; } else { transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type"); return; diff --git a/EliteBGS/MainWindow.xaml b/EliteBGS/MainWindow.xaml index afb480e..c34fd8f 100644 --- a/EliteBGS/MainWindow.xaml +++ b/EliteBGS/MainWindow.xaml @@ -108,7 +108,7 @@