コード例 #1
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiPfp([Remainder] string name)
        {
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastPicture.AddSeconds(8) - now);

            if (now < config.LastPicture.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                return;
            }
            config.LastPicture = now;
            if (config.Have == false) //if they own a Wasagotchi or not
            {
                var no = Emote.Parse("<:no:453716729525174273>");
                await Context.Channel.SendMessageAsync($"{no}  |  **{Context.User.Username}**, you don't own a <:wasagotchi:454535808079364106> Wasagotchi! \n\nPurchase one with w!wasagotchi buy!");

                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                return;
            }
            else
            {
                config.pfp = name;
                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                await Context.Channel.SendMessageAsync($":white_check_mark:   |  **{Context.User.Username}**, you successfully changed your <:wasagotchi:454535808079364106> Wasagotchi's picture to **{name}**!");
            }
        }
コード例 #2
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiInventory()
        {
            var account = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);
            var embed   = new EmbedBuilder();

            embed.WithTitle($"{Context.User.Username}'s Wasagotchi Inventory");

            embed.AddField("Common Capsules", $"**x{account.CommonCapsule}**");
            embed.AddField("Rare Capsules", $"**x{account.RareCapsule}**");
            embed.AddField("Epic Capsules", $"**x{account.EpicCapsule}**");
            embed.AddField("Legendary Capsules", $"**x{account.LegendaryCapsule}**");
            embed.WithFooter("You can get Wasagotchi Capsules from opening loot boxes!");

            await Context.Channel.SendMessageAsync("", embed : embed.Build());
        }
コード例 #3
0
ファイル: OpenLootBox.cs プロジェクト: Phytal/Wsashi
        public static async Task OpenUncommonBox(SocketUser user, ITextChannel channel)
        {
            var config  = GlobalUserAccounts.GetUserAccount(user);
            var configg = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(user);

            var embed = new EmbedBuilder()
                        .WithColor(26, 252, 10)
                        .WithImageUrl("https://i.imgur.com/MHpJetn.png");

            embed.Title          = "Uncommon Lootbox";
            embed.Description    = $"**{user.Username}** opened an **UNCOMMON** Lootbox!";
            config.LootBoxCommon = config.LootBoxUncommon - 1;
            int potatoes = Global.Rng.Next(150, 300);

            config.Money += (ulong)potatoes;
            embed.AddField("Potatoes", potatoes);

            int wasagotchiBool = Global.Rng.Next(1, 3);

            if (wasagotchiBool == 1 || wasagotchiBool == 2)
            {
                if (configg.Have != true)
                {
                    int wasagotchiValue = Global.Rng.Next(1, 64);
                    Tuple <string, string> wasagotchi = WasagotchiInteractive.GetWasagotchiRarity(wasagotchiValue);
                    embed.AddField("Wasagotchi", wasagotchi.Item2);
                    configg.Have  = true;
                    configg.Breed = wasagotchi.Item1;
                    GlobalWasagotchiUserAccounts.SaveAccounts();
                }
                else
                {
                    configg.CommonCapsule += 1;
                    embed.AddField("Wasagotchi Item", "Common Wasagotchi Capsule (Open it with `w!openCapsule`!)");
                }
                GlobalWasagotchiUserAccounts.SaveAccounts();
            }
            int duelBool = Global.Rng.Next(1, 3);

            if (duelBool == 1 || duelBool == 2)
            {
                int    duelValue = Global.Rng.Next(29, 56);
                string item      = GetDuelItem(user, duelValue);
                embed.AddField("Duels Item", $"{item} (x1)");
            }
            await channel.SendMessageAsync("", embed : embed.Build());
        }
コード例 #4
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiPlay()
        {
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastPlay.AddSeconds(8) - now);

            if (now < config.LastPlay.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                return;
            }
            config.LastPlay = now;
            if (config.Have == false) //if they own a Wasagotchi or not
            {
                await Context.Channel.SendMessageAsync($":no:  |  **{Context.User.Username}**, you don't own a <:wasagotchi:454535808079364106> Wasagotchi! \n\nPurchase one with w!wasagotchi buy!");

                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                return;
            }
            else
            {
                if (config.Attention == 20)
                {
                    await Context.Channel.SendMessageAsync($":soccer:  |  **{Context.User.Username}, your <:wasagotchi:454535808079364106> Wasagotchi is bored of playing right now!**");

                    return;
                }
                {
                    Random rand        = new Random();
                    Random randd       = new Random();
                    int    randomIndex = rand.Next(playTexts.Length);
                    string text        = playTexts[randomIndex];
                    int    much        = randd.Next(4, 8);
                    uint   clean       = Convert.ToUInt32(much);
                    config.Attention += clean;
                    if (config.Attention > 20)
                    {
                        config.Attention = 20;
                    }
                    GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                    await Context.Channel.SendMessageAsync($":soccer:  |  **{Context.User.Username}**, {text} **(+{clean} attention)**");
                }
            }
        }
