Ejemplo n.º 1
0
        public async Task DebugCombat()
        {
            ContextIds idList = new ContextIds(Context);
            var        user   = UserHandler.GetUser(idList);

            string str = "";
            double mod;
            string mess;

            str += $"Owner/Mon: {user.Name}/{user.Char.ActiveMon.Nickname}";
            str += $"\nLevel: {user.Char.ActiveMon.Level}";

            str        += $"\n\nAttack: {user.Char.ActiveMon.CurStats[1]}";
            (mod, mess) = user.Char.ActiveMon.ChangeAttStage(0);
            str        += $"\nAttack Stage Mod: {mod}";
            str        += $"\nAttack Modified: {(int)(user.Char.ActiveMon.CurStats[1]*mod)}";

            str        += $"\n\nDefense: {user.Char.ActiveMon.CurStats[2]}";
            (mod, mess) = user.Char.ActiveMon.ChangeDefStage(0);
            str        += $"\nDefense Stage Mod: {mod}";
            str        += $"\nDefense Modified: {(int)(user.Char.ActiveMon.CurStats[2]*mod)}";

            str        += $"\n\nAffinity: {user.Char.ActiveMon.CurStats[3]}";
            (mod, mess) = user.Char.ActiveMon.ChangeAffStage(0);
            str        += $"\nAffinity Stage Mod: {mod}";
            str        += $"\nAffinity Modified: {(int)(user.Char.ActiveMon.CurStats[3]*mod)}";

            str        += $"\n\nSpeed: {user.Char.ActiveMon.CurStats[4]}";
            (mod, mess) = user.Char.ActiveMon.ChangeSpdStage(0);
            str        += $"\nSpeed Stage Mod: {mod}";
            str        += $"\nSpeed Modified: {(int)(user.Char.ActiveMon.CurStats[4]*mod)}";

            await MessageHandler.SendMessage(idList, str);
        }
Ejemplo n.º 2
0
        public async Task SpawnMon([Remainder] string str)
        {
            ContextIds  idList = new ContextIds(Context);
            UserAccount user   = UserHandler.GetUser(idList.UserId);

            //Tests each case to make sure all circumstances for the execution of this command are valid (character exists, in correct location)
            try
            {
                await UserHandler.CharacterExists(idList);

                await UserHandler.ValidCharacterLocation(idList);
            }
            catch (InvalidCharacterStateException)
            {
                return;
            }

            if (!user.Char.IsPartyFull())
            {
                BasicMon mon = MonRegister.StringToMonRegister(str);
                mon.CatcherID = user.UserId;
                mon.OwnerID   = user.UserId;
                user.Char.Party.Add(mon);
                await MessageHandler.SendMessage(idList, $"{mon.Nickname} has been added to your party.");
            }
            else
            {
                await MessageHandler.SendMessage(idList, "Your party is full!");
            }
        }
Ejemplo n.º 3
0
        public async Task Commands()
        {
            ContextIds idList = new ContextIds(Context);
            var        str    = "";

            str += "**DEBUG**";
            str += "\nping- The bot responds with \"pong.\" Used to test ping and trigger bot updates.";
            str += "\ndebugplayer {@Mention}- Shows debug info for a player's UserAccount and Character profiles.";
            str += "\ndebugresetchar- Deletes the user's character.";
            str += "\ndatawipe- Wipes all bot data in case of corrupted data or inconsistent values.";
            str += "\nwhisper- Used to test various DM or special case messages.";
            str += "\nemojitest- Temporary test command to showcase custom emoji usage.";
            str += "\ntypetest- Temporary test command used to demonstrate type advantages.";
            str += "\nquickstart {MonName}- Easy alternative to !startadventure for testing purposes. Use carefully.";

            str += "\n\n**BASIC**";
            str += "\nmonstat {Party#}- Shows the stats of the mon at the indicated party number.";
            str += "\nparty- Lists the mons in the user's party.";
            str += "\nenter {Input}- Used as an input method. Needs better implementation.";
            str += "\nstartadventure- Character creation command.";

            str += "\n\n**COMBAT**";
            str += "\nduel {@Mention}- Sends a duel request to the mentioned player. Starts a duel if a request has already been recieved from the mentioned player.";
            str += "\nattack- If the fight/move screen has been broken or lost, this will resend it.";
            str += "\nexitcombat- Exits combat, automatically forfeiting.";
            str += "\npheal- Heals the user's party.";

            await MessageHandler.SendMessage(idList, str);
        }
