gw2e-account-statistics 3.18.2 → 3.20.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.
- package/build/statistics/unlocks.js +24 -1
- package/package.json +1 -1
- package/tests/unlocks.spec.js +12 -0
|
@@ -38,7 +38,9 @@ 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),
|
|
43
|
+
homesteadDecorationCountUnique: homesteadDecorationCountUnique(accountData)
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -396,4 +398,25 @@ function unstableFractalEssenceFromUnlocks(accountData) {
|
|
|
396
398
|
}
|
|
397
399
|
|
|
398
400
|
return sum;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// The amount of homestead decorations on the account
|
|
404
|
+
function homesteadDecorationCount(accountData) {
|
|
405
|
+
if (!accountData.homestead || !accountData.homestead.decorations) {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return accountData.homestead.decorations.reduce(function (sum, decoration) {
|
|
410
|
+
return sum + decoration.count;
|
|
411
|
+
}, 0);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function homesteadDecorationCountUnique(accountData) {
|
|
415
|
+
if (!accountData.homestead || !accountData.homestead.decorations) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return accountData.homestead.decorations.filter(function (d) {
|
|
420
|
+
return d.count > 0;
|
|
421
|
+
}).length;
|
|
399
422
|
}
|
package/package.json
CHANGED
package/tests/unlocks.spec.js
CHANGED
|
@@ -276,4 +276,16 @@ 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
|
+
})
|
|
285
|
+
|
|
286
|
+
it('can calculate homestead decoration count uniquely', () => {
|
|
287
|
+
expect(unlocksStatistics({}, EXTRA_INFO).homesteadDecorationCountUnique).to.equal(null)
|
|
288
|
+
expect(unlocksStatistics({ homestead: { decorations: [] } }, EXTRA_INFO).homesteadDecorationCountUnique).to.equal(0)
|
|
289
|
+
expect(unlocksStatistics({ homestead: { decorations: [{ id: 1, count: 1 }, { id: 2, count: 2 }] } }, EXTRA_INFO).homesteadDecorationCountUnique).to.equal(2)
|
|
290
|
+
})
|
|
279
291
|
})
|