Пример #1
0
        public async Task OldParty()
        {
            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;
            }

            var count = 6;

            foreach (BasicMon mon in user.Char.Party)
            {
                await MessageHandler.SendEmbedMessage(idList, "", MonEmbedBuilder.FieldMon(mon));

                count--;
            }

            await MessageHandler.SendEmbedMessage(idList, "", MonEmbedBuilder.EmptyPartySpot(count));
        }
Пример #2
0
 public static async Task SendEmbedMessage(ContextIds context, string message, Embed emb)
 {
     await _client.GetGuild(context.GuildId).GetTextChannel(context.ChannelId).SendMessageAsync(
         message,
         embed: emb)
     .ConfigureAwait(false);
 }
Пример #3
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!");
            }
        }
Пример #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!");
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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();
        }
Пример #8
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.");
        }
Пример #9
0
 public static async Task SendMessage(ContextIds context, string message)
 {
     //If a GuildId is not provided, assume it is a DM channel.
     if (context.GuildId == 0)
     {
         await SendDM(context.UserId, message);
     }
     else
     {
         await _client.GetGuild(context.GuildId).GetTextChannel(context.ChannelId).SendMessageAsync(message);
     }
 }
Пример #10
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}");
        }
Пример #11
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}");
        }
Пример #12
0
        public async Task battlefieldtest()
        {
            ContextIds idList = new ContextIds(Context);

            using (MemoryStream stream = new MemoryStream())
            {
                SixLabors.ImageSharp.Image <SixLabors.ImageSharp.PixelFormats.Rgba32> gif = ImageGenerator.BattlefieldTest();
                gif.Save(stream, new SixLabors.ImageSharp.Formats.Gif.GifEncoder());
                stream.Seek(0, SeekOrigin.Begin);
                await Context.Channel.SendFileAsync(stream, "BattlefieldTest.gif");
            }
        }
Пример #13
0
        public static async Task PvPMainMenu(ContextIds context)
        {
            var user = UserHandler.GetUser(context.UserId);

            var message = await _client.GetGuild(context.GuildId).GetTextChannel(context.ChannelId).SendMessageAsync(
                "",
                embed: MonEmbedBuilder.PvPMainMenu(user))
                          .ConfigureAwait(false);

            await PvPMainMenuEmojis(message);

            user.RemoveAllReactionMessages(11);
        }
Пример #14
0
        public async Task ImageTest()
        {
            ContextIds idList = new ContextIds(Context);
            Bitmap     image  = ImageGenerator.MergeTwoImages();

            using (MemoryStream stream = new MemoryStream())
            {
                image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                stream.Seek(0, SeekOrigin.Begin);
                image.Dispose();
                await Context.Channel.SendFileAsync(stream, "Text.jpg");
            }
        }
Пример #15
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());
        }
Пример #16
0
        public async Task ImageTest2()
        {
            ContextIds    idList  = new ContextIds(Context);
            List <Bitmap> bFrames = ImageGenerator.GifOntoBackground("C:\\Users\\lifei_jljypee\\Desktop\\Discomon Project\\DiscomonProject\\Assets\\UI Assets\\battlefield.jpg", "C:\\Users\\lifei_jljypee\\Desktop\\Discomon Project\\DiscomonProject\\Assets\\Animation Experiments\\LightBurst");

            foreach (Bitmap image in bFrames)
            {
                using (MemoryStream stream = new MemoryStream())
                {
                    image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    stream.Seek(0, SeekOrigin.Begin);
                    image.Dispose();
                    await Context.Channel.SendFileAsync(stream, "Text.jpg");
                }
            }
        }
Пример #17
0
        public static async Task ModifyAsyncTest(ContextIds context, ulong userId)
        {
            var user = UserHandler.GetUser(userId);

            var message = await _client.GetGuild(context.GuildId).GetTextChannel(context.ChannelId).SendMessageAsync(
                "Modify Async Tester",
                embed: MonEmbedBuilder.ModifyAsyncTestPageOne())
                          .ConfigureAwait(false);

            await message.AddReactionAsync(new Emoji("1\u20E3"));

            await message.AddReactionAsync(new Emoji("2\u20E3"));

            user.RemoveAllReactionMessages(1);

            user.ReactionMessages.Add(message.Id, 13);
        }
Пример #18
0
        public async Task Attack()
        {
            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.CharacterInCombat(idList);
            }
            catch (InvalidCharacterStateException)
            {
                return;
            }
        }
