Esempio n. 1
0
        public async Task ChomusukeTrain()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom   = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                int choice = Global.Rng.Next(1, 3);

                if (choice == 1)
                {
                    uint xpGain = (uint)Global.Rng.Next(20, 30);
                    chom.XP += xpGain;
                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(config.Id);
                    int    randomIndex  = Global.Rng.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);
                    embed.WithThumbnailUrl(yesTrainLinks[Global.Rng.Next(yesTrainLinks.Length)]);
                    embed.WithDescription($"{text} \n**(+{xpGain} exp)**");
                    await SendMessage(Context, embed.Build());
                }

                if (choice == 2)
                {
                    int    randomIndex  = Global.Rng.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);
                    embed.WithThumbnailUrl(noTrainLinks[Global.Rng.Next(noTrainLinks.Length)]);
                    embed.WithDescription($"{text}");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
Esempio n. 2
0
        public static AttackResult DeflectAttack(ShardedCommandContext context)
        {
            var config = GlobalUserAccounts.GetUserAccount(context.User);
            var chom   = ActiveChomusuke.GetOneActiveChomusuke(config.Id);

            string response;
            bool   success = false;
            int    dmg     = 0;

            if (chom.Effects.Contains(Effect.Blocking))
            {
                response = "You cannot block while already in blocking formation! Try again!";
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            if (chom.Effects.Contains(Effect.Deflecting))
            {
                response = "You are already in deflecting formation! Try again!";
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            chom.Effects.Add(Effect.Deflecting);
            GlobalUserAccounts.SaveAccounts(config.Id);
            response =
                $":shield:  **|** **{config.OpponentName}**, You are now in deflecting formation!\n\n**{config.OpponentName}**'s shield will deflect 50% of the damage from the next attack";
            success = true;
            return(new AttackResult {
                Success = success, Response = response, Damage = dmg
            });
        }
Esempio n. 3
0
        public static async Task Burned(ShardedCommandContext context)
        {
            var config = GlobalUserAccounts.GetUserAccount(context.User);
            var chom   = ActiveChomusuke.GetOneActiveChomusuke(config.Id);

            var dmg = (uint)Global.Rng.Next(2, 5);

            if (!chom.Effects.Contains(Effect.Burned))
            {
                return;
            }
            var rng = Global.Rng.Next(1, 5);

            if (rng == 4)
            {
                chom.Effects.Remove(Effect.Burned);
                GlobalUserAccounts.SaveAccounts(config.Id);
                await SendMessage(context, null, $"{chom.Name} stopped burning!");

                return;
            }

            chom.Health -= dmg;
            GlobalUserAccounts.SaveAccounts(config.Id);
            await SendMessage(context, null, $"{chom.Name} took {dmg} from being burned!");
        }
Esempio n. 4
0
File: Slash.cs Progetto: Phytal/Nayu
        public static AttackResult SlashAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            var    dmg      = (int)Math.Round(Attack.Damage * chom1.CP * .05);
            var    accuracy = Global.Rng.Next(1, Attack.Accuracy + 1);

            if (accuracy > 1)
            {
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;

                var block   = CheckModifiers.CheckForBlock(context.User, player2, dmg);
                var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);
                if (block.Item1)
                {
                    chom2.Health -= (uint)block.Item3;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg = block.Item3;
                }
                else if (deflect.Item1)
                {
                    chom2.Health -= (uint)deflect.Item2;
                    chom1.Health -= (uint)deflect.Item2;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg = deflect.Item2;
                }
                else
                {
                    chom2.Health -= (uint)dmg;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n**{chom1.Name}** has **{chom1.Health}** health left!\n{Helpers.GetHpLeft(chom1, chom2)}";
                }
            }
            else
            {
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
            }

            return(new AttackResult {
                Success = true, Response = response, Damage = dmg
            });
        }
