• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Compiling Edit (uint64_t) when compiling.

8408323

Hoster
Joined
Mar 6, 2009
Messages
432
Reaction score
26
Hello,

I'm trying to delete the maximum level of tibia "717171" just for fun in my server.exe But I'm not sure how to do that exactly, but I believe it has to do something with this lines in player.cpp if someone could help me I would appreciate it very much!

[cpp]
void Player::addExperience(uint64_t exp)
{
uint32_t prevLevel = level;
uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
if(Player::getExpForLevel(level) > nextLevelExp)
{
//player has reached max level
levelPercent = 0;
sendStats();
return;
}

experience += exp;
while(experience >= nextLevelExp)
{
healthMax += vocation->getGain(GAIN_HEALTH);
health += vocation->getGain(GAIN_HEALTH);
manaMax += vocation->getGain(GAIN_MANA);
mana += vocation->getGain(GAIN_MANA);
capacity += vocation->getGainCap();

++level;
nextLevelExp = Player::getExpForLevel(level + 1);
if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level
break;
}

if(prevLevel != level)
{
updateBaseSpeed();
setBaseSpeed(getBaseSpeed());

g_game.changeSpeed(this, 0);
g_game.addCreatureHealth(this);
if(getParty())
getParty()->updateSharedExperience();

char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);

CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level);
}

uint64_t currLevelExp = Player::getExpForLevel(level);
nextLevelExp = Player::getExpForLevel(level + 1);
levelPercent = 0;
if(nextLevelExp > currLevelExp)
levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);

sendStats();
}
[/cpp]
or this one
[cpp]
void Player::addExperience(uint64_t exp)
{
uint32_t prevLevel = level;
uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
if(Player::getExpForLevel(level) > nextLevelExp)
{
//player has reached max level
levelPercent = 0;
sendStats();
return;
}

experience += exp;
while(experience >= nextLevelExp)
{
healthMax += vocation->getGain(GAIN_HEALTH);
health += vocation->getGain(GAIN_HEALTH);
manaMax += vocation->getGain(GAIN_MANA);
mana += vocation->getGain(GAIN_MANA);
capacity += vocation->getGainCap();

++level;
nextLevelExp = Player::getExpForLevel(level + 1);
if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level
break;
}

if(prevLevel != level)
{
updateBaseSpeed();
setBaseSpeed(getBaseSpeed());

g_game.changeSpeed(this, 0);
g_game.addCreatureHealth(this);
if(getParty())
getParty()->updateSharedExperience();

char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);

CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
(*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level);
}

uint64_t currLevelExp = Player::getExpForLevel(level);
nextLevelExp = Player::getExpForLevel(level + 1);
levelPercent = 0;
if(nextLevelExp > currLevelExp)
levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);

sendStats();
}
[/cpp]
I know that the maximum value of "(uint64_t)" is "1844674587454754874073" but is it possible to change into "(uint64_t)(uint64_t)" or anything else that is bigger?

I'm kind of a newbie with sources, but I've come this far all by myself, hopefully I'm not totally wrong with my lines above from players.cpp.
But if I'm then you need to tell me what I need to do to fix this problem.

Thanks in advice,
Kind regards,

8408323
 

Similar threads

Back
Top