Hello. Im having some trouble to understand everything but I will try to fix it and post here to see if I understood it correctly. If I got something wrong, please help me. I have tried a couple of different ways with server crashes as result that is why I make this thread.
[Cpp] //Level loss
uint32_t newLevel = level;
while((uint64_t)(experience - getLostExperience()) < Player::getExpForLevel(newLevel))
{
if(newLevel > 1)
newLevel--;
else
break;
}[/Cpp]
I read it like this:
You loose one level every turn. When you have lost enought levels it will stop. It will also stop so you cant die below level 1. So if you die from 101 to 98 it will remove one level (100, 99, 98) and stop when newLevel is 98, only that it doesnt count in levels, it counts in experience needed for level. I cant explain better than this but I think I know how it works.
Anyways, if I changed so code now looks like this:
[CPP] //Level loss
uint32_t newLevel = level;
while((uint64_t)(experience - getLostExperience()) < Player::getExpForLevel(newLevel))
{
if(newLevel > 70)
newLevel--;
else
break;
}[/CPP]
... I guess that will set new minimum level to 70. Correct?
edit: Writing next part...
[Cpp] //Level loss
uint32_t newLevel = level;
while((uint64_t)(experience - getLostExperience()) < Player::getExpForLevel(newLevel))
{
if(newLevel > 1)
newLevel--;
else
break;
}[/Cpp]
I read it like this:
You loose one level every turn. When you have lost enought levels it will stop. It will also stop so you cant die below level 1. So if you die from 101 to 98 it will remove one level (100, 99, 98) and stop when newLevel is 98, only that it doesnt count in levels, it counts in experience needed for level. I cant explain better than this but I think I know how it works.
Anyways, if I changed so code now looks like this:
[CPP] //Level loss
uint32_t newLevel = level;
while((uint64_t)(experience - getLostExperience()) < Player::getExpForLevel(newLevel))
{
if(newLevel > 70)
newLevel--;
else
break;
}[/CPP]
... I guess that will set new minimum level to 70. Correct?
edit: Writing next part...