Пример #19
0
        public static async Task TeamSettingsMenu(ContextIds context)
        {
            var user = UserHandler.GetUser(context.UserId);

            var message = await _client.GetGuild(context.GuildId).GetTextChannel(context.ChannelId).SendMessageAsync(
                "",
                embed: MonEmbedBuilder.TeamSettingsMenu(user))
                          .ConfigureAwait(false);

            await TeamSettingsEmojis(message, user);

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

            user.ReactionMessages.Add(message.Id, 8);
        }
Пример #20
0
        public async Task TeamMenu()
        {
            ContextIds idList = new ContextIds(Context);

            //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;
            }

            await MessageHandler.TeamMenu(idList);
        }
Пример #21
0
        public static async Task PartyMenu(ContextIds context)
        {
            var user = UserHandler.GetUser(context.UserId);

            user.Char.SwapMode   = false;
            user.Char.SwapMonNum = -1;

            string url     = MessageHandler.GetImageURL(ImageGenerator.PartyMenu(user.Char.Party)).Result;
            var    message = await _client.GetGuild(context.GuildId).GetTextChannel(context.ChannelId).SendMessageAsync(
                "",
                embed: MonEmbedBuilder.PartyMenu(url, user))
                             .ConfigureAwait(false);

            await PartyMenuEmojis(message, user);

            user.RemoveAllReactionMessages(5);

            user.ReactionMessages.Add(message.Id, 5);
        }
Пример #22
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!");
            }
        }
Пример #23
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();
        }
Пример #24
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.");
        }
Пример #25
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}");
        }
Пример #26
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;
        }
Пример #27
0
        public async Task MonStat([Remainder] int num)
        {
            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;
            }

            await Context.Channel.SendMessageAsync(
                "",
                embed : MonEmbedBuilder.MonStats((BasicMon)user.Char.Party[num - 1]))
            .ConfigureAwait(false);
        }
Пример #28
0
        public async Task ReactionReceived(Cacheable <IUserMessage, ulong> cacheMessage, ISocketMessageChannel channel, SocketReaction reaction)
        {
            if (reaction.User.Value.IsBot)
            {
                return;
            }

            var message = await cacheMessage.GetOrDownloadAsync();

            var        user   = UserHandler.GetUser(reaction.UserId);
            ContextIds idList = new ContextIds()
            {
                UserId    = reaction.UserId,
                ChannelId = reaction.Channel.Id,
                GuildId   = 0
            };

            if (user.ReactionMessages.ContainsKey(message.Id))
            {
                var messageType = user.ReactionMessages[message.Id];

                //Attack Screen Main
                if (messageType == 0)
                {
                    //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.CharacterInCombat(idList);
                    }
                    catch (InvalidCharacterStateException)
                    {
                        return;
                    }

                    if (reaction.Emote.Name == "⚔")
                    {
                        Console.WriteLine("1");
                        await MessageHandler.MoveScreen(user.UserId);

                        Console.WriteLine("2");
                        user.ReactionMessages.Remove(message.Id);
                        Console.WriteLine("3");
                    }
                    else if (reaction.Emote.Name == "👜")
                    {
                        await MessageHandler.SendDm(user.UserId, "BAG not implemented yet!");
                    }
                    else if (reaction.Emote.Name == "🔁")
                    {
                        await MessageHandler.SendDm(user.UserId, "SWITCH not implemented yet!");
                    }
                    else if (reaction.Emote.Name == "🏃")
                    {
                        await MessageHandler.SendDm(user.UserId, "RUN not implemented yet!");
                    }
                }
                //Move Screen
                else if (messageType == 1)
                {
                    Console.WriteLine("4");
                    //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.CharacterInCombat(idList);
                    }
                    catch (InvalidCharacterStateException)
                    {
                        return;
                    }

                    if (reaction.Emote.Name == "1\u20E3")
                    {
                        if (user.Char.Combat.ActiveMon.ActiveMoves[0].Name != "None")
                        {
                            user.Char.Combat.SelectedMove = user.Char.Combat.ActiveMon.ActiveMoves[0];
                            user.ReactionMessages.Remove(message.Id);
                            await CombatHandler.Attack(user.Char.Combat);

                            await MessageHandler.SendDm(user.UserId, $"Selected **{user.Char.Combat.SelectedMove.Name}**!");
                        }
                    }
                    else if (reaction.Emote.Name == "2\u20E3")
                    {
                        if (user.Char.Combat.ActiveMon.ActiveMoves[1].Name != "None")
                        {
                            user.Char.Combat.SelectedMove = user.Char.Combat.ActiveMon.ActiveMoves[1];
                            user.ReactionMessages.Remove(message.Id);
                            await CombatHandler.Attack(user.Char.Combat);

                            await MessageHandler.SendDm(user.UserId, $"Selected **{user.Char.Combat.SelectedMove.Name}**!");
                        }
                    }
                    else if (reaction.Emote.Name == "3\u20E3")
                    {
                        if (user.Char.Combat.ActiveMon.ActiveMoves[2].Name != "None")
                        {
                            user.Char.Combat.SelectedMove = user.Char.Combat.ActiveMon.ActiveMoves[2];
                            user.ReactionMessages.Remove(message.Id);
                            await CombatHandler.Attack(user.Char.Combat);

                            await MessageHandler.SendDm(user.UserId, $"Selected **{user.Char.Combat.SelectedMove.Name}**!");
                        }
                    }
                    else if (reaction.Emote.Name == "4\u20E3")
                    {
                        if (user.Char.Combat.ActiveMon.ActiveMoves[3].Name != "None")
                        {
                            user.Char.Combat.SelectedMove = user.Char.Combat.ActiveMon.ActiveMoves[3];
                            user.ReactionMessages.Remove(message.Id);
                            await CombatHandler.Attack(user.Char.Combat);

                            await MessageHandler.SendDm(user.UserId, $"Selected **{user.Char.Combat.SelectedMove.Name}**!");
                        }
                    }
                }
            }
        }
