3.14.0 • Published 4 months ago

gw2e-account-value v3.14.0

Weekly downloads
60
License
MIT
Repository
github
Last release
4 months ago

account-value

Build Status Coverage Status

Calculate the value of guildwars2 accounts

This is part of gw2efficiency. Please report all issues in the central repository.

Install

npm install gw2e-account-value

This module can be used for Node.js as well as browsers using Browserify.

Usage

For better understanding of how and why this does things, please read the design document for the account value.

Calculate the account value

import accountValue from 'gw2e-account-value'

// An object containing all the account data available for the API key
const accountData = {
  account: /* ... */,
  bank: /* ... */,
  shared: /* ... */,
  materials: /* ... */,
  skins: /* ... */,
  wallet: /* ... */,
  dyes: /* ... */,
  minis: /* ... */,
  outfits: /* ... */,
  recipes: /* ... */,
  finishers: /* ... */,
  commerce: {
    buys: /* ... */,
    sells: /* ... */
  },
  characters: /* ... */,

  // These are not used yet, but might be in the future
  guilds: /* ... */,
  titles: /* ... */,
  achievements: /* ... */
}

// The values for everything needed to calculate things
const values = {
  items: {
    123: {value: 3, sell: {price: 2}, buy: {price: 1}},
    456: {value: 10, defaultUpgrades: [39619]},
    789: {value: 3000, price: {gems: 150}}
  },

  skins: {
    1: {value: 1200, unlocks: [123, 56, 76], gemstore: false},
    2: {value: 420, unlocks: [1337], gemstore: 50}
  },

  dyes: {
    1: {value: 3, gemstore: false},
    2: {value: 420, gemstore: 50}
  },

  minis: {
    1: {value: 3, gemstore: false},
    2: {value: 420, gemstore: 50}
  },

  outfits: {
    1: {value: 3, gemstore: false},
    2: {value: 420, gemstore: 50}
  },

  recipes: {
    1: {value: 3},
    2: {value: 420}
  },

  finishers: {
    1: {value: 3, gemstore: false},
    2: {value: 420, gemstore: 50}
  },

  craftingProfessions: {
    weaponsmith: {
      75: 10,
      150: 20,
      225: 30,
      300: 40,
      400: 50,
      500: 100
    },
    // ...
  }
}

// Calculate everything!
accountValue(accountData, values)
// -> Object with all values calculated

Calculate a part of the account value

You can import the partial calculations on their own and work with them.

import {bankValue, bankItems} from 'gw2e-account-value/build/bank'

bankValue(accountData, values)
bankItems(accountData)

Helper: Get needed item ids

This helper function returns a list of ids for items, which are needed for the calculation:

import {allItemIds} from 'gw2e-account-value'

allItemIds(accountData)
// -> [1, 2, 3]

Tests

npm test

Licence

MIT

3.14.0

4 months ago

3.13.3

5 months ago

3.13.2

2 years ago

3.13.1

3 years ago

3.13.0

3 years ago

3.12.3

3 years ago

3.12.1

3 years ago

3.12.0

3 years ago

3.12.2

3 years ago

3.11.0

3 years ago

3.11.1

3 years ago

3.10.3

3 years ago

3.10.2

3 years ago

3.10.1

3 years ago

3.10.0

4 years ago

3.9.2

4 years ago

3.9.1

4 years ago

3.9.0

5 years ago

3.8.1

5 years ago

3.8.0

5 years ago

3.7.1

5 years ago

3.7.0

5 years ago

3.6.1

5 years ago

3.6.0

5 years ago

3.5.2

6 years ago

3.5.1

6 years ago

3.5.0

6 years ago

3.4.2

7 years ago

3.4.1

7 years ago

3.4.0

7 years ago

3.3.0

7 years ago

3.2.0

7 years ago

3.1.3

7 years ago

3.1.2

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.7

7 years ago

3.0.6

7 years ago

3.0.5

7 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.8

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago