示例#1
0
    public void AddOurselves(ClientPlayer player, NetworkWriter nw)
    {
        player.currentVessel = this;
        player.ChunkI = WorldToChunkI((Vector2)player.transform.position);

        int rangeT = (PLAYER_CHUNK_RANGE * 2) + 1;

        nw.Write((ushort)ClientMessageType.RequestChunk);
        nw.Write((ushort)(rangeT * rangeT));

        for (int i = 0; i < rangeT; i++) {
            for (int j = 0; j < rangeT; j++) {

                Vec2i temp = player.ChunkI + new Vec2i(i - PLAYER_CHUNK_RANGE, j - PLAYER_CHUNK_RANGE);
                if (!((temp - player.ChunkI) <= PLAYER_CHUNK_RANGE)) {
                    VesselChunk temp2 = chunks.TryGet(temp.x, temp.y);

                    nw.Write(temp.x);
                    nw.Write(temp.y);

                    if (temp2 != null) {
                        nw.Write(temp2.version);
                    } else {
                        nw.Write((uint)uint.MaxValue);
                    }
                }
            }
        }
    }
示例#2
0
        public override async ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
        {
            switch (call)
            {
            case RpcCalls.Close:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.Close)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.Close)} to a specific player instead of broadcast");
                }

                break;
            }

            case RpcCalls.VotingComplete:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.VotingComplete)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.VotingComplete)} to a specific player instead of broadcast");
                }

                var states   = reader.ReadBytesAndSize();
                var playerId = reader.ReadByte();
                var tie      = reader.ReadBoolean();

                await _eventManager.CallAsync(new MeetingEndedEvent(_game, this));

                break;
            }

            case RpcCalls.CastVote:
            {
                var srcPlayerId = reader.ReadByte();
                if (srcPlayerId != sender.Character.PlayerId)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CastVote)} to an unowned {nameof(InnerPlayerControl)}");
                }

                // Host broadcasts vote to others.
                if (sender.IsHost && target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CastVote)} to a specific player instead of broadcast");
                }

                // Player sends vote to host.
                if (target == null || !target.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CastVote)} to wrong destinition, must be host");
                }

                var targetPlayerId = reader.ReadByte();
                break;
            }

            default:
            {
                _logger.LogWarning("{0}: Unknown rpc call {1}", nameof(InnerMeetingHud), call);
                break;
            }
            }
        }
示例#3
0
 public override ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
 {
     throw new System.NotImplementedException();
 }