Пример #29
0
        public async Task Duel(SocketGuildUser target)
        {
            var fromUser = UserHandler.GetUser(Context.User.Id);
            var toUser   = UserHandler.GetUser(target.Id);

            ContextIds idList = new ContextIds(Context);

            //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.OtherCharacterExists(idList, toUser);

                await UserHandler.ValidCharacterLocation(idList);

                await UserHandler.OtherCharacterLocation(idList, toUser);
            }
            catch (InvalidCharacterStateException)
            {
                return;
            }


            //Check that the user did not target themself with the command
            if (fromUser.UserId != toUser.UserId)
            {
                //Set the current user's combat request ID to the user specified
                fromUser.Char.CombatRequest = toUser.UserId;

                //Check if the specified user has a combat request ID that is the current user's ID
                if (toUser.Char.CombatRequest == fromUser.UserId)
                {
                    //Make sure neither users are in combat while sending response request
                    if (fromUser.Char.InCombat)
                    {
                        await Context.Channel.SendMessageAsync($"{Context.User.Mention}, you cannot start a duel while in combat!");
                    }
                    else if (toUser.Char.InCombat)
                    {
                        await Context.Channel.SendMessageAsync($"{Context.User.Mention}, you cannot start a duel with a player who is in combat!");
                    }
                    else
                    {
                        //Start duel

                        /*
                         * CombatInstance combat = new CombatInstance(idList, Context.User.Id, target.Id);
                         *
                         * await Context.Channel.SendMessageAsync($"The duel between {target.Mention} and {Context.User.Mention} will now begin!");
                         * fromUser.Char.InCombat = true;
                         * fromUser.Char.InPvpCombat = true;
                         * fromUser.Char.CombatRequest = 0;
                         * fromUser.Char.InCombatWith = toUser.UserId;
                         * fromUser.Char.Combat = new CombatInstance(idList, fromUser.UserId, toUser.UserId);
                         *
                         * toUser.Char.InCombat = true;
                         * toUser.Char.InPvpCombat = true;
                         * toUser.Char.CombatRequest = 0;
                         * toUser.Char.InCombatWith = fromUser.UserId;
                         * toUser.Char.Combat = new CombatInstance(idList, toUser.UserId, fromUser.UserId);
                         *
                         * await CombatHandler.StartCombat(fromUser.Char.Combat);
                         */
                        CombatInstance2 combat = new CombatInstance2(idList, fromUser, toUser);

                        CombatHandler2.StoreInstance(CombatHandler2.NumberOfInstances(), combat);
                        await combat.StartCombat();
                    }
                }
                else
                {
                    //Make sure neither users are in combat while sending initial request
                    if (fromUser.Char.InCombat)
                    {
                        await Context.Channel.SendMessageAsync($"{Context.User.Mention}, you cannot request a duel when you are in combat!");
                    }
                    else if (toUser.Char.InCombat)
                    {
                        await Context.Channel.SendMessageAsync($"{Context.User.Mention}, you cannot duel a player who is in combat!");
                    }
                    else
                    {
                        //Challenge the specified user
                        await Context.Channel.SendMessageAsync($"{target.Mention}, you have been challenged to a duel by {Context.User.Mention}\nUse the \"duel [mention target]\" command to accept.");
                    }
                }
            }
            else
            {
                //Tell the current user they have are a dum dum
                await Context.Channel.SendMessageAsync($"{Context.User.Mention}, you cannot duel yourself.");
            }
        }
Пример #30
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!");
 }