Ejemplo n.º 4
0
        public async Task Heal()
        {
            ContextIds idList = new ContextIds(Context);
            var        user   = UserHandler.GetUser(idList.UserId);

            //Tests each case to make sure all circumstances for the execution of this command are valid (character exists, in correct location)
            try
            {
                await UserHandler.CharacterExists(idList);

                await UserHandler.ValidCharacterLocation(idList);
            }
            catch (InvalidCharacterStateException)
            {
                return;
            }

            foreach (BasicMon mon in user.Char.Party)
            {
                mon.Heal();
                foreach (BasicMove move in mon.ActiveMoves)
                {
                    move.Restore();
                }
            }

            await MessageHandler.SendMessage(idList, $"{user.Mention}, your party has been healed!");
        }
Ejemplo n.º 5
0
        public async Task DataWipe()
        {
            ContextIds idList = new ContextIds(Context);
            await MessageHandler.SendMessage(idList, "User data cleared. Reboot bot to take effect.");

            UserHandler.ClearUserData();
            CombatHandler2.ClearCombatData();
            TownHandler.ClearTownData();
        }
Ejemplo n.º 6
0
        public async Task DebugResetCharacter()
        {
            ContextIds ids  = new ContextIds(Context);
            var        user = UserHandler.GetUser(ids.UserId);

            user.Char         = null;
            user.HasCharacter = false;
            user.PromptState  = -1;

            await MessageHandler.SendMessage(ids, $"{user.Mention}, your character has been deleted.");
        }
Ejemplo n.º 7
0
        public async Task HurtMe(int amt)
        {
            ContextIds idList = new ContextIds(Context);
            var        user   = UserHandler.GetUser(Context.User.Id);

            foreach (BasicMon m in user.Char.Party)
            {
                m.CurrentHP -= amt;
            }

            await MessageHandler.SendMessage(idList, $"Your entire party has been injured by {amt}");
        }
Ejemplo n.º 8
0
        public static async Task EmojiTest(ContextIds context)
        {
            var emoji = await GetEmoji(580944143287582740);

            await MessageHandler.SendMessage(context, "Test1 <:suki:580944143287582740>");

            await MessageHandler.SendMessage(context, "Test2 :suki:580944143287582740");

            await MessageHandler.SendMessage(context, $"Test3 {emoji.ToString()}");

            await MessageHandler.SendMessage(context, $"Test4 {emoji.Name}");
        }
Ejemplo n.º 9
0
        public async Task DebugInfo(SocketGuildUser target)
        {
            ContextIds  idList = new ContextIds(Context);
            UserAccount user;

            if (target != null)
            {
                user = UserHandler.GetUser(target.Id);
            }
            else
            {
                user = UserHandler.GetUser(idList.UserId);
            }

            await MessageHandler.SendMessage(idList, user.DebugString());
        }
Ejemplo n.º 10
0
        public async Task StartAdventure()
        {
            ContextIds ids  = new ContextIds(Context);
            var        user = UserHandler.GetUser(ids.UserId);

            if ((user.PromptState == -1 || user.PromptState == 0) && !user.HasCharacter)
            {
                user.PromptState = 0;
                await MessageHandler.SendMessage(ids, $"{user.Mention}, are you sure you want to create a character here? You can only have one and it will be locked to this particular location. Moving to a new location will take time and money. Type the \"enter confirm\" comnmand again to confirm character creation or \"enter cancel\" to cancel.");
            }
            else if (user.HasCharacter)
            {
                await MessageHandler.SendMessage(ids, $"{user.Mention}, you already have a character!");
            }
            else
            {
                await MessageHandler.SendMessage(ids, $"{user.Mention}, you are already in the process of creating a character!");
            }
        }
