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

[OTClient] Converting maps from different versions/protocols

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,748
Solutions
30
Reaction score
1,528
First, thanks @Gesior.pl for all the help, you are the man!

I'm using OTClient to load and convert maps from different protocols, both from 10.98 to 7.6 or from 7.6 to OpenTibia Sprite Pack.

In OTClient sources, go to /src/client/item.h find:

Code:
#pragma pack(pop)

#endif

Before it add:
Code:
int replaceCustom(uint16 itemId);

At /src/client/item.cpp find:
Code:
out->addU16(getServerId());

Replace it with this lines:
Code:
uint16 itemId = replaceCustom(getServerId());
out->addU16(itemId);

Still in /src/client/item.cpp, after the last line add this function: replace.cpp · GitHub

At /src/client/mapio.cpp find:
Code:
root->addU16(ground->getServerId());

Replace it with this lines:
Code:
uint16 itemId = replaceCustom(ground->getServerId());
root->addU16(itemId);

Those are the source changes, compile it. You may want to change the replace function to match the version you want to change, or to something totally custom if using a custom sprite pack. In the last lines, keep it as:
Code:
default:
newId = itemId;
break;
If you want to keep an item which you don't have any conversion set, if you want to remove items you don't have a match in the conversion table, instead of it, use:
Code:
default:
newId = 29999;
break;
So all the items without a match become item id 29999 and an invalid item for RME, so you can use Map -> Cleanup... option to remove them from the map.

Now, you need to add to otclient/data folder #1 the map you want to convert (rename it to map.otbm), #2 the items.otb from the version you map is (rename it to items_from.otb), #3 the items.otb from the version you are converting to (rename it to items_to.otb), and to otclient/data/things #4 the spr and dat files from the version you converting from as you would to play with it version in otclient.

Now edit your otclientrc.lua file:
Code:
-- version you are converting from
g_game.setClientVersion(1098)
g_things.loadOtb('items_from.otb')
g_map.loadOtbm('map.otbm')
g_things.loadOtb('items_to.otb')
g_map.saveOtbm('converted_map.otbm')

Just run otclient now, it will save it to '/home/linux_username/.otclient/converted_map.otbm' (linux) or 'C:\Users\windows_username\otclient\converted_map.otbm' (windows). Or something like that.
 
very nice, will you release those maps you mentioned?
I don't have a clean conversion table to convert maps OpenTibia sprite pack yet, since I'm using a mixed spr, but once I do I will release it. If you talking about the maps converted from 10.x to 7.6, you can use the code to generate the maps yourself.
 
I'm trying to compile it but im very newbie, i want to donwgrade from 10.77 to 8.6, can you help me ?
Ohh, thanks for share this,
I love your job, I'm your fan.
 
I'm trying to compile it but im very newbie, i want to donwgrade from 10.77 to 8.6, can you help me ?
Ohh, thanks for share this,
I love your job, I'm your fan.
You would need a completely new table, with correspondent 8.6 id of 10.7 items. Check otclient github wiki for compile guide. I would make the NodeJS script aproach though, seems easier: OpenTibia - Converting Tibia maps to OpenTibia Sprite Pack

It's a matter of creating your own converting table tough.
 
Nice. Could be posible to.convert.from ítems.srv yo otbm?
Do You have the code?
 
Last edited:
Can this be used to make maps from clientid to users server id's? Here's my idea:
Code:
int replaceCustom(uint16 itemId)
{
    auto itemType = g_things.getItemType(itemId);
    return itemType->getServerId();
}
 
Last edited:
Back
Top