From 697cbc2bc6d8d7b55937c05a01c5ca5a8f1724e2 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Sat, 26 Nov 2022 16:27:51 +0100 Subject: [PATCH] collate combat zones --- EliteBGS/LogGenerator/CombatZoneFormat.cs | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/EliteBGS/LogGenerator/CombatZoneFormat.cs b/EliteBGS/LogGenerator/CombatZoneFormat.cs index ab60ac3..825f0b5 100644 --- a/EliteBGS/LogGenerator/CombatZoneFormat.cs +++ b/EliteBGS/LogGenerator/CombatZoneFormat.cs @@ -1,6 +1,31 @@ -using EDPlayerJournal.BGS; +using EDPlayerJournal; +using EDPlayerJournal.BGS; +using System.Linq; +using System.Text; namespace EliteBGS.LogGenerator; -class CombatZoneFormat : GenericFormat { +class CombatZoneFormat : LogFormatter { + public string GenerateLog(Objective objective) { + var logs = objective + .EnabledOfType() + .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(); + } }