using EDPlayerJournal; using EDPlayerJournal.BGS; using System.Text; using System.Linq; namespace EliteBGS.LogGenerator; public class MurderFormat : LogFormatter { public string GenerateLog(Objective objective) { var logs = objective .EnabledOfType() .GroupBy(x => x.CrimeType) .ToDictionary(x => x.Key, x => x.ToList()) ; StringBuilder builder = new StringBuilder(); if (logs == null || logs.Count() <= 0) { return ""; } foreach (var log in logs) { string type; if (string.Compare(log.Key, CrimeTypes.Murder) == 0) { if (log.Value.Count > 1) { type = "ships"; } else { type = "ship"; } } else { if (log.Value.Count > 1) { type = "people"; } else { type = "person"; } } long bounties = log.Value.Sum(x => x.Bounties); builder.AppendFormat("Murdered {0} {1} (Bounties: {2})\n", log.Value.Count, type, Credits.FormatMillions(bounties) ); } return builder.ToString().Trim(); } public string GenerateSummary(Objective objective) { long murders = objective .EnabledOfType() .Where(x => x.CrimeType == CrimeTypes.Murder || x.CrimeType == CrimeTypes.OnFootMurder) .Count() ; if (murders <= 0) { return ""; } return string.Format("Kills: {0}", murders); } }