@wfcd/profile-parser 1.5.0 → 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 -31
  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.js DELETED
@@ -1,340 +0,0 @@
1
- import Ability from './Ability.js';
2
- import Enemy from './Enemy.js';
3
- import Mission from './Mission.js';
4
- import Pvp from './Pvp.js';
5
- import Race from './Race.js';
6
- import Scan from './Scan.js';
7
- import Weapon from './Weapon.js';
8
-
9
- /**
10
- * A player's overall career stats
11
- * @module
12
- */
13
- export default class Stats {
14
- /**
15
- *
16
- * @param {Object} stats Player stats
17
- */
18
- constructor(stats) {
19
- /**
20
- * Guild name
21
- * @type {String}
22
- */
23
- this.guildName = stats.GuildName;
24
-
25
- /**
26
- * Player's total accumulated xp
27
- * @type {String}
28
- */
29
- this.xp = stats.XP;
30
-
31
- /**
32
- * Missions completed
33
- * @type {number}
34
- */
35
- this.missionsCompleted = stats.MissionsCompleted;
36
-
37
- /**
38
- * Missions quit
39
- * @type {number}
40
- */
41
- this.missionsQuit = stats.MissionsQuit;
42
-
43
- /**
44
- * Misions failed
45
- * @type {number}
46
- */
47
- this.missionsFailed = stats.missionsFailed;
48
-
49
- /**
50
- * Missions interrupted
51
- * @type {number}
52
- */
53
- this.missionsInterrupted = stats.MissionsInterrupted;
54
-
55
- /**
56
- * Missions dumped
57
- * @type {number}
58
- */
59
- this.missionsDumped = stats.MissionsDumped;
60
-
61
- /**
62
- * Items picked up
63
- * @type {number}
64
- */
65
- this.pickupCount = stats.PickupCount;
66
-
67
- /**
68
- * Stats per weapon
69
- * @type {Array<Weapon>}
70
- */
71
- this.weapons = stats.Weapons.map((w) => new Weapon(w));
72
-
73
- /**
74
- * Stats on enemy encounters.
75
- * @type {Array<Enemy>}
76
- */
77
- this.enemies = stats.Enemies.map((e) => new Enemy(e));
78
-
79
- /**
80
- * Max score for Operation: Cryotic Front
81
- * @type {number}
82
- */
83
- this.excavationEventScoreMax = stats.ExcavationEventScoreMax;
84
-
85
- /**
86
- * Max scoring for The Cicero crisis
87
- * @type {number}
88
- */
89
- this.forestEventScoreMax = stats.ForestEventScoreMax;
90
-
91
- /**
92
- * Clan scoring for The Cicero crisis
93
- * @type {number}
94
- */
95
- this.forestEventScoreSum = stats.ForestEventScoreSum;
96
-
97
- /**
98
- * Melee kills
99
- * @type {number}
100
- */
101
- this.meleeKills = stats.MeleeKills;
102
-
103
- /**
104
- * Used abilities
105
- * @type {number}
106
- */
107
- this.abilities = stats.Abilities.map((a) => new Ability(a));
108
-
109
- /**
110
- * Ciphers completed successfully
111
- * @type {number}
112
- */
113
- this.ciphersSolved = stats.CiphersSolved;
114
-
115
- /**
116
- * Ciphers failed
117
- * @type {number}
118
- */
119
- this.ciphersFailed = stats.CiphersFaileds;
120
-
121
- /**
122
- * Gross income
123
- * @type {number}
124
- */
125
- this.income = stats.Income;
126
-
127
- /**
128
- * Total play time since account creation
129
- * @type {string}
130
- */
131
- this.timePlayedSec = stats.TimePlayedSec;
132
-
133
- /**
134
- * Average time to hack a panel
135
- * @type {number}
136
- */
137
- this.cipherTime = stats.CipherTime;
138
-
139
- // Not sure
140
- /**
141
- * @type {number}
142
- */
143
- this.rating = stats.Rating;
144
-
145
- /**
146
- * Mastery rank
147
- * @type {number}
148
- */
149
- this.rank = stats.Rank;
150
-
151
- /**
152
- * Total deaths since account creation
153
- * @type {number}
154
- */
155
- this.deaths = stats.Deaths;
156
-
157
- /**
158
- * Mastery rank
159
- * @type {number}
160
- */
161
- this.playerLevel = stats.PlayerLevel;
162
-
163
- /**
164
- * List of missions and high scores
165
- * @type {Array<Mission>}
166
- */
167
- this.missions = stats.Missions.map((m) => new Mission(m));
168
-
169
- /**
170
- * Team heals
171
- * @type {number}
172
- */
173
- this.healCount = stats.HealCount;
174
-
175
- /**
176
- * Event Scores for Operation breeding grounds
177
- * @type {Map<String,number>}
178
- */
179
- this.breedGrounds = {
180
- personalScore: stats.HiveEventScore,
181
- clanScore: stats.HiveEventScoreSum,
182
- };
183
-
184
- /**
185
- * Event Scores for The Gradivus Dilemma
186
- * @type {Map<String,number>}
187
- */
188
- this.gradivusDilemma = {
189
- grineer: stats.InvasionEventGrineerScore,
190
- corpus: stats.InvasionEventCorpusScore,
191
- };
192
-
193
- /**
194
- * List of scanned Warframe objects
195
- * @type {Array<Scan>}
196
- */
197
- this.scans = stats.Scans?.map((s) => new Scan(s)) ?? [];
198
-
199
- /**
200
- * Team revives
201
- * @type {number}
202
- */
203
- this.reviveCount = stats.ReviveCount;
204
-
205
- /**
206
- * Score for Operation: Eyes of Blight
207
- */
208
- this.fomorianEventScore = stats.FomorianEventScore;
209
-
210
- /**
211
- * Conclave scores
212
- * @type {Array<Pvp>}
213
- */
214
- if (stats.PVP) this.pvp = stats.PVP.map((pvp) => new Pvp(pvp));
215
-
216
- /**
217
- * Lunaro stats
218
- * @type {Map<String,number>}
219
- */
220
- this.lunaro = {
221
- ties: stats.PVPSpeedballTies,
222
- checks: stats.PVPSpeedballChecks,
223
- goals: stats.PVPSpeedballGoals,
224
- interceptions: stats.PVPSpeedballInterceptions,
225
- steals: stats.PVPSpeedballSteals,
226
- points: stats.PVPSpeedballPoints,
227
- losses: stats.PVPSpeedballLosses,
228
- assists: stats.PVPSpeedballAssists,
229
- wins: stats.PVPSpeedballWins,
230
- saves: stats.PVPSpeedballSaves,
231
- passes: stats.PVPSpeedballPasses,
232
- };
233
-
234
- /**
235
- * Dojo obstacle course goal
236
- * @type {number}
237
- */
238
- this.dojoObstacleScore = stats.DojoObstacleScore;
239
-
240
- /**
241
- * @type {number}
242
- */
243
- this.pvpGamesPendingMask = stats.PvpGamesPendingMask;
244
-
245
- /**
246
- * @type {number}
247
- */
248
- this.dedicatedServerGamesCompleted = stats.DedicatedServerGamesCompleted;
249
-
250
- /**
251
- * Event score for the Pacifism Defect
252
- * @type {number}
253
- */
254
- this.pacifismDefect = stats.ColonistRescueEventScoreMax;
255
-
256
- /**
257
- * Score for operation Ambulas reborn.
258
- * @type {number}
259
- */
260
- this.ambulasReborn = stats.AmbulasEventScoreMax;
261
-
262
- /**
263
- * Score for Wyrmius mini game
264
- * @type {number}
265
- */
266
- this.sentinelGameScore = stats.SentinelGameScore;
267
-
268
- /**
269
- * Event score for operation hostile merger
270
- * @type {number}
271
- */
272
- this.amalgamEventScoreMax = stats.AmalgamEventScoreMax;
273
-
274
- /**
275
- * Operation Scarlet spear event score and badges
276
- * @type {Map<String,number>}
277
- */
278
- this.scarletSpear = {
279
- eventScore: stats.FlotillaEventScore,
280
- condrixTier1: stats.FlotillaGroundBadgesTier1,
281
- condrixTier2: stats.FlotillaGroundBadgesTier2,
282
- condrixTier3: stats.FlotillaGroundBadgesTier3,
283
- murexTier1: stats.FlotillaSpaceBadgesTier1,
284
- murexTier2: stats.FlotillaSpaceBadgesTier2,
285
- murexTier3: stats.FlotillaSpaceBadgesTier3,
286
- };
287
-
288
- this.orphixVenomScore = stats.MechSurvivalScoreMax;
289
- this.happyZephyrScore = stats.ZephyrScore;
290
-
291
- this.kDriveRaces = Race.fromRaceObject(stats.Races);
292
-
293
- /**
294
- * Operation Gate Crash event
295
- * @type {number}
296
- */
297
- this.gateCrash = stats.PortalEventScore;
298
-
299
- /**
300
- * Per mission score for Operation: False Profit
301
- * @type {number}
302
- */
303
- this.falseProfitMissionScore = stats.RiotMoaEventScore;
304
-
305
- /**
306
- * Total even score for Operation: False Profit
307
- * @type {number}
308
- */
309
- this.fasleProfitEventScore = stats.RiotMoaEventScoreMax;
310
-
311
- /**
312
- * Operation: Shadow Debt event score
313
- * @type {number}
314
- */
315
- this.shadowDebtEventScore = stats.ProjectSinisterEventScore;
316
-
317
- /**
318
- * Operation: Rathuum event score
319
- * @type {number}
320
- */
321
- this.rathuumEventScore = stats.KelaEventBonusScoreMax;
322
-
323
- /**
324
- * Hollowed flame event max score
325
- * @type {number}
326
- */
327
- this.hallowedFlameScoreMax = stats.Halloween19ScoreMax;
328
-
329
- /**
330
- * Survival Weekend event score
331
- * @type {number}
332
- */
333
- this.survivalWeekenedEventScore = stats.SurvivalEventScore;
334
-
335
- /**
336
- * @type {number}
337
- */
338
- this.infestedEventScore = stats.InfestedEventScore;
339
- }
340
- }
package/src/Syndicate.js DELETED
@@ -1,34 +0,0 @@
1
- import { syndicate } from 'warframe-worldstate-data/utilities';
2
-
3
- /**
4
- * Represents a syndicate
5
- * @module
6
- */
7
- export default class Syndicate {
8
- /**
9
- * @param {Object} affiliation The syndicate data
10
- * @param {string} locale locale code
11
- */
12
- constructor(affiliation, locale = 'en') {
13
- // TODO: name is readable but still might want to clean them up
14
- // i.e "NewLokaSyndicate" can be "New Loka"" instead
15
-
16
- /**
17
- * Name of the syndicate
18
- * @type {String}
19
- */
20
- this.name = syndicate(affiliation.Tag, locale);
21
-
22
- /**
23
- * Current standing the player has with the syndicate
24
- * @type {number}
25
- */
26
- this.standing = affiliation.Standing;
27
-
28
- /**
29
- * The player's current syndicate title
30
- * @type {String}
31
- */
32
- this.title = affiliation.Title;
33
- }
34
- }
package/src/Utils.js DELETED
@@ -1,66 +0,0 @@
1
- import Items from '@wfcd/items';
2
-
3
- /** @module */
4
-
5
- /**
6
- * Map base10 int colors to hex color strings
7
- * @param {Record<string, number | undefined>} colors color map
8
- * @returns {Record<string, string>}
9
- */
10
- export const mapToHex = (colors) => {
11
- const hex = {};
12
- Object.entries(colors).forEach(([key, /** @type {undefined | number} */ value]) => {
13
- hex[key] = Math.abs(value).toString(16).toUpperCase();
14
- });
15
- return hex;
16
- };
17
-
18
- const categories = [
19
- 'Skins',
20
- 'Primary',
21
- 'Secondary',
22
- 'Melee',
23
- 'Arch-Melee',
24
- 'Arch-Gun',
25
- 'Warframes',
26
- 'Archwing',
27
- 'Sentinels',
28
- 'Pets',
29
- ];
30
-
31
- /**
32
- * Find an item by Item#uniqueName
33
- * @param {string} name string with which to query
34
- * @param {string} [locale='en'] locale to use for internationalization
35
- * @returns {Item}
36
- */
37
- export const find = (name, locale = 'en') => {
38
- const items = new Items({
39
- category: categories,
40
- i18n: locale,
41
- i18nOnObject: true,
42
- });
43
-
44
- const item = items.find((i) => i.uniqueName === name);
45
-
46
- let itemClone = { ...item };
47
- if (locale !== 'en' && itemClone.i18n[locale] && itemClone.i18n[locale]) {
48
- itemClone = { ...itemClone, ...itemClone.i18n[locale] };
49
-
50
- if (itemClone.abilities) {
51
- itemClone.abilities = itemClone.abilities.map((ability) => ({
52
- uniqueName: ability.abilityUniqueName || ability.uniqueName || undefined,
53
- name: ability.abilityName || ability.name,
54
- description: ability.abilityDescription || ability.description,
55
- imageName: ability.imageName ?? undefined,
56
- }));
57
- }
58
-
59
- delete itemClone.i18n;
60
- return itemClone;
61
- }
62
-
63
- return item;
64
- };
65
-
66
- export const numberToLetter = (num) => String.fromCharCode(64 + (num + 1));
package/src/XpInfo.js DELETED
@@ -1,35 +0,0 @@
1
- import { find } from './Utils.js';
2
-
3
- /**
4
- * An item that has contributed to a player's mastery rank
5
- * @module
6
- */
7
- export default class XpInfo {
8
- /**
9
- *
10
- * @param {Object} info The info for a given ranked item
11
- * @param {string} locale langauge to return item in
12
- * @param {boolean} [withItem=false] Whether or not to include items
13
- */
14
- constructor(info, locale = 'en', withItem = false) {
15
- /**
16
- * Unique name
17
- * @type {String}
18
- */
19
- this.uniqueName = info.ItemType;
20
-
21
- /**
22
- * XP earned
23
- * @type {number}
24
- */
25
- this.xp = info.XP;
26
-
27
- if (withItem) {
28
- /**
29
- * The item corrosponding to the unique name.
30
- * @type {module:"@wfcd/items".Item | undefined}
31
- */
32
- this.item = find(info.ItemType, locale);
33
- }
34
- }
35
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Represents a players used ability
3
- * @module
4
- */
5
- export default class Ability {
6
- /**
7
- * @param {Object} ability The ability
8
- */
9
- constructor(ability: any);
10
- /**
11
- * The ability unique name
12
- * @type {String}
13
- */
14
- uniqueName: string;
15
- /**
16
- * How many time the ability was used in the player's lifetime
17
- * @type {number}
18
- */
19
- used: number;
20
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Represents an Archon shard
3
- * @module
4
- */
5
- export default class ArchonCrystal {
6
- /**
7
- *
8
- * @param {Object} crystal The archon crystal object
9
- * @param {string} locale The locale to get translations in
10
- */
11
- constructor(crystal: any, locale?: string);
12
- /**
13
- * Archon shard color
14
- * @type {String}
15
- */
16
- color: string;
17
- /**
18
- * Archon shard modifier
19
- * @type {String}
20
- */
21
- modifier: string;
22
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Player completed or in progress challenges
3
- * @module
4
- */
5
- export default class ChallengeProgress {
6
- /**
7
- *
8
- * @param {Object} challenge The challenge object to parse
9
- */
10
- constructor(challenge: any);
11
- /**
12
- * Name of the challenge
13
- * @type {String}
14
- */
15
- name: string;
16
- /**
17
- * Progress towards completing this challenge
18
- * @type {number}
19
- */
20
- progress: number;
21
- }
package/types/Enemy.d.ts DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * An enemy killed/executed by player
3
- * @module
4
- */
5
- export default class Enemy {
6
- /**
7
- *
8
- * @param {Object} enemy The enemy
9
- */
10
- constructor(enemy: any);
11
- /**
12
- * Enenmy's unique name
13
- * @type {String}
14
- */
15
- uniqueName: string;
16
- /**
17
- * How many times the player has killed this enemy type
18
- * @type {number}
19
- */
20
- kills: number;
21
- /**
22
- * The amount of kills that were headshots
23
- * @type {number}
24
- */
25
- headshots: number;
26
- /**
27
- * The amount of kills that were finishers
28
- * @type {number}
29
- */
30
- executions: number;
31
- /**
32
- * The amount of kills that were assits
33
- * @type {number}
34
- */
35
- assists: number;
36
- /**
37
- * How many times this enemy type has killed the player
38
- * @type {number}
39
- */
40
- deaths: number;
41
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * Player's intrinsics ranks
3
- * @module
4
- */
5
- export default class Intrinsics {
6
- /**
7
- *
8
- * @param {Object} skills The intrinsics object
9
- */
10
- constructor(skills: any);
11
- /**
12
- * Intrinsic points for railjack
13
- * @type {number}
14
- */
15
- railjack: number;
16
- /**
17
- * Railjack engineering rank
18
- * @type {number}
19
- */
20
- engineering: number;
21
- /**
22
- * Railjack gunnery rank
23
- * @type {number}
24
- */
25
- gunnery: number;
26
- /**
27
- * Railjack piloting rank
28
- * @type {number}
29
- */
30
- piloting: number;
31
- /**
32
- * Railjack tactical rank
33
- * @type {number}
34
- */
35
- tactical: number;
36
- /**
37
- * Railjack command rank
38
- * @type {number}
39
- */
40
- command: number;
41
- /**
42
- * Intrinsic points for railjack
43
- * @type {number}
44
- */
45
- drifter: number;
46
- /**
47
- * Drifter riding rank
48
- * @type {number}
49
- */
50
- riding: number;
51
- /**
52
- * Drifter combat rank
53
- * @type {number}
54
- */
55
- combat: number;
56
- /**
57
- * Drifter opportunity rank
58
- * @type {number}
59
- */
60
- opportunity: number;
61
- /**
62
- * Drifter endurance rank
63
- * @type {number}
64
- */
65
- endurance: number;
66
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Item customizations such as colors and applied skins
3
- * @module
4
- */
5
- export default class ItemConfig {
6
- /**
7
- *
8
- * @param {Object} config The configuration
9
- */
10
- constructor(config: any);
11
- /**
12
- * Array of unique names for the skins applied to item
13
- * @type {Array<String> | undefined}
14
- */
15
- skins: Array<string> | undefined;
16
- conclaveUpgrades: any;
17
- primaryColor: import("@wfcd/items").ColorMap;
18
- sigilColor: import("@wfcd/items").ColorMap;
19
- attachmentsColor: import("@wfcd/items").ColorMap;
20
- syandanaColor: import("@wfcd/items").ColorMap;
21
- }