Mytherin / Tibialyzer

Tibialyzer is an extension made for the MMORPG Tibia. It automatically scans the server log and messages from the Tibia client by reading its memory, and gathers various statistics, such as loot found from creatures, damage dealt by party members and experience gained every hour.
Other
184 stars 60 forks source link

Beta Client not working #121

Open kito90 opened 8 years ago

kito90 commented 8 years ago

Hey, Tibialyzer is not working on new client... I type summary@ and the notification doesn't appear.

Mytherin commented 8 years ago

The beta client has a different internal structure than the regular client, and Tibialyzer will have to be patched to work with it.

I have done some digging into the memory of the client and have found that strings are stored as follows.

struct {
    short int length;    // 2 bytes indicate length of string
    char string[length]; // the actual string
};

The strings aren't null-terminated, thus the length must be used to figure out when the strings end.

The main problem is that log messages are split up into several separate strings. Chat messages, for example, are split up into the separate strings Name and Message (possibly also Time and Level).

That means that to get a complete log message we need to understand how these different strings are combined, which means we need to reverse engineer the structure of the server log. I haven't yet found out how they are tied together. I will need to dig deeper later.

renanleandrof commented 8 years ago

You're a master Mytherin. Go for it!

Oddegamra commented 8 years ago

The chat messages tied to a channel are stored in non-continuous memory. Each message looks like this:

struct ChatMessage {
  uint32_t MessageType, // (0=System, 1=Npc, 2=Player)
  QDateTimePrivate* MessageTimestamp, // (i.e. QDateTime member)
  QStringData* Message, // (i.e. QString member)
  uint32_t MessageID,
  QStringData* NameOfSpeaker,
  uint16_t Level,
  uint16_t _, // padding
  QColor MessageColor // (in total 16 byte, uint32_t ColorType and uint16_t[5] ColorData, plus padding)
}; // total 40 bytes

You can look up all Qt internals by cross-referencing the Qt5 source code. If you know the address of the message, you may be able to guess to the location of the ChatMessage entry by finding the pointer that refers to the string data. Good luck.