gw2e-account-statistics 3.9.0 → 3.10.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,258 @@
1
+ /* eslint-env node, mocha */
2
+ import { expect } from 'chai'
3
+ import unlocksStatistics from '../src/statistics/unlocks'
4
+
5
+ const EXTRA_INFO = {
6
+ skins: {
7
+ typeMap: {
8
+ Armor: [101],
9
+ Weapon: [102],
10
+ Back: [103]
11
+ }
12
+ }
13
+ }
14
+
15
+ describe('statistics > unlocks', () => {
16
+ it('can calculate dye count', () => {
17
+ expect(unlocksStatistics({}, EXTRA_INFO).dyeCount).to.equal(null)
18
+ expect(unlocksStatistics({dyes: []}, EXTRA_INFO).dyeCount).to.equal(0)
19
+ expect(unlocksStatistics({dyes: [1, 2, 7, 9, 10]}, EXTRA_INFO).dyeCount).to.equal(5)
20
+ })
21
+
22
+ it('can calculate skin count', () => {
23
+ expect(unlocksStatistics({}, EXTRA_INFO).skinCount).to.equal(null)
24
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).skinCount).to.equal(0)
25
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).skinCount).to.equal(5)
26
+ })
27
+
28
+ it.skip('can calculate armor skin count', () => {
29
+ expect(unlocksStatistics({}, EXTRA_INFO).armorSkinCount).to.equal(null)
30
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).armorSkinCount).to.equal(0)
31
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).armorSkinCount).to.equal(0)
32
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10, 101]}, EXTRA_INFO).armorSkinCount).to.equal(1)
33
+ })
34
+
35
+ it.skip('can calculate weapon skin count', () => {
36
+ expect(unlocksStatistics({}, EXTRA_INFO).weaponSkinCount).to.equal(null)
37
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).weaponSkinCount).to.equal(0)
38
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).weaponSkinCount).to.equal(0)
39
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10, 102]}, EXTRA_INFO).weaponSkinCount).to.equal(1)
40
+ })
41
+
42
+ it.skip('can calculate back skin count', () => {
43
+ expect(unlocksStatistics({}, EXTRA_INFO).backSkinCount).to.equal(null)
44
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).backSkinCount).to.equal(0)
45
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).backSkinCount).to.equal(0)
46
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10, 103]}, EXTRA_INFO).backSkinCount).to.equal(1)
47
+ })
48
+
49
+ it('can calculate mini count', () => {
50
+ expect(unlocksStatistics({}, EXTRA_INFO).miniCount).to.equal(null)
51
+ expect(unlocksStatistics({minis: []}, EXTRA_INFO).miniCount).to.equal(0)
52
+ expect(unlocksStatistics({minis: [1, 2, 7, 9, 10]}, EXTRA_INFO).miniCount).to.equal(5)
53
+ })
54
+
55
+ it('can calculate mount count', () => {
56
+ expect(unlocksStatistics({}, EXTRA_INFO).mountCount).to.equal(null)
57
+ expect(unlocksStatistics({mounts: null}, EXTRA_INFO).mountCount).to.equal(null)
58
+ expect(unlocksStatistics({mounts: {skins: []}}, EXTRA_INFO).mountCount).to.equal(0)
59
+ expect(unlocksStatistics({mounts: {skins: [1, 2, 7, 9, 10]}}, EXTRA_INFO).mountCount).to.equal(5)
60
+ })
61
+
62
+ it('can calculate finisher count', () => {
63
+ const finishers = [
64
+ {id: 1, permanent: true},
65
+ {id: 2, permanent: true},
66
+ {id: 7, permanent: true},
67
+ {id: 9, permanent: true},
68
+ {id: 10, permanent: true},
69
+ {id: 11, permanent: false}
70
+ ]
71
+
72
+ expect(unlocksStatistics({}, EXTRA_INFO).finisherCount).to.equal(null)
73
+ expect(unlocksStatistics({finishers: []}, EXTRA_INFO).finisherCount).to.equal(0)
74
+ expect(unlocksStatistics({finishers}, EXTRA_INFO).finisherCount).to.equal(5)
75
+ })
76
+
77
+ it('can calculate skiff count', () => {
78
+ const skiffs = [
79
+ {id: 1, permanent: true},
80
+ {id: 2, permanent: true},
81
+ {id: 7, permanent: true},
82
+ {id: 9, permanent: true},
83
+ {id: 10, permanent: true},
84
+ {id: 11, permanent: false}
85
+ ]
86
+
87
+ expect(unlocksStatistics({}, EXTRA_INFO).skiffCount).to.equal(null)
88
+ expect(unlocksStatistics({skiffs: []}, EXTRA_INFO).skiffCount).to.equal(0)
89
+ expect(unlocksStatistics({skiffs}, EXTRA_INFO).skiffCount).to.equal(5)
90
+ })
91
+
92
+ it('can calculate emote count', () => {
93
+ const emotes = [
94
+ {id: 1, permanent: true},
95
+ {id: 2, permanent: true},
96
+ {id: 7, permanent: true},
97
+ {id: 9, permanent: true},
98
+ {id: 10, permanent: true},
99
+ {id: 11, permanent: false}
100
+ ]
101
+
102
+ expect(unlocksStatistics({}, EXTRA_INFO).emoteCount).to.equal(null)
103
+ expect(unlocksStatistics({emotes: []}, EXTRA_INFO).emoteCount).to.equal(0)
104
+ expect(unlocksStatistics({emotes}, EXTRA_INFO).emoteCount).to.equal(5)
105
+ })
106
+
107
+ it('can calculate jadebot count', () => {
108
+ const jadebots = [
109
+ {id: 1, permanent: true},
110
+ {id: 2, permanent: true},
111
+ {id: 7, permanent: true},
112
+ {id: 9, permanent: true},
113
+ {id: 10, permanent: true},
114
+ {id: 11, permanent: false}
115
+ ]
116
+
117
+ expect(unlocksStatistics({}, EXTRA_INFO).jadebotCount).to.equal(null)
118
+ expect(unlocksStatistics({jadebots: []}, EXTRA_INFO).jadebotCount).to.equal(0)
119
+ expect(unlocksStatistics({jadebots}, EXTRA_INFO).jadebotCount).to.equal(5)
120
+ })
121
+
122
+ it('can calculate novelty count', () => {
123
+ expect(unlocksStatistics({}, EXTRA_INFO).noveltyCount).to.equal(null)
124
+ expect(unlocksStatistics({novelties: []}, EXTRA_INFO).noveltyCount).to.equal(0)
125
+ expect(unlocksStatistics({novelties: [1, 2, 7, 9, 10]}, EXTRA_INFO).noveltyCount).to.equal(5)
126
+ })
127
+
128
+ it('can calculate outfit count', () => {
129
+ expect(unlocksStatistics({}, EXTRA_INFO).outfitCount).to.equal(null)
130
+ expect(unlocksStatistics({outfits: []}, EXTRA_INFO).outfitCount).to.equal(0)
131
+ expect(unlocksStatistics({outfits: [1, 2, 7, 9, 10]}, EXTRA_INFO).outfitCount).to.equal(5)
132
+ })
133
+
134
+ it('can calculate mailcarrier count', () => {
135
+ expect(unlocksStatistics({}, EXTRA_INFO).mailcarrierCount).to.equal(null)
136
+ expect(unlocksStatistics({mailcarriers: []}, EXTRA_INFO).mailcarrierCount).to.equal(0)
137
+ expect(unlocksStatistics({mailcarriers: [1, 2, 7, 9, 10]}, EXTRA_INFO).mailcarrierCount).to.equal(5)
138
+ })
139
+
140
+ it('can calculate glider count', () => {
141
+ expect(unlocksStatistics({}, EXTRA_INFO).gliderCount).to.equal(null)
142
+ expect(unlocksStatistics({gliders: []}, EXTRA_INFO).gliderCount).to.equal(0)
143
+ expect(unlocksStatistics({gliders: [1, 2, 7, 9, 10]}, EXTRA_INFO).gliderCount).to.equal(5)
144
+ })
145
+
146
+ it('can calculate pvp hero count', () => {
147
+ expect(unlocksStatistics({}, EXTRA_INFO).pvpHeroCount).to.equal(null)
148
+ expect(unlocksStatistics({pvp: {}}, EXTRA_INFO).pvpHeroCount).to.equal(null)
149
+ expect(unlocksStatistics({pvp: {heroes: []}}, EXTRA_INFO).pvpHeroCount).to.equal(0)
150
+ expect(unlocksStatistics({pvp: {heroes: [1, 2, 7, 9, 10]}}, EXTRA_INFO).pvpHeroCount).to.equal(5)
151
+ })
152
+
153
+ it('can calculate title count', () => {
154
+ expect(unlocksStatistics({}, EXTRA_INFO).titleCount).to.equal(null)
155
+ expect(unlocksStatistics({titles: []}, EXTRA_INFO).titleCount).to.equal(0)
156
+ expect(unlocksStatistics({titles: [1, 2, 7, 9, 10]}, EXTRA_INFO).titleCount).to.equal(5)
157
+ })
158
+
159
+ it('can calculate recipe count', () => {
160
+ expect(unlocksStatistics({}, EXTRA_INFO).recipeCount).to.equal(null)
161
+ expect(unlocksStatistics({recipes: []}, EXTRA_INFO).recipeCount).to.equal(0)
162
+ expect(unlocksStatistics({recipes: [1, 2, 7, 9, 10]}, EXTRA_INFO).recipeCount).to.equal(5)
163
+ })
164
+
165
+ it('can calculate legendaryarmory count', () => {
166
+ expect(unlocksStatistics({}, EXTRA_INFO).legendaryarmoryCount).to.equal(null)
167
+ expect(unlocksStatistics({legendaryarmory: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
168
+
169
+ expect(unlocksStatistics({legendaryarmory: [
170
+ { id: 30699, count: 1 },
171
+ { id: 81957, count: 2 },
172
+ { id: 30687, count: 1 }
173
+ ]}, EXTRA_INFO).legendaryarmoryCount).to.equal(4)
174
+ })
175
+
176
+ it('can the count of shared inventory slots', () => {
177
+ expect(unlocksStatistics({}, EXTRA_INFO).sharedInventorySlots).to.equal(null)
178
+ expect(unlocksStatistics({shared: []}, EXTRA_INFO).sharedInventorySlots).to.equal(0)
179
+ expect(unlocksStatistics({shared: [1, 2, 7, 9, 10]}, EXTRA_INFO).sharedInventorySlots).to.equal(5)
180
+ })
181
+
182
+ it('can calculate legendary skin count', () => {
183
+ expect(unlocksStatistics({}, EXTRA_INFO).legendarySkins).to.equal(null)
184
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).legendarySkins).to.equal(0)
185
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).legendarySkins).to.equal(0)
186
+ expect(unlocksStatistics({skins: [1, 2, 4680, 6561, 7130]}, EXTRA_INFO).legendarySkins).to.equal(3)
187
+ })
188
+
189
+ it('can calculate legendary skin weapon count', () => {
190
+ expect(unlocksStatistics({}, EXTRA_INFO).legendarySkinsWeapon).to.equal(null)
191
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).legendarySkinsWeapon).to.equal(0)
192
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).legendarySkinsWeapon).to.equal(0)
193
+ expect(unlocksStatistics({skins: [1, 2, 4680, 7206]}, EXTRA_INFO).legendarySkinsWeapon).to.equal(2)
194
+ })
195
+
196
+ it('can calculate legendary skin armor count', () => {
197
+ expect(unlocksStatistics({}, EXTRA_INFO).legendarySkinsArmor).to.equal(null)
198
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).legendarySkinsArmor).to.equal(0)
199
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).legendarySkinsArmor).to.equal(0)
200
+ expect(unlocksStatistics({skins: [1, 2, 7142, 7107]}, EXTRA_INFO).legendarySkinsArmor).to.equal(2)
201
+ })
202
+
203
+ it('can calculate legendary skin back count', () => {
204
+ expect(unlocksStatistics({}, EXTRA_INFO).legendarySkinsBack).to.equal(null)
205
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).legendarySkinsBack).to.equal(0)
206
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).legendarySkinsBack).to.equal(0)
207
+ expect(unlocksStatistics({skins: [1, 2, 6344, 6561]}, EXTRA_INFO).legendarySkinsBack).to.equal(2)
208
+ })
209
+
210
+ it('can calculate fractal skin count', () => {
211
+ expect(unlocksStatistics({}, EXTRA_INFO).fractalSkins).to.equal(null)
212
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).fractalSkins).to.equal(0)
213
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).fractalSkins).to.equal(0)
214
+ expect(unlocksStatistics({skins: [1, 2, 4500, 6234]}, EXTRA_INFO).fractalSkins).to.equal(2)
215
+ })
216
+
217
+ it('can calculate immportal weapon skin count', () => {
218
+ expect(unlocksStatistics({}, EXTRA_INFO).immortalSkins).to.equal(null)
219
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).immortalSkins).to.equal(0)
220
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).immortalSkins).to.equal(0)
221
+ expect(unlocksStatistics({skins: [1, 2, 6111, 6087]}, EXTRA_INFO).immortalSkins).to.equal(2)
222
+ })
223
+
224
+ it('can calculate the winters presence unlock', () => {
225
+ expect(unlocksStatistics({}, EXTRA_INFO).wintersPresence).to.equal(null)
226
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).wintersPresence).to.equal(0)
227
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).wintersPresence).to.equal(0)
228
+ expect(unlocksStatistics({skins: [1, 2, 6577, 6577]}, EXTRA_INFO).wintersPresence).to.equal(1)
229
+ })
230
+
231
+ it('can calculate the nightfury unlock', () => {
232
+ expect(unlocksStatistics({}, EXTRA_INFO).nightfury).to.equal(null)
233
+ expect(unlocksStatistics({skins: []}, EXTRA_INFO).nightfury).to.equal(0)
234
+ expect(unlocksStatistics({skins: [1, 2, 7, 9, 10]}, EXTRA_INFO).nightfury).to.equal(0)
235
+ expect(unlocksStatistics({skins: [1, 2, 6161, 6161]}, EXTRA_INFO).nightfury).to.equal(1)
236
+ })
237
+
238
+ it('can calculate fractal relics used for titles', () => {
239
+ expect(unlocksStatistics({}, EXTRA_INFO)._fractalRelicsFromTitles).to.equal(null)
240
+ expect(unlocksStatistics({titles: []}, EXTRA_INFO)._fractalRelicsFromTitles).to.equal(0)
241
+ expect(unlocksStatistics({titles: [1, 2, 7, 9, 10]}, EXTRA_INFO)._fractalRelicsFromTitles).to.equal(0)
242
+ expect(unlocksStatistics({titles: [1, 2, 299, 297, 296, 298]}, EXTRA_INFO)._fractalRelicsFromTitles).to.equal(160000)
243
+ })
244
+
245
+ it('can calculate pristine fractal relics used for titles', () => {
246
+ expect(unlocksStatistics({}, EXTRA_INFO)._pristineFractalRelicsFromTitles).to.equal(null)
247
+ expect(unlocksStatistics({titles: []}, EXTRA_INFO)._pristineFractalRelicsFromTitles).to.equal(0)
248
+ expect(unlocksStatistics({titles: [1, 2, 7, 9, 10]}, EXTRA_INFO)._pristineFractalRelicsFromTitles).to.equal(0)
249
+ expect(unlocksStatistics({titles: [1, 2, 299, 297, 296, 298]}, EXTRA_INFO)._pristineFractalRelicsFromTitles).to.equal(3200)
250
+ })
251
+
252
+ it('can calculate unstable fractal essence used for unlocks', () => {
253
+ expect(unlocksStatistics({}, EXTRA_INFO)._unstableFractalEssenceFromUnlocks).to.equal(null)
254
+ expect(unlocksStatistics({skins: [], novelties: []}, EXTRA_INFO)._unstableFractalEssenceFromUnlocks).to.equal(0)
255
+ expect(unlocksStatistics({skins: [1, 2], novelties: [1, 2]}, EXTRA_INFO)._unstableFractalEssenceFromUnlocks).to.equal(0)
256
+ expect(unlocksStatistics({skins: [9607, 9603], novelties: [141]}, EXTRA_INFO)._unstableFractalEssenceFromUnlocks).to.equal(2 * 480 + 450)
257
+ })
258
+ })
@@ -74,6 +74,50 @@ describe('statistics > unlocks', () => {
74
74
  expect(unlocksStatistics({finishers}, EXTRA_INFO).finisherCount).to.equal(5)
75
75
  })
