gw2e-account-statistics 3.15.2 → 3.16.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.
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _arenanetEmployee = require('@gw2efficiency/game-data/achievements/categories/arenanet-employee');
6
+
7
+ var _arenanetEmployee2 = _interopRequireDefault(_arenanetEmployee);
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ var arenanetEmployeeAchievementIds = _arenanetEmployee2.default.map(function (x) {
12
+ return x.id;
13
+ });
14
+
15
+ exports.default = arenanetEmployeeAchievementIds;
@@ -70,5 +70,6 @@ exports.default = {
70
70
  jadeMinersKeycard: 71,
71
71
  staticCharge: 72,
72
72
  pinchOfStardust: 73,
73
- calcifiedGasp: 75
73
+ calcifiedGasp: 75,
74
+ ursusOblige: 76
74
75
  };
@@ -113,6 +113,8 @@ exports.default = function (accountData) {
113
113
  amnytasHerosChoice: countItems(items, 100193),
114
114
  innerNayosEndHerosChoice: countItems(items, 101195),
115
115
  convergenceHerosChoice: countItems(items, 101185),
116
+ citadelOfZakirosHerosChoice: countItems(items, 101748),
117
+ janthirSyntriHerosChoice: countItems(items, 102265),
116
118
  giftsOfExploration: countItems(items, 19677),
117
119
  giftsOfBattle: countItems(items, 19678),
118
120
  tomesOfKnowledge: countItems(items, [43741, 43766]),
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  exports.__esModule = true;
4
4
 
@@ -31,11 +31,19 @@ exports.default = function (accountData) {
31
31
  wvwDefendedCastles: achievementCurrent(accountData, 313),
32
32
  pvpKilledPlayers: achievementCurrent(accountData, 239),
33
33
  pvpKilledPlayersRanked: achievementCurrent(accountData, 240),
34
+ arenanetEmployeeAchievements: arenanetEmployeeAchievements(accountData),
35
+ convergenceCompletions: convergenceCompletions(accountData),
34
36
  homeCats: homeCats(accountData),
35
37
  homeNodes: homeNodes(accountData)
36
38
  };
37
39
  };
38
40
 
41
+ var _arenanetEmployeeAchievements = require('../gameData/arenanetEmployeeAchievements');
42
+
43
+ var _arenanetEmployeeAchievements2 = _interopRequireDefault(_arenanetEmployeeAchievements);
44
+
45
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
46
+
39
47
  // How many achievements the user did
40
48
  function achievementCount(accountData) {
41
49
  if (!accountData.achievements) {
@@ -97,6 +105,36 @@ function winterWonderlandCompletions(accountData) {
97
105
  return sum;
98
106
  }
99
107
 
108
+ function arenanetEmployeeAchievements(accountData) {
109
+ if (!accountData.achievements) {
110
+ return null;
111
+ }
112
+
113
+ var sum = 0;
114
+ _arenanetEmployeeAchievements2.default.forEach(function (achievementId) {
115
+ sum += achievementCurrent(accountData, achievementId);
116
+ });
117
+
118
+ return sum;
119
+ }
120
+
121
+ function convergenceCompletions(accountData) {
122
+ if (!accountData.achievements) {
123
+ return null;
124
+ }
125
+
126
+ var achievements = [{ id: 7668, perRepeat: 100 }, // Convergence Conquerer
127
+ { id: 7720, perRepeat: 150 // Continuous Convergence Conqueror
128
+ }];
129
+
130
+ var sum = 0;
131
+ achievements.forEach(function (achievement) {
132
+ sum += achievementCurrent(accountData, achievement.id, achievement.perRepeat);
133
+ });
134
+
135
+ return sum;
136
+ }
137
+
100
138
  // The unlocked home instance cats
101
139
  function homeCats(accountData) {
102
140
  if (!accountData.home) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw2e-account-statistics",
3
- "version": "3.15.2",
3
+ "version": "3.16.0",
4
4
  "description": "Calculate statistics of guildwars2 accounts",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  "mockdate": "^2.0.0"
20
20
  },
21
21
  "dependencies": {
22
- "@gw2efficiency/game-data": "^0.1.43",
22
+ "@gw2efficiency/game-data": "^0.1.50",
23
23
  "array-unique": "^0.3.2",
24
24
  "gw2e-account-value": "^3.13.1",
25
25
  "gw2e-static-data": "^0.5.32",
@@ -68,6 +68,8 @@ describe('statistics > items', () => {
68
68
  amnytasHerosChoice: null,
69
69
  innerNayosEndHerosChoice: null,
70
70
  convergenceHerosChoice: null,
71
+ citadelOfZakirosHerosChoice: null,
72
+ janthirSyntriHerosChoice: null,
71
73
  uniqueTonics: null,
72
74
  bloodRubies: null,
73
75
  petrifiedWood: null,
@@ -283,4 +283,37 @@ describe('statistics > progression', () => {
283
283
  expect(progressionStatistics({home: {}}).homeNodes).to.equal(null)
284
284
  expect(progressionStatistics({home: {nodes}}).homeNodes).to.equal(8)
285
285
  })
286
+
287
+ it('can calculate the completed arenanet employee achievements', () => {
288
+ expect(progressionStatistics({}).arenanetEmployeeAchievements).to.equal(null)
289
+ expect(progressionStatistics({achievements: []}).arenanetEmployeeAchievements).to.equal(0)
290
+ expect(progressionStatistics({
291
+ achievements: [
292
+ { id: 2037, current: 40, max: 40, done: true },
293
+ { id: 2150, current: 1, max: 1, done: true },
294
+ { id: 3067, current: 1, max: 1, done: true },
295
+ { id: 4501, current: 1, max: 1, done: true },
296
+ { id: 4537, current: 1, max: 1, done: true },
297
+ { id: 5457, current: 1, max: 1, done: true },
298
+ { id: 7779, current: 0, max: 1, done: false },
299
+ { id: 7853, current: 1, max: 1, done: true }
300
+ ]
301
+ }).arenanetEmployeeAchievements).to.equal(4)
302
+ })
303
+
304
+ it('can calculate the completed convergence completions', () => {
305
+ expect(progressionStatistics({}).convergenceCompletions).to.equal(null)
306
+ expect(progressionStatistics({achievements: []}).convergenceCompletions).to.equal(0)
307
+ expect(progressionStatistics({
308
+ achievements: [
309
+ { id: 7668, current: 15, max: 100, done: false }
310
+ ]
311
+ }).convergenceCompletions).to.equal(15)
312
+ expect(progressionStatistics({
313
+ achievements: [
314
+ { id: 7668, current: 100, max: 100, done: true },
315
+ { id: 7720, current: 18, max: 150, done: false, repeated: 1 }
316
+ ]
317
+ }).convergenceCompletions).to.equal(100 + 150 + 18)
318
+ })
286
319
  })
@@ -74,7 +74,8 @@ describe('statistics > wallet', () => {
74
74
  calcifiedGasp: null,
75
75
  jadeMinersKeycard: null,
76
76
  pinchOfStardust: null,
77
- staticCharge: null
77
+ staticCharge: null,
78
+ ursusOblige: null
78
79
  })
79
80
  })
80
81
 
@@ -194,7 +195,8 @@ describe('statistics > wallet', () => {
194
195
  calcifiedGasp: 0,
195
196
  jadeMinersKeycard: 0,
196
197
  pinchOfStardust: 0,
197
- staticCharge: 0
198
+ staticCharge: 0,
199
+ ursusOblige: 0
198
200
  })
199
201
  })
200
202