lay ground work for supporting thargoid combat zones

This commit is contained in:
Florian Stinglmayr 2022-12-03 14:33:09 +01:00
parent 8d72808fbf
commit 914aa43d33
4 changed files with 65 additions and 47 deletions

View File

@ -3,40 +3,15 @@ using System.Linq;
namespace EDPlayerJournal.BGS; namespace EDPlayerJournal.BGS;
public class CombatZone : Transaction { public class CombatZone : Transaction {
/// <summary>
/// Type string for ground combat zone
/// </summary>
public static readonly string GroundCombatZone = "Ground";
/// <summary>
/// Type string for ship combat zones
/// </summary>
public static readonly string ShipCombatZone = "Ship";
/// <summary>
/// Difficulty low
/// </summary>
public static readonly string DifficultyLow = "Low";
/// <summary>
/// Difficulty medium
/// </summary>
public static readonly string DifficultyMedium = "Medium";
/// <summary>
/// Difficulty high
/// </summary>
public static readonly string DifficultyHigh = "High";
/// <summary> /// <summary>
/// Type, either on foot or ship /// Type, either on foot or ship
/// </summary> /// </summary>
public string Type { get; set; } = ShipCombatZone; public string Type { get; set; } = CombatZones.ShipCombatZone;
/// <summary> /// <summary>
/// Difficulty type, low, medium or high. /// Difficulty type, low, medium or high.
/// </summary> /// </summary>
public string Grade { get; set; } = DifficultyLow; public string Grade { get; set; } = CombatZones.DifficultyLow;
/// <summary> /// <summary>
/// Whether spec ops were won. /// Whether spec ops were won.
@ -77,14 +52,21 @@ public class CombatZone : Transaction {
/// Returns true if it is an on foot/ground combat zone /// Returns true if it is an on foot/ground combat zone
/// </summary> /// </summary>
public bool IsGround { public bool IsGround {
get { return string.Compare(Type, GroundCombatZone) == 0; } get { return string.Compare(Type, CombatZones.GroundCombatZone) == 0; }
} }
/// <summary> /// <summary>
/// Returns true if it is an on foot combat zone /// Returns true if it is an on foot combat zone
/// </summary> /// </summary>
public bool IsShip { public bool IsShip {
get { return string.Compare(Type, ShipCombatZone) == 0; } get { return string.Compare(Type, CombatZones.ShipCombatZone) == 0; }
}
/// <summary>
/// Returns true if it is a thargoid combat zone
/// </summary>
public bool IsThargoid {
get { return string.Compare(Type, CombatZones.ThargoidCombatZone) == 0; }
} }
public override int CompareTo(Transaction? obj) { public override int CompareTo(Transaction? obj) {

View File

@ -57,7 +57,7 @@ internal class TransactionParserContext {
public Dictionary<string, long> BuyCost = new(); public Dictionary<string, long> BuyCost = new();
public void DiscernCombatZone(TransactionList transactions, Entry e) { public void DiscernCombatZone(TransactionList transactions, Entry e) {
string grade = CombatZone.DifficultyLow; string grade = CombatZones.DifficultyLow;
string cztype; string cztype;
ulong? highest = HighestCombatBond; ulong? highest = HighestCombatBond;
@ -66,40 +66,40 @@ internal class TransactionParserContext {
} }
if (OnFootKills > 0) { if (OnFootKills > 0) {
cztype = CombatZone.GroundCombatZone; cztype = CombatZones.GroundCombatZone;
// 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 = CombatZone.DifficultyHigh; grade = CombatZones.DifficultyHigh;
} else if (highest >= 40000) { } else if (highest >= 40000) {
grade = CombatZone.DifficultyMedium; grade = CombatZones.DifficultyMedium;
} else { } else {
grade = CombatZone.DifficultyLow; grade = CombatZones.DifficultyLow;
} }
} 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
if (ShipKills > 20) { if (ShipKills > 20) {
grade = CombatZone.DifficultyHigh; grade = CombatZones.DifficultyHigh;
} else if (ShipKills > 10) { } else if (ShipKills > 10) {
grade = CombatZone.DifficultyMedium; grade = CombatZones.DifficultyMedium;
} }
// Cap ship, means a high conflict zone // Cap ship, means a high conflict zone
if (HaveSeenCapShip) { if (HaveSeenCapShip) {
grade = CombatZone.DifficultyHigh; grade = CombatZones.DifficultyHigh;
} else { } else {
int warzoneNpcs = new List<bool>() { HaveSeenCaptain, HaveSeenCorrespondent, HaveSeenSpecOps } int warzoneNpcs = new List<bool>() { HaveSeenCaptain, HaveSeenCorrespondent, HaveSeenSpecOps }
.Where(x => x == true) .Where(x => x == true)
.Count() .Count()
; ;
if (warzoneNpcs >= 2 && grade != CombatZone.DifficultyHigh) { if (warzoneNpcs >= 2 && grade != CombatZones.DifficultyHigh) {
// Only large combat zones have two NPCs // Only large combat zones have two NPCs
grade = CombatZone.DifficultyHigh; grade = CombatZones.DifficultyHigh;
} else if (warzoneNpcs >= 1 && grade == CombatZone.DifficultyLow) { } else if (warzoneNpcs >= 1 && grade == CombatZones.DifficultyLow) {
grade = CombatZone.DifficultyMedium; grade = CombatZones.DifficultyMedium;
} }
} }
cztype = CombatZone.ShipCombatZone; cztype = CombatZones.ShipCombatZone;
} else { } else {
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type"); transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
return; return;

View File

@ -0,0 +1,36 @@
namespace EDPlayerJournal;
/// <summary>
/// Static strings related to combat zones
/// </summary>
public class CombatZones {
/// <summary>
/// Type string for ground combat zone
/// </summary>
public static readonly string GroundCombatZone = "Ground";
/// <summary>
/// Type string for ship combat zones
/// </summary>
public static readonly string ShipCombatZone = "Ship";
/// <summary>
/// Thargoid combat zone
/// </summary>
public static readonly string ThargoidCombatZone = "Thargoid";
/// <summary>
/// Difficulty low
/// </summary>
public static readonly string DifficultyLow = "Low";
/// <summary>
/// Difficulty medium
/// </summary>
public static readonly string DifficultyMedium = "Medium";
/// <summary>
/// Difficulty high
/// </summary>
public static readonly string DifficultyHigh = "High";
}

View File

@ -285,7 +285,7 @@ public partial class MainWindow : Window {
return; return;
} }
transaction.Grade = CombatZone.DifficultyLow; transaction.Grade = CombatZones.DifficultyLow;
RefreshView(); RefreshView();
} }
@ -295,7 +295,7 @@ public partial class MainWindow : Window {
return; return;
} }
transaction.Grade = CombatZone.DifficultyMedium; transaction.Grade = CombatZones.DifficultyMedium;
RefreshView(); RefreshView();
} }
@ -305,7 +305,7 @@ public partial class MainWindow : Window {
return; return;
} }
transaction.Grade = CombatZone.DifficultyHigh; transaction.Grade = CombatZones.DifficultyHigh;
RefreshView(); RefreshView();
} }
@ -315,7 +315,7 @@ public partial class MainWindow : Window {
return; return;
} }
transaction.Type = CombatZone.GroundCombatZone; transaction.Type = CombatZones.GroundCombatZone;
RefreshView(); RefreshView();
} }
@ -325,7 +325,7 @@ public partial class MainWindow : Window {
return; return;
} }
transaction.Type = CombatZone.ShipCombatZone; transaction.Type = CombatZones.ShipCombatZone;
RefreshView(); RefreshView();
} }