From ba9eeb5bb4e45bea6dcd84b53c62cb79d1623f16 Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Wed, 13 Mar 2024 19:23:56 +0100 Subject: [PATCH] Check AC config in SetName/Color checks Previously this was not done causing these checks to be unconditionally enabled --- .../Net/Inner/Objects/InnerPlayerControl.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs index 958d8a9..cd9af28 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs @@ -647,9 +647,11 @@ namespace Impostor.Server.Net.Inner.Objects if (name != expected) { - _logger.LogWarning($"Client sent {nameof(RpcCalls.SetName)} with incorrect name"); - await SetNameAsync(expected); - return false; + if (await sender.Client.ReportCheatAsync(RpcCalls.SetName, CheatCategory.GameFlow, "Client sent SetName with incorrect name")) + { + await SetNameAsync(expected); + return false; + } } } else @@ -713,8 +715,10 @@ namespace Impostor.Server.Net.Inner.Objects { if (!RequestedColorId.Any()) { - _logger.LogWarning($"Client sent {nameof(RpcCalls.SetColor)} for a player that didn't request it"); - return false; + if (await sender.Client.ReportCheatAsync(RpcCalls.SetColor, CheatCategory.GameFlow, "Client sent SetColor for a player that didn't request it")) + { + return false; + } } var expected = RequestedColorId.Dequeue(); @@ -726,9 +730,11 @@ namespace Impostor.Server.Net.Inner.Objects if (color != expected) { - _logger.LogWarning($"Client sent {nameof(RpcCalls.SetColor)} with incorrect color"); - await SetColorAsync(expected); - return false; + if (await sender.Client.ReportCheatAsync(RpcCalls.SetColor, CheatCategory.GameFlow, "Client sent SetColor with incorrect color")) + { + await SetColorAsync(expected); + return false; + } } } -- 2.39.5