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

How to parse server ID to client ID?

Lucas Alfare

New Member
Joined
May 20, 2019
Messages
6
Reaction score
1
Hello, I don't know if this is the correct section to point this (if not, please, tell me).

I'm studying some structure of the old 8.6 Tibia.dat and Tibia.spr and finnally got reading then correctly (I think). However, I'm still having problems while getting data from the .dat file. For example, if I take any ID from this file from RME editor to my .dat reader, sometimes I got a wrong item. I realized this is a problem of matching IDs from client to server: those IDs of the link are IDs of the server side, while the IDs the .dat file takes are IDs of the client side (correct me if I'm wrong).

Knowing this, how to deal with this problem? I think the way to retrieve the correct info about IDs is taken from the items.otb file, but I can't find any info of how to read it over the internet until now. If there's another solution to match the IDs, feel free to tell me.

Thanks in advance!
 
In my server I wrote a C++ function:
C++:
int ActionScript::getItemClientID(lua_State *L)
{
    uint32_t itemID = (uint32_t)lua_tonumber(L, -1);
    lua_pop(L, 1);

    const ItemType &item = Item::items[itemID];
    uint32_t clientID = item.clientId;
    lua_pushnumber(L, clientID);
    return 1;
}
and then I use it in .lua:
Lua:
local clientID = getItemClientID(item.id)
For example to send to client which items should got cooldown time:
clientid_use.gif
 
You can also load XML and OTB files on client start and use ItemType's parameters with client-side functions without sending them from server. There are some pros and cons of both solutions. With mine you have to "publish" your valueable files.
 
Back
Top