add number of passengers

This commit is contained in:
Florian Stinglmayr 2022-12-07 23:21:36 +01:00
parent 6f9d3a64ff
commit ea07c4dbcb

View File

@ -7,7 +7,8 @@ namespace EliteBGS.LogGenerator;
public class MissionFormat : LogFormatter {
public string GenerateLog(Objective objective) {
Dictionary<string, Dictionary<string, int>> collated = new Dictionary<string, Dictionary<string, int>>();
Dictionary<string, Dictionary<string, int>> collated = new();
Dictionary<string, ulong> passengers = new();
StringBuilder output = new StringBuilder();
int total_influence = 0;
@ -28,6 +29,15 @@ public class MissionFormat : LogFormatter {
++collated[m.MissionName][m.Influence];
total_influence += m.Influence.Length;
if (m.AcceptedEntry != null &&
m.AcceptedEntry.Mission != null &&
m.AcceptedEntry.Mission.IsPassengerMission) {
if (!passengers.ContainsKey(m.MissionName)) {
passengers[m.MissionName] = 0;
}
passengers[m.MissionName] += (m.AcceptedEntry.Mission.PassengerCount ?? 0);
}
}
foreach (var mission in collated) {
@ -37,8 +47,14 @@ public class MissionFormat : LogFormatter {
output.AppendFormat("Inf{0} x{1}, ", influence.Key, influence.Value);
}
output.Remove(output.Length - 2, 2); // remove last ", "
output.Append(")\n\n");
output.Append(")");
if (passengers.ContainsKey(mission.Key)) {
output.AppendFormat(" ({0} Passengers)", passengers[mission.Key]);
}
}
output.Append("\n\n");
var support = objective.EnabledOfType<InfluenceSupport>();
foreach (InfluenceSupport inf in support) {