Skip to content

Commit

Permalink
Saboteur Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Jul 21, 2024
1 parent 5377ad9 commit 61151e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@
## OSC Documentation
<details><summary>Parameter Names & Types</summary><p>
<pre>
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
</pre>
</p></details>

Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Utils/LilOSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 61151e9

Please sign in to comment.