From 96dc1a5c2f3d736e22deddee4a4d85a9d17c1ebf Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Sun, 23 Jan 2022 16:43:16 +0100 Subject: [PATCH] update crime entry --- CommitCrimeEntry.cs | 25 ++++++++++++------------- CrimeTypes.cs | 11 +++++++++++ edjournal.csproj | 1 + 3 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 CrimeTypes.cs diff --git a/CommitCrimeEntry.cs b/CommitCrimeEntry.cs index c2f0cdd..76d41e4 100644 --- a/CommitCrimeEntry.cs +++ b/CommitCrimeEntry.cs @@ -1,20 +1,19 @@ namespace EDJournal { public class CommitCrimeEntry : Entry { - private string crimetype = "assault"; - private string faction; - private string victim; - private int bounty = 0; - - public string CrimeType => crimetype; - public string Faction => faction; - public string Victim => victim; - public int Bounty => bounty; + public string CrimeType { get; set; } + public string Faction { get; set; } + public string Victim { get; set; } + public long Bounty { get; set; } protected override void Initialise() { - crimetype = JSON.Value("CrimeType") ?? "assault"; - faction = JSON.Value("Faction") ?? ""; - victim = JSON.Value("Victim") ?? ""; - bounty = JSON.Value("Bounty") ?? 0; + CrimeType = JSON.Value("CrimeType") ?? "assault"; + Faction = JSON.Value("Faction") ?? ""; + Victim = JSON.Value("Victim") ?? ""; + Bounty = JSON.Value("Bounty") ?? 0; + } + + public bool IsMurder { + get { return CrimeType?.CompareTo(CrimeTypes.Murder) == 0 || CrimeType?.CompareTo(CrimeTypes.OnFootMurder) == 0; } } } } diff --git a/CrimeTypes.cs b/CrimeTypes.cs new file mode 100644 index 0000000..805e13e --- /dev/null +++ b/CrimeTypes.cs @@ -0,0 +1,11 @@ +namespace EDJournal { + public class CrimeTypes { + public static readonly string Assault = "assault"; + public static readonly string Murder = "murder"; + public static readonly string OnFootArcCutterUse = "onFoot_arcCutterUse"; + public static readonly string OnFootDataTransfer = "onFoot_dataTransfer"; + public static readonly string OnFootIdentityTheft = "onFoot_identityTheft"; + public static readonly string OnFootMurder = "onFoot_murder"; + public static readonly string Piracy = "piracy"; + } +} diff --git a/edjournal.csproj b/edjournal.csproj index c62035c..e24f549 100644 --- a/edjournal.csproj +++ b/edjournal.csproj @@ -44,6 +44,7 @@ +