From 61151e97638274e9555d5bc5aaa847383e0d96e4 Mon Sep 17 00:00:00 2001 From: Kittenji <41535779+ChrisFeline@users.noreply.github.com> Date: Sun, 21 Jul 2024 11:11:37 -0400 Subject: [PATCH] Saboteur Parameter --- README.md | 15 +++++++++------ Utils/LilOSC.cs | 6 +++++- Windows/MainWindow.cs | 2 ++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 658afa2..59c6cc6 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,14 @@ ## OSC Documentation
Parameter Names & Types

-ToN_RoundType  |  INT
-ToN_Terror1    |  INT
-ToN_Terror2    |  INT
-ToN_Terror3    |  INT
-ToN_OptedIn    |  BOOL
+Parameter Name | Type |
+---------------|------|--------------------------
+ToN_RoundType  | INT  | The current round type.
+ToN_Terror1    | INT  | The current terror index.
+ToN_Terror2    | INT  | The second terror index.
+ToN_Terror3    | INT  | The third terror index.
+ToN_OptedIn    | BOOL | Is the player opted-in at the lobby
+ToN_Saboteur   | BOOL | Is the player currently the Saboteur
 

@@ -66,7 +69,7 @@ ToN_OptedIn | BOOL 1 = Classic 2 = Fog 3 = Punished - 4 = Sabotage (44 If you are the Saboteour) + 4 = Sabotage 5 = Cracked 6 = Bloodbath 7 = Midnight diff --git a/Utils/LilOSC.cs b/Utils/LilOSC.cs index 8cd4623..460f938 100644 --- a/Utils/LilOSC.cs +++ b/Utils/LilOSC.cs @@ -14,6 +14,7 @@ internal static class LilOSC { const string ParamTerror2 = "ToN_Terror2"; const string ParamTerror3 = "ToN_Terror3"; const string ParamOptedIn = "ToN_OptedIn"; + const string ParamSaboteur = "ToN_Saboteur"; static bool IsDirty = false; @@ -22,6 +23,7 @@ internal static class LilOSC { static int LastTerror2 = -1; static int LastTerror3 = -1; static bool LastOptedIn = false; + static bool LastSaboteur = false; static bool IsOptedIn = false; public static TerrorMatrix TMatrix = TerrorMatrix.Empty; @@ -42,7 +44,7 @@ internal static void SendData(bool force = false) { if ((MainWindow.Started && IsDirty) || force) { IsDirty = false; - int value = TMatrix.IsSaboteour && TMatrix.RoundType == ToNRoundType.Sabotage ? 44 : (int)TMatrix.RoundType; + int value = (int)TMatrix.RoundType; if (LastRoundType != value || force) SendParam(ParamRoundType, LastRoundType = value); value = TMatrix.Terror1; @@ -54,6 +56,8 @@ internal static void SendData(bool force = false) { value = TMatrix.Terror3; if (LastTerror3 != value || force) SendParam(ParamTerror3, LastTerror3 = value); + if (LastSaboteur != TMatrix.IsSaboteour || force) SendParam(ParamSaboteur, LastSaboteur = TMatrix.IsSaboteour); + if (LastOptedIn != IsOptedIn || force) SendParam(ParamOptedIn, LastOptedIn = IsOptedIn); } } diff --git a/Windows/MainWindow.cs b/Windows/MainWindow.cs index fa7d5e3..7e3061e 100644 --- a/Windows/MainWindow.cs +++ b/Windows/MainWindow.cs @@ -599,6 +599,8 @@ private bool HandleTerrorIndex(string line, DateTime timestamp, LogContext conte if (isOptedIn || line.StartsWith(ROUND_LOST_KEYWORD)) { context.Set(ROUND_RESULT_KEY, isOptedIn ? ToNRoundResult.W : ToNRoundResult.D); + context.Rem(ROUND_IS_SABO_KEY); + if (context.IsRecent) LilOSC.SetTerrorMatrix(TerrorMatrix.Empty); return true; }