@wfcd/profile-parser 1.4.1 → 2.0.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.
Files changed (65) hide show
  1. package/package.json +33 -82
  2. package/src/{Ability.js → Ability.ts} +11 -4
  3. package/src/{ArchonCrystal.js → ArchonCrystal.ts} +12 -5
  4. package/src/{ChallengeProgress.js → ChallengeProgress.ts} +11 -4
  5. package/src/Enemy.ts +55 -0
  6. package/src/Intrinsics.ts +98 -0
  7. package/src/ItemConfig.ts +71 -0
  8. package/src/LoadOutInventory.ts +69 -0
  9. package/src/LoadOutItem.ts +194 -0
  10. package/src/LoadOutPreset.ts +122 -0
  11. package/src/Mission.ts +75 -0
  12. package/src/OperatorLoadOuts.ts +108 -0
  13. package/src/Polarity.ts +31 -0
  14. package/src/Profile.ts +308 -0
  15. package/src/ProfileParser.ts +66 -0
  16. package/src/Pvp.ts +43 -0
  17. package/src/Race.ts +36 -0
  18. package/src/Scan.ts +30 -0
  19. package/src/{Skin.js → Skin.ts} +14 -6
  20. package/src/Stats.ts +504 -0
  21. package/src/Syndicate.ts +39 -0
  22. package/src/Utils.ts +85 -0
  23. package/src/{Weapon.js → Weapon.ts} +23 -3
  24. package/src/XpInfo.ts +41 -0
  25. package/src/Enemy.js +0 -47
  26. package/src/Intrinsics.js +0 -77
  27. package/src/ItemConfig.js +0 -52
  28. package/src/LoadOutInventory.js +0 -53
  29. package/src/LoadOutItem.js +0 -155
  30. package/src/LoadOutPreset.js +0 -90
  31. package/src/Mission.js +0 -58
  32. package/src/OperatorLoadOuts.js +0 -77
  33. package/src/Polarity.js +0 -25
  34. package/src/Profile.js +0 -213
  35. package/src/ProfileParser.js +0 -50
  36. package/src/Pvp.js +0 -35
  37. package/src/Race.js +0 -33
  38. package/src/Scan.js +0 -22
  39. package/src/Stats.js +0 -340
  40. package/src/Syndicate.js +0 -34
  41. package/src/Utils.js +0 -66
  42. package/src/XpInfo.js +0 -35
  43. package/types/Ability.d.ts +0 -20
  44. package/types/ArchonCrystal.d.ts +0 -22
  45. package/types/ChallengeProgress.d.ts +0 -21
  46. package/types/Enemy.d.ts +0 -41
  47. package/types/Intrinsics.d.ts +0 -66
  48. package/types/ItemConfig.d.ts +0 -21
  49. package/types/LoadOutInventory.d.ts +0 -45
  50. package/types/LoadOutItem.d.ts +0 -92
  51. package/types/LoadOutPreset.d.ts +0 -45
  52. package/types/Mission.d.ts +0 -35
  53. package/types/OperatorLoadOuts.d.ts +0 -35
  54. package/types/Polarity.d.ts +0 -21
  55. package/types/Profile.d.ts +0 -154
  56. package/types/ProfileParser.d.ts +0 -41
  57. package/types/Pvp.d.ts +0 -31
  58. package/types/Race.d.ts +0 -28
  59. package/types/Scan.d.ts +0 -20
  60. package/types/Skin.d.ts +0 -19
  61. package/types/Stats.d.ts +0 -255
  62. package/types/Syndicate.d.ts +0 -26
  63. package/types/Utils.d.ts +0 -3
  64. package/types/Weapon.d.ts +0 -51
  65. package/types/XpInfo.d.ts +0 -28