Esempio n. 5
0
        public static async Task ChooseActionAsync(SocketUser user, string action)
        {
            var activeChomusuke = ActiveChomusuke.GetOneActiveChomusuke(user.Id);

            if (action == "cure")
            {
                activeChomusuke.Sick  = false;
                activeChomusuke.Waste = 0;
                await ActiveChomusuke.ConvertOneActiveVariable(user.Id, activeChomusuke);
            }
        }
Esempio n. 6
0
        public static AttackResult FireballAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var configg = GlobalUserAccounts.GetUserAccount(player2);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            var    accuracy = Global.Rng.Next(1, Attack.Accuracy + 1);
            string response;
            bool   success;
            var    dmg = (int)Math.Round(Attack.Damage * chom1.CP * .05);

            //use if something negates this

            /*if (configg.armour == "reinforced")
             * {
             *  GlobalUserAccounts.SaveAccounts();
             *  response = $":fire: **|** **{configg.OpponentName}** used **Fireball** but {config.OpponentName}** has reinforced armour. Therefore it had no effect.";
             *  success = true;
             *  return new AttackResult{Success = success, Response = response, Damage = 0};
             * }*/
            if (accuracy > 1)
            {
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;
                chom2.Health -= (uint)dmg;
                chom2.Effects.Add(Effect.Burned);

                GlobalUserAccounts.SaveAccounts(config.Id);
                response =
                    $":fire:  | **{configg.OpponentName}** used **Fireball** and did {dmg} damage (buffed by {modifier}% due to active damage modifiers)!\n\n**{config.OpponentName}** is now burning";
                success = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
            else
            {
                dmg = 0;
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
                success  = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
        }
Esempio n. 7
0
        public async Task ChomusukeName([Remainder] string name)
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                chom.Name = name;
                await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                GlobalUserAccounts.SaveAccounts(Context.User.Id);
                await SendMessage(Context, null,
                                  $"✅   **|**  **{Context.User.Username}**, you successfully changed {Global.EChomusuke} {chom.Name}'s name to **{name}**!");
            }
        }
Esempio n. 8
0
        public static AttackResult EarthquakeAttack(ShardedCommandContext context)
        {
            var config = GlobalUserAccounts.GetUserAccount(context.User);
            var choms  = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1  = choms.Item1;
            var chom2  = choms.Item2;

            string response;
            bool   success;
            var    dmg = (int)Math.Round(Attack.Damage * chom1.CP * .05);

            if (chom1.Effects.Contains(Effect.Blocking))
            {
                chom1.Effects.Remove(Effect.Blocking);
            }
            if (chom2.Effects.Contains(Effect.Blocking))
            {
                chom2.Effects.Remove(Effect.Blocking);
            }
            if (chom1.Effects.Contains(Effect.Deflecting))
            {
                chom1.Effects.Remove(Effect.Deflecting);
            }
            if (chom2.Effects.Contains(Effect.Deflecting))
            {
                chom2.Effects.Remove(Effect.Deflecting);
            }
            chom1.Health -= (uint)dmg / 3;
            chom2.Health -= (uint)dmg;
            GlobalUserAccounts.SaveAccounts(config.Id);
            response =
                $"<:shatter:532002647692148748>  | **{chom1.Name}**, created an Earthquake! {dmg} damage was dealt to {chom2.Name} with {chom1.Name} taking {dmg / 3} and Blocks/Deflects are canceled";
            success = true;

            return(new AttackResult {
                Success = success, Response = response, Damage = dmg
            });
        }
