public PlayerCompletedTaskEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, ITaskInfo task)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     Task          = task;
 }
Exemple #2
0
 public PlayerSabotageEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, byte amount)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     Amount        = amount;
 }
        public async ValueTask MurderPlayerAsync(IInnerPlayerControl target)
        {
            if (!PlayerInfo.IsImpostor)
            {
                throw new ImpostorProtocolException("Tried to murder a player, but murderer was not the impostor.");
            }

            if (PlayerInfo.IsDead)
            {
                throw new ImpostorProtocolException("Tried to murder a player, but murderer was not alive.");
            }

            if (target.PlayerInfo.IsDead)
            {
                throw new ImpostorProtocolException("Tried to murder a player, but target was not alive.");
            }

            ((InnerPlayerControl)target).Die(DeathReason.Kill);

            using var writer = _game.StartRpc(NetId, RpcCalls.MurderPlayer);
            Rpc12MurderPlayer.Serialize(writer, target);
            await _game.FinishRpcAsync(writer);

            await _eventManager.CallAsync(new PlayerMurderEvent(_game, _game.GetClientPlayer(OwnerId), this, target));
        }
 public PlayerChatEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, string message)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     Message       = message;
 }
 public PlayerStartMeetingEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, IInnerPlayerControl?body)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     Body          = body;
 }
Exemple #6
0
 public PlayerVentEvent(IGame game, IClientPlayer sender, IInnerPlayerControl innerPlayerPhysics, IVent vent)
 {
     Game          = game;
     ClientPlayer  = sender;
     PlayerControl = innerPlayerPhysics;
     NewVent       = vent;
 }
Exemple #7
0
 public PlayerReportedBodyEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, IInnerPlayerControl?body)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     Body          = body;
 }
 public PlayerSetStartCounterEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, byte secondsLeft)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     SecondsLeft   = secondsLeft;
 }
Exemple #9
0
 public PlayerMurderEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, IInnerPlayerControl victim)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     Victim        = victim;
 }
 public PlayerRepairSystemEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, SystemTypes systemType, byte amount)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     SystemType    = systemType;
     Amount        = amount;
 }
Exemple #11
0
 public PlayerVotedEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, VoteType voteType, IInnerPlayerControl?votedFor)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     VoteType      = voteType;
     VotedFor      = votedFor;
 }
Exemple #12
0
 public PlayerVentEvent(IGame game, IClientPlayer sender, IInnerPlayerControl innerPlayerPhysics, VentLocation ventId, bool ventEnter)
 {
     Game          = game;
     ClientPlayer  = sender;
     PlayerControl = innerPlayerPhysics;
     VentId        = ventId;
     VentEnter     = ventEnter;
 }
Exemple #13
0
        private async Task ServerSendChatAsync(string text, IInnerPlayerControl player)
        {
            string playername = player.PlayerInfo.PlayerName;
            await player.SetNameAsync($"PublicMsg").ConfigureAwait(false);

            await player.SendChatAsync($"{text}").ConfigureAwait(false);

            await player.SetNameAsync(playername);
        }
Exemple #14
0
        private async Task ServerSendChatAsync(string text, IInnerPlayerControl player)
        {
            string playername  = player.PlayerInfo.PlayerName;
            byte   playercolor = player.PlayerInfo.ColorId;

            await player.SetColorAsync(ColorType.Black).ConfigureAwait(false);

            await player.SetNameAsync($"<Server>").ConfigureAwait(false);

            await player.SendChatAsync($"{text}").ConfigureAwait(false);

            await player.SetColorAsync(playercolor);

            await player.SetNameAsync(playername);
        }
        public async ValueTask <int> SendMessage(IInnerPlayerControl player, string message)
        {
            string name  = player.PlayerInfo.PlayerName;
            byte   color = player.PlayerInfo.ColorId;
            await player.SetNameAsync("[FF0000FF]All Of Us Bot | Public");

            await player.SetColorAsync((byte)0);

            await player.SendChatAsync(message);

            await player.SetNameAsync(name);

            await player.SetColorAsync(color);

            return(0);
        }
        public async void OnPlayerStartMeeting(IPlayerStartMeetingEvent e)
        {
            _logger.LogInformation($"Player Started Meeting");
            DetectiveGame game = _games[e.Game.Code];

            if (e.Body != null && game.Enabled)
            {
                _logger.LogInformation($"Body is not null: {e.Body.PlayerInfo.PlayerName}");
                IInnerPlayerControl bMurderer = game.Kills[e.Body];
                _logger.LogInformation($"Found murderer: {bMurderer.PlayerInfo.PlayerName}");

                _logger.LogInformation($"Detective: {game.DetectiveClientId}");
                if (e.ClientPlayer.Client.Id == game.DetectiveClientId)
                {
                    _logger.LogInformation($"Detective found body: {e.PlayerControl.PlayerInfo.PlayerName}");
                    // Detective found body
                    switch (new Random().Next(1, 4))
                    {
                    case 1:
                        await e.PlayerControl.SendChatToPlayerAsync($"Impostor was wearing {getSkin(bMurderer.PlayerInfo.SkinId)} on their body.");

                        break;

                    case 2:
                        await e.PlayerControl.SendChatToPlayerAsync($"Impostor was wearing {getHat(bMurderer.PlayerInfo.HatId)} on their head.");

                        break;

                    case 3:
                        await e.PlayerControl.SendChatToPlayerAsync($"Impostor was the color {getColor(bMurderer.PlayerInfo.ColorId)}.");

                        break;

                    case 4:
                        await e.PlayerControl.SendChatToPlayerAsync($"Impostor has {getPet(bMurderer.PlayerInfo.PetId)} for a pet.");

                        break;

                    default:
                        await e.PlayerControl.SendChatToPlayerAsync($"Impostor was unable to be detected");

                        break;
                    }
                }
            }
        }
 public PlayerDestroyedEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
 }
 public void Reset(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
 }
 public void Reset()
 {
     Game          = null;
     ClientPlayer  = null;
     PlayerControl = null;
 }
 public PlayerMovementEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
 }
 public static void Serialize(IMessageWriter writer, SystemTypes systemType, IInnerPlayerControl player, byte amount)
 {
     writer.Write((byte)systemType);
     writer.Write(player);
     writer.Write(amount);
 }
Exemple #22
0
 public static void Serialize(IMessageWriter writer, IInnerPlayerControl target)
 {
     writer.Write(target);
 }