Datafus
Datafus copied to clipboard
[A2] Distinction between boolean and flags
In the file https://github.com/bot4dofus/Datafus/blob/master/data/A/DofusInvoker/scripts/com/ankamagames/dofus/network/messages/connection/IdentificationMessage.as#L119
-
autoconnect
is the first bit of the byte -
useCertificate
the second bit -
useLoginToken
the third bit
Those booleans are flags.
We should be able to distinguish them from regular booleans like in https://github.com/bot4dofus/Datafus/blob/master/data/A/DofusInvoker/scripts/com/ankamagames/dofus/network/messages/game/basic/BasicWhoIsRequestMessage.as#L120
Content of events.json:
"IdentificationMessage": {
"file": "data/A/DofusInvoker/scripts/com/ankamagames/dofus/network/messages/connection/IdentificationMessage.as",
"id": "7755",
"superclass": "NetworkMessage",
"interfaces": [
"INetworkMessage"
],
"attributes": {
"version": "Version",
"lang": "String",
"credentials": "Vector<VarInt,Byte>",
"serverId": "Short",
"autoconnect": "Boolean",
"useCertificate": "Boolean",
"useLoginToken": "Boolean",
"sessionOptionalSalt": "VarLong",
"failedAttempts": "Vector<Short,VarShort>"
}
},
Based on my observations:
- When there is only one Boolean attribute, either
readByte
orreadBoolean
can be used. However, it is crucial to maintain the order of the attributes. - When dealing with multiple Boolean fields,
readByte
should be invoked first. Each bit of the byte corresponds to a Boolean attribute, arranged in the same sequence as they appear. For every group of eight Boolean attributes, an additionalreadByte
call is necessary to handle the next set of Booleans. (See ActorRestrictionsInformations).