diff --git a/EDPlayerJournal/CombatZones.cs b/EDPlayerJournal/CombatZones.cs index f369459..0eec1c9 100644 --- a/EDPlayerJournal/CombatZones.cs +++ b/EDPlayerJournal/CombatZones.cs @@ -38,4 +38,23 @@ public class CombatZones { /// Very high difficulty, so far AX combat zone only /// public static readonly string DifficultyVeryHigh = "Very High"; + + /// + /// Returns the given combat zone difficulty as an integer, so it can be sorted. + /// 0 = lowest difficulty, 1 = medium and so forth. + /// + public static int? DifficultyRank(string difficulty) { + Dictionary ranks = new() { + { DifficultyLow, 0 }, + { DifficultyMedium, 1 }, + { DifficultyHigh, 2 }, + { DifficultyVeryHigh, 3 } + }; + + if (ranks.TryGetValue(difficulty, out int rank)) { + return rank; + } + + return null; + } } diff --git a/EliteBGS/LogGenerator/CombatZoneFormat.cs b/EliteBGS/LogGenerator/CombatZoneFormat.cs index 2304a10..e849bd8 100644 --- a/EliteBGS/LogGenerator/CombatZoneFormat.cs +++ b/EliteBGS/LogGenerator/CombatZoneFormat.cs @@ -9,6 +9,7 @@ class CombatZoneFormat : LogFormatter { public string GenerateLog(Objective objective) { var logs = objective .EnabledOfType() + .OrderBy(x => CombatZones.DifficultyRank(x.Grade)) .GroupBy(x => new { x.Type, x.Grade }) .ToDictionary(x => x.Key, x => x.ToList()) ; @@ -47,6 +48,7 @@ class CombatZoneFormat : LogFormatter { public string GenerateSummary(Objective objective) { var logs = objective .EnabledOfType() + .OrderBy(x => CombatZones.DifficultyRank(x.Grade)) .GroupBy(x => new { x.Type, x.Grade }) .ToDictionary(x => x.Key, x => x.ToList()) ;