package/src/Stats.ts ADDED
@@ -0,0 +1,504 @@
1
+ import Ability, { type RawAbility } from './Ability';
2
+ import Enemy, { type RawEnemy } from './Enemy';
3
+ import Mission, { type RawMission } from './Mission';
4
+ import Pvp, { type RawPvp } from './Pvp';
5
+ import Race, { type RawRace } from './Race';
6
+ import Scan, { type RawScan } from './Scan';
7
+ import Weapon, { type RawWeapon } from './Weapon';
8
+
9
+ export interface RawStats {
10
+ GuildName: string;
11
+ MissionsCompleted: number;
12
+ MissionsQuit: number;
13
+ MissionsFailed: number;
14
+ MissionsInterrupted: number;
15
+ MissionsDumped: number;
16
+ PickupCount: number;
17
+ Weapons: RawWeapon[];
18
+ Enemies: RawEnemy[];
19
+ ExcavationEventScoreMax?: number;
20
+ ForestEventScoreMax?: number;
21
+ ForestEventScoreSum?: number;
22
+ MeleeKills: number;
23
+ Abilities: RawAbility[];
24
+ CiphersSolved: number;
25
+ CiphersFailed: number;
26
+ Income: number;
27
+ TimePlayedSec: number;
28
+ CipherTime: number;
29
+ Rating: number;
30
+ Rank: number;
31
+ Deaths: number;
32
+ PlayerLevel: number;
33
+ Missions: RawMission[];
34
+ HealCount: number;
35
+ HiveEventScore?: number;
36
+ HiveEventScoreSum?: number;
37
+ InvasionEventGrineerScore?: number;
38
+ InvasionEventCorpusScore?: number;
39
+ Scans: RawScan[];
40
+ ReviveCount: number;
41
+ FomorianEventScore?: number;
42
+ PVP?: RawPvp[];
43
+ PVPSpeedballTies?: number;
44
+ PVPSpeedballChecks?: number;
45
+ PVPSpeedballGoals?: number;
46
+ PVPSpeedballInterceptions?: number;
47
+ PVPSpeedballSteals?: number;
48
+ PVPSpeedballPoints?: number;
49
+ PVPSpeedballLosses?: number;
50
+ PVPSpeedballAssists?: number;
51
+ PVPSpeedballWins?: number;
52
+ PVPSpeedballSaves?: number;
53
+ PVPSpeedballPasses?: number;
54
+ DojoObstacleScore?: number;
55
+ PvpGamesPendingMask?: number;
56
+ DedicatedServerGamesCompleted?: number;
57
+ ColonistRescueEventScoreMax?: number;
58
+ AmbulasEventScoreMax?: number;
59
+ SentinelGameScore?: number;
60
+ AmalgamEventScoreMax?: number;
61
+ FlotillaEventScore?: number;
62
+ FlotillaGroundBadgesTier1?: number;
63
+ FlotillaGroundBadgesTier2?: number;
64
+ FlotillaGroundBadgesTier3?: number;
65
+ FlotillaSpaceBadgesTier1?: number;
66
+ FlotillaSpaceBadgesTier2?: number;
67
+ FlotillaSpaceBadgesTier3?: number;
68
+ MechSurvivalScoreMax: number;
69
+ ZephyrScore?: number;
70
+ Races: RawRace;
71
+ PortalEventScore?: number;
72
+ RiotMoaEventScore?: number;
73
+ RiotMoaEventScoreMax?: number;
74
+ ProjectSinisterEventScore?: number;
75
+ KelaEventBonusScoreMax?: number;
76
+ Halloween19ScoreMax?: number;
77
+ SurvivalEventScore?: number;
78
+ InfestedEventScore?: number;
79
+ }
80
+
81
+ interface Lunaro {
82
+ ties: number;
83
+ checks: number;
84
+ goals: number;
85
+ interceptions: number;
86
+ steals: number;
87
+ points: number;
88
+ losses: number;
89
+ assists: number;
90
+ wins: number;
91
+ saves: number;
92
+ passes: number;
93
+ }
94
+
95
+ interface ScarletSpear {
96
+ eventScore: number;
97
+ condrixTier1: number;
98
+ condrixTier2: number;
99
+ condrixTier3: number;
100
+ murexTier1: number;
101
+ murexTier2: number;
102
+ murexTier3: number;
103
+ }
104
+
105
+ /**
106
+ * A player's overall career stats
107
+ * @module
108
+ */
109
+ export default class Stats {
110
+ /**
111
+ * Guild name
112
+ */
113
+ guildName: string;
114
+
115
+ /**
116
+ * Missions completed
117
+ */
118
+ missionsCompleted: number;
119
+
120
+ /**
121
+ * Missions quit
122
+ */
123
+ missionsQuit: number;
124
+
125
+ /**
126
+ * Misions failed
127
+ */
128
+ missionsFailed: number;
129
+
130
+ /**
131
+ * Missions interrupted
132
+ */
133
+ missionsInterrupted: number;
134
+
135
+ /**
136
+ * Missions dumped
137
+ */
138
+ missionsDumped: number;
139
+
140
+ /**
141
+ * Items picked up
142
+ */
143
+ pickupCount: number;
144
+
145
+ /**
146
+ * Stats per weapon
147
+ */
148
+ weapons: Weapon[];
149
+
150
+ /**
151
+ * Stats on enemy encounters.
152
+ */
153
+ enemies: Enemy[];
154
+
155
+ /**
156
+ * Max score for Operation: Cryotic Front
157
+ */
158
+ excavationEventScoreMax?: number;
159
+
160
+ /**
161
+ * Max scoring for The Cicero crisis
162
+ */
163
+ forestEventScoreMax?: number;
164
+
165
+ /**
166
+ * Clan scoring for The Cicero crisis
167
+ */
168
+ forestEventScoreSum?: number;
169
+
170
+ /**
171
+ * Melee kills
172
+ */
173
+ meleeKills: number;
174
+
175
+ /**
176
+ * Used abilities
177
+ */
178
+ abilities: Ability[];
179
+
180
+ /**
181
+ * Ciphers completed successfully
182
+ */
183
+ ciphersSolved: number;
184
+
185
+ /**
186
+ * Ciphers failed
187
+ */
188
+ ciphersFailed: number;
189
+
190
+ /**
191
+ * Gross income
192
+ */
193
+ income: number;
194
+
195
+ /**
196
+ * Total play time since account creation
197
+ */
198
+ timePlayedSec: number;
199
+
200
+ /**
201
+ * Average time to hack a panel
202
+ */
203
+ cipherTime: number;
204
+
205
+ /**
206
+ * N/A
207
+ */
208
+ rating: number;
209
+
210
+ /**
211
+ * Mastery rank
212
+ */
213
+ rank: number;
214
+
215
+ /**
216
+ * Total deaths since account creation
217
+ */
218
+ deaths: number;
219
+
220
+ /**
221
+ * Mastery rank
222
+ */
223
+ playerLevel: number;
224
+
225
+ /**
226
+ * List of missions and high scores
227
+ */
228
+ missions: Mission[];
229
+
230
+ /**
231
+ * Team heals
232
+ */
233
+ healCount: number;
234
+
235
+ /**
236
+ * Event Scores for Operation breeding grounds
237
+ */
238
+ breedGrounds?: { personalScore: number; clanScore: number };
239
+
240
+ /**
241
+ * Event Scores for The Gradivus Dilemma
242
+ */
243
+ gradivusDilemma?: { grineer: number; corpus: number };
244
+
245
+ /**
246
+ * List of scanned Warframe objects
247
+ */
248
+ scans: Scan[];
249
+
250
+ /**
251
+ * Team revives
252
+ */
253
+ reviveCount: number;
254
+
255
+ /**
256
+ * Score for Operation: Eyes of Blight
257
+ */
258
+ fomorianEventScore?: number;
259
+
260
+ /**
261
+ * Conclave scores
262
+ */
263
+ pvp: Pvp[];
264
+
265
+ /**
266
+ * Lunaro stats
267
+ */
268
+ lunaro: Lunaro;
269
+
270
+ /**
271
+ * Dojo obstacle course goal
272
+ */
273
+ dojoObstacleScore: number;
274
+
275
+ /**
276
+ * N/A
277
+ */
278
+ pvpGamesPendingMask: number;
279
+
280
+ /**
281
+ * N/A
282
+ */
283
+ dedicatedServerGamesCompleted: number;
284
+
285
+ /**
286
+ * Event score for the Pacifism Defect
287
+ */
288
+ pacifismDefect?: number;
289
+
290
+ /**
291
+ * Score for operation Ambulas reborn.
292
+ */
293
+ ambulasReborn?: number;
294
+
295
+ /**
296
+ * Score for Wyrmius mini game
297
+ */
298
+ sentinelGameScore?: number;
299
+
300
+ /**
301
+ * Event score for operation hostile merger
302
+ */
303
+ amalgamEventScoreMax?: number;
304
+
305
+ /**
306
+ * Operation Scarlet spear event score and badges
307
+ */
308
+ scarletSpear?: ScarletSpear;
309
+
310
+ /**
311
+ * Operation: Orphix Venom score
312
+ */
313
+ orphixVenomScore?: number;
314
+
315
+ /**
316
+ * Play's Highest score in Happy Zephyr
317
+ */
318
+ happyZephyrScore: number;
319
+
320
+ /**
321
+ * K-Drive races
322
+ */
323
+ kDriveRaces: Race[];
324
+
325
+ /**
326
+ * Operation Gate Crash event
327
+ */
328
+ gateCrash?: number;
329
+
330
+ /**
331
+ * Per mission score for Operation: False Profit
332
+ */
333
+ falseProfitMissionScore?: number;
334
+
335
+ /**
336
+ * Total even score for Operation: False Profit
337
+ */
338
+ falseProfitEventScore?: number;
339
+
340
+ /**
341
+ * Operation: Shadow Debt event score
342
+ */
343
+ shadowDebtEventScore?: number;
344
+
345
+ /**
346
+ * Operation: Rathuum event score
347
+ */
348
+ rathuumEventScore?: number;
349
+
350
+ /**
351
+ * Hollowed flame event max score
352
+ */
353
+ hallowedFlameScoreMax?: number;
354
+
355
+ /**
356
+ * Survival Weekend event score
357
+ */
358
+ survivalWeekenedEventScore?: number;
359
+
360
+ /**
361
+ * N/A
362
+ */
363
+ infestedEventScore?: number;
364
+
365
+ /**
366
+ *
367
+ * @param stats Player stats
368
+ */
369
+ constructor(stats: RawStats) {
370
+ this.guildName = stats.GuildName;
371
+
372
+ this.missionsCompleted = stats.MissionsCompleted;
373
+
374
+ this.missionsQuit = stats.MissionsQuit;
375
+
376
+ this.missionsFailed = stats.MissionsFailed;
377
+
378
+ this.missionsInterrupted = stats.MissionsInterrupted;
379
+
380
+ this.missionsDumped = stats.MissionsDumped;
381
+
382
+ this.pickupCount = stats.PickupCount;
383
+
384
+ this.weapons = stats.Weapons.map((w) => new Weapon(w));
385
+
386
+ this.enemies = stats.Enemies.map((e) => new Enemy(e));
387
+
388
+ if (stats.ExcavationEventScoreMax) this.excavationEventScoreMax = stats.ExcavationEventScoreMax;
389
+
390
+ if (stats.ForestEventScoreMax) this.forestEventScoreMax = stats.ForestEventScoreMax;
391
+
392
+ if (stats.ForestEventScoreSum) this.forestEventScoreSum = stats.ForestEventScoreSum;
393
+
394
+ this.meleeKills = stats.MeleeKills;
395
+
396
+ this.abilities = stats.Abilities.map((a) => new Ability(a));
397
+
398
+ this.ciphersSolved = stats.CiphersSolved;
399
+
400
+ this.ciphersFailed = stats.CiphersFailed;
401
+
402
+ this.income = stats.Income;
403
+
404
+ this.timePlayedSec = stats.TimePlayedSec;
405
+
406
+ this.cipherTime = stats.CipherTime;
407
+
408
+ this.rating = stats.Rating;
409
+
410
+ this.rank = stats.Rank;
411
+
412
+ this.deaths = stats.Deaths;
413
+
414
+ this.playerLevel = stats.PlayerLevel;
415
+
416
+ this.missions = stats.Missions.map((m) => new Mission(m));
417
+
418
+ this.healCount = stats.HealCount;
419
+
420
+ if (stats.HiveEventScore || stats.HiveEventScoreSum) {
421
+ this.breedGrounds = {
422
+ personalScore: stats.HiveEventScore!,
423
+ clanScore: stats.HiveEventScoreSum!,
424
+ };
425
+ }
426
+
427
+ if (stats.InvasionEventGrineerScore || stats.InvasionEventCorpusScore) {
428
+ this.gradivusDilemma = {
429
+ grineer: stats.InvasionEventGrineerScore!,
430
+ corpus: stats.InvasionEventCorpusScore!,
431
+ };
432
+ }
433
+
434
+ this.scans = stats.Scans?.map((s) => new Scan(s)) ?? [];
435
+
436
+ this.reviveCount = stats.ReviveCount;
437
+
438
+ if (stats.FomorianEventScore) this.fomorianEventScore = stats.FomorianEventScore;
439
+
440
+ this.pvp = stats.PVP?.map((pvp) => new Pvp(pvp)) ?? [];
441
+
442
+ this.lunaro = {
443
+ ties: stats.PVPSpeedballTies ?? 0,
444
+ checks: stats.PVPSpeedballChecks ?? 0,
445
+ goals: stats.PVPSpeedballGoals ?? 0,
446
+ interceptions: stats.PVPSpeedballInterceptions ?? 0,
447
+ steals: stats.PVPSpeedballSteals ?? 0,
448
+ points: stats.PVPSpeedballPoints ?? 0,
449
+ losses: stats.PVPSpeedballLosses ?? 0,
450
+ assists: stats.PVPSpeedballAssists ?? 0,
451
+ wins: stats.PVPSpeedballWins ?? 0,
452
+ saves: stats.PVPSpeedballSaves ?? 0,
453
+ passes: stats.PVPSpeedballPasses ?? 0,
454
+ };
455
+
456
+ this.dojoObstacleScore = stats.DojoObstacleScore ?? 0;
457
+
458
+ this.pvpGamesPendingMask = stats.PvpGamesPendingMask ?? 0;
459
+
460
+ this.dedicatedServerGamesCompleted = stats.DedicatedServerGamesCompleted ?? 0;
461
+
462
+ if (stats.ColonistRescueEventScoreMax) this.pacifismDefect = stats.ColonistRescueEventScoreMax;
463
+
464
+ if (stats.AmbulasEventScoreMax) this.ambulasReborn = stats.AmbulasEventScoreMax;
465
+
466
+ if (stats.SentinelGameScore) this.sentinelGameScore = stats.SentinelGameScore;
467
+
468
+ if (stats.AmalgamEventScoreMax) this.amalgamEventScoreMax = stats.AmalgamEventScoreMax;
469
+
470
+ if (stats.FlotillaEventScore) {
471
+ this.scarletSpear = {
472
+ eventScore: stats.FlotillaEventScore,
473
+ condrixTier1: stats.FlotillaGroundBadgesTier1!,
474
+ condrixTier2: stats.FlotillaGroundBadgesTier2!,
475
+ condrixTier3: stats.FlotillaGroundBadgesTier3!,
476
+ murexTier1: stats.FlotillaSpaceBadgesTier1!,
477
+ murexTier2: stats.FlotillaSpaceBadgesTier2!,
478
+ murexTier3: stats.FlotillaSpaceBadgesTier3!,
479
+ };
480
+ }
481
+
482
+ if (stats.MechSurvivalScoreMax) this.orphixVenomScore = stats.MechSurvivalScoreMax;
483
+
484
+ this.happyZephyrScore = stats.ZephyrScore ?? 0;
485
+
486
+ this.kDriveRaces = Race.fromRaceObject(stats.Races);
487
+
488
+ if (stats.PortalEventScore) this.gateCrash = stats.PortalEventScore;
489
+
490
+ if (stats.RiotMoaEventScore) this.falseProfitMissionScore = stats.RiotMoaEventScore;
491
+
492
+ if (stats.RiotMoaEventScoreMax) this.falseProfitEventScore = stats.RiotMoaEventScoreMax;
493
+
494
+ if (stats.ProjectSinisterEventScore) this.shadowDebtEventScore = stats.ProjectSinisterEventScore;
495
+
496
+ if (stats.KelaEventBonusScoreMax) this.rathuumEventScore = stats.KelaEventBonusScoreMax;
497
+
498
+ if (stats.Halloween19ScoreMax) this.hallowedFlameScoreMax = stats.Halloween19ScoreMax;
499
+
500
+ if (stats.SurvivalEventScore) this.survivalWeekenedEventScore = stats.SurvivalEventScore;
501
+
502
+ if (stats.InfestedEventScore) this.infestedEventScore = stats.InfestedEventScore;
503
+ }
504
+ }
@@ -0,0 +1,39 @@
1
+ import { Locale } from 'warframe-worldstate-data';
2
+ import { syndicate } from 'warframe-worldstate-data/utilities';
3
+
4
+ export interface RawAffiliation {
5
+ Tag: string;
6
+ Standing: number;
7
+ Title: number;
8
+ }
9
+
10
+ /**
11
+ * Represents a syndicate
12
+ * @module
13
+ */
14
+ export default class Syndicate {
15
+ /**
16
+ * Name of the syndicate
17
+ */
18
+ name: string;
19
+
20
+ /**
21
+ * Current standing the player has with the syndicate
22
+ */
23
+ standing: number;
24
+
25
+ /**
26
+ * The player's current syndicate title
27
+ */
28
+ title: number;
29
+
30
+ /**
31
+ * @param affiliation The syndicate data
32
+ * @param locale locale code
33
+ */
34
+ constructor(affiliation: RawAffiliation, locale: Locale = 'en') {
35
+ this.name = syndicate(affiliation.Tag, locale);
36
+ this.standing = affiliation.Standing;
37
+ this.title = affiliation.Title;
38
+ }
39
+ }
package/src/Utils.ts ADDED
@@ -0,0 +1,85 @@
1
+ import Items, { type Category, type RawColors } from '@wfcd/items';
2
+ import { WorldStateDate } from 'warframe-worldstate-data/utilities';
3
+
4
+ /**
5
+ * interface for DE's ID data
6
+ */
7
+ export interface RawId {
8
+ $oid: string;
9
+ }
10
+
11
+ // {"$date":{"$numberLong":"1462464026233"}}
12
+ export type RawDate = WorldStateDate;
13
+
14
+ export interface ProfileRawColors {
15
+ t0?: number;
16
+ t1?: number;
17
+ t2?: number;
18
+ t3?: number;
19
+ m0?: number;
20
+ m1?: number;
21
+ en?: number;
22
+ e1?: number;
23
+ }
24
+
25
+ /**
26
+ * Map base10 int colors to hex color strings
27
+ * @param colors color map
28
+ */
29
+ export const mapToHex = (colors: ProfileRawColors): RawColors => {
30
+ const hex: Record<string, string> = {};
31
+ Object.entries(colors).forEach(([key, value]) => {
32
+ if (value) hex[key] = Math.abs(value).toString(16).toUpperCase();
33
+ });
34
+ return hex as RawColors;
35
+ };
36
+
37
+ const categories = [
38
+ 'Skins',
39
+ 'Primary',
40
+ 'Secondary',
41
+ 'Melee',
42
+ 'Arch-Melee',
43
+ 'Arch-Gun',
44
+ 'Warframes',
45
+ 'Archwing',
46
+ 'Sentinels',
47
+ 'Pets',
48
+ ];
49
+
50
+ /**
51
+ * Find an item by Item#uniqueName
52
+ * @param name string with which to query
53
+ * @param locale locale to use for internationalization
54
+ * @returns {Item}
55
+ */
56
+ export const find = (name: string, locale = 'en') => {
57
+ const items = new Items({
58
+ category: categories as (Category | 'SentinelWeapons')[],
59
+ i18n: [locale],
60
+ i18nOnObject: true,
61
+ });
62
+
63
+ const item = items.find((i) => i.uniqueName === name);
64
+
65
+ let itemClone: any = { ...item };
66
+ if (locale !== 'en' && itemClone.i18n[locale] && itemClone.i18n[locale]) {
67
+ itemClone = { ...itemClone, ...itemClone.i18n[locale] };
68
+
69
+ if (itemClone.abilities) {
70
+ itemClone.abilities = itemClone.abilities.map((ability: any) => ({
71
+ uniqueName: ability.abilityUniqueName || ability.uniqueName || undefined,
72
+ name: ability.abilityName || ability.name,
73
+ description: ability.abilityDescription || ability.description,
74
+ imageName: ability.imageName ?? undefined,
75
+ }));
76
+ }
77
+
78
+ delete itemClone.i18n;
79
+ return itemClone;
80
+ }
81
+
82
+ return item;
83
+ };
84
+
85
+ export const numberToLetter = (num: number) => String.fromCharCode(64 + (num + 1));
@@ -1,13 +1,33 @@
1
+ export interface RawWeapon {
2
+ type: string;
3
+ xp: number;
4
+ equipTime: number;
5
+ headShots: number;
6
+ hits: number;
7
+ assists: number;
8
+ kills: number;
9
+ fired: number;
10
+ }
11
+
1
12
  /**
2
13
  * Represents a player's used weapon stats
3
14
  * @module
4
15
  */
