Esempio n. 1
0
            public async Task IncomingPlayerRuffFishingRequest()
            {
                if (CharactersData.GetCharacterFishingSkill(Context.User.Id) >= 5)
                {
                    if ((DateTime.Now - CharactersData.GetCharacterFishingCooldown(Context.User.Id)).TotalSeconds >= 120) // checks if more than 120 seconds have passed between the last requests send by the player
                    {
                        //In future update add a fishing rod durability check

                        //Execution of command
                        FishingEmbed.WithColor(Color.Blue);
                        FishingEmbed.AddField("<:FishingRod:603598075239596042>```Success!```", $"```You caught a ruff fish!```");
                        await Context.Channel.SendMessageAsync("", false, FishingEmbed.Build());

                        //Save data
                        await CharactersData.SavePlayerFishingCooldown(Context.User.Id, DateTime.Now); //Refresh cooldown for mining

                        await CharactersData.SaveCharacterCarp(Context.User.Id, 1, 0.3f / CharactersData.GetCharacterFishingSkill(Context.User.Id));
                    }
                    else
                    {
                        //Send message about cooldown
                        FishingEmbed.WithColor(Color.Blue);
                        if (120 - (DateTime.Now - CharactersData.GetCharacterFishingCooldown(Context.User.Id)).TotalSeconds > 60)
                        {
                            FishingEmbed.AddField($"<:FishingRod:603598075239596042>```{CharactersData.GetCharacterName(Context.User.Id)}, you're too exhausted to go fishing```",
                                                  $"```Try again in 1m {Math.Round(Convert.ToDecimal(120 - (DateTime.Now - CharactersData.GetCharacterFishingCooldown(Context.User.Id)).TotalSeconds - 60))}s```");
                        }
                        else
                        {
                            FishingEmbed.AddField($"<:FishingRod:603598075239596042>```{CharactersData.GetCharacterName(Context.User.Id)}, you're too exhausted to go fishing```",
                                                  $"```Try again in {Math.Round(Convert.ToDecimal(120 - (DateTime.Now - CharactersData.GetCharacterFishingCooldown(Context.User.Id)).TotalSeconds))}s```");
                        }
                        await Context.Channel.SendMessageAsync("", false, FishingEmbed.Build());

                        return;
                    }
                }
                else
                {
                    FishingEmbed.WithColor(Color.Blue);
                    FishingEmbed.AddField($"<:FishingRod:603598075239596042>```Fishing skill comes with time, {CharactersData.GetCharacterName(Context.User.Id)}```",
                                          "```Required level of skill is: [5]\n" +
                                          $"Your current skill level is: [{CharactersData.GetCharacterFishingSkill(Context.User.Id)}]```");
                    await Context.Channel.SendMessageAsync("", false, FishingEmbed.Build());

                    return;
                }
            }