2022-12-03 14:16:45 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2022-11-01 18:01:28 +01:00
|
|
|
|
using EDPlayerJournal.Entries;
|
|
|
|
|
|
|
|
|
|
namespace EDPlayerJournal.BGS;
|
|
|
|
|
|
|
|
|
|
public class MissionCompleted : Transaction {
|
2022-12-03 14:16:45 +01:00
|
|
|
|
public MissionCompletedEntry? CompletedEntry { get; set; }
|
|
|
|
|
|
|
|
|
|
public MissionAcceptedEntry? AcceptedEntry { get; set; }
|
|
|
|
|
|
2022-12-20 18:33:09 +01:00
|
|
|
|
public Mission? Mission { get; set; }
|
|
|
|
|
|
2022-11-01 18:01:28 +01:00
|
|
|
|
public MissionCompleted() { }
|
2022-12-03 14:16:45 +01:00
|
|
|
|
|
2022-12-09 17:51:46 +01:00
|
|
|
|
public override DateTime? CompletedAtDateTime {
|
2022-12-03 14:16:45 +01:00
|
|
|
|
get {
|
|
|
|
|
if (CompletedEntry == null) {
|
2022-12-09 17:51:46 +01:00
|
|
|
|
return null;
|
2022-12-03 14:16:45 +01:00
|
|
|
|
}
|
2022-12-09 17:51:46 +01:00
|
|
|
|
return CompletedEntry.Timestamp;
|
2022-12-03 14:16:45 +01:00
|
|
|
|
}
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string MissionName {
|
|
|
|
|
get {
|
2022-12-03 14:16:45 +01:00
|
|
|
|
if (CompletedEntry == null || CompletedEntry.Mission == null) {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-03 14:16:45 +01:00
|
|
|
|
return CompletedEntry.Mission.FriendlyName;
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Influence {
|
|
|
|
|
get {
|
2022-12-03 14:16:45 +01:00
|
|
|
|
if (CompletedEntry == null || Faction == null || CompletedEntry.Mission == null) {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-03 14:16:45 +01:00
|
|
|
|
return (CompletedEntry.Mission.GetInfluenceForFaction(Faction, SystemAddress) ?? "");
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-03 15:01:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Rescue missions contribute to the system.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public override bool SystemContribution {
|
|
|
|
|
get {
|
2022-12-20 18:33:09 +01:00
|
|
|
|
if (Mission == null || Mission.Name == null) {
|
2022-12-03 15:01:46 +01:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-07 23:08:31 +01:00
|
|
|
|
// If the mission starts with the name for thargoid war mission
|
|
|
|
|
// names, we assume its a system contribution
|
2022-12-20 18:33:09 +01:00
|
|
|
|
if (Mission.Name.Contains("Mission_TW_")) {
|
2022-12-03 15:01:46 +01:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-01 18:01:28 +01:00
|
|
|
|
public override string ToString() {
|
2022-12-03 14:16:45 +01:00
|
|
|
|
if (Faction == null || CompletedEntry == null || CompletedEntry.Mission == null) {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
2022-12-03 14:16:45 +01:00
|
|
|
|
var influence = CompletedEntry.Mission.GetInfluenceForFaction(Faction, SystemAddress);
|
2022-11-01 18:01:28 +01:00
|
|
|
|
|
|
|
|
|
builder.AppendFormat("{0}", MissionName);
|
|
|
|
|
if (influence != "") {
|
|
|
|
|
builder.AppendFormat(", Influence: {0}", influence);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|