コード例 #5
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiClean()
        {
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User.Id);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastClean.AddSeconds(8) - now);

            if (now < config.LastClean.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                return;
            }
            config.LastClean = now;
            if (config.Have == false) //if they own a Wasagotchi or not
            {
                await Context.Channel.SendMessageAsync($":no:  |  **{Context.User.Username}**, you don't own a <:wasagotchi:454535808079364106> Wasagotchi! \n\nPurchase one with w!wasagotchi buy!");

                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                return;
            }
            else
            {
                if (config.Waste == 0)
                {
                    await Context.Channel.SendMessageAsync($":sparkles:  | **{Context.User.Username}, your <:wasagotchi:454535808079364106> Wasagotchi's room is squeaky clean!**");

                    return;
                }
                {
                    Random rand        = new Random();
                    int    randomIndex = rand.Next(cleanTexts.Length);
                    string text        = cleanTexts[randomIndex];
                    int    much        = rand.Next(4, 8);
                    uint   clean       = Convert.ToUInt32(much);
                    config.Waste -= clean;
                    if (config.Waste > 20)
                    {
                        config.Waste = 0;
                    }
                    GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                    await Context.Channel.SendMessageAsync($":sparkles:  |  **{Context.User.Username}**, {text} **(-{clean} waste)**");
                }
            }
        }
コード例 #6
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiFeed()
        {
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastFeed.AddSeconds(8) - now);

            if (now < config.LastFeed.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                return;
            }
            config.LastFeed = now;
            if (config.Have == false) //if they own a Wasagotchi or not
            {
                await Context.Channel.SendMessageAsync($":no:  |  **{Context.User.Username}**, you don't own a <:wasagotchi:454535808079364106> Wasagotchi! \n\nPurchase one with w!wasagotchi buy!");

                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                return;
            }
            else
            {
                if (config.Hunger == 20)
                {
                    await Context.Channel.SendMessageAsync($":poultry_leg:  |  **{Context.User.Username}**, your <:wasagotchi:454535808079364106> Wasagotchi is full!");

                    return;
                }
                {
                    Random rnd     = new Random();
                    int    cost    = rnd.Next(54, 113);
                    Random rand    = new Random();
                    int    much    = rnd.Next(4, 8);
                    uint   hungerr = Convert.ToUInt32(much);
                    config.Hunger += hungerr;
                    if (config.Hunger > 20)
                    {
                        config.Hunger = 20;
                    }
                    GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                    await Context.Channel.SendMessageAsync($":poultry_leg:  |  **{Context.User.Username}**, you fill your <:wasagotchi:454535808079364106> Wasagotchi's bowl with food. It looks happy! **(+{hungerr} food [-{cost} :potato:])**");
                }
            }
        }
