add a Mission class for accepted missions
This commit is contained in:
@@ -9,8 +9,11 @@ public class MissionFailed : Transaction {
|
||||
public MissionFailed() { }
|
||||
|
||||
public MissionFailed(MissionAcceptedEntry accepted) {
|
||||
if (accepted.Mission == null) {
|
||||
throw new Exception("Mission cannot be null");
|
||||
}
|
||||
Accepted = accepted;
|
||||
Faction = accepted.Faction;
|
||||
Faction = accepted.Mission.Faction;
|
||||
}
|
||||
|
||||
public override int CompareTo(Transaction? other) {
|
||||
|
||||
@@ -401,7 +401,11 @@ public class Report {
|
||||
continue;
|
||||
}
|
||||
|
||||
ulong id = accepted.MissionID;
|
||||
if (accepted.Mission == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ulong id = accepted.Mission.MissionID;
|
||||
|
||||
if (!acceptedMissions.ContainsKey(id)) {
|
||||
acceptedMissions[id] = accepted;
|
||||
@@ -429,23 +433,27 @@ public class Report {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (accepted.Mission == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!acceptedSystems.TryGetValue(failed.MissionID, out accepted_address)) {
|
||||
OnLog?.Invoke(string.Format(
|
||||
"Unable to figure out in which system mission \"{0}\" was accepted.", accepted.Name
|
||||
"Unable to figure out in which system mission \"{0}\" was accepted.", accepted.Mission.Name
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!systems.TryGetValue(accepted_address, out accepted_system)) {
|
||||
OnLog?.Invoke(string.Format(
|
||||
"Unable to figure out in which system mission \"{0}\" was accepted.", accepted.Name
|
||||
"Unable to figure out in which system mission \"{0}\" was accepted.", accepted.Mission.Name
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!acceptedStations.TryGetValue(failed.MissionID, out accepted_station)) {
|
||||
OnLog?.Invoke(string.Format(
|
||||
"Unable to figure out in which station mission \"{0}\" was accepted.", accepted.Name
|
||||
"Unable to figure out in which station mission \"{0}\" was accepted.", accepted.Mission.Name
|
||||
));
|
||||
continue;
|
||||
}
|
||||
@@ -454,7 +462,7 @@ public class Report {
|
||||
Failed = failed,
|
||||
System = accepted_system,
|
||||
Station = accepted_station,
|
||||
Faction = accepted.Faction,
|
||||
Faction = accepted.Mission.Faction,
|
||||
SystemAddress = accepted_address,
|
||||
});
|
||||
|
||||
|
||||
@@ -53,7 +53,11 @@ internal class TransactionParserContext {
|
||||
throw new Exception("Mission accepted without knowing where.");
|
||||
}
|
||||
|
||||
AcceptedMissions.TryAdd(accepted.MissionID, accepted);
|
||||
if (accepted.Mission == null) {
|
||||
throw new Exception("Mission is null");
|
||||
}
|
||||
|
||||
AcceptedMissions.TryAdd(accepted.Mission.MissionID, accepted);
|
||||
|
||||
Location location = new() {
|
||||
StarSystem = CurrentSystem,
|
||||
@@ -61,7 +65,7 @@ internal class TransactionParserContext {
|
||||
Station = (CurrentStation ?? ""),
|
||||
};
|
||||
|
||||
AcceptedMissionLocation.TryAdd(accepted.MissionID, location);
|
||||
AcceptedMissionLocation.TryAdd(accepted.Mission.MissionID, location);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +412,7 @@ internal class MissionFailedParser : TransactionParserPart {
|
||||
|
||||
transactions.Add(new MissionFailed() {
|
||||
Accepted = accepted,
|
||||
Faction = accepted.Faction,
|
||||
Faction = accepted.Mission?.Faction,
|
||||
Failed = entry,
|
||||
Station = accepted_location.Station,
|
||||
System = accepted_location.StarSystem,
|
||||
|
||||
Reference in New Issue
Block a user