EDBGS/EliteBGS/LogGenerator/FailedMissionFormat.cs

35 lines
910 B
C#
Raw Normal View History

2022-11-24 19:38:19 +01:00
using System.Linq;
using System.Text;
using EDPlayerJournal.Entries;
using EDPlayerJournal.BGS;
namespace EliteBGS.LogGenerator;
public class FailedMissionFormat : LogFormatter {
public string GenerateLog(Objective objective) {
var missions = objective.EnabledOfType<MissionFailed>();
if (missions.Count <= 0) {
return "";
}
2022-12-28 10:41:26 +01:00
StringBuilder builder = new StringBuilder();
2022-12-20 18:33:09 +01:00
2022-12-28 10:41:26 +01:00
var grouping = missions
.GroupBy(x => x.Mission.IsOnFoot)
;
foreach (var group in grouping) {
int amount = group.Count();
2022-12-20 18:33:09 +01:00
2022-12-28 10:41:26 +01:00
if (group.Key) {
builder.AppendFormat("Failed {0} On Foot Mission(s)\n", amount);
2022-12-20 18:33:09 +01:00
} else {
2022-12-28 10:41:26 +01:00
builder.AppendFormat("Failed {0} Ship Mission(s)\n", amount);
2022-12-20 18:33:09 +01:00
}
2022-11-24 19:38:19 +01:00
}
return builder.ToString().Trim();
}
}