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 (string.IsNullOrEmpty(cmd.Arguments))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.TOGGLE_NO_ARG);
                return;
            }

            if (cmd.Arguments.Contains("helm", StringComparison.OrdinalIgnoreCase))
            {
                var player = playerProvider.Get(cmd.Sender);
                await game.ToggleHelmetAsync(player);
            }
            else if (cmd.Arguments.Contains("pet", StringComparison.OrdinalIgnoreCase))
            {
                var player = playerProvider.Get(cmd.Sender);
                await game.TogglePetAsync(player);
            }
            else
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.TOGGLE_INVALID, cmd.Arguments);
            }
        }
        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;
            }

            if (string.IsNullOrEmpty(cmd.Arguments))
            {
                broadcaster.Send(cmd.Sender.Username,
                                 "You need to specify what to toggle, like: helm or pet");
                return;
            }

            if (cmd.Arguments.Contains("helm", StringComparison.OrdinalIgnoreCase))
            {
                var player = playerProvider.Get(cmd.Sender);
                await game.ToggleHelmetAsync(player);
            }
            else if (cmd.Arguments.Contains("pet", StringComparison.OrdinalIgnoreCase))
            {
                var player = playerProvider.Get(cmd.Sender);
                await game.TogglePetAsync(player);
            }
            else
            {
                broadcaster.Send(cmd.Sender.Username, cmd.Arguments + " cannot be toggled.");
            }
        }
        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);
            }
        }
        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);
            }
        }
        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 player = playerProvider.Get(cmd.Sender);

            if (string.IsNullOrEmpty(cmd.Arguments))
            {
                await game.ActivateTicTacToeAsync(player);

                return;
            }

            if (cmd.Arguments.Trim().Equals("reset", System.StringComparison.OrdinalIgnoreCase))
            {
                await game.ResetTicTacToeAsync(player);

                return;
            }

            if (int.TryParse(cmd.Arguments.Trim(), out var num))
            {
                await game.PlayTicTacToeAsync(player, num);
            }
        }
Esempio n. 6
0
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator)
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_PERM);
                return;
            }

            var targetPlayerName = cmd.Arguments?.Trim();

            if (string.IsNullOrEmpty(targetPlayerName))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_NO_USER);
                return;
            }

            var targetPlayer = playerProvider.Get(targetPlayerName);
            await game.KickAsync(targetPlayer);
        }
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Send(cmd.Sender.Username,
                                 //broadcaster.Broadcast(
                                 Localization.GAME_NOT_STARTED);
                return;
            }

            if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator)
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 "You do not have permission to kick a player from the game.");
                return;
            }

            var targetPlayerName = cmd.Arguments?.Trim();

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

                broadcaster.Send(cmd.Sender.Username,
                                 "You are kicking who? Provide a username");
                return;
            }

            var targetPlayer = playerProvider.Get(targetPlayerName);
            await game.KickAsync(targetPlayer);
        }
        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 player = playerProvider.Get(cmd.Sender);


            if (string.IsNullOrEmpty(cmd.Arguments))
            {
                await this.game.JoinDungeonAsync(player);

                return;
            }
            else if (cmd.Arguments.Contains("stop", System.StringComparison.OrdinalIgnoreCase))
            {
                if (player.IsBroadcaster || player.IsModerator)
                {
                    await this.game.StopDungeonAsync(player);
                }
            }
            else
            {
                await this.game.DungeonStartAsync(player);
            }
        }
Esempio n. 9
0
        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 (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" "))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.TRADE_NO_ARG, cmd.Command);
                return;
            }

            var player = playerProvider.Get(cmd.Sender);

            if (cmd.Command.Equals("sell", StringComparison.OrdinalIgnoreCase))
            {
                await this.game.SellItemAsync(player, cmd.Arguments);
            }
            else if (cmd.Command.Equals("buy", StringComparison.OrdinalIgnoreCase))
            {
                await this.game.BuyItemAsync(player, cmd.Arguments);
            }
        }
Esempio n. 10
0
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Send(cmd.Sender.Username,
                                 //broadcaster.Broadcast(
                                 Localization.GAME_NOT_STARTED);
                return;
            }

            if (!cmd.Sender.IsBroadcaster)
            {
                //broadcaster.Broadcast(

                broadcaster.Send(cmd.Sender.Username,
                                 "You do not have permission to kick a player from the game.");
                return;
            }

            var item = cmd.Arguments?.Trim();

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

            var player = playerProvider.Get(cmd.Sender);
            await game.ItemDropEventAsync(player, item);
        }
        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);
        }
