using System.Collections.Generic; using System.Text; using EDPlayerJournal.Entries; namespace EDPlayerJournal.BGS; public class MissionCompleted : Transaction { public MissionCompletedEntry? CompletedEntry { get; set; } public MissionAcceptedEntry? AcceptedEntry { get; set; } public MissionCompleted() { } public override string CompletedAt { get { if (CompletedEntry == null) { return ""; } return CompletedEntry.Timestamp.ToString("dd.MM.yyyy HH:mm UTC"); } } public string MissionName { get { if (CompletedEntry == null || CompletedEntry.Mission == null) { return ""; } return CompletedEntry.Mission.FriendlyName; } } public string Influence { get { if (CompletedEntry == null || Faction == null || CompletedEntry.Mission == null) { return ""; } return (CompletedEntry.Mission.GetInfluenceForFaction(Faction, SystemAddress) ?? ""); } } /// /// Rescue missions contribute to the system. /// public override bool SystemContribution { get { if (AcceptedEntry == null || AcceptedEntry.Mission == null || AcceptedEntry.Mission.Name == null) { return false; } // If the mission starts with the name for thargoid war mission // names, we assume its a system contribution if (AcceptedEntry.Mission.Name.Contains("Mission_TW_")) { return true; } return false; } } public override string ToString() { if (Faction == null || CompletedEntry == null || CompletedEntry.Mission == null) { return ""; } StringBuilder builder = new StringBuilder(); var influence = CompletedEntry.Mission.GetInfluenceForFaction(Faction, SystemAddress); builder.AppendFormat("{0}", MissionName); if (influence != "") { builder.AppendFormat(", Influence: {0}", influence); } return builder.ToString(); } }