Exemplo n.º 1
0
        public async Task StartGame(CommandContext ctx)
        {
            if (!DeathGames.ContainsKey(ctx.Guild.Id))
            {
                await ctx.RespondAsync("This server is not running a Death Game");

                return;
            }
            DeathGame dg      = DeathGames[ctx.Guild.Id];
            var       fmcheck = await GameUtils.CheckFloormaster(dg, ctx);

            if (fmcheck)
            {
                await ctx.RespondAsync("Iniciando el Juego...");

                WatchedStartMessages.Remove(WatchedStartMessages.First(x => x.Channel.Guild.Id == ctx.Guild.Id));
                var embed = new DiscordEmbedBuilder
                {
                    Title       = "Comienza el Juego de Muerte!",
                    Description = "A partir de ahora, nadie puede sumarse."
                };
                var msg = await SettingsManager.GetAnnounceChannel(ctx).SendMessageAsync(embed: embed);

                DeathGames[ctx.Guild.Id].ChangeState(GameState.Preparation);
            }
        }
Exemplo n.º 2
0
        public async Task Info(CommandContext ctx)
        {
            if (!DeathGames.ContainsKey(ctx.Guild.Id))
            {
                await ctx.RespondAsync("This server is not running a Death Game");

                return;
            }
            DeathGame dg        = DeathGames[ctx.Guild.Id];
            string    partpList = "";

            foreach (Participant participant in dg.participants)
            {
                string listItem = dg.participants.IndexOf(participant).ToString() + " - " + participant.Name + "\n";
                partpList += listItem;
            }
            var embed = new DiscordEmbedBuilder
            {
                Title       = $"Juego de Muerte en {ctx.Guild.Name}",
                Description =
                    $@"Main FloorMaster: {dg.MainFM.Nickname}
Estado del juego: {dg.State}
Participantes: 
{partpList}"
            };

            await ctx.RespondAsync(embed : embed);
        }
Exemplo n.º 3
0
        public async Task Create(CommandContext ctx)
        {
            if (DeathGames.ContainsKey(ctx.Guild.Id))
            {
                await ctx.RespondAsync("This server is already running a Death Game.");

                return;
            }
            await ctx.RespondAsync($"Creating Game Instance for guild {ctx.Guild.Name} (guild id: {ctx.Guild.Id}).\nYou have been assigned as Floor Master.");

            DeathGame deathGame = new DeathGame
            {
                MainFM = ctx.Member
            };

            DeathGames.Add(ctx.Guild.Id, deathGame);
            Program.LogToConsole(LogLevel.Info, $"A death game has been created for guild {ctx.Guild.Name} id {ctx.Guild.Id}\nMain Floor Master is {ctx.Member.Username}#{ctx.Member.Discriminator}");
            var embed = new DiscordEmbedBuilder
            {
                Title       = "Se ha creado un nuevo Juego de Muerte!",
                Description = "Para participar, agregue una reacción a este mensaje."
            };
            var msg = await SettingsManager.GetAnnounceChannel(ctx).SendMessageAsync(embed: embed);

            await msg.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":blue_circle:"));

            WatchedStartMessages.Add(msg);
        }
Exemplo n.º 4
0
        public async Task BeginVote(CommandContext ctx)
        {
            if (!DeathGames.ContainsKey(ctx.Guild.Id))
            {
                await ctx.RespondAsync("This server is not running a Death Game");

                return;
            }
            DeathGame dg      = DeathGames[ctx.Guild.Id];
            var       fmcheck = await GameUtils.CheckFloormaster(dg, ctx);

            if (fmcheck)
            {
                dg.ChangeState(GameState.Vote);
                //
                var    announceChannel = SettingsManager.GetAnnounceChannel(ctx);
                string partpList       = "";
                foreach (Participant participant in dg.participants)
                {
                    string listItem = dg.participants.IndexOf(participant).ToString() + " - " + participant.Name + "\n";
                    partpList += listItem;
                }
                await announceChannel.SendMessageAsync("Comienza una votación por mayoría!\nLos participantes por favor, envíen sus votos acorde a la siguiente tabla:");

                var embed = new DiscordEmbedBuilder
                {
                    Title       = "Lista de participantes",
                    Description = partpList,
                };
                await announceChannel.SendMessageAsync(embed : embed);
            }
        }
Exemplo n.º 5
0
        public async Task Stop(CommandContext ctx)
        {
            if (!DeathGames.ContainsKey(ctx.Guild.Id))
            {
                await ctx.RespondAsync("This server is not running a Death Game");

                return;
            }
            DeathGame dg      = DeathGames[ctx.Guild.Id];
            var       fmcheck = await GameUtils.CheckFloormaster(dg, ctx);

            if (fmcheck)
            {
                await ctx.RespondAsync("Stopping server's active Death Game instance.");

                DeathGames.Remove(ctx.Guild.Id);
                var watchedmsg = WatchedStartMessages.First(x => x.Channel.Guild.Id == ctx.Guild.Id);
                if (WatchedStartMessages.Contains(watchedmsg))
                {
                    WatchedStartMessages.Remove(watchedmsg);
                }
            }
        }