Exemple #1
0
        public async Task Fishy()
        {
            var inventory = await _items.GetInventoryByUserId(Context.User.Id);

            var profileCoins = await _userProfiles.GetEssentiCoinsAsync(Context.User.Id);

            if (profileCoins < 5)
            {
                await Context.Channel.SendErrorAsync("Error!", "You are poor!");
            }
            else
            {
                await _userProfiles.SubtractEssentiCoinsAsync(Context.User.Id, 5);

                if (inventory != null)
                {
                    var catchRate   = new Random().Next(1, 100);
                    var catchChance = new Random().Next(1, 100);

                    if (catchChance >= 50)
                    {
                        //catch fish
                        if (catchRate <= 50)
                        {
                            //catch garbage fish
                            //add common fish to user inventory
                            await Context.Channel.EmbedBuild("Success!", "You just caught 🗑️!");
                        }
                        else if (catchRate >= 51 && catchRate <= 75)
                        {
                            //catch common fish
                            //add to user inventory
                            await Context.Channel.EmbedBuild("Success!", "You just caught 🐟!");
                        }
                        else if (catchRate >= 76 && catchRate <= 93)
                        {
                            //catch uncommon fish
                            //add to inventory
                            await Context.Channel.EmbedBuild("Success!", "You just caught 🐡!");
                        }
                        else
                        {
                            //catch rare fish
                            //add to inventory
                            await Context.Channel.EmbedBuild("Success!", "You just caught 🐠!");
                        }
                    }
                    else
                    {
                        await Context.Channel.SendErrorAsync("OOF", "You didn't catch anything. Better luck next time!");

                        //didnt catch anything
                    }
                }
                else
                {
                    await _items.AddInventory(Context.User.Id);
                }
            }
        }