Esempio n. 9
0
        public async Task SellChomusukeAsync()
        {
            var config     = GlobalUserAccounts.GetUserAccount(Context.User);
            var activeChom = ActiveChomusuke.GetOneActiveChomusuke(Context.User.Id);

            if ((DateTime.Now - activeChom.BoughtDay).Days < 1)
            {
                throw new Exception("You cannot sell a Chomusuke that's under a day old!");
            }
            string shoptext =
                $":department_store:  **| Are you sure you want to sell your active Chomusuke, {activeChom.Name}? [y/n]";
            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("y", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                var value = GetChomusukeValue(activeChom);
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $":feet:  |  **Your {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke is worth {value} Taiyakis, do you wish to sell it? (**900** {Emote.Parse("<:taiyaki:599774631984889857>")})**\n\nType `confirm` to continue or `cancel` to cancel.\n\n**Warning: this is irreversible!**";
                });

                var newresponse = await NextMessageAsync();

                if (newresponse.Content.Equals("confirm", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    //remove chomusuke
                    config.ActiveChomusuke = 0;
                    config.Taiyaki        += value;
                    GlobalUserAccounts.SaveAccounts(Context.User.Id);
                    await SendMessage(Context, null, $"You have successfully sold your Chomusuke {activeChom.Name}");

                    return;
                }

                if (newresponse.Content.Equals("n", StringComparison.CurrentCultureIgnoreCase) &&
                    (response.Author.Equals(Context.User)))
                {
                    await shop.ModifyAsync(m =>
                    {
                        m.Content = $":feet:  **|**  **{Context.User.Username}**, action 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 = $"{Global.ENo}  **|** That is an invalid response. Please try again.";
                    });

                    return;
                }
            }
        }
Esempio n. 10
0
        public static AttackResult BashAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            bool   success  = false;
            var    dmg      = (int)Math.Round(Attack.Damage * chom1.CP * .05);
            var    stunProb = Global.Rng.Next(1, 3);

            chom1.Mana -= Attack.Mana;

            var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);

            dmg = result.Item1;
            int modifier = result.Item2;

            var block = CheckModifiers.CheckForBlock(context.User, player2, dmg);

            if (block.Item1)
            {
                chom2.Health -= (uint)block.Item3;
                GlobalUserAccounts.SaveAccounts(config.Id);
                response =
                    $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                dmg = block.Item3;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);

            if (deflect.Item1)
            {
                chom2.Health -= (uint)deflect.Item2;
                chom1.Health -= (uint)deflect.Item2;
                GlobalUserAccounts.SaveAccounts(config.Id);
                response =
                    $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                dmg = deflect.Item2;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }

            if (stunProb == 1)
            {
                response =
                    $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!**{chom2.Name}** is now stunned!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                foreach (Effect effect in Attack.Effects)
                {
                    chom2.Effects.Add(effect);
                }
            }

            chom2.Health -= (uint)dmg;
            GlobalUserAccounts.SaveAccounts(context.User.Id, player2.Id);

            response =
                $"**{context.User.Username}**, You bashed **{chom2.Name}** and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
            success = true;

            return(new AttackResult {
                Success = success, Response = response, Damage = dmg
            });
        }
Esempio n. 11
0
        public static AttackResult AbsorbAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            bool   success;
            int    hit = Global.Rng.Next(1, Attack.Accuracy + 1);

            if (hit == 1)
            {
                //use if something negates this

                /*if (configg.armour == "reinforced")
                 * {
                 *  GlobalUserAccounts.SaveAccounts();
                 *  response =
                 *      $":fire: **|** **{configg.OpponentName}** used **Absorb** but {config.OpponentName}** has reinforced armour. Therefore it had no effect.";
                 *  success = true;
                 *  return new AttackResult{Success = success, Response = response, Damage = 0};
                 * }*/

                var dmg = (int)Math.Round(Attack.Damage * chom1.CP * .05);

                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;

                var block = CheckModifiers.CheckForBlock(context.User, player2, dmg);
                if (block.Item1 == true)
                {
                    chom2.Health -= (uint)block.Item3;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":comet:  | **{context.User.Username}**,You absorbed **{dmg}** health and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg     = block.Item3;
                    success = true;
                    return(new AttackResult {
                        Success = success, Response = response, Damage = dmg
                    });
                }

                var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);
                if (deflect.Item1 == true)
                {
                    chom2.Health -= (uint)deflect.Item2;
                    chom1.Health -= (uint)deflect.Item2;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":comet:  | **{context.User.Username}**, You absorbed **{dmg}** health and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg     = deflect.Item2;
                    success = true;
                    return(new AttackResult {
                        Success = success, Response = response, Damage = dmg
                    });
                }

                chom2.Health -= (uint)dmg;
                GlobalUserAccounts.SaveAccounts(config.Id);

                response =
                    $":comet:  | **{context.User.Username}**, You absorbed **{dmg}** health and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                success = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
            else
            {
                int dmg    = 0;
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg); //resets 1 turn buffs
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
                success  = true;
                return(new AttackResult {
                    Success = success, Response = response, Damage = dmg
                });
            }
        }
