static uint64_t getExpForLevel(uint32_t lv)
static uint64_t getExpForLevel(uint32_t lv)
{
static std::map<uint32_t, uint64_t> cache;
lv--;
std::map<uint32_t, uint64_t>::iterator it = cache.find(lv);
if(it != cache.end())
return it->second;
uint64_t exp = ((50ULL * (lv+1ULL) / 3ULL - 100ULL) * (lv+1ULL) + 850ULL / 3ULL) * (lv+1ULL) - 200ULL;
cache[lv] = exp;
return exp;
}
if(experience > 0x7FFFFFFF) // client debugs after 2,147,483,647 exp
msg->put<uint32_t>(0x7FFFFFFF);
if(experience > 2147483647) // client debugs after 2,147,483,647 exp
msg->put<uint32_t>(2147483647);
Did you make sure to rebuild all?It doesn't work ;p... the compiling worked, but I can't get above 717k.
It is not necessary because that's what the hex value stands for is 2,147,483,64, so all you've done is made it so the server has to convert it to the value before sending the byte to the client.it is necessary because if you passed level 717k you will get experience more than 2,147,483,647 and the tibia client limit is a unsigned int 32.so i check if experience is after 2,147,483,647.it will just print(2,147,483,647)
void Player::onGainExperience(double& gainExp, bool fromMonster, bool multiplied)
{
if(party && party->isSharedExperienceEnabled() && party->isSharedExperienceActive())
{
party->shareExperience(gainExp, fromMonster, multiplied);
rateExperience(gainExp, fromMonster);
return; //we will get a share of the experience through the sharing mechanism
}
if(gainExperience(gainExp, fromMonster))
Creature::onGainExperience(gainExp, fromMonster, true);
}