Log in

View Full Version : Tibia 11 - Collection of server info AND character list



blackd
09-26-2016, 17:51
I noticed that Tibia 11 stores server info in some kind of collection struct.
This collection will only store 1 entry per server, no matter if your account have many chars that belong to that server.
If all your chars play same server, then this collection will only have 1 item.
If you have 20 chars, each of them in 20 different servers, then this collection will have 20 items.

Tips for reverse engineering, for future updates:
- The initial key for finding this struct is searching game server url in memory. For example: astera-lb.ciproxy.com
- A shortcut is using an account with only 1 char, and searching 010000000000000000000000????????????????031C0000
- You should find 2 results. Result - 0x0C = possible element. So have ELEM0 and ELEM1. Each possible element points to a possible start address: STARTER0 and STARTER1. Check what access each address. Control+L to go back to char list. Tibia should access the right one. Now you should be able to determine wich one is the good start. If good start is STARTER0 then use cheat engine to search address ELEM1. If good start is STARTER0 then use cheat engine to search address ELEM1. In any case, force last offset to 0.
- You usually end obtaining a path starting in gui or threadstack-e8, don't worry. Use following translations to Qt5Core.dll, a stable point where all the most important things can start safely:
"THREADSTACK0"-000000E8 = "Qt5Core.dll" + 004555C8 > 8
"Qt5Gui.dll" + 00482EE4 > 28 > 0 = "Qt5Core.dll" + 004555C8 > 8
"Qt5Gui.dll" + 00482EE4 > 20 > C = "Qt5Core.dll" + 004555C8 > 4 > 20 > C

How is a Tibia 11 collection struct?
COLLECTION START:
[Pointer to starter item] 4 bytes
[Total count] 4 bytes

STARTER ITEM:
[Pointer 0] 4 bytes
[Pointer 1] 4 bytes
[Pointer 2] 4 bytes
1 byte , always 01
[Byte 2] 1 byte , always 01

[B]COLLECTION ITEM
[Pointer 0] 4 bytes - points to a random? different collection item
[Pointer 1] 4 bytes - points to a random? different collection item
[Pointer 2] 4 bytes - points to a random? different collection item
1 byte
[Byte 2] 1 byte
[Integer] 2 bytes
[KEY] 4 bytes - The key required by client to find this item. In the case of the server collection here you have a short id number that is used in the charlist as reference to this server.
[Long number] 4 bytes
[Server Name] 4 bytes - points to a QString containing game server name
[Server URL] 4 bytes - points to a QString containing game server url
[Server port] 4 bytes - game server port, for now always 7171

[B]Current path to the collection start:
adrServerList_CollectionStart="Qt5Core.dll" + 004555C8 > 8 > 168 > 54 > 18 > 2c

An example path to test if it worked:
randomServerNameInCollection="Qt5Core.dll" + 004555C8 > 8 > 168 > 54 > 18 > 2c > 0 > 18 > 10

Some final notes:
- Reading full collection will require a small algorithm to follow all possible pointer paths, avoiding loops.
- Tibia 11 skills are stored in a collection struct too. However they are always the same number of skills, and they are always stored in the same order so each of them can be retrieved using a fixed path. Read more here (http://www.blackdtools.net/showthread.php?62973-Tibia-11-About-the-structure-of-the-SKILLS-in-memory).

blackd
09-28-2016, 16:40
Interesting additional fact:
adrServerList_CollectionStart + 8 = LIST OF LOADED CHARACTERS!

How to read char list in Tibia 11:
At the first 4 bytes of the list start you can see 01 00 00 00 (you are already in the real list start), or a pointer to the real list start.
Now, when you are in the real list start:
NUMBER OF CHARS = start + 4
LIST START = start + HEX 10
That is...
Pointer to CHAR #0 = start + HEX 10
Pointer to CHAR #1 = start + HEX 14
Pointer to CHAR #2 = start + HEX 18
Pointer to CHAR #3 = start + HEX 1C
Pointer to CHAR #4 = start + HEX 20
Pointer to CHAR #5 = start + HEX 24
Pointer to CHAR #6 = start + HEX 28
Pointer to CHAR #7 = start + HEX 2C
etc.

Each char contains 2 usefull things:
Pointer to a QString containing CHAR NAME = item start + HEX 10
Pointer to a QString containing SERVER NAME = item start + HEX 14
And I am afraid that is all.
However... you can obtain server info from the collection of servers! Problem solved. :)

blackd
09-28-2016, 16:54
How to determine the selected char:

When you are still in the char list:
adrSelectedCharIndex="Qt5Gui.dll"+00482EE4 > 20 > C > 58 > 4 > F8 > 418
WARNING: does not work after login into game: "Qt5Gui.dll"+00482EE4 > 20 > C > 58 > 4 > F8 = 0
However, when you are ingame you can read selected char name directly:
adrSelectedCharName="Qt5Core.dll" + 004555C8 > 8 > C > 4 > 18 > 38 > 28
adrSelectedCharName points to a QSTRING with character name. If you are outside game then it will point to null (address FFFFFFF) or to an address containing an empty qstring ""

blackd
09-28-2016, 17:54
I am still searching an stable path for adrSelectedCharIndex

alternatives:
adrSelectedCharIndex="Qt5Gui.dll" + 00482EE4 > 20 > C > 58 > 4 > F8 > 418
adrSelectedCharIndex="Qt5Gui.dll" + 00482EE4 > 20 > C > 58 > 4 > 108 > 4 > 418
adrSelectedCharIndex="Qt5Gui.dll" + 00482EE4 > 20 > C > 4 > 98 > 8C > 418

?? adrSelectedCharIndex="Qt5Core.dll" + 004555C8 > 8 > 24 > 0 > A4 > 4 > 64 > 8 > 4 > 418