Esempio n. 12
0
        public async Task ChomusukePlay()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                if (chom.Trust == 20)
                {
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Chiiiii..",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 128, 0);
                    embed.WithThumbnailUrl(NoPlayLinks[Global.Rng.Next(NoPlayLinks.Length)]);
                    embed.WithDescription(
                        $":soccer:  **|**  **{Context.User.Username}, your {Global.EChomusuke} Chomusuke is bored of playing right now!**");
                    await SendMessage(Context, embed.Build());

                    return;
                }

                {
                    int    randomIndex = Global.Rng.Next(playTexts.Length);
                    string text        = playTexts[randomIndex];
                    int    trustGain   = Global.Rng.Next(4, 9);
                    chom.Trust += (byte)trustGain;
                    if (chom.Trust > 20)
                    {
                        chom.Trust = 20;
                    }

                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(Context.User.Id);
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl(YesPlayLinks[Global.Rng.Next(YesPlayLinks.Length)]);
                    embed.WithDescription(
                        $":soccer:  **|**  **{Context.User.Username}**, {text} **(+{trustGain} trust)**");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
Esempio n. 13
0
        public async Task ChomusukeClean()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                if (chom.Waste == 0)
                {
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Chiiiii..",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 128, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/OtVepvM.gif");
                    embed.WithDescription(
                        $":sparkles:  **|** **{Context.User.Username}, your {Global.EChomusuke} Chomusuke's room is squeaky clean!**");
                    await SendMessage(Context, embed.Build());
                }
                else
                {
                    int    randomIndex   = Global.Rng.Next(cleanTexts.Length);
                    string text          = cleanTexts[randomIndex];
                    int    cleanedAmount = Global.Rng.Next(4, 8);
                    chom.Waste -= (byte)cleanedAmount;
                    if (chom.Waste > 20)
                    {
                        chom.Waste = 0;
                    }

                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(Context.User.Id);

                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/PI2z8rm.gif");
                    embed.WithDescription(
                        $":sparkles:  **|**  **{Context.User.Username}**, {text} **(-{cleanedAmount} waste)**");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
Esempio n. 14
0
        public async Task ChomusukeFeed()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.ActiveChomusuke == 0) //if they set an active chomusuke
            {
                await SendMessage(Context, null,
                                  $"{Global.ENo}  **|**  **{Context.User.Username}**, you don't have an active {Global.EChomusuke} Chomusuke set!\n\nSet an active Chomusuke with `n!active`!");
            }
            else
            {
                var chom = ActiveChomusuke.GetOneActiveChomusuke(config.Id);
                if (chom.Hunger == 20)
                {
                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Chiiiii..",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(255, 128, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/Sc4HGir.gif");
                    embed.WithDescription(
                        $":poultry_leg:  **|**  **{Context.User.Username}**, {Global.EChomusuke} {chom.Name} is full!");
                    await SendMessage(Context, embed.Build());
                }
                else
                {
                    int cost       = Global.Rng.Next(34, 87);
                    int hungerGain = Global.Rng.Next(4, 9);
                    chom.Hunger += (byte)hungerGain;
                    if (chom.Hunger > 20)
                    {
                        chom.Hunger = 20;
                    }

                    await ActiveChomusuke.ConvertOneActiveVariable(config.Id, chom);

                    GlobalUserAccounts.SaveAccounts(Context.User.Id);

                    var thumbnailurl = Context.User.GetAvatarUrl();
                    var auth         = new EmbedAuthorBuilder()
                    {
                        Name    = "Success!",
                        IconUrl = thumbnailurl,
                    };
                    var embed = new EmbedBuilder()
                    {
                        Author = auth
                    };
                    embed.WithColor(0, 255, 0);
                    embed.WithThumbnailUrl("https://i.imgur.com/Sc4HGir.gif");
                    embed.WithDescription(
                        $":poultry_leg:  **|**  **{Context.User.Username}**, you fill {Global.EChomusuke} {chom.Name}'s bowl with food. It looks happy! **(+{hungerGain} food [-{cost} {Global.ETaiyaki}])**");
                    await SendMessage(Context, embed.Build());
                }
            }
        }
