Compare commits

..

No commits in common. "0b47b7331eea9e3ad1feed8cab02be06a515f6ad" and "132d090fd574303c1d76837a1dcfb810a58c6f83" have entirely different histories.

2 changed files with 21 additions and 12 deletions

View File

@ -36,6 +36,10 @@ public class MissionFailed : Transaction {
return -1;
}
public int Amount {
get { return Entries.Count + 1; }
}
public override string ToString() {
StringBuilder builder = new StringBuilder();
@ -43,7 +47,8 @@ public class MissionFailed : Transaction {
return "";
}
builder.AppendFormat(" Mission failed: \"{0}\"",
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
Amount,
Mission?.FriendlyName
);

View File

@ -8,24 +8,28 @@ namespace EliteBGS.LogGenerator;
public class FailedMissionFormat : LogFormatter {
public string GenerateLog(Objective objective) {
var missions = objective.EnabledOfType<MissionFailed>();
StringBuilder builder = new StringBuilder();
if (missions.Count <= 0) {
return "";
}
StringBuilder builder = new StringBuilder();
foreach (var failed in missions) {
MissionFailedEntry f = failed.Failed;
string name;
var grouping = missions
.GroupBy(x => x.Mission.IsOnFoot)
;
foreach (var group in grouping) {
int amount = group.Count();
if (group.Key) {
builder.AppendFormat("Failed {0} On Foot Mission(s)\n", amount);
if (!string.IsNullOrEmpty(f.Mission.FriendlyName)) {
name = f.Mission.FriendlyName;
} else if (!string.IsNullOrEmpty(f.Mission.LocalisedName)) {
name = f.Mission.LocalisedName;
} else {
builder.AppendFormat("Failed {0} Ship Mission(s)\n", amount);
name = f.Mission.Name;
}
if (!string.IsNullOrEmpty(failed.Faction)) {
builder.AppendFormat("Failed mission \"{0}\" targeting {1}\n", name, failed.Faction);
} else {
builder.AppendFormat("Failed mission \"{0}\"\n", name);
}
}