common lib for dofus 2.0
$ npm install --save d2js
var d2js = require('d2js') // :: es5
// or import {D2I, D2O} from 'd2js' :: es6
d2js.D2I.register({key: 'file1', path: 'file1.d2i'}, {key: 'file2', path: 'file2.d2i'} [,...]) // I18nFileAccessor
d2js.D2O.register({key: 'file1', path: 'file1.d2o'}, {key: 'file2', path: 'file2.d2o'} [,...]) // GameDataFileAccessor
console.log(D2O.getObjects('file1', null, 5)); // display objects limit 5
- register()
Register all d2o files
- getClassDefinition(key, idx) ⇒
Object
Get class definition by index
- getlength(key) ⇒
number
Get d2o items length
- getObject(key, idx) ⇒
Object
Get object by index
- getObjects(key, filter, [limit], map) ⇒
Array.<Object>
Get objects from d2o file
- map(key, cb) ⇒
Array.<Object>
Mapping of objects as you wanted
- register(...entry)
Register d2i files
- overrideId(key, idx1, idx2)
Override id
- getOrderIndex(key, idx) ⇒
number
Get order index
- getText(key, idx) ⇒
string
Get text
- getUnDiacriticalText(key, idx) ⇒
string
Get undiacritical text
- hasText(idx) ⇒
boolean
Verify if text exist
- getNamedText(key, name) ⇒
string
Get named text
- hasNamedText(key, name) ⇒
boolean
Verify if named text exists
- useDirectBuffer(key, enableDirectBuffer)
Use direct buff
- getTexts(key, filter) ⇒
Array
Get all text
Allow user to read d2o files
Allow user to read d2i files
name getter
name setter
Register all d2o files
Get class definition by index
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
Get d2o items length
Kind: global function
Param | Type |
---|---|
key | string |
Get object by index
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
Get objects from d2o file
Kind: global function
Param | Type | Default |
---|---|---|
key | stirng |
|
filter | function |
|
[limit] | number |
0 |
map | function |
Mapping of objects as you wanted
Kind: global function
Param | Type |
---|---|
key | string |
cb | function |
Register d2i files
Kind: global function
Param | Type | Description |
---|---|---|
...entry | Object |
|
entry.key | string |
used when you call get methods |
entry.path | string |
full path of d2i file |
Override id
Kind: global function
Param | Type |
---|---|
key | string |
idx1 | number |
idx2 | number |
Get order index
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
Get text
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
Get undiacritical text
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
Verify if text exist
Kind: global function
Param | Type |
---|---|
idx | number |
Get named text
Kind: global function
Param | Type |
---|---|
key | string |
name | string |
Verify if named text exists
Kind: global function
Param | Type |
---|---|
key | string |
name | string |
Use direct buff
Kind: global function
Param | Type |
---|---|
key | string |
enableDirectBuffer | boolean |
Get all text
Kind: global function
Param | Type |
---|---|
key | string |
filter | function |
MIT © Snapiz