public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            if (!cmd.Sender.IsBroadcaster || !cmd.Sender.DisplayName.ToLower().Equals("zerratar"))
            {
                return;
            }

            if (string.IsNullOrEmpty(cmd.Arguments))
            {
                return;
            }

            var values = cmd.Arguments.Split(' ');

            if (values.Length <= 1)
            {
                return;
            }

            var player = playerProvider.Get(values[0], values[1]);
            await game.JoinAsync(player);
        }
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 Localization.GAME_NOT_STARTED);
                return;
            }

            var arg = cmd.Arguments?.ToLower();

            if (string.IsNullOrEmpty(arg))
            {
                return;
            }

            if (arg.StartsWith("help"))
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 "The commands are available in the panels below the stream :-) Too many commands.");
                return;
            }

            if (arg.StartsWith("join"))
            {
                var player = playerProvider.Get(cmd.Sender);
                await game.JoinAsync(player);
            }

            if (arg.StartsWith("task"))
            {
                var player = playerProvider.Get(cmd.Sender);
                var task   = arg.Split(' ').LastOrDefault();

                var availableTasks = Enum.GetValues(typeof(PlayerTask))
                                     .Cast <PlayerTask>()
                                     .ToList();

                if (string.IsNullOrEmpty(task))
                {
                    //broadcaster.Broadcast(

                    broadcaster.Send(cmd.Sender.Username,
                                     $"You need to specify a task, currently supported tasks: {string.Join(", ", availableTasks.Select(x => x.ToString()))}");
                    return;
                }

                var targetTask = availableTasks.FirstOrDefault(x =>
                                                               x.ToString().Equals(task, StringComparison.InvariantCultureIgnoreCase));

                await game.SendPlayerTaskAsync(player, targetTask);
            }
        }
Esempio n. 3
0
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 Localization.GAME_NOT_STARTED);
                return;
            }

            var player = playerProvider.Get(cmd.Sender);
            await game.JoinAsync(player);
        }
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            var arg = cmd.Arguments?.ToLower();

            if (string.IsNullOrEmpty(arg))
            {
                return;
            }

            if (arg.StartsWith("help"))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.HELP);
                return;
            }

            if (arg.StartsWith("join"))
            {
                var player = playerProvider.Get(cmd.Sender);
                await game.JoinAsync(player);
            }

            if (arg.StartsWith("task"))
            {
                var player = playerProvider.Get(cmd.Sender);
                var task   = arg.Split(' ').LastOrDefault();

                var availableTasks = Enum.GetValues(typeof(PlayerTask))
                                     .Cast <PlayerTask>()
                                     .ToList();

                if (string.IsNullOrEmpty(task))
                {
                    broadcaster.Broadcast(cmd.Sender.Username, Localization.TASK_NO_ARG, string.Join(", ", availableTasks.Select(x => x.ToString())));
                    return;
                }

                var targetTask = availableTasks.FirstOrDefault(x =>
                                                               x.ToString().Equals(task, StringComparison.InvariantCultureIgnoreCase));

                await game.SendPlayerTaskAsync(player, targetTask);
            }
        }
Esempio n. 5
0
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (cmd.Sender.IsVerifiedBot)
            {
                return;
            }

            if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            var player = playerProvider.Get(cmd.Sender, cmd.Arguments);
            await game.JoinAsync(player);
        }