gw2e-account-statistics 3.18.2 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,8 @@ exports.default = function (accountData, extraInformation) {
38
38
  _unstableFractalEssenceFromUnlocks: unstableFractalEssenceFromUnlocks(accountData),
39
39
  aureneLegendaryVariantSkins: aureneLegendaryVariantSkins(accountData),
40
40
  suffusedObsidianArmorSkins: suffusedObsidianArmorSkins(accountData),
41
- coloredTitleCount: coloredTitleCount(accountData)
41
+ coloredTitleCount: coloredTitleCount(accountData),
42
+ homesteadDecorationCount: homesteadDecorationCount(accountData)
42
43
  };
43
44
  };
44
45
 
@@ -396,4 +397,15 @@ function unstableFractalEssenceFromUnlocks(accountData) {
396
397
  }
397
398
 
398
399
  return sum;
400
+ }
401
+
402
+ // The amount of homestead decorations on the account
403
+ function homesteadDecorationCount(accountData) {
404
+ if (!accountData.homestead || !accountData.homestead.decorations) {
405
+ return null;
406
+ }
407
+
408
+ return accountData.homestead.decorations.reduce(function (sum, decoration) {
409
+ return sum + decoration.count;
410
+ }, 0);
399
411
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw2e-account-statistics",
3
- "version": "3.18.2",
3
+ "version": "3.19.0",
4
4
  "description": "Calculate statistics of guildwars2 accounts",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -276,4 +276,10 @@ describe('statistics > unlocks', () => {
276
276
  expect(unlocksStatistics({ skins: [1, 2, 7, 9, 10] }, EXTRA_INFO).suffusedObsidianArmorSkins).to.equal(0)
277
277
  expect(unlocksStatistics({ skins: [1, 2, 12171, 12136] }, EXTRA_INFO).suffusedObsidianArmorSkins).to.equal(2)
278
278
  })
279
+
280
+ it('can calculate homestead decoration count', () => {
281
+ expect(unlocksStatistics({}, EXTRA_INFO).homesteadDecorationCount).to.equal(null)
282
+ expect(unlocksStatistics({ homestead: { decorations: [] } }, EXTRA_INFO).homesteadDecorationCount).to.equal(0)
283
+ expect(unlocksStatistics({ homestead: { decorations: [{ id: 1, count: 1 }, { id: 2, count: 2 }] } }, EXTRA_INFO).homesteadDecorationCount).to.equal(3)
284
+ })
279
285
  })