2022-11-01 18:01:28 +01:00
|
|
|
|
using System.Text;
|
|
|
|
|
using EDPlayerJournal.Entries;
|
|
|
|
|
|
|
|
|
|
namespace EDPlayerJournal.BGS;
|
|
|
|
|
|
|
|
|
|
public class MissionCompleted : Transaction {
|
|
|
|
|
public MissionCompleted() { }
|
|
|
|
|
public MissionCompleted(MissionCompletedEntry e) {
|
|
|
|
|
Entries.Add(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string MissionName {
|
|
|
|
|
get {
|
|
|
|
|
MissionCompletedEntry? c = Entries[0] as MissionCompletedEntry;
|
2022-11-24 15:53:40 +01:00
|
|
|
|
if (c == null || c.Mission == null) {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-25 10:44:48 +01:00
|
|
|
|
return c.Mission.FriendlyName;
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Influence {
|
|
|
|
|
get {
|
|
|
|
|
MissionCompletedEntry? e = (Entries[0] as MissionCompletedEntry);
|
|
|
|
|
|
2022-11-24 15:53:40 +01:00
|
|
|
|
if (e == null || Faction == null || e.Mission == null) {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 15:53:40 +01:00
|
|
|
|
return (e.Mission.GetInfluenceForFaction(Faction, SystemAddress) ?? "");
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString() {
|
|
|
|
|
if (Faction == null || Entries.Count <= 0) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
var entry = Entries[0] as MissionCompletedEntry;
|
|
|
|
|
|
2022-11-24 15:53:40 +01:00
|
|
|
|
if (entry == null || entry.Mission == null) {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 15:53:40 +01:00
|
|
|
|
var influence = entry.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();
|
|
|
|
|
}
|
|
|
|
|
}
|