]> git.deb.at Git - rhonda/impostor.git/commitdiff
Add PlayAnimation checks
authorAeonLucid <aeonlucid@outlook.com>
Fri, 23 Oct 2020 21:47:08 +0000 (23:47 +0200)
committerAeonLucid <aeonlucid@outlook.com>
Fri, 23 Oct 2020 21:47:08 +0000 (23:47 +0200)
src/Impostor.Api/Innersloth/Net/Objects/InnerPlayerControl.cs

index 018fbc0da8b8ba457b19ae3cca215dd80bfc2a15..103ea06b572be0c4b76c427e31b5461711ecd594 100644 (file)
@@ -36,9 +36,19 @@ namespace Impostor.Api.Innersloth.Net.Objects
         {
             switch (call)
             {
+                // Play an animation.
                 case RpcCalls.PlayAnimation:
                 {
-                    // TODO: Figure out checks
+                    if (!sender.IsOwner(this))
+                    {
+                        throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.PlayAnimation)} to an unowned {nameof(InnerPlayerControl)}.");
+                    }
+
+                    if (target != null)
+                    {
+                        throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.PlayAnimation)} to a specific player instead of broadcast.");
+                    }
+
                     var animation = reader.ReadByte();
                     break;
                 }