A few months ago, or a year ago I asked Elf to explain how item attributes were stored in the database. As you know, what's inside player_items.attributes is binary, and is not as easy to read as normal values in the database. So Elf answered me:
The reason why I want to know is because I want to improve the communication with the OT database outside the game. That would give me the opportunity to control my server from the outside, like from a website. And btw, something like this should be documented, or at least have a small description or something.
Today, this came into my mind a second time. Now because I couldn't find this kind of information anywhere. I started taking a look at the source code myself, and I studied how attributes were stored. But I could not fully decode the whole piece of information. I'm stuck. And I'll show you how far I've come.
There are two ways for the server to store attributes. The first way is only for stackable items. They have only one attribute, and that's their "count". The binary information for this can look like the following example:
If we split the binary value, we will have two bytes:
0F and 05. 0F(15 as decimal) is the type of the attribute, and 05 is the value. That's the attribute you will have to for example 5 apples in a stack.
The second type of binary information is used in case there are many attributes for the same item. It can look something like this:
To explain further, this is an item with the actionid 3400 and the uniqueid 3241. That's two attributes, uniqueid and actionid. And both have a value. I've split the "map" to make it more clear:
This is what I know about the values:
1. The type of a attribute "map", 0x80.
2. Numbers of attributes, in this case 0x0002, or just 2.
3. Information for the actionid.
4. Information for the uniqueid.
Now let's split each attribute:
5. unknown
6. unknown
7. unknown
8. Attribute value.
9. unknown
You see that 4 values are for me unknown, that's why I'm stuck. I want to know what they are for. So guys, I'm asking you for help to solve this with me. If we do, I'll write a tutorial about this, or at least something better than this thread. And maybe in the future someone decides to make use of this.
So what do you think?
How rude of him, not even an explanation?Learn binary.
The reason why I want to know is because I want to improve the communication with the OT database outside the game. That would give me the opportunity to control my server from the outside, like from a website. And btw, something like this should be documented, or at least have a small description or something.
Today, this came into my mind a second time. Now because I couldn't find this kind of information anywhere. I started taking a look at the source code myself, and I studied how attributes were stored. But I could not fully decode the whole piece of information. I'm stuck. And I'll show you how far I've come.
There are two ways for the server to store attributes. The first way is only for stackable items. They have only one attribute, and that's their "count". The binary information for this can look like the following example:
Code:
0x0F05
If we split the binary value, we will have two bytes:
0F and 05. 0F(15 as decimal) is the type of the attribute, and 05 is the value. That's the attribute you will have to for example 5 apples in a stack.
The second type of binary information is used in case there are many attributes for the same item. It can look something like this:
Code:
0x800200030061696402480d0000030075696402a90c0000
To explain further, this is an item with the actionid 3400 and the uniqueid 3241. That's two attributes, uniqueid and actionid. And both have a value. I've split the "map" to make it more clear:
Code:
1. 2. 3. 4.
80 0200 030061696402480d0000 030075696402a90c0000
This is what I know about the values:
1. The type of a attribute "map", 0x80.
2. Numbers of attributes, in this case 0x0002, or just 2.
3. Information for the actionid.
4. Information for the uniqueid.
Now let's split each attribute:
Code:
5. 6. 7. 8. 9.
0300 6169 6402 480d 0000 (Actionid: 0d48, 3400)
0300 7569 6402 a90c 0000 (Uniqueid: 0ca9, 3241)
5. unknown
6. unknown
7. unknown
8. Attribute value.
9. unknown
You see that 4 values are for me unknown, that's why I'm stuck. I want to know what they are for. So guys, I'm asking you for help to solve this with me. If we do, I'll write a tutorial about this, or at least something better than this thread. And maybe in the future someone decides to make use of this.
So what do you think?
Last edited: