• 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!

Compiling Max level edit, client crashes.

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,078
Solutions
15
Reaction score
370
Location
Sweden
YouTube
Joriku
Hi,
Ran past an issue while I edited the max level on TFS 1.3 (Forgottenserver)

Ran past this old therd explaining it, but I can't manage to find the code in later versions.
Anyone that knows how to get rid of this in the later version?


5437d25a5c16bf43eab8d8bd692d589f.png




Error:
cd69de1b64d434691b4ec049973b1cc3.png
 
Last edited:
Solution
TFS 1.3 already uses uint64_t by default, there is no way to extend the limits further, that is the highest integer numeric type you can use
this limit is: 18446744073709551615 or if you like the hexadecimal format 0xFFFFFFFFFFFFFFFF

As it is by default it is the maximum: uint64_t
msg.add<uint64_t>(player->getExperience());

If you want to use this space to show level instead of experience, then just change player->getExperience() for player->getLevel()
But you cannot change the type of number sent for the level waiting for the CIP client to know how to read this value
the client reads the level with 2 Bytes, and the experience with 8 Bytes
Update:
Got this:
0d86489a5ffc79ed2cbaa9e89b1c9fe1.png



After adding this:
Protocolgame.cpp
Lua:
at:
msg.add<uint64_t>(player->getExperience());

I added this:
if (player->getExperience() > 2147483647) // client debugs after 2,147,483,647 exp
        msg.add<uint64_t>(2147483647);
 
You are sending u64 I believe it should be u32
While doing
Lua:
msg.add<uint32_t>(player->getExperience());
    if (player->getExperience() > 2147483647) // client debugs after 2,147,483,647 exp
        msg.add<uint32_t>(2147483647);
Instant crash on login
cceb2851cfea5ab0dff10c24babe9b1b.png


Also this:
Lua:
msg.add<uint64_t>(player->getExperience());
    if (player->getExperience() > 2147483647) // client debugs after 2,147,483,647 exp
        msg.add<uint32_t>(2147483647);

Still crashing client upon death
 
I believe that you'll still need the other change, did you apply it? (There may be more changes required, since the thread you linked is for TFS 0.4.x)
 
Last edited:
I believe that you'll still need the other change, did you apply it? (There may be more changes required, since the thread you linked is for TFS 0.4.x)
What do you mean with the other?
Can you send it or send a sample?
 
In the thread you linked to there are two changes required to make it work. From what you're saying you only made one of them (in protocolgame.cpp).
Yeah, doesn't work. Instantly dbugging once I level up. Think above 500? unsure, could die on low level tho but once I reach high level or give myself level the character is ripped. instant dbug on login
7025b8262b53870c522d279357a69e17.png
 
Yeah, doesn't work. Instantly dbugging once I level up. Think above 500? unsure, could die on low level tho but once I reach high level or give myself level the character is ripped. instant dbug on login
7025b8262b53870c522d279357a69e17.png
Yeah-what? You only made that single change? In which case it most likely won't work.
 
Yeah-what? You only made that single change? In which case it most likely won't work.
I got those two changes into the client, It allowed my character to reach above 717k and I max got to 7.9 mil before being satesfied.
The thing that's the issue for me is that the client crashes upon death for the player and you can get into the game again but I want to prevent the crash from happening.
So... how would this be possible to stop the crashes?
 
TFS 1.3 already uses uint64_t by default, there is no way to extend the limits further, that is the highest integer numeric type you can use
this limit is: 18446744073709551615 or if you like the hexadecimal format 0xFFFFFFFFFFFFFFFF

As it is by default it is the maximum: uint64_t
msg.add<uint64_t>(player->getExperience());

If you want to use this space to show level instead of experience, then just change player->getExperience() for player->getLevel()
But you cannot change the type of number sent for the level waiting for the CIP client to know how to read this value
the client reads the level with 2 Bytes, and the experience with 8 Bytes
 
Last edited:
Solution
TFS 1.3 already uses uint64_t by default, there is no way to extend the limits further, that is the highest integer numeric type you can use
this limit is: 18446744073709551615 or if you like the hexadecimal format 0xFFFFFFFFFFFFFFFF

As it is by default it is the maximum: uint64_t
msg.add<uint64_t>(player->getExperience());

If you want to use this space to show level instead of experience, then just change player->getExperience() for player->getLevel()
But you cannot change the type of number sent for the level waiting for the CIP client to know how to read this value
the client reads the level with 2 Bytes, and the experience with 8 Bytes
Alright, Sarah. You saw what I couldn't. Thanks alot, replacing the Experience to level solved the crashing part and the level can still be above 10 million thanks to this.
I'll try to explain,
So. Thanks to @Gesior.pl I managed to get rid of all the issues and understand a little bit more but I had to change the client to OTClient in-order for it to not crash.
So the issue for both clients are:
getExperience, change that into getLevel and both clients are fine.

So, this Is how it ended up looking like:
player.h
Lua:
static uint64_t getExpForLevel(uint64_t lv) {
return ((150ULL * lv * lv) - (50ULL * lv * lv) + (1200ULL)) / 3ULL;
}

Protocolgame.cpp
Changed:
Lua:
msg.add<uint32_t>(player->getExperience());
Into:
Lua:
if (player->getExperience() > 12345678ULL) {
        msg.add<uint64_t>(12345678ULL);
    }
    else {
        msg.add<uint64_t>(player->getLevel()); -- changed out getExperience to getLevel which solved the crashing on normal client (tibia cipsoft client)
    }

Thanks you both for the help, this solved my crashing Issue and makes me able to have above 717k level on later client.
 
Back
Top