Right now we have a java method calculating a number, it is called prestige, the prestige cost increases each level, the code is a loop, we're trying to find the max prestige an user can reach with all their current balance.
The loop takes a long time, i believe we could somehow generate an formula which would be way way faster than the loop.
The actual calculation of an prestige cost is: cost + cost/(100 * prestige)
We have the variable balance, which is the actual balance of the user, and we need the balance = sum of prestige costs, until a level where the sum of costs is higher than the balance,
at first I thought about something related to An? do you guys have an idea?
double balance = EnchantedPrison.getEcon().getBalance(player);
while (true){
final double prestigeCost = PrestigeUtils.getPrestigeCost(cost, prestige + prestiges.getFirst() + 1) + prestiges.getSecond();
//Bukkit.getLogger().log(Level.INFO,"PrestigeCost -> " + prestigeCost);
if (!EnchantedPrison.getEcon().has(player, prestigeCost)){
break;
}
prestiges.setSecond(prestigeCost);
prestiges.setFirst(prestiges.getFirst() + 1);
}
return prestiges;
I've gotten to the point where I achieved a "formula", for it, but I'm having a hard time getting it from summation to an actual pack of variables that I could use on my program. here it is: