From 7c946525fc72952c0210b6e7e483e404cf62af05 Mon Sep 17 00:00:00 2001 From: AeonLucid Date: Fri, 23 Oct 2020 23:47:08 +0200 Subject: [PATCH] Add PlayAnimation checks --- .../Innersloth/Net/Objects/InnerPlayerControl.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Impostor.Api/Innersloth/Net/Objects/InnerPlayerControl.cs b/src/Impostor.Api/Innersloth/Net/Objects/InnerPlayerControl.cs index 018fbc0..103ea06 100644 --- a/src/Impostor.Api/Innersloth/Net/Objects/InnerPlayerControl.cs +++ b/src/Impostor.Api/Innersloth/Net/Objects/InnerPlayerControl.cs @@ -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; } -- 2.39.5