76
76
 
77
+ it('can calculate skiff count', () => {
78
+ const skiffs = [
79
+ 410,
80
+ 413,
81
+ 420,
82
+ 428,
83
+ 502
84
+ ]
85
+
86
+ expect(unlocksStatistics({}, EXTRA_INFO).skiffCount).to.equal(null)
87
+ expect(unlocksStatistics({skiffs: []}, EXTRA_INFO).skiffCount).to.equal(0)
88
+ expect(unlocksStatistics({skiffs}, EXTRA_INFO).skiffCount).to.equal(5)
89
+ })
90
+
91
+ it('can calculate emote count', () => {
92
+ const emotes = [
93
+ {id: 1, permanent: true},
94
+ {id: 2, permanent: true},
95
+ {id: 7, permanent: true},
96
+ {id: 9, permanent: true},
97
+ {id: 10, permanent: true},
98
+ {id: 11, permanent: false}
99
+ ]
100
+
101
+ expect(unlocksStatistics({}, EXTRA_INFO).emoteCount).to.equal(null)
102
+ expect(unlocksStatistics({emotes: []}, EXTRA_INFO).emoteCount).to.equal(0)
103
+ expect(unlocksStatistics({emotes}, EXTRA_INFO).emoteCount).to.equal(5)
104
+ })
105
+
106
+ it('can calculate jadebot count', () => {
107
+ const jadebots = [
108
+ {id: 1, permanent: true},
109
+ {id: 2, permanent: true},
110
+ {id: 7, permanent: true},
111
+ {id: 9, permanent: true},
112
+ {id: 10, permanent: true},
113
+ {id: 11, permanent: false}
114
+ ]
115
+
116
+ expect(unlocksStatistics({}, EXTRA_INFO).jadebotCount).to.equal(null)
117
+ expect(unlocksStatistics({jadebots: []}, EXTRA_INFO).jadebotCount).to.equal(0)
118
+ expect(unlocksStatistics({jadebots}, EXTRA_INFO).jadebotCount).to.equal(5)
119
+ })
120
+
77
121
  it('can calculate novelty count', () => {
78
122
  expect(unlocksStatistics({}, EXTRA_INFO).noveltyCount).to.equal(null)
79
123
  expect(unlocksStatistics({novelties: []}, EXTRA_INFO).noveltyCount).to.equal(0)
@@ -119,8 +163,13 @@ describe('statistics > unlocks', () => {
119
163
 
120
164
  it('can calculate legendaryarmory count', () => {
121
165
  expect(unlocksStatistics({}, EXTRA_INFO).legendaryarmoryCount).to.equal(null)
122
- expect(unlocksStatistics({legendaryarmorys: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
123
- expect(unlocksStatistics({legendaryarmorys: [1, 2, 7, 9, 10]}, EXTRA_INFO).legendaryarmoryCount).to.equal(5)
166
+ expect(unlocksStatistics({legendaryarmory: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
167
+
168
+ expect(unlocksStatistics({legendaryarmory: [
169
+ { id: 30699, count: 1 },
170
+ { id: 81957, count: 2 },
171
+ { id: 30687, count: 1 }
172
+ ]}, EXTRA_INFO).legendaryarmoryCount).to.equal(4)
124
173
  })
125
174
 
126
175
  it('can the count of shared inventory slots', () => {
@@ -74,6 +74,47 @@ describe('statistics > unlocks', () => {
74
74
  expect(unlocksStatistics({finishers}, EXTRA_INFO).finisherCount).to.equal(5)
75
75
  })
76
76
 
77
+ it('can calculate skiff count', () => {
78
+ const skiffs = [
79
+ 410,
80
+ 413,
81
+ 420,
82
+ 428,
83
+ 502
84
+ ]
85
+
86
+ expect(unlocksStatistics({}, EXTRA_INFO).skiffCount).to.equal(null)
87
+ expect(unlocksStatistics({skiffs: []}, EXTRA_INFO).skiffCount).to.equal(0)
88
+ expect(unlocksStatistics({skiffs}, EXTRA_INFO).skiffCount).to.equal(5)
89
+ })
90
+
91
+ it('can calculate emote count', () => {
92
+ const emotes = [
93
+ 'shiver',
94
+ 'shuffle',
95
+ 'step'
96
+ ]
97
+
98
+ expect(unlocksStatistics({}, EXTRA_INFO).emoteCount).to.equal(null)
99
+ expect(unlocksStatistics({emotes: []}, EXTRA_INFO).emoteCount).to.equal(0)
100
+ expect(unlocksStatistics({emotes}, EXTRA_INFO).emoteCount).to.equal(5)
101
+ })
102
+
103
+ it('can calculate jadebot count', () => {
104
+ const jadebots = [
105
+ {id: 1, permanent: true},
106
+ {id: 2, permanent: true},
107
+ {id: 7, permanent: true},
108
+ {id: 9, permanent: true},
109
+ {id: 10, permanent: true},
110
+ {id: 11, permanent: false}
111
+ ]
112
+
113
+ expect(unlocksStatistics({}, EXTRA_INFO).jadebotCount).to.equal(null)
114
+ expect(unlocksStatistics({jadebots: []}, EXTRA_INFO).jadebotCount).to.equal(0)
115
+ expect(unlocksStatistics({jadebots}, EXTRA_INFO).jadebotCount).to.equal(5)
116
+ })
117
+
77
118
  it('can calculate novelty count', () => {
78
119
  expect(unlocksStatistics({}, EXTRA_INFO).noveltyCount).to.equal(null)
79
120
  expect(unlocksStatistics({novelties: []}, EXTRA_INFO).noveltyCount).to.equal(0)
@@ -119,9 +160,9 @@ describe('statistics > unlocks', () => {
119
160
 
120
161
  it('can calculate legendaryarmory count', () => {
121
162
  expect(unlocksStatistics({}, EXTRA_INFO).legendaryarmoryCount).to.equal(null)
122
- expect(unlocksStatistics({legendaryarmorys: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
163
+ expect(unlocksStatistics({legendaryarmory: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
123
164
 
124
- expect(unlocksStatistics({legendaryarmorys: [
165
+ expect(unlocksStatistics({legendaryarmory: [
125
166
  { id: 30699, count: 1 },
126
167
  { id: 81957, count: 2 },
127
168
  { id: 30687, count: 1 }
@@ -74,6 +74,47 @@ describe('statistics > unlocks', () => {
74
74
  expect(unlocksStatistics({finishers}, EXTRA_INFO).finisherCount).to.equal(5)
75
75
  })
76
76
 
77
+ it('can calculate skiff count', () => {
78
+ const skiffs = [
79
+ 410,
80
+ 413,
81
+ 420,
82
+ 428,
83
+ 502
84
+ ]
85
+
86
+ expect(unlocksStatistics({}, EXTRA_INFO).skiffCount).to.equal(null)
87
+ expect(unlocksStatistics({skiffs: []}, EXTRA_INFO).skiffCount).to.equal(0)
88
+ expect(unlocksStatistics({skiffs}, EXTRA_INFO).skiffCount).to.equal(5)
89
+ })
90
+
91
+ it('can calculate emote count', () => {
92
+ const emotes = [
93
+ 'shiver',
94
+ 'shuffle',
95
+ 'step'
96
+ ]
97
+
98
+ expect(unlocksStatistics({}, EXTRA_INFO).emoteCount).to.equal(null)
99
+ expect(unlocksStatistics({emotes: []}, EXTRA_INFO).emoteCount).to.equal(0)
100
+ expect(unlocksStatistics({emotes}, EXTRA_INFO).emoteCount).to.equal(3)
101
+ })
102
+
103
+ it('can calculate jadebot count', () => {
104
+ const jadebots = [
105
+ {id: 1, permanent: true},
106
+ {id: 2, permanent: true},
107
+ {id: 7, permanent: true},
108
+ {id: 9, permanent: true},
109
+ {id: 10, permanent: true},
110
+ {id: 11, permanent: false}
111
+ ]
112
+
113
+ expect(unlocksStatistics({}, EXTRA_INFO).jadebotCount).to.equal(null)
114
+ expect(unlocksStatistics({jadebots: []}, EXTRA_INFO).jadebotCount).to.equal(0)
115
+ expect(unlocksStatistics({jadebots}, EXTRA_INFO).jadebotCount).to.equal(5)
116
+ })
117
+
77
118
  it('can calculate novelty count', () => {
78
119
  expect(unlocksStatistics({}, EXTRA_INFO).noveltyCount).to.equal(null)
79
120
  expect(unlocksStatistics({novelties: []}, EXTRA_INFO).noveltyCount).to.equal(0)
@@ -119,13 +160,13 @@ describe('statistics > unlocks', () => {
119
160
 
120
161
  it('can calculate legendaryarmory count', () => {
121
162
  expect(unlocksStatistics({}, EXTRA_INFO).legendaryarmoryCount).to.equal(null)
122
- expect(unlocksStatistics({legendaryarmorys: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
163
+ expect(unlocksStatistics({legendaryarmory: []}, EXTRA_INFO).legendaryarmoryCount).to.equal(0)
123
164
 
124
- expect(unlocksStatistics({legendaryarmorys: [
165
+ expect(unlocksStatistics({legendaryarmory: [
125
166
  { id: 30699, count: 1 },
126
167
  { id: 81957, count: 2 },
127
168
  { id: 30687, count: 1 }
128
- ]}, EXTRA_INFO).legendaryarmoryCount).to.equal(5)
169
+ ]}, EXTRA_INFO).legendaryarmoryCount).to.equal(4)
129
170
  })
130
171
 
131
172
  it('can the count of shared inventory slots', () => {
@@ -74,6 +74,44 @@ describe('statistics > unlocks', () => {
74
74
  expect(unlocksStatistics({finishers}, EXTRA_INFO).finisherCount).to.equal(5)
75
75
  })
76
76
 
77
+ it('can calculate skiff count', () => {
78
+ const skiffs = [
79
+ 410,
80
+ 413,
81
+ 420,
82
+ 428,
83
+ 502
84
+ ]
85
+
86
+ expect(unlocksStatistics({}, EXTRA_INFO).skiffCount).to.equal(null)
87
+ expect(unlocksStatistics({skiffs: []}, EXTRA_INFO).skiffCount).to.equal(0)
88
+ expect(unlocksStatistics({skiffs}, EXTRA_INFO).skiffCount).to.equal(5)
89
+ })
90
+
91
+ it('can calculate emote count', () => {
92
+ const emotes = [
93
+ 'shiver',
94
+ 'shuffle',
95
+ 'step'
96
+ ]
97
+
98
+ expect(unlocksStatistics({}, EXTRA_INFO).emoteCount).to.equal(null)
99
+ expect(unlocksStatistics({emotes: []}, EXTRA_INFO).emoteCount).to.equal(0)
100
+ expect(unlocksStatistics({emotes}, EXTRA_INFO).emoteCount).to.equal(3)
101
+ })
102
+
103
+ it('can calculate jadebot count', () => {
104
+ const jadebots = [
105
+ 3,
106
+ 4,
107
+ 6
108
+ ]
109
+
110
+ expect(unlocksStatistics({}, EXTRA_INFO).jadebotCount).to.equal(null)
111
+ expect(unlocksStatistics({jadebots: []}, EXTRA_INFO).jadebotCount).to.equal(0)
112
+ expect(unlocksStatistics({jadebots}, EXTRA_INFO).jadebotCount).to.equal(3)
113
+ })
114
+
77
115
  it('can calculate novelty count', () => {
78
116
  expect(unlocksStatistics({}, EXTRA_INFO).noveltyCount).to.equal(null)
79
117
  expect(unlocksStatistics({novelties: []}, EXTRA_INFO).noveltyCount).to.equal(0)
@@ -12,6 +12,9 @@ exports.default = function (accountData, extraInformation) {
12
12
  miniCount: miniCount(accountData),
13
13
  mountCount: mountCount(accountData),
14
14
  finisherCount: finisherCount(accountData),
15
+ skiffCount: skiffCount(accountData),
16
+ emoteCount: emoteCount(accountData),
17
+ jadebotCount: jadebotCount(accountData),
15
18
  noveltyCount: noveltyCount(accountData),
16
19
  outfitCount: outfitCount(accountData),
17
20
  pvpHeroCount: pvpHeroCount(accountData),
@@ -108,6 +111,33 @@ function finisherCount(accountData) {
108
111
  }).length;
109
112
  }
110
113
 
114
+ // The unlocked skiffs on the account
115
+ function skiffCount(accountData) {
116
+ if (!accountData.skiffs) {
117
+ return null;
118
+ }
119
+
120
+ return accountData.skiffs.length;
121
+ }
122
+
123
+ // The unlocked emotes on the account
124
+ function emoteCount(accountData) {
125
+ if (!accountData.emotes) {
126
+ return null;
127
+ }
128
+
129
+ return accountData.emotes.length;
130
+ }
131
+
132
+ // The unlocked jadebots on the account
133
+ function jadebotCount(accountData) {
134
+ if (!accountData.jadebots) {
135
+ return null;
136
+ }
137
+
138
+ return accountData.jadebots.length;
139
+ }
140
+
111
141
  // The unlocked novelties on the account
112
142
  function noveltyCount(accountData) {
113
143
  if (!accountData.novelties) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw2e-account-statistics",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "Calculate statistics of guildwars2 accounts",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -74,6 +74,44 @@ describe('statistics > unlocks', () => {
74
74
  expect(unlocksStatistics({finishers}, EXTRA_INFO).finisherCount).to.equal(5)
75
75
  })
76
76
 
77
+ it('can calculate skiff count', () => {
78
+ const skiffs = [
79
+ 410,
80
+ 413,
81
+ 420,
82
+ 428,
83
+ 502
84
+ ]
85
+
86
+ expect(unlocksStatistics({}, EXTRA_INFO).skiffCount).to.equal(null)
87
+ expect(unlocksStatistics({skiffs: []}, EXTRA_INFO).skiffCount).to.equal(0)
88
+ expect(unlocksStatistics({skiffs}, EXTRA_INFO).skiffCount).to.equal(5)
89
+ })
90
+
91
+ it('can calculate emote count', () => {
92
+ const emotes = [
93
+ 'shiver',
94
+ 'shuffle',
95
+ 'step'
96
+ ]
97
+
98
+ expect(unlocksStatistics({}, EXTRA_INFO).emoteCount).to.equal(null)
99
+ expect(unlocksStatistics({emotes: []}, EXTRA_INFO).emoteCount).to.equal(0)
100
+ expect(unlocksStatistics({emotes}, EXTRA_INFO).emoteCount).to.equal(3)
101
+ })
102
+
103
+ it('can calculate jadebot count', () => {
104
+ const jadebots = [
105
+ 3,
106
+ 4,
107
+ 6
108
+ ]
109
+
110
+ expect(unlocksStatistics({}, EXTRA_INFO).jadebotCount).to.equal(null)
111
+ expect(unlocksStatistics({jadebots: []}, EXTRA_INFO).jadebotCount).to.equal(0)
112
+ expect(unlocksStatistics({jadebots}, EXTRA_INFO).jadebotCount).to.equal(3)
113
+ })
114
+
77
115
  it('can calculate novelty count', () => {
78
116
  expect(unlocksStatistics({}, EXTRA_INFO).noveltyCount).to.equal(null)
79
117
  expect(unlocksStatistics({novelties: []}, EXTRA_INFO).noveltyCount).to.equal(0)