示例#4
0
        public override async ValueTask <bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
        {
            switch (call)
            {
            case RpcCalls.PlayAnimation:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc00PlayAnimation.Deserialize(reader, out var task);
                break;
            }

            case RpcCalls.CompleteTask:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc01CompleteTask.Deserialize(reader, out var taskId);
                await HandleCompleteTask(sender, taskId);

                break;
            }

            case RpcCalls.SyncSettings:
            {
                if (!await ValidateHost(call, sender))
                {
                    return(false);
                }

                Rpc02SyncSettings.Deserialize(reader, _game.Options);
                break;
            }

            case RpcCalls.SetInfected:
            {
                if (!await ValidateOwnership(call, sender) || !await ValidateHost(call, sender))
                {
                    return(false);
                }

                Rpc03SetInfected.Deserialize(reader, out var infectedIds);
                await HandleSetInfected(infectedIds);

                break;
            }

            case RpcCalls.CheckName:
            {
                if (!await ValidateOwnership(call, sender) || !await ValidateCmd(call, sender, target))
                {
                    return(false);
                }

                Rpc05CheckName.Deserialize(reader, out var name);
                return(await HandleCheckName(sender, name));
            }

            case RpcCalls.SetName:
            {
                if (!await ValidateHost(call, sender))
                {
                    return(false);
                }

                Rpc06SetName.Deserialize(reader, out var name);
                return(await HandleSetName(sender, name));
            }

            case RpcCalls.CheckColor:
            {
                if (!await ValidateOwnership(call, sender) || !await ValidateCmd(call, sender, target))
                {
                    return(false);
                }

                Rpc07CheckColor.Deserialize(reader, out var color);
                return(await HandleCheckColor(sender, color));
            }

            case RpcCalls.SetColor:
            {
                if (!await ValidateHost(call, sender))
                {
                    return(false);
                }

                Rpc08SetColor.Deserialize(reader, out var color);
                return(await HandleSetColor(sender, color));
            }

            case RpcCalls.SetHat:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc09SetHat.Deserialize(reader, out var hat);
                return(await HandleSetHat(sender, hat));
            }

            case RpcCalls.SetSkin:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc10SetSkin.Deserialize(reader, out var skin);
                return(await HandleSetSkin(sender, skin));
            }

            case RpcCalls.ReportDeadBody:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc11ReportDeadBody.Deserialize(reader, out var targetId);
                break;
            }

            case RpcCalls.MurderPlayer:
            {
                if (!await ValidateOwnership(call, sender) || !await ValidateImpostor(RpcCalls.MurderPlayer, sender, PlayerInfo))
                {
                    return(false);
                }

                Rpc12MurderPlayer.Deserialize(reader, _game, out var murdered);
                return(await HandleMurderPlayer(sender, murdered));
            }

            case RpcCalls.SendChat:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc13SendChat.Deserialize(reader, out var message);
                return(await HandleSendChat(sender, message));
            }

            case RpcCalls.StartMeeting:
            {
                if (!await ValidateHost(call, sender))
                {
                    return(false);
                }

                Rpc14StartMeeting.Deserialize(reader, out var targetId);
                await HandleStartMeeting(targetId);

                break;
            }

            case RpcCalls.SetScanner:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc15SetScanner.Deserialize(reader, out var on, out var scannerCount);
                break;
            }

            case RpcCalls.SendChatNote:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

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

            case RpcCalls.SetPet:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc17SetPet.Deserialize(reader, out var pet);
                return(await HandleSetPet(sender, pet));
            }

            case RpcCalls.SetStartCounter:
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc18SetStartCounter.Deserialize(reader, out var sequenceId, out var startCounter);
                return(await HandleSetStartCounter(sender, sequenceId, startCounter));
            }

            case RpcCalls.CustomRpc:
                return(await HandleCustomRpc(reader, _game));

            default:
                return(await UnregisteredCall(call, sender));
            }

            return(true);
        }
示例#5
0
 public abstract ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader);
