@wfcd/profile-parser 1.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/package.json +104 -0
  4. package/src/Ability.js +21 -0
  5. package/src/ArchonCrystal.js +8 -0
  6. package/src/ChallengeProgress.js +15 -0
  7. package/src/Enemy.js +45 -0
  8. package/src/Intrinsics.js +69 -0
  9. package/src/ItemConfig.js +51 -0
  10. package/src/LoadOutInventory.js +43 -0
  11. package/src/LoadOutItem.js +135 -0
  12. package/src/Mission.js +40 -0
  13. package/src/OperatorLoadOuts.js +68 -0
  14. package/src/Polarity.js +17 -0
  15. package/src/Profile.js +189 -0
  16. package/src/ProfileParser.js +32 -0
  17. package/src/Pvp.js +27 -0
  18. package/src/Race.js +15 -0
  19. package/src/Scan.js +15 -0
  20. package/src/Stats.js +339 -0
  21. package/src/Syndicate.js +30 -0
  22. package/src/Util.js +12 -0
  23. package/src/Weapon.js +51 -0
  24. package/src/WeaponSkin.js +9 -0
  25. package/src/XpInfo.js +23 -0
  26. package/types/Ability.d.ts +19 -0
  27. package/types/ArchonCrystal.d.ts +5 -0
  28. package/types/ChallengeProgress.d.ts +13 -0
  29. package/types/Enemy.d.ts +39 -0
  30. package/types/Intrinsics.d.ts +56 -0
  31. package/types/ItemConfig.d.ts +19 -0
  32. package/types/LoadOutInventory.d.ts +36 -0
  33. package/types/LoadOutItem.d.ts +78 -0
  34. package/types/Mission.d.ts +21 -0
  35. package/types/OperatorLoadOuts.d.ts +26 -0
  36. package/types/Polarity.d.ts +13 -0
  37. package/types/Profile.d.ts +143 -0
  38. package/types/ProfileParser.d.ts +19 -0
  39. package/types/Pvp.d.ts +23 -0
  40. package/types/Race.d.ts +13 -0
  41. package/types/Scan.d.ts +13 -0
  42. package/types/Stats.d.ts +258 -0
  43. package/types/Syndicate.d.ts +24 -0
  44. package/types/Util.d.ts +6 -0
  45. package/types/Weapon.d.ts +43 -0
  46. package/types/WeaponSkin.d.ts +8 -0
  47. package/types/XpInfo.d.ts +18 -0