Ejemplo n.º 11
0
        public async Task QuickDuel(string mon, string mon2, SocketGuildUser target)
        {
            var        fromUser = UserHandler.GetUser(Context.User.Id);
            var        toUser   = UserHandler.GetUser(target.Id);
            ContextIds ids      = new ContextIds(Context);

            fromUser.Char = new Character(true);
            fromUser.Char.CurrentGuildId   = ids.GuildId;
            fromUser.Char.CurrentGuildName = Context.Guild.Name;
            fromUser.Char.Name             = fromUser.Name;
            mon = mon.ToLower();
            BasicMon m = MonRegister.StringToMonRegister(mon);

            m.CatcherID = fromUser.UserId;
            m.OwnerID   = fromUser.UserId;
            fromUser.Char.Party.Add(m);
            fromUser.HasCharacter = true;
            await MessageHandler.SendMessage(ids, $"{fromUser.Mention}, you have chosen {m.Nickname} as your partner! Good luck on your adventure.");

            fromUser.PromptState = -1;

            toUser.Char = new Character(true);
            toUser.Char.CurrentGuildId   = ids.GuildId;
            toUser.Char.CurrentGuildName = target.Guild.Name;
            toUser.Char.Name             = toUser.Name;
            mon2 = mon2.ToLower();
            BasicMon m2 = MonRegister.StringToMonRegister(mon2);

            m2.CatcherID = toUser.UserId;
            m2.OwnerID   = toUser.UserId;
            toUser.Char.Party.Add(m2);
            toUser.HasCharacter = true;
            await MessageHandler.SendMessage(ids, $"{toUser.Mention}, you have chosen {m2.Nickname} as your partner! Good luck on your adventure.");

            toUser.PromptState = -1;

            CombatInstance2 combat = new CombatInstance2(ids, fromUser, toUser);

            CombatHandler2.StoreInstance(CombatHandler2.NumberOfInstances(), combat);
            await combat.StartCombat();
        }
Ejemplo n.º 12
0
        public async Task TypeTest()
        {
            ContextIds idList = new ContextIds(Context);

            var attack = new BeastType(true);
            List <BasicType> defense = new List <BasicType>()
            {
                new BeastType(true),
                new BeastType(true)
            };

            var effect = attack.ParseEffectiveness(defense);

            string defstr = $"{defense[0].Type}";

            if (defense.Count > 1)
            {
                defstr += $"/{defense[1].Type}";
            }

            await MessageHandler.SendMessage(idList, $"{attack.Type} is {effect}x effective against {defstr}");
        }
Ejemplo n.º 13
0
        public async Task QuickStart([Remainder] string text)
        {
            ContextIds ids  = new ContextIds(Context);
            var        user = UserHandler.GetUser(ids.UserId);

            user.Char = new Character(true);
            user.Char.CurrentGuildId   = ids.GuildId;
            user.Char.CurrentGuildName = Context.Guild.Name;
            user.Char.Name             = user.Name;

            text = text.ToLower();

            BasicMon mon = MonRegister.StringToMonRegister(text);

            mon.CatcherID = user.UserId;
            mon.OwnerID   = user.UserId;
            user.Char.Party.Add(mon);
            user.HasCharacter = true;
            await MessageHandler.SendMessage(ids, $"{user.Mention}, you have chosen {mon.Nickname} as your partner! Good luck on your adventure.");

            user.PromptState = -1;
        }
Ejemplo n.º 14
0
        public async Task DeleteMon(int i)
        {
            ContextIds  idList = new ContextIds(Context);
            UserAccount user   = UserHandler.GetUser(idList.UserId);

            //Tests each case to make sure all circumstances for the execution of this command are valid (character exists, in correct location)
            try
            {
                await UserHandler.CharacterExists(idList);

                await UserHandler.ValidCharacterLocation(idList);
            }
            catch (InvalidCharacterStateException)
            {
                return;
            }

            string nick = user.Char.Party[i - 1].Nickname;

            user.Char.Party.RemoveAt(i - 1);
            await MessageHandler.SendMessage(idList, $"{nick} has been removed from your party.");
        }
Ejemplo n.º 15
0
 public static async Task NotInCombat(ContextIds context)
 {
     var user = UserHandler.GetUser(context.UserId);
     await MessageHandler.SendMessage(context, $"{user.Mention}, you are not in combat right now!");
 }
Ejemplo n.º 16
0
 public static async Task OtherCharacterMissing(ContextIds context)
 {
     var user = UserHandler.GetUser(context.UserId);
     await MessageHandler.SendMessage(context, $"{user.Mention}, that user does not have a character!");
 }
Ejemplo n.º 17
0
 /* PRESET MESSAGES */
 public static async Task CharacterMissing(ContextIds context)
 {
     var user = UserHandler.GetUser(context.UserId);
     await MessageHandler.SendMessage(context, $"{user.Mention}, you do not have a character! You can create one using the \"startadventure\" command.");
 }
