Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[A2] Distinction between boolean and flags #40

Open
LucBerge opened this issue Jul 10, 2023 · 1 comment
Open

[A2] Distinction between boolean and flags #40

LucBerge opened this issue Jul 10, 2023 · 1 comment

Comments

@LucBerge
Copy link
Member

LucBerge commented Jul 10, 2023

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>"
        }
    },
@bmassemin
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants