EDBGS/EDPlayerJournal/BGS/InfluenceSupport.cs

55 lines
1.5 KiB
C#
Raw Permalink 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 MissionInfluence? Influence { get; set; } = null;
2022-12-03 14:16:45 +01:00
/// <summary>
/// Relevant mission completed entry
/// </summary>
2022-11-01 18:01:28 +01:00
public MissionCompletedEntry? RelevantMission { get; set; }
2022-12-03 14:16:45 +01:00
/// <summary>
2022-12-20 18:33:09 +01:00
/// Mission information
2022-12-03 14:16:45 +01:00
/// </summary>
2022-12-20 18:33:09 +01:00
public Mission? Mission { get; set; }
2022-12-03 14:16:45 +01:00
public override DateTime? CompletedAtDateTime {
2022-11-01 18:01:28 +01:00
get {
if (RelevantMission == null) {
return null;
2022-11-01 18:01:28 +01:00
}
return RelevantMission.Timestamp;
2022-11-01 18:01:28 +01:00
}
}
public override string ToString() {
StringBuilder builder = new StringBuilder();
string? missionname;
if (RelevantMission != null && RelevantMission.Mission != null) {
2022-11-26 17:32:08 +01:00
missionname = RelevantMission.Mission.FriendlyName;
2022-11-01 18:01:28 +01:00
} else {
missionname = "UNKNOWN MISSION";
}
if (missionname == null) {
return "";
}
builder.AppendFormat("Influence gained from \"{0}\": \"{1}\"",
missionname,
Influence == null ? "NONE" : Influence.TrendAdjustedInfluence
2022-11-01 18:01:28 +01:00
);
return builder.ToString();
}
}