From 386c211de5baf32669564d87b5a9c9cc63063702 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 2 Nov 2024 23:51:59 +0100 Subject: [PATCH] Activity Change Event --- CS2GSI/CS2Event.cs | 1 + CS2GSI/CS2EventGenerator.cs | 3 +++ CS2GSI/CS2GSI.cs | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CS2GSI/CS2Event.cs b/CS2GSI/CS2Event.cs index f6e83dd..27ff43f 100644 --- a/CS2GSI/CS2Event.cs +++ b/CS2GSI/CS2Event.cs @@ -28,4 +28,5 @@ public enum CS2Event : byte { OnBombExploded = 24, AnyEvent = 25, AnyMessage = 26, + OnActivityChange = 27 } \ No newline at end of file diff --git a/CS2GSI/CS2EventGenerator.cs b/CS2GSI/CS2EventGenerator.cs index 13bd2dd..2cdabe0 100644 --- a/CS2GSI/CS2EventGenerator.cs +++ b/CS2GSI/CS2EventGenerator.cs @@ -15,6 +15,9 @@ internal static class CS2EventGenerator if(events.Count > 0) events.Add(new ValueTuple(CS2Event.AnyEvent, new CS2EventArgs(events.Count))); + + if (lastGameState.Player?.Activity != newGameState.Player?.Activity) + events.Add(new(CS2Event.OnActivityChange, new CS2EventArgs(newGameState.Player?.Activity))); events.Add(new ValueTuple(CS2Event.AnyMessage, new CS2EventArgs())); return events; diff --git a/CS2GSI/CS2GSI.cs b/CS2GSI/CS2GSI.cs index a0d4adc..4bcdea9 100644 --- a/CS2GSI/CS2GSI.cs +++ b/CS2GSI/CS2GSI.cs @@ -99,6 +99,7 @@ public class CS2GSI CS2Event.OnBombExploded => this.OnBombExploded, CS2Event.AnyEvent => this.AnyEvent, CS2Event.AnyMessage => this.AnyMessage, + CS2Event.OnActivityChange => this.OnActivityChange, _ => throw new ArgumentException(Resources.Unknown_Event, nameof(cs2Event)) }; } @@ -133,6 +134,7 @@ public class CS2GSI OnBombDefused, OnBombExploded, AnyEvent, - AnyMessage; + AnyMessage, + OnActivityChange; } \ No newline at end of file