using System.Text; using EDPlayerJournal.Entries; namespace EDPlayerJournal.BGS; public class MissionCompleted : Transaction { public MissionCompleted() { } public MissionCompleted(MissionCompletedEntry e) { Entries.Add(e); } public string MissionName { get { MissionCompletedEntry? c = Entries[0] as MissionCompletedEntry; if (c == null) { return ""; } if (string.IsNullOrEmpty(c.HumanReadableName)) { return (c.Name ?? ""); } else { return c.HumanReadableName; } } } public string Influence { get { MissionCompletedEntry? e = (Entries[0] as MissionCompletedEntry); if (e == null || Faction == null) { return ""; } if (SystemAddress == 0) { return (e.GetInfluenceForFaction(Faction) ?? ""); } else { return (e.GetInfluenceForFaction(Faction, SystemAddress) ?? ""); } } } public override string ToString() { if (Faction == null || Entries.Count <= 0) { return ""; } StringBuilder builder = new StringBuilder(); var entry = Entries[0] as MissionCompletedEntry; if (entry == null) { return ""; } var influence = entry.GetInfluenceForFaction(Faction, SystemAddress); builder.AppendFormat("{0}", MissionName); if (influence != "") { builder.AppendFormat(", Influence: {0}", influence); } return builder.ToString(); } }