@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/Profile.js DELETED
@@ -1,213 +0,0 @@
1
- import { parseDate } from 'warframe-worldstate-data/utilities';
2
-
3
- import ChallengeProgress from './ChallengeProgress.js';
4
- import Intrinsics from './Intrinsics.js';
5
- import LoadOutInventory from './LoadOutInventory.js';
6
- import Mission from './Mission.js';
7
- import OperatorLoadOuts from './OperatorLoadOuts.js';
8
- import Syndicate from './Syndicate.js';
9
- import LoadOutPreset from './LoadOutPreset.js';
10
-
11
- /**
12
- * A player's profile
13
- * @module
14
- */
15
- export default class Profile {
16
- /**
17
- *
18
- * @param {Object} profile The profile data to parse
19
- * @param {string} locale The locale to return in where possible
20
- * @param {boolean} [withItem=false] Whether or not to include items
21
- */
22
- constructor(profile, locale = 'en', withItem = false) {
23
- /**
24
- * Player's account ID
25
- * @type {String}
26
- */
27
- this.accountId = profile.AccountId.$oid;
28
-
29
- /**
30
- * In-game name
31
- * @type {String}
32
- */
33
- this.displayName = profile.DisplayName;
34
-
35
- /**
36
- * List of usernames across supported platforms
37
- * @type {Array<String>}
38
- */
39
- this.platformNames = profile.PlatformNames;
40
-
41
- /**
42
- * Mastery rank
43
- * @type {String}
44
- */
45
- this.masteryRank = profile.PlayerLevel;
46
-
47
- /**
48
- * Load out preset equipped
49
- * @type {LoadOutPreset | undefined}
50
- */
51
- if (profile.LoadOutPreset) this.preset = new LoadOutPreset(profile.LoadOutPreset);
52
-
53
- /**
54
- * Current loadout
55
- * @type {LoadOutInventory}
56
- */
57
- this.loadout = new LoadOutInventory(profile.LoadOutInventory, locale, withItem);
58
-
59
- /**
60
- * Railjack and drifter Intrinsics
61
- * @type {Intrinsics}
62
- */
63
- this.intrinsics = new Intrinsics(profile.PlayerSkills ?? {});
64
-
65
- /**
66
- * Nightwave challenges progress
67
- * @type {Array<ChallengeProgress>}
68
- */
69
- this.challengeProgress = profile.ChallengeProgress.map((c) => new ChallengeProgress(c));
70
-
71
- /**
72
- * Guild ID
73
- * @type {String}
74
- */
75
- if (profile.GuildId?.$oid) this.guildId = profile.GuildId.$oid;
76
-
77
- /**
78
- * Guild name
79
- * @type {String}
80
- */
81
- this.guildName = profile.GuildName;
82
-
83
- /**
84
- * Guild tier
85
- * @type {number}
86
- */
87
- this.guildTier = profile.GuildTier;
88
-
89
- /**
90
- * Guild XP
91
- * @type {number}
92
- */
93
- this.guildXp = profile.GuildXp;
94
-
95
- /**
96
- * Guild class
97
- * @type {String}
98
- */
99
- this.guildClass = profile.GuildClass;
100
-
101
- /**
102
- * Guild emblem.
103
- * @type {String}
104
- */
105
- this.guildEmblem = profile.GuildEmblem;
106
-
107
- /**
108
- * Alliance ID
109
- * @type {String | undefined}
110
- */
111
- if (profile.AllianceId?.$oid) this.allianceId = profile.AllianceId.$oid;
112
-
113
- /**
114
- * Assassins currently asfter the player
115
- * @type {Array<String>}
116
- */
117
- this.deathMarks = profile.DeathMarks;
118
-
119
- /**
120
- * Whether or not the player is qualified as a target for Zanuka
121
- * @type {boolean}
122
- */
123
- this.harvestable = profile.Harvestable;
124
-
125
- /**
126
- * Whether or not the player is qualified as a target for a syndicate death squad
127
- * @type {boolean}
128
- */
129
- this.deathSquadable = profile.DeathSquadable;
130
-
131
- /**
132
- * Date the account was created
133
- * @type {Date}
134
- */
135
- this.created = parseDate(profile.Created);
136
-
137
- /**
138
- * Whether the user has migrated to console or not
139
- * @type {boolean}
140
- */
141
- this.migratedToConsole = profile.MigratedToConsole;
142
-
143
- /**
144
- * List of completed missions and their completions
145
- * @type {Mission}
146
- */
147
- this.missions = profile.Missions.map((m) => new Mission(m, locale));
148
-
149
- /**
150
- * Player standing and title across all syndicates
151
- * @type {Array<Syndicate>}
152
- */
153
- this.syndicates = profile.Affiliations?.map((a) => new Syndicate(a)) ?? [];
154
-
155
- /**
156
- * Daily standing per Syndicate
157
- *
158
- * Faction syndicates all share daily standing
159
- * @type {Map<String,number>}
160
- */
161
- this.dailyStanding = {
162
- daily: profile.DailyAffiliation,
163
- conclave: profile.DailyAffiliationPvp,
164
- simaris: profile.DailyAffiliationLibrary,
165
- ostron: profile.DailyAffiliationCetus,
166
- quills: profile.DailyAffiliationQuills,
167
- solaris: profile.DailyAffiliationSolaris,
168
- ventKids: profile.DailyAffiliationVentkids,
169
- voxSolaris: profile.DailyAffiliationVox,
170
- entrati: profile.DailyAffiliationEntrati,
171
- necraloid: profile.DailyAffiliationNecraloid,
172
- holdfasts: profile.DailyAffiliationZariman,
173
- kahl: profile.DailyAffiliationKahl,
174
- cavia: profile.DailyAffiliationCavia,
175
- hex: profile.DailyAffiliationHex,
176
- };
177
-
178
- /**
179
- * Daily focus
180
- * @type {number}
181
- */
182
- this.dailyFocus = profile.DailyFocus;
183
-
184
- /**
185
- * Player wishlist for in-game market items
186
- */
187
- this.wishList = profile.Wishlist;
188
-
189
- /**
190
- * Whether the player has unlocked their operator or not
191
- * @type {boolean}
192
- */
193
- this.unlockedOperator = profile.UnlockedOperator;
194
-
195
- /**
196
- * Whether the player has unlocked their alignment or not
197
- * @type {boolean}
198
- */
199
- this.unlockedAlignment = profile.UnlockedAlignment;
200
-
201
- /**
202
- * Operator loadout
203
- * @type {OperatorLoadOuts | undefined}
204
- */
205
- this.operatorLoadouts = profile.OperatorLoadOuts?.map((ol) => new OperatorLoadOuts(ol));
206
-
207
- /**
208
- * Player's alignment
209
- * @type {Map<String,number | undefined>}
210
- */
211
- this.alignment = { wisdom: profile.Alignment?.Wisdom, alignment: profile.Alignment?.Alignment };
212
- }
213
- }
@@ -1,50 +0,0 @@
1
- import { parseDate } from 'warframe-worldstate-data/utilities';
2
-
3
- import Profile from './Profile.js';
4
- import Stats from './Stats.js';
5
-
6
- /**
7
- * Parser entry point
8
- * @module
9
- */
10
- export default class ProfileParser {
11
- /**
12
- *
13
- * @param {Object} data The data returned by getProfile endpoint
14
- * @param {string} locale The locale to return where possible
15
- * @param {boolean} [withItem=false] Whether or not to include items
16
- */
17
- constructor(data, locale = 'en', withItem = false) {
18
- /**
19
- * Player's profile
20
- * @type {Profile}
21
- */
22
- this.profile = new Profile(data.Results[0], locale, withItem);
23
-
24
- /**
25
- * @type {number}
26
- */
27
- this.techProjects = data.TechProjects;
28
-
29
- /**
30
- * @type {number}
31
- */
32
- this.xpComponents = data.XpCompoents;
33
-
34
- /**
35
- * @type {number}
36
- */
37
- this.xpCacheExpiryDate = parseDate(data.XpCacheExpiryDate);
38
-
39
- /**
40
- * @type {number}
41
- */
42
- this.ceremonyResetDate = parseDate(data.CeremonyResetDate);
43
-
44
- /**
45
- * Player stats
46
- * @type {Stats}
47
- */
48
- this.stats = new Stats(data.Stats);
49
- }
50
- }
package/src/Pvp.js DELETED
@@ -1,35 +0,0 @@
1
- /**
2
- * Player's conclave stats
3
- * @module
4
- */
5
- export default class Pvp {
6
- /**
7
- *
8
- * @param {Object} pvp PVP data to parse
9
- */
10
- constructor(pvp) {
11
- /**
12
- * PVP match unique name
13
- * @type {String}
14
- */
15
- this.uniqueName = pvp.type;
16
-
17
- /**
18
- * Deaths for this match
19
- * @type {number | undefined}
20
- */
21
- this.suitDeaths = pvp.suitDeaths;
22
-
23
- /**
24
- * Warframe kills
25
- * @type {number | undefined}
26
- */
27
- this.suitKills = pvp.suitKills;
28
-
29
- /**
30
- * Weapon killes
31
- * @type {number | undefined}
32
- */
33
- this.weaponKills = pvp.weaponKills;
34
- }
35
- }
package/src/Race.js DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * Represents a k-drive race
3
- * @module
4
- */
5
- export default class Race {
6
- /**
7
- *
8
- * @param {string} type Race name
9
- * @param {number} highScore high score
10
- */
11
- constructor(type, highScore) {
12
- /**
13
- * Race name
14
- * @type {String}
15
- */
16
- this.uniqueName = type;
17
-
18
- /**
19
- * Race High score
20
- * @type {number}
21
- */
22
- this.highScore = highScore;
23
- }
24
-
25
- /**
26
- * Created an array of Race objects from DE's Races array
27
- * @param {Object} races Array of races
28
- * @returns {Race[]} An array of races formatted in a more consumable way.
29
- */
30
- static fromRaceObject(races) {
31
- return Object.entries(races ?? []).map(([type, { highScore }]) => new Race(type, highScore));
32
- }
33
- }
package/src/Scan.js DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Represents an enemy scanned to the codex
3
- * @module
4
- */
5
- export default class Scan {
6
- /**
7
- * @param {Object} scan The scanned Warframe object
8
- */
9
- constructor(scan) {
10
- /**
11
- * Enemy unique name
12
- * @type {String}
13
- */
14
- this.uniqueName = scan.type;
15
-
16
- /**
17
- * Number of scans done
18
- * @type {number}
19
- */
20
- this.scans = scan.scans;
21
- }
22
- }
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
- }