Skip to content

Commit

Permalink
Merge branch 'Testing' into CN-Special
Browse files Browse the repository at this point in the history
  • Loading branch information
NikoCat233 committed Apr 21, 2024
2 parents ba47248 + 83659f6 commit a01c5f6
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc00PlayAnimation.Deserialize(reader, out var task);
break;
}
Expand All @@ -148,6 +153,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc01CompleteTask.Deserialize(reader, out var taskId);
await HandleCompleteTask(sender, taskId);
break;
Expand Down Expand Up @@ -282,6 +292,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc11ReportDeadBody.Deserialize(reader, out var targetId);
return await HandleReportDeadBody(sender, targetId);
}
Expand All @@ -293,6 +308,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc12MurderPlayer.Deserialize(reader, Game, out var murdered, out var result);
return await HandleMurderPlayer(sender, (InnerPlayerControl?)murdered, result);
}
Expand All @@ -304,6 +324,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc13SendChat.Deserialize(reader, out var message);
return await HandleSendChat(sender, message);
}
Expand All @@ -315,6 +340,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc14StartMeeting.Deserialize(reader, out var targetId);
await HandleStartMeeting(targetId);
break;
Expand All @@ -327,6 +357,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc15SetScanner.Deserialize(reader, out var on, out var scannerCount);
break;
}
Expand All @@ -344,6 +379,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc16SendChatNote.Deserialize(reader, out var playerId, out var chatNoteType);

if (chatNoteType != ChatNoteType.DidVote)
Expand Down Expand Up @@ -397,6 +437,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

// TODO: deserialize and expose the result in an API
break;
}
Expand All @@ -408,6 +453,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc44SetRole.Deserialize(reader, out var role);
PlayerInfo.RoleType = role;

Expand All @@ -426,6 +476,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc45ProtectPlayer.Deserialize(reader, Game, out var protectTarget, out _);
return await HandleProtectPlayer(sender, protectTarget);
}
Expand All @@ -442,6 +497,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc46Shapeshift.Deserialize(reader, Game, out _, out _);

break;
Expand All @@ -459,6 +519,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc47CheckMurder.Deserialize(reader, Game, out var murdered);
return await HandleCheckMurder(sender, (InnerPlayerControl?)murdered);
}
Expand All @@ -475,6 +540,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateBroadcast(call, sender, target))
{
return false;
}

Rpc48CheckProtect.Deserialize(reader, Game, out var protecttarget);
return await HandleCheckProtect(sender, (InnerPlayerControl?)protecttarget);
}
Expand All @@ -486,6 +556,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateCmd(call, sender, target))
{
return false;
}

Rpc51CheckZipline.Deserialize(reader, out var fromTop);
break;
}
Expand Down Expand Up @@ -519,6 +594,11 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateCmd(call, sender, target))
{
return false;
}

Rpc54CheckSpore.Deserialize(reader, out var mushroomId);
break;
}
Expand All @@ -530,6 +610,16 @@ public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, Client
return false;
}

if (!await ValidateRole(call, sender, PlayerInfo, RoleTypes.Shapeshifter))
{
return false;
}

if (!await ValidateCmd(call, sender, target))
{
return false;
}

Rpc46Shapeshift.Deserialize(reader, Game, out var playerControl, out var shouldAnimate);
break;
}
Expand Down

0 comments on commit a01c5f6

Please sign in to comment.