Esempio n. 1
0
            public async Task IncomingPlayerAshTreatingRequest()
            {
                //Checking commands
                if (CharactersData.GetCharacterAshWood(Context.User.Id) < 5)
                {
                    TreatingEmbed.WithColor(Color.Blue);
                    TreatingEmbed.AddField("<:Plank:607523563410554880>```You don't have enought ash wood to treat it!```", $"```You need {5 - CharactersData.GetCharacterAshWood(Context.User.Id)} more units of ash wood```");
                    await Context.Channel.SendMessageAsync("", false, TreatingEmbed.Build());

                    return;
                }
                //Execution of command
                TreatingEmbed.WithColor(Color.Blue);
                int TotalPlanksToGive = 0, TotalWoodToTook = 0, ChanceToGetBonusPlanks, TreatedPlanksToGive;

                for (int i = CharactersData.GetCharacterAshWood(Context.User.Id); i >= 5; i -= 5)
                {
                    ChanceToGetBonusPlanks = random.Next(0, 10);
                    if (ChanceToGetBonusPlanks > (7 - CharactersData.GetCharacterWoodworkingSkill(Context.User.Id) / 10))
                    {
                        TreatedPlanksToGive = random.Next(2, 3);
                    }
                    else
                    {
                        TreatedPlanksToGive = 1;
                    }
                    TotalPlanksToGive += TreatedPlanksToGive;
                    TotalWoodToTook   += 5;
                }
                TreatingEmbed.AddField("<:Plank:607523563410554880>```Success!```", $"```You have received {TotalPlanksToGive} units of treated ash wood!```");
                await Context.Channel.SendMessageAsync("", false, TreatingEmbed.Build());

                //Save data
                if (CharactersData.GetCharacterWoodworkingSkill(Context.User.Id) <= 2)
                {
                    await CharactersData.SaveCharacterTheratedAshWood(Context.User.Id, TotalPlanksToGive, 0.3f, TotalWoodToTook);
                }
                else
                {
                    await CharactersData.SaveCharacterTheratedAshWood(Context.User.Id, TotalPlanksToGive, 0.3f / CharactersData.GetCharacterWoodworkingSkill(Context.User.Id), TotalWoodToTook);;
                }
                return;
            }