From f77f5bc3b4961eac876a50529170e9b23ff16870 Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 14 Jan 2024 02:09:54 +0100 Subject: [PATCH] Add "Over" Roundstate --- OpenCS2hock/CS2MessageHandler.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenCS2hock/CS2MessageHandler.cs b/OpenCS2hock/CS2MessageHandler.cs index 14a8cc0..bea9585 100644 --- a/OpenCS2hock/CS2MessageHandler.cs +++ b/OpenCS2hock/CS2MessageHandler.cs @@ -18,10 +18,12 @@ public class CS2MessageHandler RoundState currentRoundState = ParseRoundStateFromString(messageJson.SelectToken("round.phase", false)?.Value()); RoundState previousRoundState = ParseRoundStateFromString(messageJson.SelectToken("previously.round.phase", false)?.Value()); - if(previousRoundState == RoundState.FreezeTime && currentRoundState == RoundState.Live) + if(previousRoundState == RoundState.Over && currentRoundState == RoundState.Live) OnRoundStart?.Invoke(); if(previousRoundState == RoundState.Live && currentRoundState == RoundState.FreezeTime) OnRoundEnd?.Invoke(); + if(previousRoundState == RoundState.Live && currentRoundState == RoundState.Over) + OnRoundEnd?.Invoke(); Team playerTeam = ParseTeamFromString(messageJson.SelectToken("player.team", false)?.Value()); Team winnerTeam = ParseTeamFromString(messageJson.SelectToken("round.win_team", false)?.Value()); @@ -47,6 +49,7 @@ public class CS2MessageHandler { "live" => RoundState.Live, "freezetime" => RoundState.FreezeTime, + "over" => RoundState.Over, _ => RoundState.Unknown }; } @@ -61,7 +64,7 @@ public class CS2MessageHandler }; } - private enum RoundState {FreezeTime, Live, Unknown} + private enum RoundState {FreezeTime, Live, Over, Unknown} private enum Team {T, CT, None} } \ No newline at end of file