0.1.7 • Published 2 years ago

datafus-parser v0.1.7

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

datafus-parser

This is a simple lib to encode and decode Dofus 2 packets.

Usage

Init

First of all, you need to init the parser :

import { initDatafusParser } from 'datafus-parser'

await initDatafusParser()

This will download the latest Datafus release if not already done and load needed files.

Decoding

import { writeMessage } from 'datafus-parser'

const messageFromDofus: Buffer = ...

const result = await readMessage(data.toString("hex"));

Encoding

import { writeMessage } from 'datafus-parser'

const data = {
  recruitmentData: {
    minLevelFacultative: false,
    invalidatedByModeration: false,
    recruitmentAutoLocked: true,
    socialId: 13563,
    recruitmentType: 0,
    recruitmentTitle: '',
    recruitmentText: '',
    selectedLanguages: [ 1 ],
    selectedCriterion: [],
    minLevel: 50,
    lastEditPlayerName: 'Anonimized-Bob',
    lastEditDate: 1686099907132,
    _name: 'GuildRecruitmentInformation',
    minSuccess: 0,
    minSuccessFacultative: false
  },
  _name: 'RecruitmentInformationMessage'
}

const result = await writeMessage(data);
mySocket.send(result.buffer);

data can be any object representing a dofus entity, it has to have a _name prop which identifies the message.

Advanced

You can specify and owner and a repo when initializing the parser :

await initDatafusParser({ owner: "ledouxm", repo: "Datafus" });

I can be handy for testing purpose.

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.7

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago