@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
@@ -1,77 +0,0 @@
1
- import { colors } from '@wfcd/items/utilities';
2
-
3
- import Skin from './Skin.js';
4
- import { mapToHex } from './Utils.js';
5
-
6
- /**
7
- * Player's operator loadout
8
- * @module
9
- */
10
- export default class OperatorLoadOuts {
11
- /**
12
- *
13
- * @param {Object} loadout The operator loadout
14
- */
15
- constructor(loadout) {
16
- /**
17
- * Skins that have been applied to the player's operator.
18
- * @type {Array<Skin>}
19
- */
20
- this.skins = loadout.Skins.filter(Boolean).map((s) => new Skin({ ItemType: s }));
21
-
22
- /**
23
- * Operator amp ID
24
- * @type {String | undefined}
25
- */
26
- this.operatorAmp = loadout.OperatorAmp?.$oid;
27
-
28
- /**
29
- * Applied upgrade IDs
30
- * @type {Array<String>}
31
- */
32
- this.upgrades = loadout.Upgrades;
33
- this.abilityOverride = loadout.AbilityOverride;
34
-
35
- /**
36
- * Operator primary colors
37
- * @type {module:"@wfcd/items".ColorMap | undefined}
38
- */
39
- if (loadout.pricol) this.primaryColor = colors.mapColors(mapToHex(loadout.pricol));
40
-
41
- /**
42
- * Operator sigil colors
43
- * @type {module:"@wfcd/items".ColorMap | undefined}
44
- */
45
- if (loadout.sigcol) this.sigilColor = colors.mapColors(mapToHex(loadout.sigcol));
46
-
47
- /**
48
- * Operator attachment colors
49
- * @type {module:"@wfcd/items".ColorMap | undefined}
50
- */
51
- if (loadout.attcol) this.attachmentsColor = colors.mapColors(mapToHex(loadout.attcol));
52
-
53
- /**
54
- * Operator syandana colors
55
- * @type {module:"@wfcd/items".ColorMap | undefined}
56
- */
57
- if (loadout.syancol) this.syandanaColor = colors.mapColors(mapToHex(loadout.syancol));
58
-
59
- /**
60
- * Operator eye colors
61
- * @type {module:"@wfcd/items".ColorMap | undefined}
62
- */
63
- if (loadout.eyecol) this.eyeColor = colors.mapColors(mapToHex(loadout.eyecol));
64
-
65
- /**
66
- * Operator facial colors
67
- * @type {module:"@wfcd/items".ColorMap | undefined}
68
- */
69
- if (loadout.facial) this.facial = colors.mapColors(mapToHex(loadout.facial));
70
-
71
- /**
72
- * Operator cloth colors
73
- * @type {module:"@wfcd/items".ColorMap | undefined}
74
- */
75
- if (loadout.cloth) this.cloth = colors.mapColors(mapToHex(loadout.cloth));
76
- }
77
- }
package/src/Polarity.js DELETED
@@ -1,25 +0,0 @@
1
- import { translatePolarity } from 'warframe-worldstate-data/utilities';
2
-
3
- /**
4
- * A polarity in a LoadOutItem
5
- * @module
6
- */
7
- export default class Polarity {
8
- /**
9
- *
10
- * @param {Object} polarity The polarity to parse
11
- */
12
- constructor(polarity) {
13
- /**
14
- * Polarity name
15
- * @type {String}
16
- */
17
- this.polarity = translatePolarity(polarity.Value);
18
-
19
- /**
20
- * Polarized slot
21
- * @type {number}
22
- */
23
- this.slot = polarity.Slot;
24
- }
25
- }
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
- }