d2js v1.1.5
d2js
common lib for dofus 2.0
Installation
$ npm install --save d2js
Usage
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
Classes
Members
Functions
GameDataFileAccessor
Kind: global class
Export:
new GameDataFileAccessor()
Allow user to read d2o files
I18nFileAccessor
Kind: global class
Export:
new I18nFileAccessor()
Allow user to read d2i files
name
name getter
Kind: global variable
name
name setter
Kind: global variable
register()
Register all d2o files
Kind: global function
getClassDefinition(key, idx) ⇒ Object
Get class definition by index
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
getlength(key) ⇒ number
Get d2o items length
Kind: global function
Param | Type |
---|---|
key | string |
getObject(key, idx) ⇒ Object
Get object by index
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
getObjects(key, filter, limit, map) ⇒ Array.<Object>
Get objects from d2o file
Kind: global function
Param | Type | Default |
---|---|---|
key | stirng | |
filter | function | |
limit | number | 0 |
map | function |
map(key, cb) ⇒ Array.<Object>
Mapping of objects as you wanted
Kind: global function
Param | Type |
---|---|
key | string |
cb | function |
register(...entry)
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 |
overrideId(key, idx1, idx2)
Override id
Kind: global function
Param | Type |
---|---|
key | string |
idx1 | number |
idx2 | number |
getOrderIndex(key, idx) ⇒ number
Get order index
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
getText(key, idx) ⇒ string
Get text
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
getUnDiacriticalText(key, idx) ⇒ string
Get undiacritical text
Kind: global function
Param | Type |
---|---|
key | string |
idx | number |
hasText(idx) ⇒ boolean
Verify if text exist
Kind: global function
Param | Type |
---|---|
idx | number |
getNamedText(key, name) ⇒ string
Get named text
Kind: global function
Param | Type |
---|---|
key | string |
name | string |
hasNamedText(key, name) ⇒ boolean
Verify if named text exists
Kind: global function
Param | Type |
---|---|
key | string |
name | string |
useDirectBuffer(key, enableDirectBuffer)
Use direct buff
Kind: global function
Param | Type |
---|---|
key | string |
enableDirectBuffer | boolean |
getTexts(key, filter) ⇒ Array
Get all text
Kind: global function
Param | Type |
---|---|
key | string |
filter | function |
License
MIT © Snapiz