예제 #1
0
            public async Task IncomingPlayerAdamantiteOreRemeltingRequest()
            {
                if (CharactersData.GetCharacterOreMeltingSkill(Context.User.Id) >= 35)
                {
                    //Checking commands
                    if (CharactersData.GetCharacterGoldenOre(Context.User.Id) < 5)
                    {
                        RemeltingEmbed.WithColor(Color.Blue);
                        RemeltingEmbed.AddField("<:Iron:603979800092344340>```You don't have enought adamantite ore to remelt it!```", $"```You need {5 - CharactersData.GetCharacterAdamantiteOre(Context.User.Id)} more units of adamantite ore```");
                        await Context.Channel.SendMessageAsync("", false, RemeltingEmbed.Build());

                        return;
                    }
                    //Execution of command
                    RemeltingEmbed.WithColor(Color.Blue);
                    int TotalBarsToGive = 0, TotalOreToTook = 0;
                    for (int i = CharactersData.GetCharacterAdamantiteOre(Context.User.Id); i >= 5; i -= 5)
                    {
                        int ChanceToGetBonusBars = random.Next(0, 10);
                        int RemeltedBarsToGive;
                        if (ChanceToGetBonusBars > (7 - CharactersData.GetCharacterOreMeltingSkill(Context.User.Id) / 24))
                        {
                            RemeltedBarsToGive = random.Next(2, 3);
                        }
                        else
                        {
                            RemeltedBarsToGive = 1;
                        }
                        TotalBarsToGive += RemeltedBarsToGive;
                        TotalOreToTook  += 5;
                    }
                    RemeltingEmbed.AddField("<:Iron:603979800092344340>```Success!```", $"```You have received {TotalBarsToGive} adamantite bars!```");
                    await Context.Channel.SendMessageAsync("", false, RemeltingEmbed.Build());

                    //Save data
                    await CharactersData.SaveCharacterRemeltedAdamantite(Context.User.Id, TotalBarsToGive, 0.3f / CharactersData.GetCharacterOreMeltingSkill(Context.User.Id), TotalOreToTook);;
                    return;
                }
                else
                {
                    RemeltingEmbed.WithColor(Color.Blue);
                    RemeltingEmbed.AddField($"<:Iron:603979800092344340>```Remelting skill comes with time, {CharactersData.GetCharacterName(Context.User.Id)}```",
                                            "```Required level of skill is: [35]\n" +
                                            $"Your current skill level is: [{CharactersData.GetCharacterOreMeltingSkill(Context.User.Id)}]```");
                    await Context.Channel.SendMessageAsync("", false, RemeltingEmbed.Build());

                    return;
                }
            }