Esempio n. 12
0
        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 player = playerProvider.Get(cmd.Sender);

            if (cmd.Command.StartsWith("disembark"))
            {
                await game.DisembarkFerryAsync(player);

                return;
            }

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

            if (string.IsNullOrEmpty(destination))
            {
                await game.EmbarkFerryAsync(player);

                return;
            }

            if (destination.StartsWith("stop"))
            {
                await game.DisembarkFerryAsync(player);

                return;
            }

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

            if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber)
            {
                //broadcaster.Broadcast(
                broadcaster.Send(cmd.Sender.Username,
                                 "You do not have permission to set the currently observed player.");
                return;
            }
            var isSubscriber = cmd.Sender.IsSubscriber && !cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator;

            if (isSubscriber)
            {
                var user    = userStore.Get(cmd.Sender.Username);
                var command = nameof(ObserveCommandProcessor);
                if (!user.CanUseCommand(command))
                {
                    var timeLeft = user.GetCooldown(command);
                    broadcaster.Broadcast($"{cmd.Sender.Username}, You must wait another {Math.Floor(timeLeft.TotalSeconds)} secs to use that command.");
                    return;
                }

                user.UseCommand(command, TimeSpan.FromSeconds(120));
            }

            var targetPlayerName = cmd.Arguments?.Trim();

            Models.Player player = null;
            if (!string.IsNullOrEmpty(targetPlayerName))
            {
                player = playerProvider.Get(targetPlayerName);
            }
            else
            {
                player = playerProvider.Get(cmd.Sender);
            }

            await game.ObservePlayerAsync(player);
        }
Esempio n. 14
0
        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 player = playerProvider.Get(cmd.Sender);

            if (!string.IsNullOrEmpty(cmd.Arguments))
            {
                player = playerProvider.Get(cmd.Arguments);
            }

            await game.InspectPlayerAsync(player);
        }
Esempio n. 15
0
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(ServerPort))
            {
                //broadcaster.Broadcast(
                broadcaster.Send(cmd.Sender.Username,
                                 Localization.GAME_NOT_STARTED);
                return;
            }

            var player = playerProvider.Get(cmd.Sender);


            if (GetCombatTypeFromString(cmd.Command) != -1)
            {
                await game.SendPlayerTaskAsync(player, PlayerTask.Fighting, cmd.Command);

                return;
            }

            var commandSkillTarget = GetSkillTypeFromString(cmd.Command);

            if (commandSkillTarget != -1)
            {
                await game.SendPlayerTaskAsync(player, (PlayerTask)commandSkillTarget, cmd.Command);

                return;
            }

            var arg   = cmd.Arguments?.ToLower();
            var skill = arg?.Split(' ').LastOrDefault();

            if (string.IsNullOrEmpty(skill))
            {
                broadcaster.Send(cmd.Sender.Username,
                                 $"You need to specify a skill to train, currently supported skills: " + string.Join(", ", trainableSkills));
                return;
            }

            if (GetCombatTypeFromString(skill) != -1)
            {
                await game.SendPlayerTaskAsync(player, PlayerTask.Fighting, skill);
            }
            else
            {
                var value = GetSkillTypeFromString(skill);
                if (value == -1)
                {
                    //broadcaster.Broadcast(
                    broadcaster.Send(cmd.Sender.Username,
                                     $"You cannot train '{skill}'.");
                }
                else
                {
                    await game.SendPlayerTaskAsync(player, (PlayerTask)value, skill);
                }
            }
        }
Esempio n. 16
0
        //private void Pubsub_OnRewardRedeemed(object sender, TwitchLib.PubSub.Events.OnRewardRedeemedArgs e)
        //{
        //    var player = playerProvider.Get(e.Login);
        //    var cmd = commandProvider.GetCommand(player, e.RewardTitle, e.RewardPrompt);
        //    if (cmd != null)
        //        commandHandler.HandleAsync(this, cmd);
        //}

        private void Pubsub_OnChannelPointsRewardRedeemed(object sender, TwitchLib.PubSub.Events.OnChannelPointsRewardRedeemedArgs e)
        {
            var player = playerProvider.Get(e.RewardRedeemed.Redemption.User.Login);
            var cmd    = commandProvider.GetCommand(player, e.RewardRedeemed.Redemption.Reward.Title, e.RewardRedeemed.Redemption.Reward.Prompt);

            if (cmd != null)
            {
                commandHandler.HandleAsync(this, cmd);
            }
        }
