change "on foot" to "ground"

This commit is contained in:
Florian Stinglmayr 2022-11-29 17:52:27 +01:00
parent f0977b774b
commit f14982f37a
4 changed files with 49 additions and 24 deletions

View File

@ -3,15 +3,40 @@ using System.Linq;
namespace EDPlayerJournal.BGS;
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>
/// Type, either on foot or ship
/// </summary>
public string Type { get; set; } = "Ship";
public string Type { get; set; } = ShipCombatZone;
/// <summary>
/// Difficulty type, low, medium or high.
/// </summary>
public string Grade { get; set; } = "Low";
public string Grade { get; set; } = DifficultyLow;
/// <summary>
/// Whether spec ops were won.
@ -52,14 +77,14 @@ public class CombatZone : Transaction {
/// Returns true if it is an on foot/ground combat zone
/// </summary>
public bool IsGround {
get { return string.Compare(Type, "On Foot") == 0; }
get { return string.Compare(Type, GroundCombatZone) == 0; }
}
/// <summary>
/// Returns true if it is an on foot combat zone
/// </summary>
public bool IsShip {
get { return string.Compare(Type, "Ship") == 0; }
get { return string.Compare(Type, ShipCombatZone) == 0; }
}
public override int CompareTo(Transaction? obj) {

View File

@ -57,7 +57,7 @@ internal class TransactionParserContext {
public Dictionary<string, long> 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<bool>() { 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;

View File

@ -108,7 +108,7 @@
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="High" x:Name="High" Click="High_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="On Foot" x:Name="OnFoot" Click="OnFoot_Click"/>
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
</StackPanel>

View File

@ -285,7 +285,7 @@ public partial class MainWindow : Window {
return;
}
transaction.Grade = "Low";
transaction.Grade = CombatZone.DifficultyLow;
RefreshView();
}
@ -295,7 +295,7 @@ public partial class MainWindow : Window {
return;
}
transaction.Grade = "Medium";
transaction.Grade = CombatZone.DifficultyMedium;
RefreshView();
}
@ -305,17 +305,17 @@ public partial class MainWindow : Window {
return;
}
transaction.Grade = "High";
transaction.Grade = CombatZone.DifficultyHigh;
RefreshView();
}
private void OnFoot_Click(object sender, RoutedEventArgs e) {
private void Ground_Click(object sender, RoutedEventArgs e) {
CombatZone transaction = GetTransaction<CombatZone>(sender);
if (transaction == null) {
return;
}
transaction.Type = "On Foot";
transaction.Type = CombatZone.GroundCombatZone;
RefreshView();
}
@ -325,7 +325,7 @@ public partial class MainWindow : Window {
return;
}
transaction.Type = "Ship";
transaction.Type = CombatZone.ShipCombatZone;
RefreshView();
}