collate combat zones

This commit is contained in:
Florian Stinglmayr 2022-11-26 16:27:51 +01:00
parent 0cc8a1f29a
commit 697cbc2bc6

View File

@ -1,6 +1,31 @@
using EDPlayerJournal.BGS; using EDPlayerJournal;
using EDPlayerJournal.BGS;
using System.Linq;
using System.Text;
namespace EliteBGS.LogGenerator; namespace EliteBGS.LogGenerator;
class CombatZoneFormat : GenericFormat<CombatZone> { class CombatZoneFormat : LogFormatter {
public string GenerateLog(Objective objective) {
var logs = objective
.EnabledOfType<CombatZone>()
.GroupBy(x => new { x.Type, x.Grade })
.ToDictionary(x => x.Key, x => x.ToList())
;
StringBuilder builder = new StringBuilder();
if (logs == null || logs.Count() <= 0) {
return "";
}
foreach (var log in logs) {
builder.AppendFormat("Won {0}x {1} {2} Combat Zones\n",
log.Value.Count,
log.Key.Grade,
log.Key.Type
);
}
return builder.ToString().Trim();
}
} }