sort combat zones
This commit is contained in:
		
							parent
							
								
									e864db8488
								
							
						
					
					
						commit
						831bf38e78
					
				| @ -38,4 +38,23 @@ public class CombatZones { | ||||
|     /// Very high difficulty, so far AX combat zone only | ||||
|     /// </summary> | ||||
|     public static readonly string DifficultyVeryHigh = "Very High"; | ||||
| 
 | ||||
|     /// <summary> | ||||
|     /// 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) { | ||||
|         Dictionary<string, int> ranks = new() { | ||||
|             { DifficultyLow, 0 }, | ||||
|             { DifficultyMedium, 1 }, | ||||
|             { DifficultyHigh, 2 }, | ||||
|             { DifficultyVeryHigh, 3 } | ||||
|         }; | ||||
| 
 | ||||
|         if (ranks.TryGetValue(difficulty, out int rank)) { | ||||
|             return rank; | ||||
|         } | ||||
| 
 | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -9,6 +9,7 @@ class CombatZoneFormat : LogFormatter { | ||||
|     public string GenerateLog(Objective objective) { | ||||
|         var logs = objective | ||||
|             .EnabledOfType<CombatZone>() | ||||
|             .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<CombatZone>() | ||||
|             .OrderBy(x => CombatZones.DifficultyRank(x.Grade)) | ||||
|             .GroupBy(x => new { x.Type, x.Grade }) | ||||
|             .ToDictionary(x => x.Key, x => x.ToList()) | ||||
|             ; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user