From 1f673970eedbcbfc5a34268b22aa6dd8509fc267 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Wed, 7 Dec 2022 22:43:24 +0100 Subject: [PATCH] fix formatting of combat zones --- EDPlayerJournal/BGS/CombatZone.cs | 2 +- EliteBGS/LogGenerator/CombatZoneFormat.cs | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/EDPlayerJournal/BGS/CombatZone.cs b/EDPlayerJournal/BGS/CombatZone.cs index a7a8229..178760a 100644 --- a/EDPlayerJournal/BGS/CombatZone.cs +++ b/EDPlayerJournal/BGS/CombatZone.cs @@ -91,7 +91,7 @@ public class CombatZone : Transaction { } public override string ToString() { - if (Grade != null) { + if (!string.IsNullOrEmpty(Grade)) { return string.Format("Won {0} {1} Combat Zone", Grade, Type); } else { return string.Format("Won {0} Combat Zone", Type); diff --git a/EliteBGS/LogGenerator/CombatZoneFormat.cs b/EliteBGS/LogGenerator/CombatZoneFormat.cs index 8d987be..1057047 100644 --- a/EliteBGS/LogGenerator/CombatZoneFormat.cs +++ b/EliteBGS/LogGenerator/CombatZoneFormat.cs @@ -22,11 +22,18 @@ class CombatZoneFormat : LogFormatter { int optionals = log.Value .Sum(x => x.OptionalObjectivesCompleted) ; - builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)", - log.Value.Count, - log.Key.Grade, - log.Key.Type - ); + if (!string.IsNullOrEmpty(log.Key.Grade)) { + builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)", + log.Value.Count, + log.Key.Grade, + log.Key.Type + ); + } else { + builder.AppendFormat("Won {0}x {1} Combat Zone(s)", + log.Value.Count, + log.Key.Type + ); + } if (optionals > 0) { builder.AppendFormat(" (with {0} optional objectives)", optionals);