grade can be null
This commit is contained in:
parent
1a8c163fc4
commit
d8ac2a7ee7
@ -43,7 +43,7 @@ public class CombatZones {
|
||||
/// Returns the given combat zone difficulty as an integer, so it can be sorted.
|
||||
/// 0 = lowest difficulty, 1 = medium and so forth.
|
||||
/// </summary>
|
||||
public static int? DifficultyRank(string difficulty) {
|
||||
public static int? DifficultyRank(string? difficulty) {
|
||||
Dictionary<string, int> ranks = new() {
|
||||
{ DifficultyLow, 0 },
|
||||
{ DifficultyMedium, 1 },
|
||||
@ -51,6 +51,10 @@ public class CombatZones {
|
||||
{ DifficultyVeryHigh, 3 }
|
||||
};
|
||||
|
||||
if (difficulty == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ranks.TryGetValue(difficulty, out int rank)) {
|
||||
return rank;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class CombatZoneFormat : LogFormatter {
|
||||
public string GenerateLog(Objective objective) {
|
||||
var logs = objective
|
||||
.EnabledOfType<CombatZone>()
|
||||
.OrderBy(x => CombatZones.DifficultyRank(x.Grade))
|
||||
.OrderBy(x => (CombatZones.DifficultyRank(x.Grade) ?? 0))
|
||||
.GroupBy(x => new { x.Type, x.Grade })
|
||||
.ToDictionary(x => x.Key, x => x.ToList())
|
||||
;
|
||||
@ -48,7 +48,7 @@ class CombatZoneFormat : LogFormatter {
|
||||
public string GenerateSummary(Objective objective) {
|
||||
var logs = objective
|
||||
.EnabledOfType<CombatZone>()
|
||||
.OrderBy(x => CombatZones.DifficultyRank(x.Grade))
|
||||
.OrderBy(x => (CombatZones.DifficultyRank(x.Grade) ?? 0))
|
||||
.GroupBy(x => new { x.Type, x.Grade })
|
||||
.ToDictionary(x => x.Key, x => x.ToList())
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user