diff --git a/EDPlayerJournal/BGS/InfluenceSupport.cs b/EDPlayerJournal/BGS/InfluenceSupport.cs
index 2bf0ffc..af88659 100644
--- a/EDPlayerJournal/BGS/InfluenceSupport.cs
+++ b/EDPlayerJournal/BGS/InfluenceSupport.cs
@@ -10,8 +10,17 @@ namespace EDPlayerJournal.BGS;
///
public class InfluenceSupport : Transaction {
public string Influence { get; set; } = "";
+
+ ///
+ /// Relevant mission completed entry
+ ///
public MissionCompletedEntry? RelevantMission { get; set; }
+ ///
+ /// Mission accepted entry
+ ///
+ public MissionAcceptedEntry? AcceptedEntry { get; set; }
+
public override string CompletedAt {
get {
if (RelevantMission == null) {
diff --git a/EDPlayerJournal/BGS/MissionCompleted.cs b/EDPlayerJournal/BGS/MissionCompleted.cs
index fc8536b..c31997c 100644
--- a/EDPlayerJournal/BGS/MissionCompleted.cs
+++ b/EDPlayerJournal/BGS/MissionCompleted.cs
@@ -1,50 +1,52 @@
-using System.Text;
+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 MissionCompleted(MissionCompletedEntry e) {
- Entries.Add(e);
+
+ public override string CompletedAt {
+ get {
+ if (CompletedEntry == null) {
+ return "";
+ }
+ return CompletedEntry.Timestamp.ToString("dd.MM.yyyy HH:mm UTC");
+ }
}
public string MissionName {
get {
- MissionCompletedEntry? c = Entries[0] as MissionCompletedEntry;
- if (c == null || c.Mission == null) {
+ if (CompletedEntry == null || CompletedEntry.Mission == null) {
return "";
}
- return c.Mission.FriendlyName;
+ return CompletedEntry.Mission.FriendlyName;
}
}
public string Influence {
get {
- MissionCompletedEntry? e = (Entries[0] as MissionCompletedEntry);
-
- if (e == null || Faction == null || e.Mission == null) {
+ if (CompletedEntry == null || Faction == null || CompletedEntry.Mission == null) {
return "";
}
- return (e.Mission.GetInfluenceForFaction(Faction, SystemAddress) ?? "");
+ return (CompletedEntry.Mission.GetInfluenceForFaction(Faction, SystemAddress) ?? "");
}
}
public override string ToString() {
- if (Faction == null || Entries.Count <= 0) {
+ if (Faction == null || CompletedEntry == null || CompletedEntry.Mission == null) {
return "";
}
StringBuilder builder = new StringBuilder();
- var entry = Entries[0] as MissionCompletedEntry;
-
- if (entry == null || entry.Mission == null) {
- return "";
- }
-
- var influence = entry.Mission.GetInfluenceForFaction(Faction, SystemAddress);
+ var influence = CompletedEntry.Mission.GetInfluenceForFaction(Faction, SystemAddress);
builder.AppendFormat("{0}", MissionName);
if (influence != "") {
diff --git a/EDPlayerJournal/BGS/Report.cs b/EDPlayerJournal/BGS/Report.cs
index 53e15d5..61f0305 100644
--- a/EDPlayerJournal/BGS/Report.cs
+++ b/EDPlayerJournal/BGS/Report.cs
@@ -360,7 +360,9 @@ public class Report {
if (faction.Equals(source_faction_name) && system_address == accepted_address) {
/* This is the influence block for the origin of the mission.
*/
- main_mission = new MissionCompleted(completed) {
+ main_mission = new MissionCompleted() {
+ CompletedEntry = completed,
+ AcceptedEntry = accepted,
System = accepted_system,
Faction = source_faction_name,
SystemAddress = accepted_address,
diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs
index 3f971d6..3f74b27 100644
--- a/EDPlayerJournal/BGS/TransactionParser.cs
+++ b/EDPlayerJournal/BGS/TransactionParser.cs
@@ -499,7 +499,9 @@ internal class MissionCompletedParser : TransactionParserPart {
system_address == accepted_location.SystemAddress) {
// Source and target faction are the same, and this is the block
// for the source system. So we make a full mission completed entry.
- transactions.Add(new MissionCompleted(entry) {
+ transactions.Add(new MissionCompleted() {
+ CompletedEntry = entry,
+ AcceptedEntry = accepted,
System = accepted_location.StarSystem,
Faction = source_faction_name,
SystemAddress = accepted_location.SystemAddress,
@@ -513,6 +515,7 @@ internal class MissionCompletedParser : TransactionParserPart {
// differs. Sometimes missions go to different systems but to
// the same faction.
transactions.Add(new InfluenceSupport() {
+ AcceptedEntry = accepted,
Faction = faction,
Influence = influences.Value,
System = system,
diff --git a/EDPlayerJournal/Mission.cs b/EDPlayerJournal/Mission.cs
index adfc475..125cb41 100644
--- a/EDPlayerJournal/Mission.cs
+++ b/EDPlayerJournal/Mission.cs
@@ -109,6 +109,11 @@ public class MissionFactionEffects {
}
public class Mission : IComparable {
+ ///
+ /// Passenger type for refugees
+ ///
+ public static readonly string PassengerTypeRefugee = "PassengerRefugee";
+
public ulong MissionID { get; set; } = 0;
///
@@ -250,6 +255,31 @@ public class Mission : IComparable {
///
public List FactionEffects { get; set; } = new List();
+
+ public bool IsPassengerMission {
+ get {
+ if (PassengerCount == null || PassengerCount == 0) {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ public bool IsRescueMission {
+ get {
+ if (!IsPassengerMission) {
+ return false;
+ }
+
+ if (string.Compare(PassengerType, PassengerTypeRefugee) == 0) {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
///
/// Returns a friendly human-readable name for the mission. If a localised name is available
/// it will use that, baring that it will check EnglishMissionNames for a translation, and