Datafus icon indicating copy to clipboard operation
Datafus copied to clipboard

[A2] Distinction between boolean and flags

Open LucBerge opened this issue 1 year ago • 1 comments

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>"
        }
    },

LucBerge avatar Jul 10 '23 16:07 LucBerge

Based on my observations:

  • When there is only one Boolean attribute, either readByte or readBoolean 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 additional readByte call is necessary to handle the next set of Booleans. (See ActorRestrictionsInformations).

bmassemin avatar May 12 '24 19:05 bmassemin