From 11811f8b19c4b439511cb1022182ccf29f363be5 Mon Sep 17 00:00:00 2001 From: rampaa Date: Sat, 14 Dec 2024 20:08:30 +0300 Subject: [PATCH] Minor --- JL.Core/Statistics/Stats.cs | 43 +++++++++++-------------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/JL.Core/Statistics/Stats.cs b/JL.Core/Statistics/Stats.cs index c1776414..a63557fd 100644 --- a/JL.Core/Statistics/Stats.cs +++ b/JL.Core/Statistics/Stats.cs @@ -122,36 +122,19 @@ public static void IncrementStat(StatType type, long amount = 1) public static void ResetStats(StatsMode statsMode) { - switch (statsMode) + Stats stats = statsMode switch { - case StatsMode.Lifetime: - LifetimeStats.Characters = 0; - LifetimeStats.Lines = 0; - LifetimeStats.Time = TimeSpan.Zero; - LifetimeStats.CardsMined = 0; - LifetimeStats.TimesPlayedAudio = 0; - LifetimeStats.Imoutos = 0; - break; - - case StatsMode.Profile: - ProfileLifetimeStats.Characters = 0; - ProfileLifetimeStats.Lines = 0; - ProfileLifetimeStats.Time = TimeSpan.Zero; - ProfileLifetimeStats.CardsMined = 0; - ProfileLifetimeStats.TimesPlayedAudio = 0; - ProfileLifetimeStats.Imoutos = 0; - break; - - case StatsMode.Session: - SessionStats.Characters = 0; - SessionStats.Lines = 0; - SessionStats.Time = TimeSpan.Zero; - SessionStats.CardsMined = 0; - SessionStats.TimesPlayedAudio = 0; - SessionStats.Imoutos = 0; - break; - default: - throw new ArgumentOutOfRangeException(nameof(statsMode), statsMode, "Invalid StatsMode"); - } + StatsMode.Lifetime => LifetimeStats, + StatsMode.Profile => ProfileLifetimeStats, + StatsMode.Session => SessionStats, + _ => throw new ArgumentOutOfRangeException(nameof(statsMode), statsMode, "Invalid StatsMode") + }; + + stats.Characters = 0; + stats.Lines = 0; + stats.Time = TimeSpan.Zero; + stats.CardsMined = 0; + stats.TimesPlayedAudio = 0; + stats.Imoutos = 0; } }