Esempio n. 17
0
        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.IsModerator && !cmd.Sender.IsSubscriber)
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.OBSERVE_PERM);
                return;
            }
            var isSubscriber = cmd.Sender.IsSubscriber && !cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator;

            if (isSubscriber)
            {
                var user    = userStore.Get(cmd.Sender.Username);
                var command = nameof(ObserveCommandProcessor);
                if (!user.CanUseCommand(command))
                {
                    var timeLeft = user.GetCooldown(command);
                    broadcaster.Broadcast(cmd.Sender.Username, Localization.COMMAND_COOLDOWN, Math.Floor(timeLeft.TotalSeconds));
                    return;
                }

                user.UseCommand(command, TimeSpan.FromSeconds(120));
            }

            var targetPlayerName = cmd.Arguments?.Trim();

            Models.Player player = null;
            if (!string.IsNullOrEmpty(targetPlayerName))
            {
                player = playerProvider.Get(targetPlayerName);
            }
            else
            {
                player = playerProvider.Get(cmd.Sender);
            }

            await game.ObservePlayerAsync(player);
        }
Esempio n. 18
0
 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 player = playerProvider.Get(cmd.Sender);
     await game.ToggleItemRequirementsAsync(player);
 }
Esempio n. 19
0
        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 player    = playerProvider.Get(cmd.Sender);
            var isRaidWar = cmd.Command.Contains("war", StringComparison.OrdinalIgnoreCase);

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

                await this.game.JoinRaidAsync(player);

                return;
            }

            if (!string.IsNullOrEmpty(cmd.Arguments))
            {
                if (cmd.Arguments.Contains("start", StringComparison.OrdinalIgnoreCase))
                {
                    await this.game.RaidStartAsync(player);

                    return;
                }

                if (!cmd.Sender.IsBroadcaster)
                {
                    broadcaster.Broadcast(cmd.Sender.Username, Localization.PERMISSION_DENIED);
                    return;
                }

                var target = playerProvider.Get(cmd.Arguments);
                await this.game.RaidStreamerAsync(target, isRaidWar);
            }
        }
Esempio n. 20
0
        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 player = playerProvider.Get(cmd.Sender);
            var skill  = cmd.Arguments;

            await this.game.RequestHighscoreAsync(player, skill);
        }
Esempio n. 21
0
        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 query  = cmd.Arguments?.Trim();
            var player = playerProvider.Get(cmd.Sender);
            await game.CraftAsync(player, query);
        }
Esempio n. 22
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 sub = cmd.Arguments?.Trim();

            if (string.IsNullOrEmpty(sub))
            {
                //broadcaster.Broadcast(
                broadcaster.Send(cmd.Sender.Username,
                                 "To duel a player you need to specify their name. ex: '!duel JohnDoe', to accept or decline a duel request use '!duel accept' or '!duel decline'. You may also cancel an ongoing request by using '!duel cancel'");
                return;
            }

            var player = playerProvider.Get(cmd.Sender);

            if (sub.Equals("cancel", StringComparison.InvariantCultureIgnoreCase))
            {
                await this.game.CancelDuelRequestAsync(player);
            }
            else if (sub.Equals("accept", StringComparison.InvariantCultureIgnoreCase))
            {
                await this.game.AcceptDuelRequestAsync(player);
            }
            else if (sub.Equals("decline", StringComparison.InvariantCultureIgnoreCase))
            {
                await this.game.DeclineDuelRequestAsync(player);
            }
            else
            {
                await this.game.DuelRequestAsync(player, playerProvider.Get(sub));
            }
        }