示例#6
0
 public override ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
 {
     if (call != RpcCalls.AddVote)
     {
         _logger.LogWarning("{0}: Unknown rpc call {1}", nameof(InnerVoteBanSystem), call);
         return(default);
示例#7
0
        private async ValueTask <bool> HandleSetName(ClientPlayer sender, string name)
        {
            if (_game.GameState == GameStates.Started)
            {
                if (await sender.Client.ReportCheatAsync(RpcCalls.SetColor, "Client tried to set a name midgame"))
                {
                    return(false);
                }
            }

            if (sender.IsOwner(this))
            {
                if (_game.Players.Any(x => x.Character != null && x.Character != this && x.Character.PlayerInfo.PlayerName == name))
                {
                    if (await sender.Client.ReportCheatAsync(RpcCalls.SetName, "Client sent name that is already used"))
                    {
                        return(false);
                    }
                }

                if (sender.Client.Name != name)
                {
                    if (await sender.Client.ReportCheatAsync(RpcCalls.SetName, "Client sent name not matching his name from handshake"))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (!RequestedPlayerName.Any())
                {
                    _logger.LogWarning($"Client sent {nameof(RpcCalls.SetName)} for a player that didn't request it");
                    return(false);
                }

                var expected = RequestedPlayerName.Dequeue();

                if (_game.Players.Any(x => x.Character != null && x.Character != this && x.Character.PlayerInfo.PlayerName == expected))
                {
                    var i = 1;
                    while (true)
                    {
                        string text = expected + " " + i;

                        if (_game.Players.All(x => x.Character == null || x.Character == this || x.Character.PlayerInfo.PlayerName != text))
                        {
                            expected = text;
                            break;
                        }

                        i++;
                    }
                }

                if (name != expected)
                {
                    _logger.LogWarning($"Client sent {nameof(RpcCalls.SetName)} with incorrect name");
                    await SetNameAsync(expected);

                    return(false);
                }
            }

            PlayerInfo.PlayerName = name;

            return(true);
        }
示例#8
0
 private void Start()
 {
     m_charUi = GameObject.Find("CharacterUI").GetComponent <CharacterUI>();
     m_client = ClientPlayer.Singleton;
 }
示例#9
0
 public void Initialize(ClientPlayer clientPlayer)
 {
     ResetAll();
     ClientPlayer = clientPlayer;
 }
示例#10
0
 public static IEnumerator SaveCharacter(ClientPlayer cp)
 {
     yield return(SaveCharacter(cp.SteamID, cp.Cid, cp.CharData));
 }
示例#11
0
 public override ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
 {
     if (call != RpcCalls.EnterVent && call != RpcCalls.ExitVent)
     {
         _logger.LogWarning("{0}: Unknown rpc call {1}", nameof(InnerPlayerPhysics), call);
         return(default);
        public override async ValueTask <bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
        {
            if (call == RpcCalls.SnapTo)
            {
                if (!await ValidateOwnership(call, sender))
                {
                    return(false);
                }

                Rpc21SnapTo.Deserialize(reader, out Vector2 position, out ushort minSid);

                if (Game.GameNet.ShipStatus is InnerSubmarineShipStatus)
                {
                    return(true);
                }

                if (Game.GameNet.ShipStatus is InnerAirshipStatus airshipStatus)
                {
                    /*
                     * // As part of airship spawning, clients are sending snap to -25 40 for no reason(?), cancelling it works just fine
                     * if (Approximately(position, airshipStatus.PreSpawnLocation))
                     * {
                     *  return false;
                     * }
                     *
                     * throw new SixPackStupidException(); // Snapping to -25 40 is intentional so that people snapping early
                     *                                  // wont be able to see people snapping late in their old positions
                     */

                    if (_spawnSnapAllowed && airshipStatus.SpawnLocations.Any(location => Approximately(position, location)))
                    {
                        _spawnSnapAllowed = false;
                        return(true);
                    }
                }

                if (!await ValidateImpostor(call, sender, _playerControl.PlayerInfo))
                {
                    return(false);
                }

                IEnumerable <IVent> vents = null !;
                IVent?vent = null;
                try
                {
                    vents = Game.GameNet.ShipStatus !.Data.Vents.Values;
                    vent  = vents.SingleOrDefault(x => Approximately(x.Position, position + ColliderOffset));
                }
                catch (NotSupportedException) { }

                if (vent == null)
                {
                    if (await sender.Client.ReportCheatAsync(call, "Failed vent position check"))
                    {
                        return(false);
                    }
                }
                else
                {
                    await _eventManager.CallAsync(new PlayerVentEvent(Game, sender, _playerControl, vent));
                }

                await SnapToAsync(sender, position, minSid);

                return(true);
            }

            return(await base.HandleRpcAsync(sender, target, call, reader));
        }
示例#13
0
 void Start()
 {
     m_player = GameObject.Find("NetworkClient").GetComponent <ClientPlayer>();
     //m_menuPanel = GameObject.Find("Menu Panel").GetComponent<Image>();
 }
示例#14
0
 public override void Initiate(CardInfo_Base cardInfo, CardShowMode cardShowMode, ClientPlayer clientPlayer = null)
 {
     base.Initiate(cardInfo, cardShowMode, clientPlayer);
 }
示例#15
0
        public override ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call,
                                            IMessageReader reader)
        {
            switch (call)
            {
            case RpcCalls.SetTasks:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetTasks)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetTasks)} to a specific player instead of broadcast");
                }

                var playerId    = reader.ReadByte();
                var taskTypeIds = reader.ReadBytesAndSize();

                SetTasks(playerId, taskTypeIds);
                break;
            }

            case RpcCalls.UpdateGameData:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetTasks)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetTasks)} to a specific player instead of broadcast");
                }

                while (reader.Position < reader.Length)
                {
                    using var message = reader.ReadMessage();
                    var player = GetPlayerById(message.Tag);
                    if (player != null)
                    {
                        player.Deserialize(message);
                    }
                    else
                    {
                        var playerInfo = new InnerPlayerInfo(message.Tag);

                        playerInfo.Deserialize(reader);

                        if (!_allPlayers.TryAdd(playerInfo.PlayerId, playerInfo))
                        {
                            throw new ImpostorException("Failed to add player to InnerGameData.");
                        }
                    }
                }

                break;
            }

            default:
            {
                _logger.LogWarning("{0}: Unknown rpc call {1}", nameof(InnerGameData), call);
                break;
            }
            }

            return(default);