Ejemplo n.º 18
0
        public async Task GetIds()
        {
            ContextIds idList = new ContextIds(Context);

            await MessageHandler.SendMessage(idList, $"Guild ID: {idList.GuildId}\nChannel ID: {idList.ChannelId}\nMessage ID:{idList.MessageId}");
        }
Ejemplo n.º 19
0
 public static async Task FaintWinner(ContextIds context, UserAccount user, BasicMon mon)
 {
     await MessageHandler.SendMessage(context, $"{mon.Nickname} fainted! {user.Mention} wins!");
 }
Ejemplo n.º 20
0
 public static async Task OutOfMonsWinner(ContextIds context, UserAccount winner, UserAccount loser)
 {
     await MessageHandler.SendMessage(context, $"{loser.Mention} has run out of mon! {winner.Mention} wins!");
 }
Ejemplo n.º 21
0
 public static async Task AttackInvalid(ContextIds context, UserAccount user)
 {
     await MessageHandler.SendMessage(context, $"{user.Mention}, you cannot enter an attack right now!");
 }
Ejemplo n.º 22
0
 public static async Task AttackAlreadyEntered(ContextIds context, UserAccount user)
 {
     await MessageHandler.SendMessage(context, $"{user.Mention}, you already entered an attack! Waiting on other player.");
 }
Ejemplo n.º 23
0
 public static async Task AttackEnteredTextNew(ContextIds context, UserAccount user, int num)
 {
     await MessageHandler.SendMessage(context, $"{user.Mention}, your attack has been entered. Awaiting {num} other player(s).");
 }
Ejemplo n.º 24
0
 public static async Task AttackStepText(ContextIds context)
 {
     await MessageHandler.SendMessage(context, "Next turn starts! Choose attacks.");
 }
Ejemplo n.º 25
0
 public static async Task InvalidOtherCharacterLocation(ContextIds context, UserAccount otherUser)
 {
     var user = UserHandler.GetUser(context.UserId);
     await MessageHandler.SendMessage(context, $"{user.Mention} that player is not in this location! They are currently at {otherUser.Char.CurrentGuildName}.");
 }
Ejemplo n.º 26
0
 public static async Task InvalidCharacterLocation(ContextIds context)
 {
     var user = UserHandler.GetUser(context.UserId);
     await MessageHandler.SendMessage(context, $"{user.Mention} you must be in this location to use commands here! Your character is currently at {user.Char.CurrentGuildName}.");
 }
Ejemplo n.º 27
0
        public async Task Enter([Remainder] string text)
        {
            ContextIds ids          = new ContextIds(Context);
            var        user         = UserHandler.GetUser(ids.UserId);
            var        originalText = text;

            text = text.ToLower();

            /* PROMPT STATE MEANINGS-
             * -1- Has no character
             * 0- Awaiting confirmation or cancellation of character creation
             * 1- Character creation confirmed. Awaiting name.
             * 2- Name confirmed. Awaiting partner.
             */
            switch (user.PromptState)
            {
            case 0:
                if (text.Equals("confirm"))
                {
                    user.Char = new Character(true);
                    user.Char.CurrentGuildId   = ids.GuildId;
                    user.Char.CurrentGuildName = Context.Guild.Name;
                    user.PromptState           = 1;
                    await MessageHandler.SendMessage(ids, $"Beginning character creation for {user.Mention}.\nWhat is your name? (use the \"enter\" command to enter your name)");
                }
                else if (text.Equals("cancel"))
                {
                    user.PromptState = -1;
                    await MessageHandler.SendMessage(ids, $"Character creation cancelled for {user.Mention}.");
                }
                else
                {
                    await MessageHandler.SendMessage(ids, $"{user.Mention}, I'm sorry, but I don't recognize that. Please enter \"confirm\" or \"cancel\"");
                }
                break;

            case 1:
                if (text.Length <= 32 && text.Length > 0)
                {
                    user.Char.Name   = originalText;
                    user.PromptState = 2;
                    await MessageHandler.SendMessage(ids, $"{user.Mention}, your character's name is now {originalText}. Now you must choose your partner.");

                    await Context.Channel.SendMessageAsync(
                        "", embed : MonEmbedBuilder.MonDex(new Snoril(true)))
                    .ConfigureAwait(false);

                    await Context.Channel.SendMessageAsync(
                        "", embed : MonEmbedBuilder.MonDex(new Suki(true)))
                    .ConfigureAwait(false);
                }
                else
                {
                    await MessageHandler.SendMessage(ids, $"{user.Mention}, your name must be 32 characters or less.");
                }
                break;

            case 2:
                if (text.Equals("snoril") || text.Equals("1"))
                {
                    user.Char.Party.Add(new Snoril(true)
                    {
                        CatcherID = user.UserId,
                        OwnerID   = user.UserId
                    });
                    user.HasCharacter = true;
                    await MessageHandler.SendMessage(ids, $"{user.Mention}, you have chosen Snoril as your partner! Good luck on your adventure.");
                }
                else if (text.Equals("suki") || text.Equals("2"))
                {
                    user.Char.Party.Add(new Suki(true)
                    {
                        CatcherID = user.UserId,
                        OwnerID   = user.UserId
                    });
                    user.HasCharacter = true;
                    await MessageHandler.SendMessage(ids, $"{user.Mention}, you have chosen Suki as your partner! Good luck on your adventure.");
                }
                else
                {
                    await MessageHandler.SendMessage(ids, $"{user.Mention}, please enter either Snoril or Suki.");
                }
                break;
            }
        }