Esempio n. 15
0
File: Shop.cs Progetto: Phytal/Nayu
        public async Task ChomusukeBuy()
        {
            var    user            = Context.User as SocketGuildUser;
            var    config          = GlobalUserAccounts.GetUserAccount(user);
            var    activeChomusuke = ActiveChomusuke.GetOneActiveChomusuke(user.Id);
            string shoptext        =
                ":department_store:  **|  Chomusuke Shop** \n ```xl\nPlease select the purchase you would like to make.\n\n[1] Capsules\n[2] Boosts\n[3] 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 {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke? (**900** {Emote.Parse("<:taiyaki:599774631984889857>")})**\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 (config.Taiyaki < 900)
                    {
                        await shop.ModifyAsync(m =>
                        {
                            m.Content =
                                $"**<:no:453716729525174273>  |  {Context.User.Username}, you don't have enough Taiyakis for that! **You require **{900 - config.Taiyaki}** more Taiyakis!";
                        });

                        return;
                    }

                    config.NormalCapsule += 1;
                    config.Taiyaki       -= 900;
                    GlobalUserAccounts.SaveAccounts(user.Id);
                    await SendMessage(Context, null,
                                      $"You have successfully bought a {Emote.Parse("<:chomusuke:601183653657182280>")} Normal Chomusuke Capsule!");

                    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 = $"{Global.ENo} **|** 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;
            }

            //TODO: add boosts
            if (response.Content.Equals("2", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $"```xl\n[1] Medicine - cures your Chomusuke's sickness [400 {Emote.Parse("<:taiyaki:599774631984889857>")}]\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)))
                {
                    await ChooseChomusuke.ChooseActionAsync(user, "cure");

                    config.Taiyaki -= 400;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    await shop.ModifyAsync(m =>
                    {
                        m.Content =
                            $":pill:  |  **{Context.User.Username}**, your {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke has been cured of it's sickness! Make sure to keep looking after it!";
                    });

                    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 = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                    });
                }
            }

            if (response.Content.Equals("3", StringComparison.CurrentCultureIgnoreCase) &&
                (response.Author.Equals(Context.User)))
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content =
                        $"```xl\n[1] Medicine - cures your Chomusuke's sickness [400 {Emote.Parse("<:taiyaki:599774631984889857>")}]\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)))
                {
                    await ChooseChomusuke.ChooseActionAsync(user, "cure");

                    config.Taiyaki -= 400;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    await shop.ModifyAsync(m =>
                    {
                        m.Content =
                            $":pill:  |  **{Context.User.Username}**, your {Emote.Parse("<:chomusuke:601183653657182280>")} Chomusuke has been cured of it's sickness! Make sure to keep looking after it!";
                    });

                    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 = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                    });
                }
            }
            else
            {
                await shop.ModifyAsync(m =>
                {
                    m.Content = $"{Global.ENo} **|** That is an invalid response. Please try again.";
                });
            }
        }