Esempio n. 23
0
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(ServerPort))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            var player = playerProvider.Get(cmd.Sender);

            if (GetCombatTypeFromString(cmd.Command) != -1)
            {
                await game.SendPlayerTaskAsync(player, PlayerTask.Fighting, cmd.Command);

                return;
            }

            var commandSkillTarget = GetSkillTypeFromString(cmd.Command);

            if (commandSkillTarget != -1)
            {
                await game.SendPlayerTaskAsync(player, (PlayerTask)commandSkillTarget, cmd.Command);

                return;
            }

            var arg   = cmd.Arguments?.ToLower();
            var skill = arg?.Split(' ').LastOrDefault();

            if (string.IsNullOrEmpty(skill))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.TRAIN_NO_ARG, string.Join(", ", trainableSkills));
                return;
            }

            if (GetCombatTypeFromString(skill) != -1)
            {
                await game.SendPlayerTaskAsync(player, PlayerTask.Fighting, skill);
            }
            else
            {
                var value = GetSkillTypeFromString(skill);
                if (value == -1)
                {
                    broadcaster.Broadcast(cmd.Sender.Username, Localization.TRAIN_INVALID, skill);
                }
                else
                {
                    await game.SendPlayerTaskAsync(player, (PlayerTask)value, skill);
                }
            }
        }
Esempio n. 24
0
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            if (!string.IsNullOrEmpty(cmd.Arguments) && (cmd.Sender.IsBroadcaster || cmd.Sender.IsModerator))
            {
                var player = playerProvider.Get(cmd.Arguments);
                if (player != null)
                {
                    await game.UnstuckAsync(player);
                }
            }
            else
            {
                var player = playerProvider.Get(cmd.Sender, cmd.Arguments);
                await game.UnstuckAsync(player);
            }
        }
Esempio n. 25
0
        private void RegisterSessionOwner(IGameCommand obj)
        {
            if (string.IsNullOrEmpty(obj.Args[0]))
            {
                return;
            }

            var plr = playerProvider.Get(obj.Args[0], obj.Args[1]);

            plr.IsBroadcaster = true;

            messageBus.Send("streamer_userid_acquired", plr.UserId);
        }
Esempio n. 26
0
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(BabyYoda.Settings.UNITY_SERVER_PORT))
            {
                //broadcaster.Broadcast(
                broadcaster.Send(cmd.Sender.Username,
                                 BabyYoda.Localization.GAME_NOT_STARTED);
                return;
            }

            var player = playerProvider.Get(cmd.Sender);
            await game.FeedAsync(player);
        }
        public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd)
        {
            var sender = playerProvider.Get(cmd.Sender);

            if (!sender.IsBroadcaster)
            {
                return;
            }

            var targetPlayerName = cmd.Arguments?.Trim();

            Models.Player player = null;
            if (!string.IsNullOrEmpty(targetPlayerName))
            {
                player = playerProvider.Get(targetPlayerName);
            }
            else
            {
                player = playerProvider.Get(cmd.Sender);
            }

            await game.ScalePlayerAsync(player, 0.25f);
        }
Esempio n. 28
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 this.game.RequestPlayerStatsAsync(player, cmd.Arguments);
        }
Esempio n. 29
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);
        }
        public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd)
        {
            if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT))
            {
                broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED);
                return;
            }

            var player = playerProvider.Get(cmd.Sender);

            if (string.IsNullOrEmpty(cmd.Arguments))
            {
                await this.game.JoinDungeonAsync(player);

                return;
            }

            if (!string.IsNullOrEmpty(cmd.Arguments))
            {
                if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber)
                {
                    broadcaster.Send(cmd.Sender.Username, Localization.PERMISSION_DENIED);
                    return;
                }

                //if (cmd.Arguments.Contains("start", StringComparison.OrdinalIgnoreCase))
                //{
                //    var isSubscriber = cmd.Sender.IsSubscriber && !cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator;
                //    if (isSubscriber)
                //    {
                //        var user = userStore.Get(cmd.Sender.Username);
                //        var command = nameof(RaidCommandProcessor);
                //        if (!user.CanUseCommand(command))
                //        {
                //            var timeLeft = user.GetCooldown(command);
                //            broadcaster.Broadcast($"{cmd.Sender.Username}, You must wait another {Math.Floor(timeLeft.TotalSeconds)} secs to use that command.");
                //            return;
                //        }
                //        user.UseCommand(command, TimeSpan.FromHours(1));
                //    }

                //    await this.game.RaidStartAsync(player);
                //    return;
                //}
            }
        }