EDBGS/EDPlayerJournal/Entries/CommitCrimeEntry.cs

31 lines
1.0 KiB
C#

namespace EDPlayerJournal.Entries;
public class CommitCrimeEntry : Entry {
public string? CrimeType { get; set; }
public string? Faction { get; set; }
public string? Victim { get; set; }
public string? VictimLocalised { get; set; }
public long Bounty { get; set; }
public long Fine { get; set; }
protected override void Initialise() {
CrimeType = JSON.Value<string>("CrimeType") ?? "assault";
Faction = JSON.Value<string>("Faction") ?? "";
Victim = JSON.Value<string>("Victim") ?? "";
VictimLocalised = JSON.Value<string>("Victim_Localised") ?? "";
Bounty = JSON.Value<long?>("Bounty") ?? 0;
Fine = JSON.Value<long?>("Fine") ?? 0;
}
public bool IsMurder {
get { return CrimeType?.CompareTo(CrimeTypes.Murder) == 0 || CrimeType?.CompareTo(CrimeTypes.OnFootMurder) == 0; }
}
public bool IsCrime(string crimetype) {
if (CrimeType == null) {
return false;
}
return string.Compare(CrimeType, crimetype) == 0;
}
}