public async Task IncomingPlayerPotatoCollectingRequest() { if (CharactersData.GetCharacterFarmingSkill(Context.User.Id) >= 5) { if ((DateTime.Now - CharactersData.GetCharacterFarmingCooldown(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 axe durability check //Execution of command int PlantsToGiveAmount = random.Next(1, 5) + Convert.ToInt32(CharactersData.GetCharacterFarmingSkill(Context.User.Id)); PlantsFarmEmbed.WithColor(Color.Blue); PlantsFarmEmbed.AddField("<:Wheat:603957637947588608>```Success!```", $"```You have received {PlantsToGiveAmount} potatoes!```"); await Context.Channel.SendMessageAsync("", false, PlantsFarmEmbed.Build()); //Save data await CharactersData.SavePlayerFarmCooldown(Context.User.Id, DateTime.Now); //Refresh cooldown for mining await CharactersData.SaveCharacterPotato(Context.User.Id, PlantsToGiveAmount, 0.3f / CharactersData.GetCharacterFarmingSkill(Context.User.Id)); } else { //Send message about cooldown PlantsFarmEmbed.WithColor(Color.Blue); if (120 - (DateTime.Now - CharactersData.GetCharacterFarmingCooldown(Context.User.Id)).TotalSeconds > 60) { PlantsFarmEmbed.AddField($"<:Wheat:603957637947588608>```{CharactersData.GetCharacterName(Context.User.Id)}, you're too exhausted to collect plants```", $"```Try again in 1m {Math.Round(Convert.ToDecimal(120 - (DateTime.Now - CharactersData.GetCharacterFarmingCooldown(Context.User.Id)).TotalSeconds - 60))}s```"); } else { PlantsFarmEmbed.AddField($"<:Wheat:603957637947588608>```{CharactersData.GetCharacterName(Context.User.Id)}, you're too exhausted to collect plants```", $"```Try again in {Math.Round(Convert.ToDecimal(120 - (DateTime.Now - CharactersData.GetCharacterFarmingCooldown(Context.User.Id)).TotalSeconds))}s```"); } await Context.Channel.SendMessageAsync("", false, PlantsFarmEmbed.Build()); return; } } else { PlantsFarmEmbed.WithColor(Color.Blue); PlantsFarmEmbed.AddField($"<:Wheat:603957637947588608>```Farming skill comes with time, {CharactersData.GetCharacterName(Context.User.Id)}```", "```Required level of skill is: [5]\n" + $"Your current skill level is: [{CharactersData.GetCharacterFarmingSkill(Context.User.Id)}]```"); await Context.Channel.SendMessageAsync("", false, PlantsFarmEmbed.Build()); return; } }
public async Task IncomingPlayerEggsCollectingRequest() { if ((DateTime.Now - CharactersData.GetCharacterFarmingCooldown(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 axe durability check //Execution of command int AnimalLootToGiveAmount = random.Next(1, 5) + Convert.ToInt32(CharactersData.GetCharacterFarmingSkill(Context.User.Id)); AnimalsFarmEmbed.WithColor(Color.Blue); AnimalsFarmEmbed.AddField("<:milkBar:604047741189881857>```Success!```", $"```You have received {AnimalLootToGiveAmount} eggs!```"); await Context.Channel.SendMessageAsync("", false, AnimalsFarmEmbed.Build()); //Save data await CharactersData.SavePlayerFarmCooldown(Context.User.Id, DateTime.Now); //Refresh cooldown for mining if (CharactersData.GetCharacterFarmingSkill(Context.User.Id) <= 2) { await CharactersData.SaveCharacterEggsAmount(Context.User.Id, AnimalLootToGiveAmount, 0.3f); } else { await CharactersData.SaveCharacterEggsAmount(Context.User.Id, AnimalLootToGiveAmount, 0.3f / CharactersData.GetCharacterFarmingSkill(Context.User.Id)); } } else { //Send message about cooldown AnimalsFarmEmbed.WithColor(Color.Blue); if (120 - (DateTime.Now - CharactersData.GetCharacterFarmingCooldown(Context.User.Id)).TotalSeconds > 60) { AnimalsFarmEmbed.AddField($"<:milkBar:604047741189881857>```{CharactersData.GetCharacterName(Context.User.Id)}, you're too exhausted to collect farm loot```", $"```Try again in 1m {Math.Round(Convert.ToDecimal(120 - (DateTime.Now - CharactersData.GetCharacterFarmingCooldown(Context.User.Id)).TotalSeconds - 60))}s```"); } else { AnimalsFarmEmbed.AddField($"<:Wheat:603957637947588608>```{CharactersData.GetCharacterName(Context.User.Id)}, you're too exhausted to collect farm loot```", $"```Try again in {Math.Round(Convert.ToDecimal(120 - (DateTime.Now - CharactersData.GetCharacterFarmingCooldown(Context.User.Id)).TotalSeconds))}s```"); } await Context.Channel.SendMessageAsync("", false, AnimalsFarmEmbed.Build()); return; } }
public async Task DisplayCharacterInfo(IUser User = null) { if (User == null) { CharacterCreationEmbed.WithColor(Color.Blue); CharacterCreationEmbed.AddField($"<:InfoBook:603974731535876106>```{Context.User}, your character info:```", $"```Name is: {CharactersData.GetCharacterName(Context.User.Id)}" + $"\nGold: {CharactersData.GetCharacterMoney(Context.User.Id)}\n――――――――――Skills――――――――――\nMining: |" + $"{Math.Round(Convert.ToDouble(CharactersData.GetCharacterMiningSkill(Context.User.Id)),1)}\nWood chopping: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterWoodChoppingSkill(Context.User.Id)),1)}" + $"\nHunting: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterHuntingSkill(Context.User.Id)),1)}\nFishing: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterFishingSkill(Context.User.Id)),1)}" + $"\nFarming: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterFarmingSkill(Context.User.Id)),1)}\nTrade: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterTradeSkill(Context.User.Id)),1)}" + $"\n――――――CraftingSkills―――――――\nOre melting: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterOreMeltingSkill(Context.User.Id)),1)}\nWoodworking: |" + $"{Math.Round(Convert.ToDouble(CharactersData.GetCharacterWoodworkingSkill(Context.User.Id)),1)}\nBlacksmith: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterBlacksmithSkill(Context.User.Id)),1)}" + $"\nFurniture maker: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterFurnitureMakerSkill(Context.User.Id)),1)}\nCooking: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterCookingSkill(Context.User.Id)),1)}" + $"\nSnipper: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterSnipperSkill(Context.User.Id)),1)}```"); } else { CharacterCreationEmbed.WithColor(Color.Blue); CharacterCreationEmbed.AddField($"<:InfoBook:603974731535876106>```{User.Username}, your character info:```", $"```Name is: {CharactersData.GetCharacterName(User.Id)}" + $"\nGold: {CharactersData.GetCharacterMoney(User.Id)}\n――――――――――Skills――――――――――\nMining: |" + $"{Math.Round(Convert.ToDouble(CharactersData.GetCharacterMiningSkill(User.Id)), 1)}\nWood chopping: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterWoodChoppingSkill(User.Id)), 1)}" + $"\nHunting: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterHuntingSkill(User.Id)), 1)}\nFishing: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterFishingSkill(User.Id)), 1)}" + $"\nFarming: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterFarmingSkill(User.Id)), 1)}\nTrade: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterTradeSkill(User.Id)), 1)}" + $"\n――――――CraftingSkills―――――――\nOre melting: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterOreMeltingSkill(User.Id)), 1)}\nWoodworking: |" + $"{Math.Round(Convert.ToDouble(CharactersData.GetCharacterWoodworkingSkill(User.Id)), 1)}\nBlacksmith: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterBlacksmithSkill(User.Id)), 1)}" + $"\nFurniture maker: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterFurnitureMakerSkill(User.Id)), 1)}\nCooking: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterCookingSkill(User.Id)), 1)}" + $"\nSnipper: |{Math.Round(Convert.ToDouble(CharactersData.GetCharacterSnipperSkill(User.Id)), 1)}```"); } await Context.Channel.SendMessageAsync("", false, CharacterCreationEmbed.Build()); }