79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
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) ?? "");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Rescue missions contribute to the system.
|
|
/// </summary>
|
|
public override bool SystemContribution {
|
|
get {
|
|
if (AcceptedEntry == null ||
|
|
AcceptedEntry.Mission == null ||
|
|
AcceptedEntry.Mission.Name == null) {
|
|
return false;
|
|
}
|
|
|
|
if (AcceptedEntry.Mission.IsRescueMission &&
|
|
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();
|
|
}
|
|
}
|