using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using EDJournal; namespace EliteBGS.BGS { /// /// 36 Lessons of Vivec, Lesson 36 /// public class FoulMurder : LogEntry { 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(LogEntry other) { if (other == null || other.GetType() != typeof(FoulMurder)) { return -1; } FoulMurder hortator = other as FoulMurder; if (Faction == other.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(); } } }