package/src/Profile.js ADDED
@@ -0,0 +1,189 @@
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
+
10
+ export default class Profile {
11
+ constructor(profile, locale) {
12
+ /**
13
+ * Player's acount ID
14
+ * @type {Stirng}
15
+ */
16
+ this.accountId = profile.AccountId.$oid;
17
+
18
+ /**
19
+ * In-game name
20
+ * @type {String}
21
+ */
22
+ this.displayName = profile.DisplayName;
23
+
24
+ /**
25
+ * Mastery rank
26
+ * @type {String}
27
+ */
28
+ this.masteryRank = profile.PlayerLevel;
29
+
30
+ /**
31
+ * Current loadout
32
+ * @type {LoadOutInventory}
33
+ */
34
+ this.loadout = new LoadOutInventory(profile.LoadOutInventory);
35
+
36
+ /**
37
+ * Railjack and drifter Intrinsics
38
+ * @type {Intrinsics}
39
+ */
40
+ this.intrinsics = new Intrinsics(profile.PlayerSkills);
41
+
42
+ /**
43
+ * Nightwave challenges progress
44
+ * @type {}
45
+ */
46
+ this.challengeProgress = profile.ChallengeProgress.map((c) => new ChallengeProgress(c));
47
+
48
+ /**
49
+ * Guild ID
50
+ * @type {String}
51
+ */
52
+ this.guildId = profile.GuildId.$oid;
53
+
54
+ /**
55
+ * Guild name
56
+ * @type {String}
57
+ */
58
+ this.guildName = profile.GuildName;
59
+
60
+ /**
61
+ * Guild tier
62
+ * @type {number}
63
+ */
64
+ this.guildTier = profile.GuildTier;
65
+
66
+ /**
67
+ * Guild XP
68
+ * @type {number}
69
+ */
70
+ this.guildXp = profile.GuildXp;
71
+
72
+ /**
73
+ * Guild class
74
+ * @type {String}
75
+ */
76
+ this.guildClass = profile.GuildClass;
77
+
78
+ /**
79
+ * Guild emblem.
80
+ * @type {String}
81
+ */
82
+ this.guildEmblem = profile.GuildEmblem;
83
+
84
+ /**
85
+ * Alliance ID
86
+ * @type {String}
87
+ */
88
+ this.allianceId = profile.AllianceId.$oid;
89
+
90
+ /**
91
+ * Assassins currently asfter the player
92
+ * @type {Array<String>}
93
+ */
94
+ this.deathMarks = profile.DeathMarks;
95
+
96
+ /**
97
+ * Whether or not the player is qualified as a target for Zanuka
98
+ * @type {bool}
99
+ */
100
+ this.harvestable = profile.Harvestable;
101
+
102
+ /**
103
+ * Whether or not the player is qualified as a target for a syndicate death squad
104
+ * @type {bool}
105
+ */
106
+ this.deathSquadable = profile.DeathSquadable;
107
+
108
+ /**
109
+ * Date the account was created
110
+ * @type {Date}
111
+ */
112
+ this.created = parseDate(profile.Created);
113
+
114
+ /**
115
+ * Whether the user has migrated to console or not
116
+ * @type {bool}
117
+ */
118
+ this.migratedToConsole = profile.MigratedToConsole;
119
+
120
+ /**
121
+ * List of completed missions and their completions
122
+ * @type {MIssion}
123
+ */
124
+ this.missions = profile.Missions.map((m) => new Mission(m, locale));
125
+
126
+ /**
127
+ * Player standing and title across all syndicates
128
+ * @type {Array<Syndicate>}
129
+ */
130
+ this.syndicates = profile.Affiliations.map((a) => new Syndicate(a));
131
+
132
+ /**
133
+ * Daily standing per Syndicate
134
+ *
135
+ * Faction syndicates all share daily standing
136
+ * @type {Map<String,number>}
137
+ */
138
+ this.dailyStanding = {
139
+ daily: profile.DailyAffiliation,
140
+ conclave: profile.DailyAffiliationPvp,
141
+ simaris: profile.DailyAffiliationLibrary,
142
+ ostron: profile.DailyAffiliationCetus,
143
+ quills: profile.DailyAffiliationQuills,
144
+ solaris: profile.DailyAffiliationSolaris,
145
+ ventKids: profile.DailyAffiliationVentkids,
146
+ voxSolaris: profile.DailyAffiliationVox,
147
+ entrati: profile.DailyAffiliationEntrati,
148
+ necraloid: profile.DailyAffiliationNecraloid,
149
+ holdfasts: profile.DailyAffiliationZariman,
150
+ kahl: profile.DailyAffiliationKahl,
151
+ cavia: profile.DailyAffiliationCavia,
152
+ };
153
+
154
+ /**
155
+ * Daily focus
156
+ * @type {number}
157
+ */
158
+ this.dailyFocus = profile.DailyFocus;
159
+
160
+ /**
161
+ * Player wishlist for in-game market items
162
+ */
163
+ this.wishList = profile.Wishlist;
164
+
165
+ /**
166
+ * Whhether the player has unlocked thier operator or not
167
+ * @type {bool}
168
+ */
169
+ this.unlockedOperator = profile.UnlockedOperator;
170
+
171
+ /**
172
+ * Whether the player has unlocked their alignement or not
173
+ * @type {bool}
174
+ */
175
+ this.unlockedAlignment = profile.UnlockedAlignment;
176
+
177
+ /**
178
+ * Operator loadout
179
+ * @type {OperatorLoadOuts}
180
+ */
181
+ this.operatorLoadouts = profile.OperatorLoadOuts.map((ol) => new OperatorLoadOuts(ol));
182
+
183
+ /**
184
+ * Player's alignment
185
+ * @type {Map<String,number>}
186
+ */
187
+ this.alignment = { wisdom: profile.Alignment.Wisdom, alignment: profile.Alignment.Alignment };
188
+ }
189
+ }
@@ -0,0 +1,32 @@
1
+ import { parseDate } from 'warframe-worldstate-data/utilities';
2
+
3
+ import Profile from './Profile.js';
4
+ import Stats from './Stats.js';
5
+
6
+ export default class ProfileParser {
7
+ constructor(data, locale) {
8
+ /**
9
+ * Player's profile
10
+ * @type {Profile}
11
+ */
12
+ this.profile = new Profile(data.Results[0], locale);
13
+
14
+ // N/A
15
+ this.techProjects = data.TechProjects;
16
+
17
+ // N/A
18
+ this.xpComponents = data.XpCompoents;
19
+
20
+ // N/A
21
+ this.xpCacheExpiryDate = parseDate(data.XpCacheExpiryDate);
22
+
23
+ // N/A
24
+ this.ceremonyResetDate = parseDate(data.CeremonyResetDate);
25
+
26
+ /**
27
+ * Player stats
28
+ * @type {Stats}
29
+ */
30
+ this.stats = new Stats(data.Stats);
31
+ }
32
+ }
package/src/Pvp.js ADDED
@@ -0,0 +1,27 @@
1
+ export default class Pvp {
2
+ constructor(pvp) {
3
+ /**
4
+ * PVP match unique name
5
+ * @type {String}
6
+ */
7
+ this.uniqueName = pvp.type;
8
+
9
+ /**
10
+ * Deaths for this match
11
+ * @type {number}
12
+ */
13
+ this.suitDeaths = pvp.suitDeaths;
14
+
15
+ /**
16
+ * Warframe kills
17
+ * @type {number}
18
+ */
19
+ this.suitKills = pvp.suitKills;
20
+
21
+ /**
22
+ * Weapon killes
23
+ * @type {number}
24
+ */
25
+ this.weaponKills = pvp.weaponKills;
26
+ }
27
+ }
package/src/Race.js ADDED
@@ -0,0 +1,15 @@
1
+ export default class Race {
2
+ constructor(race) {
3
+ /**
4
+ * Race name
5
+ * @type {String}
6
+ */
7
+ this.uniqueName = race.type;
8
+
9
+ /**
10
+ * Race High score
11
+ * @type {number}
12
+ */
13
+ this.highScore = race.highScore;
14
+ }
15
+ }
package/src/Scan.js ADDED
@@ -0,0 +1,15 @@
1
+ export default class Scan {
2
+ constructor(scan) {
3
+ /**
4
+ * Enemy unique name
5
+ * @type {String}
6
+ */
7
+ this.uniqueName = scan.type;
8
+
9
+ /**
10
+ * Number of scans done
11
+ * @type {number}
12
+ */
13
+ this.scans = scan.scans;
14
+ }
15
+ }
package/src/Stats.js ADDED
@@ -0,0 +1,339 @@
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
+ * Player stats
11
+ */
12
+ export default class Stats {
13
+ /**
14
+ *
15
+ * @param {Object} stats Player stats
16
+ */
17
+ constructor(stats) {
18
+ /**
19
+ * Guild name
20
+ * @type {String}
21
+ */
22
+ this.guildName = stats.GuildName;
23
+
24
+ /**
25
+ * Player's total accumalted xp
26
+ * @type {String}
27
+ */
28
+ this.xp = stats.XP;
29
+
30
+ /**
31
+ * Missions completed
32
+ * @type {number}
33
+ */
34
+ this.missionsCompleted = stats.MissionsCompleted;
35
+
36
+ /**
37
+ * MIssions quit
38
+ * @type {number}
39
+ */
40
+ this.missionsQuit = stats.MissionsQuit;
41
+
42
+ /**
43
+ * MIsions failed
44
+ * @type {number}
45
+ */
46
+ this.missionsFailed = stats.missionsFailed;
47
+
48
+ /**
49
+ * MIssions interrupted
50
+ * @type {number}
51
+ */
52
+ this.missionsInterrupted = stats.MissionsInterrupted;
53
+
54
+ /**
55
+ * MIssions dumped
56
+ * @type {number}
57
+ */
58
+ this.missionsDumped = stats.MissionsDumped;
59
+
60
+ /**
61
+ * Items picked up
62
+ * @type {number}
63
+ */
64
+ this.pickupCount = stats.PickupCount;
65
+
66
+ /**
67
+ * Stats per weapon
68
+ * @type {Array<Weapon>}
69
+ */
70
+ this.weapons = stats.Weapons.map((w) => new Weapon(w));
71
+
72
+ /**
73
+ * Stats on enemy encounters.
74
+ * @type {Array<Enemy>}
75
+ */
76
+ this.enemies = stats.Enemies.map((e) => new Enemy(e));
77
+
78
+ /**
79
+ * Max score for Operation: Cryotic Front
80
+ * @type {number}
81
+ */
82
+ this.excavationEventScoreMax = stats.ExcavationEventScoreMax;
83
+
84
+ /**
85
+ * Max scoring for The Cicero crisis
86
+ * @type {number}
87
+ */
88
+ this.forestEventScoreMax = stats.ForestEventScoreMax;
89
+
90
+ /**
91
+ * Clan scoring for The Cicero crisis
92
+ * @type {number}
93
+ */
94
+ this.forestEventScoreSum = stats.ForestEventScoreSum;
95
+
96
+ /**
97
+ * Melee kilss
98
+ * @type {number}
99
+ */
100
+ this.meleeKills = stats.MeleeKills;
101
+
102
+ /**
103
+ * Used abilities
104
+ * @type {number}
105
+ */
106
+ this.abilities = stats.Abilities.map((a) => new Ability(a));
107
+
108
+ /**
109
+ * Ciphers completed succefully
110
+ * @type {number}
111
+ */
112
+ this.ciphersSolved = stats.CiphersSolved;
113
+
114
+ /**
115
+ * Ciphers failed
116
+ * @type {number}
117
+ */
118
+ this.ciphersFailed = stats.CiphersFaileds;
119
+
120
+ /**
121
+ * Gross income
122
+ * @type {number}
123
+ */
124
+ this.income = stats.Income;
125
+
126
+ /**
127
+ * Total play time since account creation
128
+ * @type {string}
129
+ */
130
+ this.timePlayedSec = stats.TimePlayedSec;
131
+
132
+ /**
133
+ * Average time to hack a panel
134
+ * @type {number}
135
+ */
136
+ this.cipherTime = stats.CipherTime;
137
+
138
+ // Not sure
139
+ /**
140
+ * @type {number}
141
+ */
142
+ this.rating = stats.Rating;
143
+
144
+ /**
145
+ * Mastery rank
146
+ * @type {number}
147
+ */
148
+ this.rank = stats.Rank;
149
+
150
+ /**
151
+ * Total deaths since account creation
152
+ * @type {number}
153
+ */
154
+ this.deaths = stats.Deaths;
155
+
156
+ /**
157
+ * Mastery rank
158
+ * @type {number}
159
+ */
160
+ this.playerLevel = stats.PlayerLevel;
161
+
162
+ /**
163
+ * List of missions and high scores
164
+ * @type {Array<Mission>}
165
+ */
166
+ this.missions = stats.Missions.map((m) => new Mission(m));
167
+
168
+ /**
169
+ * Team heals
170
+ * @type {number}
171
+ */
172
+ this.healCount = stats.HealCount;
173
+
174
+ /**
175
+ * Event Scores for Operation breeding grounds
176
+ * @type {Map<String,numbert>}
177
+ */
178
+ this.breedGrounds = {
179
+ personalScore: stats.HiveEventScore,
180
+ clanScore: stats.HiveEventScoreSum,
181
+ };
182
+
183
+ /**
184
+ * Event Scores for The Gradivus Dilemma
185
+ * @type {Map<String,numbert>}
186
+ */
187
+ this.gradivusDilemma = {
188
+ grineer: stats.InvasionEventGrineerScore,
189
+ corpus: stats.InvasionEventCorpusScore,
190
+ };
191
+
192
+ /**
193
+ * List of scans
194
+ * @type {Array<Scan>}
195
+ */
196
+ this.scans = stats.Scans.map((s) => new Scan(s));
197
+
198
+ /**
199
+ * Team revives
200
+ * @type {number}
201
+ */
202
+ this.reviveCount = stats.ReviveCount;
203
+
204
+ /**
205
+ * Score for Operation: Eyes of Blight
206
+ */
207
+ this.fomorianEventScore = stats.FomorianEventScore;
208
+
209
+ /**
210
+ * Conclave scores
211
+ * @type {Array<Pvp>}
212
+ */
213
+ this.pvp = stats.PVP.map((pvp) => new Pvp(pvp));
214
+
215
+ /**
216
+ * Lunaro stats
217
+ * @type {Map<String,number>}
218
+ */
219
+ this.lunaro = {
220
+ ties: stats.PVPSpeedballTies,
221
+ checks: stats.PVPSpeedballChecks,
222
+ goals: stats.PVPSpeedballGoals,
223
+ interceptions: stats.PVPSpeedballInterceptions,
224
+ steals: stats.PVPSpeedballSteals,
225
+ points: stats.PVPSpeedballPoints,
226
+ losses: stats.PVPSpeedballLosses,
227
+ assists: stats.PVPSpeedballAssists,
228
+ wins: stats.PVPSpeedballWins,
229
+ saves: stats.PVPSpeedballSaves,
230
+ passes: stats.PVPSpeedballPasses,
231
+ };
232
+
233
+ /**
234
+ * Dojo obstacle course goal
235
+ * @type {number}
236
+ */
237
+ this.dojoObstacleScore = stats.DojoObstacleScore;
238
+
239
+ /**
240
+ * @type {number}
241
+ */
242
+ this.pvpGamesPendingMask = stats.PvpGamesPendingMask;
243
+
244
+ /**
245
+ * @type {number}
246
+ */
247
+ this.dedicatedServerGamesCompleted = stats.DedicatedServerGamesCompleted;
248
+
249
+ /**
250
+ * Event score for the Pacifism Defect
251
+ * @type {number}
252
+ */
253
+ this.pacifismDefect = stats.ColonistRescueEventScoreMax;
254
+
255
+ /**
256
+ * Score for operation Ambulas reborn.
257
+ * @type {number}
258
+ */
259
+ this.ambulasReborn = stats.AmbulasEventScoreMax;
260
+
261
+ /**
262
+ * Score for Wyrmius mini game
263
+ * @type {number}
264
+ */
265
+ this.sentinelGameScore = stats.SentinelGameScore;
266
+
267
+ /**
268
+ * Event score for operation hostile merger
269
+ * @type {number}
270
+ */
271
+ this.amalgamEventScoreMax = stats.AmalgamEventScoreMax;
272
+
273
+ /**
274
+ * Operation Scarlet spear event score and badges
275
+ * @type {Map<String,number>}
276
+ */
277
+ this.scarletSpear = {
278
+ eventScore: stats.FlotillaEventScore,
279
+ condrixTier1: stats.FlotillaGroundBadgesTier1,
280
+ condrixTier2: stats.FlotillaGroundBadgesTier2,
281
+ condrixTier3: stats.FlotillaGroundBadgesTier3,
282
+ murexTier1: stats.FlotillaSpaceBadgesTier1,
283
+ murexTier2: stats.FlotillaSpaceBadgesTier2,
284
+ murexTier3: stats.FlotillaSpaceBadgesTier3,
285
+ };
286
+
287
+ this.orphixVenomScore = stats.MechSurvivalScoreMax;
288
+ this.happyZephyrScore = stats.ZephyrScore;
289
+
290
+ this.kDriveRaces = Object.entries(stats.Races).map(([type, { highScore }]) => new Race({ type, highScore }));
291
+
292
+ /**
293
+ * Operation Gate Crash event
294
+ * @type {number}
295
+ */
296
+ this.gateCrash = stats.PortalEventScore;
297
+
298
+ /**
299
+ * Per mission score for Operation: False Profit
300
+ * @type {number}
301
+ */
302
+ this.falseProfitMissionScore = stats.RiotMoaEventScore;
303
+
304
+ /**
305
+ * Total even score for Operation: False Profit
306
+ * @type {number}
307
+ */
308
+ this.fasleProfitEventScore = stats.RiotMoaEventScoreMax;
309
+
310
+ /**
311
+ * Operation: Shadow Debt event score
312
+ * @type {number}
313
+ */
314
+ this.shadowDebtEventScore = stats.ProjectSinisterEventScore;
315
+
316
+ /**
317
+ * Operation: Rathuum event score
318
+ * @type {number}
319
+ */
320
+ this.rathuumEventScore = stats.KelaEventBonusScoreMax;
321
+
322
+ /**
323
+ * Hollowed flame event max score
324
+ * @type {number}
325
+ */
326
+ this.hallowedFlameScoreMax = stats.Halloween19ScoreMax;
327
+
328
+ /**
329
+ * Survival Weekend event score
330
+ * @type {number}
331
+ */
332
+ this.survivalWeekenedEventScore = stats.SurvivalEventScore;
333
+
334
+ /**
335
+ * @type {number}
336
+ */
337
+ this.infestedEventScore = stats.InfestedEventScore;
338
+ }
339
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Represents a player's progress with a Syndicate
3
+ */
4
+ export default class Syndicate {
5
+ /**
6
+ * @param {Object} affiliation The syndicate data
7
+ */
8
+ constructor(affiliation) {
9
+ // TODO: name is readable but still might want to clean them up
10
+ // i.e "NewLokaSyndicate" can be "New Loka"" instead
11
+
12
+ /**
13
+ * Name of the syndicate
14
+ * @type {String}
15
+ */
16
+ this.name = affiliation.Tag;
17
+
18
+ /**
19
+ * Current standing the player has with the syndicate
20
+ * @type {number}
21
+ */
22
+ this.standing = affiliation.Standing;
23
+
24
+ /**
25
+ * The player's current syndicate title
26
+ * @type {String}
27
+ */
28
+ this.title = affiliation.Title;
29
+ }
30
+ }
package/src/Util.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Map base10 int colors to hex color strings
3
+ * @param {Record<string, number | undefined>} colors color map
4
+ * @returns {Record<string, string>}
5
+ */
6
+ export default function mapToHex(colors) {
7
+ const hex = {};
8
+ Object.entries(colors).forEach(([key, /** @type {undefined | number} */ value]) => {
9
+ hex[key] = Math.abs(value).toString(16).toUpperCase();
10
+ });
11
+ return hex;
12
+ }
package/src/Weapon.js ADDED
@@ -0,0 +1,51 @@
1
+ export default class Weapon {
2
+ constructor(weapon) {
3
+ /**
4
+ * Weapon unique name
5
+ * @type {String}
6
+ */
7
+ this.uniqueName = weapon.type;
8
+
9
+ /**
10
+ * Earned XP with weapon
11
+ * @type {number}
12
+ */
13
+ this.xp = weapon.xp;
14
+
15
+ /**
16
+ * Time using this weapon
17
+ * @type {number}
18
+ */
19
+ this.equiptime = weapon.equipTime;
20
+
21
+ /**
22
+ * Headshots using this weapon
23
+ * @type {number}
24
+ */
25
+ this.headShots = weapon.headShots;
26
+
27
+ /**
28
+ * Hits using weapon
29
+ * @type {number}
30
+ */
31
+ this.hits = weapon.hits;
32
+
33
+ /**
34
+ * Assists using weapon
35
+ * @type {number}
36
+ */
37
+ this.assists = weapon.assists;
38
+
39
+ /**
40
+ * Kills with weapon
41
+ * @type {number}
42
+ */
43
+ this.kills = weapon.kills;
44
+
45
+ /**
46
+ * Shots fired
47
+ * @type {number}
48
+ */
49
+ this.fired = weapon.fired;
50
+ }
51
+ }