EDBGS/EDPlayerJournal/BGS/InfluenceSupport.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2022-11-01 18:01:28 +01:00
using System.Text;
using EDPlayerJournal.Entries;
namespace EDPlayerJournal.BGS;
/// <summary>
/// This class is used when a completed mission gives influence to another
/// faction as well. This happens, for example, when you deliver cargo from one
/// faction to another. Both sometimes gain influence.
/// </summary>
public class InfluenceSupport : Transaction {
public string Influence { get; set; } = "";
public MissionCompletedEntry? RelevantMission { get; set; }
public override string CompletedAt {
get {
if (RelevantMission == null) {
return "";
}
return RelevantMission.Timestamp.ToString("dd.MM.yyyy hh:mm UTC");
}
}
public override string ToString() {
StringBuilder builder = new StringBuilder();
string? missionname;
if (RelevantMission != null && RelevantMission.Mission != null) {
missionname = RelevantMission.Mission.LocalisedName;
2022-11-01 18:01:28 +01:00
} else {
missionname = "UNKNOWN MISSION";
}
if (missionname == null) {
return "";
}
builder.AppendFormat("Influence gained from \"{0}\": \"{1}\"",
missionname,
string.IsNullOrEmpty(Influence) ? "NONE" : Influence
);
return builder.ToString();
}
}