-
Notifications
You must be signed in to change notification settings - Fork 11
Support new socket parsing
B4D can read incoming sockets from the Dofus server. While creating you API, you might want to be able to parse sockets that are not parsed yet. I'll introduce you how I reversed engineer chat message sockets. Before going any futher, you'll need to understand the general structure of a dofus socket.
Explain the dofus socket structure
- Download and install WireShark
- Start Dofus and connect to a server
- Start WireShark and start listening
The objective of this step is to identify, in WireShark, the sockets you are looking for.
- Open a terminal and paste the following command to identify the dofus server you are connected to:
xxx
- In WireShark, add an ip filter to see the incoming sockets from the server.
- In the dofus chat, copy a word that someone said. eg: "kamas".
- In WireShark, add a content filter to see the sockets containing the word.
- In WireShark, identify the socket id.
- In WireShark, add a byte filter to see the sockets starting with this id.
The displayed sockets are now chat messages only. Those are the one you'll need to reverse engineer and parse.
This step is most complicated and long one. You'll have to find the payload structure from scratch without any documentation. There are multiple ways of doing it. Here is a list of tips you can do:
- Start by collecting a lot of sockets in WireShark and save the recording in a local file. You can then work from this file in offline without Dofus.
- In the recorded sockets, find the common bytes to identify the delimiters.
- You can also force the event to happend and look for the location of the expected data in the socket.
Be patient and try hard, ask for help if needed...
The payload structure I found for chat messages is the following:
-
In the package
fr.B4D.socket.event
, create a new event class extending theDofusEvent
class. This class will represent you dofus event once parsed. It must be a simple class containing attributs and there getters. The attributs can only be defined in the constructor. -
In the package
fr.B4D.socket.parse
, create a new parse class extending theSocketParser<YOU_EVENT_CLASS>
class. -
Implement the
parse
method based on the payload structure you identified in step 2. Once all the fields have been identified, you can create the event and return it. -
In the class
fr.B4D.socket.DofusSocketType
, map the socket id with the parser by adding a value.
At this step, all the sockets starting with the registered id will be parsed using the parser. The event will be created and added to the event store.
B4D
Utilisation
Contribution