gw2-itemstats
v0.0.5
Published
Get itemstats with real attribute values from the API
Downloads
5
Maintainers
Readme
gw2-itemstats
This module loads itemstats combinations with real attribute values from the API by parsing all available items and matching them to /v2/itemstats
.
Installation
Install this module with your favorite package manager, e.g. npm install gw2-itemstats
.
Usage
import { getItemstats } from 'gw2-itemstats';
const language = 'en';
// get itemstats
const itemstats = getItemstats(language);
// get itemstats for rare level 78 weapons
const itemstatsRare78Weapons = getItemstats(language, {
filter: (item) => item.rarity === 'Rare' && item.level === 78 && item.type === 'Weapon'
});
Result
Array of itemstats objects following this structure:
{
id: 161,
name: 'Berserker\'s',
attributes: {
CritDamage: 101,
Power: 141,
Precision: 101
},
level: 80,
rarity: 'Ascended',
type: 'Armor',
subtype: 'Coat'
}
Options
| Option | Type | Description
|---|---|---|
| useCache
| bool | Use the cache to lookup items and itemstats.Default: true
.
| api
| Object | Object containing the functions items
and itemstats
, both returning promises containing all items and itemstats that should be considered for resulting list.Default: Uses gw2api-client to load all items and itemstats
| cache
| Map | Object used as cache following the Map interface.Default: new Map()
| filter
| function | Callback used to filter the items. The first parameter is the item as it is returned from the API.This is done after caching, to reuse the cache for different filters. Manually applying a filter in the api
-option can reduce the cache size.Default: (item) => true
License
gw2-itemstats is licensed under the MIT License.