Skip to content

Commit

Permalink
Merge pull request #52 from ChrisFeline/dev
Browse files Browse the repository at this point in the history
Add IsOptedIn to stats.
  • Loading branch information
ChrisFeline authored Oct 4, 2024
2 parents e82dbb3 + 9df4206 commit 4368feb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Localization/Language/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@
"STATS.LABEL_PLAYERSONLINE.TT": "Represents the amount of players in the instance.",
"STATS.LABEL_ITEMNAME": "Item Name",
"STATS.LABEL_ITEMNAME.TT": "The name of the current item held.",
"STATS.LABEL_ISOPTEDIN": "Is Opted In",
"STATS.LABEL_ISOPTEDIN.TT": "True if the player is opted-in onto the game. This means the player is outside the respawn zone.",

"STATS.LABEL_ROUNDSTUNS": "Round Stuns",
"STATS.LABEL_ROUNDSTUNS.TT": "Amount of times you have stunned a Terror in the round.",
Expand Down
1 change: 1 addition & 0 deletions Models/Stats/StatsData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ internal class StatsRound : StatsBase {

internal class StatsLobby : StatsData {
public int PlayersOnline { get; internal set; } = 0;
public bool IsOptedIn { get; internal set; } = false;

// Player data
public string DisplayName { get; internal set; } = "Unknown";
Expand Down
5 changes: 5 additions & 0 deletions Models/Stats/ToNStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public static void AddDamage(int damage, bool ready) {
if (ready) Add(KEY_DAMAGE, damage);
}

const string KEY_OPTEDIN_PLAYERS = nameof(StatsLobby.IsOptedIn);
public static void AddOptedIn(bool optedIn) {
Set(KEY_OPTEDIN_PLAYERS, optedIn);
}

const string KEY_ONLINE_PLAYERS = nameof(StatsLobby.PlayersOnline);
public static void AddPlayerCount(int players) {
Set(KEY_ONLINE_PLAYERS, players);
Expand Down
2 changes: 2 additions & 0 deletions Utils/LogParser/ToNGameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public static void SetAlive(bool isAlive) {

public static void SetOptedIn(bool isOptedIn) {
IsOptedIn = isOptedIn;

StatsWindow.SetOptedIn(IsOptedIn);
LilOSC.SetDirty();

WebSocketAPI.SendValue("OPTED_IN", IsOptedIn);
Expand Down
4 changes: 4 additions & 0 deletions Windows/StatsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ internal static void SetPageCount(int pages) {
ToNStats.AddPageCount(pages);
RefreshTable();
}
internal static void SetOptedIn(bool optedIn) {
ToNStats.AddOptedIn(optedIn);
RefreshTable();
}
internal static void SetPlayerCount(int playerCount) {
ToNStats.AddPlayerCount(playerCount);
RefreshTable();
Expand Down

0 comments on commit 4368feb

Please sign in to comment.