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

TFS 0.X TFS 0.4 Experience displaying Level, Level displaying number of rebirths.

Aurolio

New Member
Joined
Aug 26, 2018
Messages
45
Reaction score
3
Hi All, this is the system that I am using on my server.
CreatureEvent - Best Rebirth System Mysql By mlody.1039 With Gesior Script (https://otland.net/threads/best-rebirth-system-mysql-by-mlody-1039-with-gesior-script.186274/)


What I am trying to do is make Experience display my current level, and Level display number of rebirths I've done.

Max lvl on my server is 717217 lvl, but that's fine, the problem is with displaying it. As you may know, Level will only display up to 65,535 as this is the maximum value for uint_16t, that's why I need to display it as Experience as it can go to much higher numbers than 65,535.

Another thing is displaying my current Rebirth as the Level.

I know it has to be changed in the source, protocolgame.cpp, but I don't know how to change it. Here is what I have at the moment:

Code:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
    msg->put<char>(0xA0);
    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_t>(0);
    }
    msg->put<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
    
    uint64_t experience = player->getExperience();
    if(experience > 0x7FFFFFFF) // client debugs after 2,147,483,647 exp
        msg->put<uint32_t>(0x7FFFFFFF);
    else
        msg->put<uint32_t>(experience);
    
    msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
    msg->put<char>(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));
    if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0)
    {
        msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_t>(0);
    }
    msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
    msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
    msg->put<char>(player->getPlayerInfo(PLAYERINFO_SOUL));
    msg->put<uint16_t>(player->getStaminaMinutes());
}


Thanks.
 
Solution
I don't know your rebirth system, so no.
I just used the default storage value for most rebirth systems which is 85987, use whatever storage key you use instead.
change this:
C++:
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
to this:
C++:
std::string rebirths;
player->getStorageValue(85987, rebirths);
msg->put<uint16_t>(std::stoi(rebirths));
 
C++:
std::string rebirths;
player->getStorage(85987, rebirths);
msg->put<uint16_t>(atoi(rebirths));
 
Compiled, but this time it is 0 for all the characters. Did you have a look at the rebirth system? It is stored in th DB as far as I know. Thanks for your time. Appreciate it.
 
I don't know your rebirth system, so no.
I just used the default storage value for most rebirth systems which is 85987, use whatever storage key you use instead.
 
Solution
Where can I find the storage key used? I haven't seen anything like getStorageValue or similar in this rebirth system.

I don't think it is even using storages.
 
Last edited:
Back
Top