示例#16
0
        public override async ValueTask HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader)
        {
            switch (call)
            {
            // Play an animation.
            case RpcCalls.PlayAnimation:
            {
                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;
            }

            // Complete a task.
            case RpcCalls.CompleteTask:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CompleteTask)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CompleteTask)} to a specific player instead of broadcast");
                }

                var taskId = reader.ReadPackedUInt32();
                var task   = PlayerInfo.Tasks[(int)taskId];
                if (task == null)
                {
                    _logger.LogWarning($"Client sent {nameof(RpcCalls.CompleteTask)} with a taskIndex that is not in their {nameof(InnerPlayerInfo)}");
                }
                else
                {
                    task.Complete = true;
                    await _eventManager.CallAsync(new PlayerCompletedTaskEvent(_game, sender, this, task));
                }

                break;
            }

            // Update GameOptions.
            case RpcCalls.SyncSettings:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SyncSettings)} but was not a host");
                }

                _game.Options.Deserialize(reader.ReadBytesAndSize());
                break;
            }

            // Set Impostors.
            case RpcCalls.SetInfected:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetInfected)} but was not a host");
                }

                var length = reader.ReadPackedInt32();

                for (var i = 0; i < length; i++)
                {
                    var playerId = reader.ReadByte();
                    var player   = _game.GameNet.GameData.GetPlayerById(playerId);
                    if (player != null)
                    {
                        player.IsImpostor = true;
                    }
                }

                if (_game.GameState == GameStates.Starting)
                {
                    await _game.StartedAsync();
                }

                break;
            }

            // Player was voted out.
            case RpcCalls.Exiled:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.Exiled)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.Exiled)} to a specific player instead of broadcast");
                }

                // TODO: Not hit?
                Die(DeathReason.Exile);

                await _eventManager.CallAsync(new PlayerExileEvent(_game, sender, this));

                break;
            }

            // Validates the player name at the host.
            case RpcCalls.CheckName:
            {
                if (target == null || !target.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CheckName)} to the wrong player");
                }

                var name = reader.ReadString();
                break;
            }

            // Update the name of a player.
            case RpcCalls.SetName:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetName)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetName)} to a specific player instead of broadcast");
                }

                PlayerInfo.PlayerName = reader.ReadString();
                break;
            }

            // Validates the color at the host.
            case RpcCalls.CheckColor:
            {
                if (target == null || !target.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.CheckColor)} to the wrong player");
                }

                var color = reader.ReadByte();
                break;
            }

            // Update the color of a player.
            case RpcCalls.SetColor:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetColor)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetColor)} to a specific player instead of broadcast");
                }

                PlayerInfo.ColorId = reader.ReadByte();
                break;
            }

            // Update the hat of a player.
            case RpcCalls.SetHat:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetHat)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetHat)} to a specific player instead of broadcast");
                }

                PlayerInfo.HatId = reader.ReadPackedUInt32();
                break;
            }

            case RpcCalls.SetSkin:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetSkin)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetHat)} to a specific player instead of broadcast");
                }

                PlayerInfo.SkinId = reader.ReadPackedUInt32();
                break;
            }

            // TODO: (ANTICHEAT) Location check?
            // only called by a non-host player on to start meeting
            case RpcCalls.ReportDeadBody:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.ReportDeadBody)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.ReportDeadBody)} to a specific player instead of broadcast");
                }


                var deadBodyPlayerId = reader.ReadByte();
                // deadBodyPlayerId == byte.MaxValue -- means emergency call by button

                break;
            }

            // TODO: (ANTICHEAT) Cooldown check?
            case RpcCalls.MurderPlayer:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.MurderPlayer)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.MurderPlayer)} to a specific player instead of broadcast");
                }

                if (!sender.Character.PlayerInfo.IsImpostor)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.MurderPlayer)} as crewmate");
                }

                if (!sender.Character.PlayerInfo.CanMurder(_game))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.MurderPlayer)} too fast");
                }

                sender.Character.PlayerInfo.LastMurder = DateTimeOffset.UtcNow;

                var player = reader.ReadNetObject <InnerPlayerControl>(_game);
                if (!player.PlayerInfo.IsDead)
                {
                    player.Die(DeathReason.Kill);
                    await _eventManager.CallAsync(new PlayerMurderEvent(_game, sender, this, player));
                }

                break;
            }

            case RpcCalls.SendChat:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SendChat)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SendChat)} to a specific player instead of broadcast");
                }

                var chat = reader.ReadString();

                await _eventManager.CallAsync(new PlayerChatEvent(_game, sender, this, chat));

                break;
            }

            case RpcCalls.StartMeeting:
            {
                if (!sender.IsHost)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.StartMeeting)} but was not a host");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.StartMeeting)} to a specific player instead of broadcast");
                }

                // deadBodyPlayerId == byte.MaxValue -- means emergency call by button
                var deadBodyPlayerId = reader.ReadByte();
                var deadPlayer       = deadBodyPlayerId != byte.MaxValue
                        ? _game.GameNet.GameData.GetPlayerById(deadBodyPlayerId)?.Controller
                        : null;

                await _eventManager.CallAsync(new PlayerStartMeetingEvent(_game, _game.GetClientPlayer(this.OwnerId), this, deadPlayer));

                break;
            }

            case RpcCalls.SetScanner:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetScanner)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetScanner)} to a specific player instead of broadcast");
                }

                var on    = reader.ReadBoolean();
                var count = reader.ReadByte();
                break;
            }

            case RpcCalls.SendChatNote:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SendChatNote)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SendChatNote)} to a specific player instead of broadcast");
                }

                var playerId = reader.ReadByte();
                var chatNote = (ChatNoteType)reader.ReadByte();
                break;
            }

            case RpcCalls.SetPet:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetPet)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetPet)} to a specific player instead of broadcast");
                }

                PlayerInfo.PetId = reader.ReadPackedUInt32();
                break;
            }

            // TODO: Understand this RPC
            case RpcCalls.SetStartCounter:
            {
                if (!sender.IsOwner(this))
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetStartCounter)} to an unowned {nameof(InnerPlayerControl)}");
                }

                if (target != null)
                {
                    throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.SetStartCounter)} to a specific player instead of broadcast");
                }

                // Used to compare with LastStartCounter.
                var startCounter = reader.ReadPackedUInt32();

                // Is either start countdown or byte.MaxValue
                var secondsLeft = reader.ReadByte();
                if (secondsLeft < byte.MaxValue)
                {
                    await _eventManager.CallAsync(new PlayerSetStartCounterEvent(_game, sender, this, secondsLeft));
                }

                break;
            }

            default:
            {
                _logger.LogWarning("{0}: Unknown rpc call {1}", nameof(InnerPlayerControl), call);
                break;
            }
            }
        }