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

otb2json

kor

PHP ziom
Premium User
Joined
Jul 12, 2008
Messages
252
Solutions
13
Reaction score
410
Location
Bialystok, Poland
GitHub
rookgaard
YouTube
Rookgaard
Hello. Have you ever encountered situation while running your own server the map on which you work with other developers can not be developed simultaneously by several people with the help of git, due to the fact that it is a binary file? I have not yet on my Rookgaard server, but if I needed such solution, a few days ago I found repository which converts otbm files to json, so (skipping the huge weight of such a file) it makes working with branches very easy.

I met with another problem, finding a universal otb file editor. Yes, there are many versions of otitemeditor, but I wanted something easier to read, so I went a step further and on the basis of the Inconcessus/OTBM2JSON repository I created my own version of otb2json. Json file which is created in effect has a little more than 5 MB, but allows you to edit the attributes of objects with any text editor, and later, for example in the case of pushing branch, running pipeline will allow you to build an otb file again.

Since I have little contact with binary files in my daily work, I would like to ask the OTLand community to review my work for a better future of OpenTibia - added otb2json · rookgaard/OTBM2JSON@be625a0
 
Nice work! I tried reading .otb to your JSON structure and it works. Just two minor suggestions:
  • Trim the NULL values in the CSDVersion field
  • For all the flags, use full expressions (e.g. alwaysOnTop instead of aOT) and perhaps omit everything that is false (this will reduce the file size by a great amount).
Is it correct that the "unknown" stands for a string of bytes that you do not know the meaning of? What is the difference between "id" and "clientid"?
 
1. If I will escape NULL values from CSDV I'm not sure if I could reverse full length when compiling again to otb. Hmm, maybe after I write string I will fill the rest bytes with 0x00, nice suggestion.
2. The reason I cutted variables names was exactly because of file size :D Now "decompiled" json have around 5 MB, using full flag names makes file size above 10 MB. I will try to change true/false for 0/1.
3. Normally, when server parse otb file it is ignoring all flags that are other than defined (serverId, clientId, speed, light or toporder) as you can see it here - otland/forgottenserver. But for packing json again I decided to mantain this data, even if I don't know what is for (btw, recreated otb file without "unknowns" attributes still works with TFS and RME).
4. Analyzing otb structure I used 0.4 sources where "id" means serverID = Fir3element/3777. Difference between both is that clientID is the ID of an item in client and serverID is the ID on server side. For example "mouldy cheese" has serverID = 2235, but clientID = 3120, so while writing quest in LUA you will use ID 2235 and writing cavebot scripts you will use ID 3120.

Anyway, thanks for review :)
 
Thanks a lot. I hope all the framework can eventually be exported to more updated technologies such as this. Myself, I wish to develop a map editor for this JSON format, perhaps even in a JS environment.
 
Thank god! I have been searching for a thing like this for few days already. @kor Does it support 8.6 otb files only?
 
Back
Top