using System.Text; using EDPlayerJournal.Entries; namespace EDPlayerJournal.BGS; /// /// 36 Lessons of Vivec, Sermon Thirty Six /// public class FoulMurder : Transaction { public FoulMurder() { } public FoulMurder (CommitCrimeEntry e) { Entries.Add(e); } public string? CrimeType { get { return Entries.OfType().First().CrimeType; } } public long Bounties => Entries.OfType().Sum(x => x.Bounty); public long Fines => Entries.OfType().Sum(x => x.Fine); public override int CompareTo(Transaction? other) { if (other == null || other.GetType() != typeof(FoulMurder)) { return -1; } FoulMurder? hortator = other as FoulMurder; if (hortator != null && Faction == hortator.Faction && CrimeType == hortator.CrimeType) { return 0; } return -1; } public override string ToString() { StringBuilder builder = new StringBuilder(); string type; if (CrimeType == CrimeTypes.Murder) { if (Entries.Count > 1) { type = "ships"; } else { type = "ship"; } } else { if (Entries.Count > 1) { type = "people"; } else { type = "person"; } } builder.AppendFormat("Murdered {0} {1} of {2} (Bounties: {3}, Fines: {4})", Entries.Count, type, Faction, Credits.FormatCredits(Bounties), Credits.FormatCredits(Fines) ); return builder.ToString(); } }