コード例 #7
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiHelp()
        {
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastHelp.AddSeconds(8) - now);

            if (now < config.LastHelp.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                return;
            }
            config.LastHelp = now;
            string[] footers = new string[]
            {
                "Every 4 hours all Wasagotchis will have a time modifier, -1 hunger, -1 attention, and +1 waste. Make sure to check on your Wasagotchi often!",
                "If the living conditions you provide for your Wasagotchi are too low - never clean, never play, etc - it will run away! (Your room will remain the same)",
                "If your Wasagotchi is sick, buy it some medicine with w!buy.",
                "All Wasagotchi commands have a 8 second cooldown.",
                "To get a direct link to a picture right click and open image in new tab. Then there's the URL! :)"
            };
            Random rand        = new Random();
            int    randomIndex = rand.Next(footers.Length);
            string text        = footers[randomIndex];

            var embed = new EmbedBuilder();

            embed.WithTitle("<:wasagotchi:454535808079364106> Wasagotchi Command List");
            embed.AddField("w!wasagotchi help", "Brings up the help commmand (lol)", true);
            embed.AddField("w!wasagotchi shop", "Opens the Wasagotchi shop menu!", true);
            embed.AddField("w!wasagotchi stats", "Brings up the stats/info of your or someone else's Wasagotchi!", true);
            embed.AddField("w!wasagotchi name", "Set the name of your Wasagotchi!", true);
            embed.AddField("w!wasagotchi picture", "Set the picture of your Wasagotchi! (Note: It must be a direct link)", true);
            embed.AddField("w!wasagotchi feed", "Feeds your Wasagtochi at the cost of Potatoes! Otherwise it will starve!", true);
            embed.AddField("w!wasagotchi clean", "Clean up your Wasagotchi's waste, Otherwise it'll get sick!", true);
            embed.AddField("w!wasagotchi play", "Play with your wasagotchi! Your Wasagotchi must have high attention levels at all times!", true);
            embed.AddField("w!wasagotchi train", "Train your Wasagotchi to earn Exp and level up!", true);
            embed.WithFooter(text);
            await Context.Channel.SendMessageAsync("", embed : embed.Build());
        }
コード例 #8
0
ファイル: WasagotchiTimer.cs プロジェクト: Phytal/Wsashi
        //try to get something so that all pets will experience soemthing
        public async void OnTimerTicked(object sender, ElapsedEventArgs e)
        {
            var config = GlobalWasagotchiUserAccounts.GetAllWasagotchiAccount();

            foreach (var userAcc in config)
            {
                if (userAcc.Have == true)
                {
                    if (userAcc.Hunger > 0)
                    {
                        userAcc.Hunger = userAcc.Hunger - 1;
                    }
                    else
                    {
                        userAcc.Hunger = 0;
                    }
                    if (userAcc.Waste < 20)
                    {
                        userAcc.Waste = userAcc.Waste + 1;
                    }
                    else
                    {
                        userAcc.Waste = 20;
                    }
                    if (userAcc.Attention > 0)
                    {
                        userAcc.Attention = userAcc.Attention - 1;
                    }
                    else
                    {
                        userAcc.Attention = 0;
                    }
                    GlobalWasagotchiUserAccounts.SaveAccounts();

                    var user = Global.Client.GetUser(userAcc.Id);
                    Console.WriteLine($"{userAcc.Id}");
                    var message = await user.GetOrCreateDMChannelAsync();

                    if (userAcc.Waste >= 15)
                    {
                        userAcc.Sick = true;
                        GlobalWasagotchiUserAccounts.SaveAccounts();
                        await message.SendMessageAsync($":exclamation:  | {user.Mention}, **{userAcc.Name}** is sick! Treat her right with medicine with w!buy! ");
                    }
                    if ((userAcc.Waste == 20) && (userAcc.Hunger <= 5) && (userAcc.Attention <= 5))
                    {
                        userAcc.XP      = 0;
                        userAcc.Name    = null;
                        userAcc.Have    = false;
                        userAcc.pfp     = null;
                        userAcc.RanAway = true;
                        await message.SendMessageAsync($":exclamation:  | {user.Mention}, **{userAcc.Name}** ran away! The living conditions you provided were too low... Maybe try to pay more attention to your Wasagotchi next time! ");

                        GlobalWasagotchiUserAccounts.SaveAccounts();
                    }
                    GlobalWasagotchiUserAccounts.SaveAccounts();
                }
                else
                {
                    return;
                }
            }
            Console.WriteLine("Successfully executed pet crippling effects.");
        }
