store optional events in combat zone

This commit is contained in:
Florian Stinglmayr 2022-11-28 19:40:33 +01:00
parent 65fec2cd1e
commit dd1d7ff091
2 changed files with 51 additions and 3 deletions

View File

@ -3,9 +3,52 @@ using System.Linq;
namespace EDPlayerJournal.BGS;
public class CombatZone : Transaction {
public string Type { get; set; } = "";
public string Grade { get; set; } = "";
public int Amount { get; set; } = 0;
/// <summary>
/// Type, either on foot or ship
/// </summary>
public string Type { get; set; } = "Ship";
/// <summary>
/// Difficulty type, low, medium or high.
/// </summary>
public string Grade { get; set; } = "Low";
/// <summary>
/// How many?
/// </summary>
public int Amount { get; set; } = 1;
/// <summary>
/// Whether spec ops were won.
/// </summary>
public bool? SpecOps { get; set; }
/// <summary>
/// Whether captain was won
/// </summary>
public bool? Captain { get; set; }
/// <summary>
/// Whether correspondent objective was won
/// </summary>
public bool? Correspondent { get; set; }
/// <summary>
/// Whether cap ship objective was won
/// </summary>
public bool? CapitalShip { get; set; }
/// <summary>
/// How many optional objectives were completed?
/// </summary>
public int OptionalObjectivesCompleted {
get {
return new List<bool?>() { SpecOps, Captain, Correspondent, CapitalShip }
.Where(x => x != null && x == true)
.Count()
;
}
}
public override int CompareTo(Transaction? obj) {
if (obj == null || obj.GetType() != typeof(CombatZone)) {

View File

@ -106,6 +106,11 @@ internal class TransactionParserContext {
Faction = LastRecordedAwardingFaction,
Grade = grade,
Type = cztype,
// Sad truth is, if HaveSeenXXX is false, we just don't know for certain
CapitalShip = HaveSeenCapShip ? true : null,
SpecOps = HaveSeenSpecOps ? true : null,
Correspondent = HaveSeenCorrespondent ? true : null,
Captain = HaveSeenCaptain ? true : null,
Amount = 1,
};
zone.Entries.Add(e);