using System.Linq; using System.Text; using EDPlayerJournal.Entries; using EDPlayerJournal.BGS; namespace EliteBGS.LogGenerator; public class FailedMissionFormat : LogFormatter { public string GenerateLog(Objective objective) { var missions = objective.EnabledOfType(); StringBuilder builder = new StringBuilder(); if (missions.Count <= 0) { return ""; } foreach (var failed in missions) { MissionFailedEntry f = failed.Failed; string name; if (!string.IsNullOrEmpty(f.Mission.FriendlyName)) { name = f.Mission.FriendlyName; } else if (!string.IsNullOrEmpty(f.Mission.LocalisedName)) { name = f.Mission.LocalisedName; } else { name = f.Mission.Name; } if (!string.IsNullOrEmpty(failed.Faction)) { builder.AppendFormat("Failed mission \"{0}\" targeting {1}\n", name, failed.Faction); } else { builder.AppendFormat("Failed mission \"{0}\"\n", name); } } return builder.ToString().Trim(); } }