コード例 #9
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiTrain()
        {
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastTrain.AddSeconds(8) - now);

            if (now < config.LastTrain.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                return;
            }
            if (config.Have == false) //if they own a Wasagotchi or not
            {
                await Context.Channel.SendMessageAsync($":no:  |  **{Context.User.Username}**, you don't own a <:wasagotchi:454535808079364106> Wasagotchi! \n\nPurchase one with w!wasagotchi buy!");

                GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                return;
            }
            else
            {
                config.LastTrain = now;
                Random rand   = new Random();
                int    choice = rand.Next(1, 3);

                if (choice == 1)
                {
                    int  much = rand.Next(20, 30);
                    uint attn = Convert.ToUInt32(much);
                    config.XP += attn;
                    GlobalWasagotchiUserAccounts.SaveAccounts(Context.User.Id);
                    int    randomIndex  = rand.Next(yesTrainTexts.Length);
                    string text         = yesTrainTexts[randomIndex];
                    var    thumbnailurl = Context.User.GetAvatarUrl();
                    var    auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    if (config.pfp == null)
                    {
                        embed.WithThumbnailUrl("https://i.imgur.com/6AaY08I.png");
                    }
                    else
                    {
                        embed.WithThumbnailUrl(config.pfp);
                    }
                    embed.WithDescription($"{text} \n**(+{attn} exp)**");
                    await Context.Channel.SendMessageAsync("", embed : embed.Build());
                }
                if (choice == 2)
                {
                    int    randomIndex  = rand.Next(yesTrainTexts.Length);
                    string text         = noTrainTexts[randomIndex];
                    var    thumbnailurl = Context.User.GetAvatarUrl();
                    var    auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Try again!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 0, 0);
                    if (config.pfp == null)
                    {
                        embed.WithThumbnailUrl("https://i.imgur.com/6AaY08I.png");
                    }
                    else
                    {
                        embed.WithThumbnailUrl(config.pfp);
                    }
                    embed.WithDescription($"{text}");
                    await Context.Channel.SendMessageAsync("", embed : embed.Build());
                }
            }
        }
コード例 #10
0
ファイル: General.cs プロジェクト: Phytal/Wsashi
        public async Task WasagotchiUser([Remainder] string arg = "")
        {
            SocketUser user          = null;
            var        mentionedUser = Context.Message.MentionedUsers.FirstOrDefault();

            user = mentionedUser ?? Context.User;
            var      config         = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(user);
            var      configg        = GlobalUserAccounts.GetUserAccount(user);
            DateTime now            = DateTime.UtcNow;
            var      timeSpanString = string.Format("{0:%s} seconds", config.LastStats.AddSeconds(8) - now);

            if (now < config.LastStats.AddSeconds(8))
            {
                await Context.Channel.SendMessageAsync($"**{Context.User.Username}, please cooldown! You may use this command in {timeSpanString}.**");

                return;
            }
            config.LastStats = now;
            if (config.Have == false) //if they own a Wasagotchi or not
            {
                await Context.Channel.SendMessageAsync($":no:  |  **{Context.User.Username}**, you don't own a <:wasagotchi:454535808079364106> Wasagotchi! \n\nPurchase one with w!wasagotchi buy!");

                return;
            }
            else //show their Wasagotchi status
            {
                var thumbnailurl = Context.User.GetAvatarUrl();
                var auth         = new EmbedAuthorBuilder()
                {
                    Name    = $"{user.Username}'s Wasagotchi",
                    IconUrl = thumbnailurl,
                };
                var embed = new EmbedBuilder()
                {
                    Author = auth
                };
                if (config.pfp == null)
                {
                    embed.WithThumbnailUrl("https://i.imgur.com/6AaY08I.png");
                }
                else
                {
                    embed.WithThumbnailUrl(config.pfp);
                }
                embed.WithColor(37, 152, 255);
                embed.AddField("Owner", user, true);
                if (config.Name == null)
                {
                    embed.AddField("Name", "*(Name your wasagotchi!)*", true);
                }
                else
                {
                    embed.AddField("Name", config.Name, true);
                }
                if (config.Breed == null)
                {
                    embed.AddField("Breed", "Breedless (You can get a wasagotchi with a breed from a wasagotchi capsule)", true);
                }
                else
                {
                    embed.AddField("Breed", config.Breed, true);
                }
                embed.AddField("Exp", config.XP, true);
                embed.AddField("Level", config.LevelNumber, true);
                embed.AddField("Room", GetRooms(config.rLvl), true);
                embed.AddField("Waste", config.Waste, true);
                embed.AddField("Attention", config.Attention, true);
                embed.AddField("Hunger", config.Hunger, true);
                embed.AddField("Sick", config.Sick, true);
                embed.AddField("Ran Away", config.RanAway, true);
                if (config.pfp == null)
                {
                    embed.AddField("Picture", "*Default*", true);
                }
                else
                {
                    embed.AddField("Picture", "*Custom*", true);
                }

                await Context.Channel.SendMessageAsync("", embed : embed.Build());
            }
        }
