poe-mods
v1.12.0
Published
Emulates interaction of Mods with Items, Atlas etc. in Path of Exile
Downloads
33
Readme
Path of Exile Mods
Emulates interaction of Mods with Items, Atlas etc. in Path of Exile@3.3.0
.
Install
$ npm install --save poe-mods
Usage
Typescript is supported.
import { createItems, createMods, Transmute } from 'poe-mods';
// data has to be provided. see eps1lon/poedb
Promise.all([
fetch('/items.json')
.then(body => body.json())
.then(props => createItems(props))
.then(items => {
return items.from(item => {
return item.name === 'Iron Greaves';
});
}),
fetch('/mods.json')
.then(body => body.json())
.then(props => createMods(props))
.then(mods => Transmute.build(mods.all())),
]).then(([greaves, transmute]) => {
console.log(transmute.modsFor(greaves).map(({ mod }) => mod)); // => GeneratorDetails[]
console.log(transmute.applyTo(greaves)); // => Item
});
Data
Data for for the create*
helpers can be imported from poe-mods/data/
.
If you want to use the data somewhere else you can use https://unpkg.com/poe-mods@/data/. The data provided by unpkg supports compression.
Immutability
To provide the best support for redux every class is immutable.
declare var item: Item;
item.setRaritiy('magic') === item // false
item.addMod(someMod) === item // false
Documentation
Contributing
Issue reports and pull requests are always welcome.
When you contribute code please make sure that it passes the test, lint and format checks. Pull requests should be made against the master branch and Travis will inform you wheather all checks have passed.
License
MIT