5
16
  export default class Weapon {
17
+ uniqueName: string;
18
+ xp: number;
19
+ equipTime: number;
20
+ headShots: number;
21
+ hits: number;
22
+ assists: number;
23
+ kills: number;
24
+ fired: number;
25
+
6
26
  /**
7
27
  *
8
- * @param {Object} weapon The weapon stats being parsed
28
+ * @param weapon The weapon stats being parsed
9
29
  */
10
- constructor(weapon) {
30
+ constructor(weapon: RawWeapon) {
11
31
  /**
12
32
  * Weapon unique name
13
33
  * @type {String}
@@ -24,7 +44,7 @@ export default class Weapon {
24
44
  * Time using this weapon
25
45
  * @type {number}
26
46
  */
27
- this.equiptime = weapon.equipTime;
47
+ this.equipTime = weapon.equipTime;
28
48
 
29
49
  /**
30
50
  * Headshots using this weapon
package/src/XpInfo.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { type Item } from '@wfcd/items';
2
+ import { find } from './Utils';
3
+
4
+ export interface RawXpItem {
5
+ ItemType: string;
6
+ XP: number;
7
+ }
8
+
9
+ /**
10
+ * An item that has contributed to a player's mastery rank
11
+ * @module
12
+ */
13
+ export default class XpInfo {
14
+ /**
15
+ * Unique name
16
+ */
17
+ uniqueName: string;
18
+
19
+ /**
20
+ * XP earned
21
+ */
22
+ xp: number;
23
+
24
+ /**
25
+ * The item corrosponding to the unique name.
26
+ */
27
+ item?: Item;
28
+
29
+ /**
30
+ *
31
+ * @param info The info for a given ranked item
32
+ * @param locale langauge to return item in
33
+ * @param withItem Whether or not to include items
34
+ */
35
+ constructor(info: RawXpItem, locale = 'en', withItem = false) {
36
+ this.uniqueName = info.ItemType;
37
+ this.xp = info.XP;
38
+
39
+ if (withItem) this.item = find(info.ItemType, locale);
40
+ }
41
+ }