]> git.deb.at Git - rhonda/impostor.git/commitdiff
Check AC config in SetName/Color checks
authorminiduikboot <mini@duikbo.at>
Wed, 13 Mar 2024 18:23:56 +0000 (19:23 +0100)
committerminiduikboot <mini@duikbo.at>
Thu, 4 Apr 2024 18:10:23 +0000 (20:10 +0200)
Previously this was not done causing these checks to be unconditionally enabled

src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs

index 958d8a90eb165615cf1215ee9b69d6316a25987b..cd9af281fbc5cbea005abcb5617148deccabe3f1 100644 (file)
@@ -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;
+                    }
                 }
             }