Ejemplo n.º 28
0
        public static async Task TeamMenu(UserAccount user, IUserMessage message, IEmote emote, ContextIds idList)
        {
            Team team = user.GetTeam();

            if (team != null)
            {
                switch (emote.Name.ToLower())
                {
                case "back1":
                    user.RemoveAllReactionMessages(7);
                    user.RemoveAllReactionMessages(1);

                    await message.RemoveAllReactionsAsync();

                    await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.MainMenu(user); m.Content = ""; });

                    await MessageHandler.MenuEmojis(message);

                    user.ReactionMessages.Add(message.Id, 1);
                    break;

                case "invite":
                    if (team.CanInvite(user))
                    {
                        await message.ModifyAsync(m => { m.Content = "**Please tag the player(s) you wish to invite.**"; });

                        user.ExpectedInput         = 0;
                        user.ExpectedInputLocation = message.Channel.Id;
                    }
                    break;

                case "kick_player":
                    if (team.CanKick(user))
                    {
                        await message.ModifyAsync(m => { m.Content = "**Please tag the player(s) you wish to kick.**"; });

                        user.ExpectedInput         = 1;
                        user.ExpectedInputLocation = message.Channel.Id;
                    }
                    break;

                case "exit":
                    bool leader = false;
                    if (team.Members.IndexOf(user) == 0)
                    {
                        leader = true;
                    }

                    team.KickMember(user);

                    if (team.Members.Count > 0)
                    {
                        if (leader)
                        {
                            await MessageHandler.SendMessage(user.Char.CurrentGuildId, message.Channel.Id, $"{team.Members[0].Mention}, you are now the team leader.");
                        }
                    }
                    else
                    {
                        TownHandler.GetTown(user.Char.CurrentGuildId).Teams.Remove(team);
                    }

                    user.RemoveAllReactionMessages(9);
                    user.RemoveAllReactionMessages(7);

                    await message.RemoveAllReactionsAsync();

                    await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.TeamMenu(user); m.Content = ""; });

                    await MessageHandler.TeamMenuEmojis(message, user);

                    break;

                case "settings":
                    if (team.CanAccessSettings(user))
                    {
                        user.RemoveAllReactionMessages(7);
                        user.RemoveAllReactionMessages(8);

                        await message.RemoveAllReactionsAsync();

                        await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.TeamSettingsMenu(user); m.Content = ""; });

                        await MessageHandler.TeamSettingsEmojis(message, user);

                        user.ReactionMessages.Add(message.Id, 8);
                    }
                    break;

                case "disband":
                    if (team.CanDisband(user))
                    {
                        TownHandler.GetTown(user.Char.CurrentGuildId).Teams.Remove(team);

                        user.RemoveAllReactionMessages(9);
                        user.RemoveAllReactionMessages(7);

                        await message.RemoveAllReactionsAsync();

                        await message.ModifyAsync(m => { m.Embed = MonEmbedBuilder.TeamMenu(user); m.Content = ""; });

                        await MessageHandler.TeamMenuEmojis(message, user);
                    }
                    break;

                default:
                    break;
                }
            }
        }