Exemple #1
0
        public async Task UpdateName(CommandContext ctx)
        {
            if (ctx.Guild.Id != 572662006692315136)
            {
                await ctx.RespondAsync("Command is not usable within this guild");

                return;
            }
            bool success = await MatchmakingModule.ChangeNameIfRelevant(ctx.Member);

            if (success)
            {
                await ctx.RespondAsync("Your name was updated to " + ctx.Member.DisplayName);
            }
            else
            {
                await ctx.RespondAsync("Your name was unable to be updated (You may not be in the system yet. Try playing at least one game.)");
            }
        }
Exemple #2
0
        public async Task Play(CommandContext ctx, string extra = "")
        {
            if (ctx.Guild.Id != 572662006692315136)
            {
                await ctx.RespondAsync("Command is not usable within this guild");

                return;
            }
            if (!(await MatchmakingModule.DoesPlayerHaveSteamIDRegistered(ctx, ctx.Member)))
            {
                await ctx.RespondAsync("You must have your Steam ID registered to play! Use `>register id` to add your Steam ID. (NEEDS to be a SteamID64. Find your Steam ID here: https://steamidfinder.com/)");

                return;
            }

            if (MatchmakingModule.CurrentGameState != MatchmakingModule.MatchmakingState.Idle)
            {
                if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.GameInProgress || MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.GameSetup)
                {
                    await ctx.RespondAsync("A match is currently being played, please wait until the match concludes.");
                }
                else if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.Queueing)
                {
                    await ctx.RespondAsync("A queue already exists. Use `>queue` to join the game.");
                }
                else if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.DisplayingResults)
                {
                    await ctx.RespondAsync("The results for the previous game are being calculated. Please wait for it to finish before starting a new queue.");
                }
                return;
            }

            MatchmakingModule.CurrentGameState = MatchmakingModule.MatchmakingState.Queueing;
            MatchmakingModule.PlayersInQueue.Clear();

            MatchmakingModule.CaptainPick = extra.ToLower() == "pick";

            await MatchmakingModule.ChangeNameIfRelevant(ctx.Member);

            await MatchmakingModule.JoinQueue(ctx, ctx.Member);

            new Task(async() => { await MatchmakingModule.TimeOut(ctx); }).Start();
        }
Exemple #3
0
        public async Task Queue(CommandContext ctx)
        {
            if (ctx.Guild.Id != 572662006692315136)
            {
                await ctx.RespondAsync("Command is not usable within this guild");

                return;
            }
            if (!(await MatchmakingModule.DoesPlayerHaveSteamIDRegistered(ctx, ctx.Member)))
            {
                await ctx.RespondAsync("You must have your Steam ID registered to play! Use `>register [id]` to add your Steam ID. (NEEDS to be a SteamID64. Find your Steam ID here: https://steamidfinder.com/)");

                return;
            }

            if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.Idle)
            {
                await ctx.RespondAsync("There is no existing queue to join. Use `>startqueue` to start your own queue.");

                return;
            }
            else if (MatchmakingModule.CurrentGameState != MatchmakingModule.MatchmakingState.Queueing)
            {
                await ctx.RespondAsync("A game is already being played, you cannot join this queue.");

                return;
            }

            if (MatchmakingModule.Bets.ContainsKey(ctx.Member.Id.ToString()))
            {
                await ctx.RespondAsync("Your bet of " + MatchmakingModule.Bets[ctx.Member.Id.ToString()] + " SquidCoin has been removed.");

                MatchmakingModule.Bets.Remove(ctx.Member.Id.ToString());
            }

            await MatchmakingModule.ChangeNameIfRelevant(ctx.Member);

            await MatchmakingModule.JoinQueue(ctx, ctx.Member);
        }