EDBGS/EDPlayerJournal/BGS/MissionCompleted.cs

57 lines
1.4 KiB
C#
Raw Normal View History

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;
if (c == null || c.Mission == null) {
2022-11-01 18:01:28 +01:00
return "";
}
return c.Mission.FriendlyName;
2022-11-01 18:01:28 +01:00
}
}
public string Influence {
get {
MissionCompletedEntry? e = (Entries[0] as MissionCompletedEntry);
if (e == null || Faction == null || e.Mission == null) {
2022-11-01 18:01:28 +01:00
return "";
}
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;
if (entry == null || entry.Mission == null) {
2022-11-01 18:01:28 +01:00
return "";
}
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();
}
}