コード例 #11
0
        public async Task OpenCapsule(string arg)
        {
            var config = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(Context.User);

            if (config.Have == false) //if they own a Wasagotchi or not
            {
                int value = 0;
                if (arg == "common")
                {
                    if (config.CommonCapsule > 0)
                    {
                        config.CommonCapsule -= 1;
                        GlobalUserAccounts.SaveAccounts();
                        value = Global.Rng.Next(1, 64);
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Common Wasagotchi Capsules!");

                        return;
                    }
                }
                if (arg == "rare")
                {
                    if (config.EpicCapsule > 0)
                    {
                        config.RareCapsule -= 1;
                        GlobalUserAccounts.SaveAccounts();
                        value = Global.Rng.Next(30, 64);
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Rare Wasagotchi Capsules!");

                        return;
                    }
                }
                if (arg == "epic")
                {
                    if (config.EpicCapsule > 0)
                    {
                        config.EpicCapsule -= 1;
                        GlobalUserAccounts.SaveAccounts();
                        value = Global.Rng.Next(48, 64);
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Epic Wasagotchi Capsules!");

                        return;
                    }
                }
                if (arg == "legendary")
                {
                    if (config.LegendaryCapsule > 0)
                    {
                        config.LegendaryCapsule -= 1;
                        GlobalUserAccounts.SaveAccounts();
                        value = Global.Rng.Next(63, 64);
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Legendary Wasagotchi Capsules!");

                        return;
                    }
                }
                Tuple <string, string> wasagotchi = GetWasagotchiRarity(value);
                config.Breed = wasagotchi.Item1;
                GlobalUserAccounts.SaveAccounts();
                await Context.Channel.SendMessageAsync($":pill:  |  **{Context.User.Username}**, you got a **{wasagotchi.Item2}**! Would you like to name it? `yes/no` (If not, the name will be left empty)");

                var responsee = await NextMessageAsync();

                if (responsee.Content.Equals("yes", StringComparison.CurrentCultureIgnoreCase) && (responsee.Author.Equals(Context.User)))
                {
                    await Context.Channel.SendMessageAsync($"<:wasagotchi:454535808079364106>  |  **{Context.User.Username}**, what would you like to name it? (type the name you want to give it!)");

                    var responseee = await NextMessageAsync();

                    if (responseee.Content.Length > 1 && (responseee.Author.Equals(Context.User)))
                    {
                        await Context.Channel.SendMessageAsync($"<:wasagotchi:454535808079364106>  |  **{Context.User.Username}**, successfully named your **{config.Breed}** to **{responseee}**! You can use the command `w!wasagotchi help` for more Wasagotchi commands!");
                    }
                }
                if (responsee.Content.Equals("no", StringComparison.CurrentCultureIgnoreCase) && (responsee.Author.Equals(Context.User)))
                {
                    await Context.Channel.SendMessageAsync($"<:wasagotchi:454535808079364106>  |  **{Context.User.Username}**, your Wasagotchi is unnamed! You can change the name of it by using the command `w!wasagotchi name`");

                    return;
                }
            }
            else //starts the capsule opening process
            {
                await Context.Channel.SendMessageAsync($":warning:  |  **{Context.User.Username}**, you already own a <:wasagotchi:454535808079364106> Wasagotchi! Would you like to replace it? `yes/no` (If not, the capsule won't be opened)");

                var response = await NextMessageAsync();

                if (response.Content.Equals("yes", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    int value = 0;
                    if (arg == "common")
                    {
                        if (config.CommonCapsule > 0)
                        {
                            config.CommonCapsule -= 1;
                            GlobalUserAccounts.SaveAccounts();
                            value = Global.Rng.Next(1, 64);
                        }
                        else
                        {
                            await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Common Wasagotchi Capsules!");

                            return;
                        }
                    }
                    if (arg == "rare")
                    {
                        if (config.RareCapsule > 0)
                        {
                            config.RareCapsule -= 1;
                            GlobalUserAccounts.SaveAccounts();
                            value = Global.Rng.Next(30, 64);
                        }
                        else
                        {
                            await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Rare Wasagotchi Capsules!");

                            return;
                        }
                    }
                    if (arg == "epic")
                    {
                        if (config.EpicCapsule > 0)
                        {
                            config.EpicCapsule -= 1;
                            GlobalUserAccounts.SaveAccounts();
                            value = Global.Rng.Next(48, 64);
                        }
                        else
                        {
                            await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Epic Wasagotchi Capsules!");

                            return;
                        }
                    }
                    if (arg == "legendary")
                    {
                        if (config.LegendaryCapsule > 0)
                        {
                            config.LegendaryCapsule -= 1;
                            GlobalUserAccounts.SaveAccounts();
                            value = Global.Rng.Next(63, 64);
                        }
                        else
                        {
                            await Context.Channel.SendMessageAsync($":octagonal_sign:  |  **{Context.User.Username}**, you don't have any Legendary Wasagotchi Capsules!");

                            return;
                        }
                    }
                    Tuple <string, string> wasagotchi = GetWasagotchiRarity(value);
                    config.Breed = wasagotchi.Item1;

                    await Context.Channel.SendMessageAsync($":pill:  |  **{Context.User.Username}**, you got a {wasagotchi.Item2}! Would you like to name it? `yes/no` (If not, the name will be left empty)");

                    var responsee = await NextMessageAsync();

                    if (responsee.Content.Equals("yes", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                    {
                        await Context.Channel.SendMessageAsync($"<:wasagotchi:454535808079364106>  |  **{Context.User.Username}**, what would you like to name it? (type the name you want to give it!)");

                        var responseee = await NextMessageAsync();

                        if (responseee.Content.Length > 1 && (response.Author.Equals(Context.User)))
                        {
                            string name = responseee.Content;
                            config.Name = name;
                            GlobalWasagotchiUserAccounts.SaveAccounts();
                            await Context.Channel.SendMessageAsync($"<:wasagotchi:454535808079364106>  |  **{Context.User.Username}**, successfully named your {config.Breed} to {name}! You can use the command `w!wasagotchi help` for more Wasagotchi commands!");
                        }
                    }
                    if (responsee.Content.Equals("no", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                    {
                        await Context.Channel.SendMessageAsync($"<:wasagotchi:454535808079364106>  |  **{Context.User.Username}**, your Wasagotchi is unnamed! You can change the name of it by using the command `w!wasagotchi name`");

                        return;
                    }
                }

                if (response.Content.Equals("no", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    await Context.Channel.SendMessageAsync($":feet:   |  Capsule opening canceled.");

                    return;
                }
            }
        }
コード例 #12
0
        public async Task WasagotchiBuy()
        {
            var    user     = Context.User as SocketGuildUser;
            var    config   = GlobalWasagotchiUserAccounts.GetWasagotchiAccount(user);
            var    configg  = GlobalUserAccounts.GetUserAccount(user);
            string shoptext = ":department_store:  **|  Wasagotchi Shop** \n ```xl\nPlease select the purchase you would like to make.\n\n[1] Capsules\n[2] Room Upgrades\n[3] Room Downgrade\n[4] Boosts + Items\n\nType the respective number beside the purchase you would like to select.\nType 'cancel' to cancel your purchase.```";
            var    shop     = await Context.Channel.SendMessageAsync(shoptext);

            var response = await NextMessageAsync();

            if (response == null)
            {
                await shop.ModifyAsync(m => { m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity"; });

                return;
            }
            if (response.Content.Equals("1", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m => { m.Content = $":feet:  |  **Are you sure you want to purchase a <:wasagotchi:454535808079364106> Wasagotchi? (**900** :potato:)**\n\nType `confirm` to continue or `cancel` to cancel.\n\n**Warning: this will replace your current Wasagotchi!**"; });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("confirm", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    if (configg.Money < config.RoomCost)
                    {
                        await shop.ModifyAsync(m => { m.Content = $"**<:no:453716729525174273>  |  {Context.User.Username}, you don't have enough Potatoes for that! **You require **{900 - configg.Money}** more Potatoes!"; });

                        return;
                    }
                    config.Have        = true;
                    configg.Money     -= config.RoomCost;
                    config.BoughtSince = DateTime.UtcNow;
                    //config.Owner = Context.User.Username;
                    GlobalWasagotchiUserAccounts.SaveAccounts(user.Id);
                    await Context.Channel.SendMessageAsync("You have successfully bought a <:wasagotchi:454535808079364106> Wasagotchi!");

                    return;
                }
                if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m => { m.Content = $":feet:  |  **{Context.User.Username}**, purchase cancelled."; });

                    return;
                }
                if (response == null)
                {
                    await shop.ModifyAsync(m => { m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity"; });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m => { m.Content = "<:no:453716729525174273>  | That is an invalid response. Please try again."; });

                    return;
                }
            }
            if (response.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m => { m.Content = $":feet:  |  **{Context.User.Username}**, purchase cancelled."; });

                return;
            }

            if (response.Content.Equals("2", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m => { m.Content = $":house:  |  Your current room is: **{GetRooms(config.rLvl)}**. Are you sure you want to upgrade to **{GetRooms(config.rLvl + 1)}**? (**{config.RoomCost}** :potato:) \n\nType `confirm` to continue or `cancel` to cancel."; });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("confirm", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    if (configg.Money < config.RoomCost)
                    {
                        await Context.Channel.SendMessageAsync($"**<:no:453716729525174273>  |  {Context.User.Username}, you don't have enough Potatoes for that! **You require **{config.RoomCost - configg.Money}** more Potatoes!");

                        return;
                    }
                    else
                    {
                        configg.Money -= config.RoomCost;
                        config.rLvl   += 1;
                        GlobalWasagotchiUserAccounts.SaveAccounts(user.Id);
                        await Context.Channel.SendMessageAsync($":house:  |  **{Context.User.Username}**, your room has been upgraded to **{GetRooms(config.rLvl)}**");

                        return;
                    }
                }
                if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m => { m.Content = $":feet:  |  **{Context.User.Username}**, purchase cancelled."; });

                    return;
                }
                if (response == null)
                {
                    await shop.ModifyAsync(m => { m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity"; });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m => { m.Content = "<:no:453716729525174273>  | That is an invalid response. Please try again."; });

                    return;
                }
            }

            if (response.Content.Equals("3", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
            {
                if (config.RoomCost != 0)
                {
                    await shop.ModifyAsync(m => { m.Content = $":house:  |  **Your current room is: {GetRooms(config.rLvl)}. Are you sure you want to downgrade to {GetRooms(config.rLvl - 1)}? This will not refund your Potatoes!** \n\nType `confirm` to continue or `cancel` to cancel."; });

                    var newresponse = await NextMessageAsync();

                    if (newresponse.Content.Equals("confirm", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                    {
                        config.rLvl -= 1;
                        GlobalWasagotchiUserAccounts.SaveAccounts(user.Id);
                        await shop.ModifyAsync(m => { m.Content = $":house:  |  **{Context.User.Username}**, your room has been downgraded to **{GetRooms(config.rLvl)}**"; });

                        return;
                    }
                    if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                    {
                        await shop.ModifyAsync(m => { m.Content = $":feet:  |  **{Context.User.Username}**, purchase cancelled."; });

                        return;
                    }
                    if (response == null)
                    {
                        await shop.ModifyAsync(m => { m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity"; });

                        return;
                    }
                    else
                    {
                        await shop.ModifyAsync(m => { m.Content = "<:no:453716729525174273>  | That is an invalid response. Please try again."; });

                        return;
                    }
                }
                else
                {
                    await Context.Channel.SendMessageAsync(":octagonal_sign:  | You cannot downgrade your room any further, as you have the loewst possible room");
                }
            }
            if (response.Content.Equals("4", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m => { m.Content = $"```xl\n[1] Medicine - cures your Wasagotchi's sickness [{config.Waste * 30} :potato:]\n\nType the respective number beside the purchase you would like to select.\nType 'cancel' to cancel your purchase.```"; });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("1", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    config.Sick  = false;
                    config.Waste = 0;
                    GlobalWasagotchiUserAccounts.SaveAccounts(user.Id);
                    await shop.ModifyAsync(m => { m.Content = $":pill:  |  **{Context.User.Username}**, your <:wasagotchi:454535808079364106> Wasagotchi has been cured of it's sickness!"; });

                    return;
                }
                if (newresponse.Content.Equals("cancel", StringComparison.CurrentCultureIgnoreCase) && (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m => { m.Content = $":feet:  |  **{Context.User.Username}**, purchase cancelled."; });

                    return;
                }
                if (response == null)
                {
                    await shop.ModifyAsync(m => { m.Content = $"{Context.User.Mention}, The interface has closed due to inactivity"; });

                    return;
                }
                else
                {
                    await shop.ModifyAsync(m => { m.Content = "<:no:453716729525174273>  | That is an invalid response. Please try again."; });

                    return;
                }
            }
            else
            {
                await shop.ModifyAsync(m => { m.Content = "<:no:453716729525174273>  | That is an invalid response. Please try again."; });

                return;
            }
        }