using Newtonsoft.Json.Linq; namespace EDPlayerJournal; public class Mission : IComparable { public ulong MissionID { get; set; } = 0; /// /// Name of the mission, in machine readable format. /// public string? Name { get; set; } /// /// Localised, human readable mission name. /// public string? LocalisedName { get; set; } /// /// Target of the mission. Optional. /// public string? Target { get; set; } /// /// Target of the mission as a localised human readable string. /// public string? TargetLocalised { get; set; } /// /// Target system of the mission /// public string? DestinationSystem { get; set; } /// /// Destination station. /// public string? DestinationStation { get; set; } /// /// Destination settlement /// public string? DestinationSettlement { get; set; } /// /// In case of redirection, these values denote the new system. /// public string? NewDestinationSystem { get; set; } /// /// In case of redirection, these values denote the new station. /// public string? NewDestinationStation { get; set; } /// /// Faction offering the mission. /// public string? Faction { get; set; } /// /// Target faction (for example for courier missions). /// public string? TargetFaction { get; set; } /// /// Whether the mission is a wing message. /// public bool Wing { get; set; } = false; /// /// Expiry date for the mission. /// public string? Expiry { get; set; } /// /// Influence reward offered. This is for accepting missions only, see the /// mission effects for actual effects once the mission is complete. /// public string? Influence { get; set; } /// /// Reputation reward offered. /// public string? Reputation { get; set; } /// /// Number of kills required for massacre missions. /// public ulong? KillCount { get; set; } /// /// Monatery reward offered for the mission. Optional, as donate missions don't give /// a monatery reward. /// public ulong? Reward { get; set; } /// /// Amount donated for donation missions, optional. If this is null, then /// the mission was not a donation mission. /// public ulong? Donation { get; set; } /// /// Actual amount donated. /// public ulong? Donated { get; set; } /// /// Commodity delivered, or donated. Optional, if this is null, then no /// commodity was donated or delivered. /// public string? Commodity { get; set; } /// /// Amount of the commodity donated or delivered. Optional. /// public ulong? Count { get; set; } /// /// How many passengers are being transported. /// public ulong? PassengerCount { get; set; } /// /// If the passengers are VIPs. /// public bool? PassengerVIPs { get; set; } /// /// If the passengers are wanted. /// public bool? PassengerWanted { get; set; } /// /// What sort of passengers are being transported. /// public string? PassengerType { get; set; } public int CompareTo(Mission? other) { if (other == null) { return 1; } return MissionID.CompareTo(other.MissionID); } private static Mission FromJSON(JObject o) { Mission mission = new Mission(); mission.MissionID = o.Value("MissionID") ?? 0; mission.Reputation = o.Value("Reputation"); mission.Influence = o.Value("Influence"); mission.DestinationSystem = o.Value("DestinationSystem"); mission.DestinationSettlement = o.Value("DestinationSettlement"); mission.DestinationStation = o.Value("DestinationStation"); mission.NewDestinationSystem = o.Value("NewDestinationSystem"); mission.NewDestinationStation = o.Value("NewDestinationSystem"); mission.Reward = o.Value("Reward"); mission.Target = o.Value("Target"); mission.TargetLocalised = o.Value("Target_Localised"); mission.Expiry = o.Value("Expiry")?.ToString(); mission.Wing = o.Value("Wing") ?? false; mission.Name = o.Value("Name"); mission.LocalisedName = o.Value("LocalisedName"); mission.Faction = o.Value("Faction"); mission.Donation = o.Value("Donation"); mission.Donated = o.Value("Donated"); mission.PassengerCount = o.Value("PassengerCount"); mission.PassengerVIPs = o.Value("PassengerVIPs"); mission.PassengerWanted = o.Value("PassengerWanted"); mission.PassengerType = o.Value("PassengerType"); mission.KillCount = o.Value("KillCount"); return mission; } public static Mission FromMissionAccepted(JObject o) { return FromJSON(o); } }