@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
@@ -0,0 +1,122 @@
1
+ import { translatePolarity } from 'warframe-worldstate-data/utilities';
2
+
3
+ import { numberToLetter } from './Utils';
4
+
5
+ interface RawSlotPreset {
6
+ ItemId?: { $oid: string };
7
+ mod?: number;
8
+ cus?: number;
9
+ hide?: boolean;
10
+ }
11
+
12
+ export interface RawLoadOutPreset {
13
+ FocusSchool: string;
14
+ PresetIcon: string;
15
+ Favorite: boolean;
16
+ n: string;
17
+ s: RawSlotPreset;
18
+ l?: RawSlotPreset;
19
+ p?: RawSlotPreset;
20
+ h?: RawSlotPreset;
21
+ m?: RawSlotPreset;
22
+ a?: RawSlotPreset;
23
+ b?: RawSlotPreset;
24
+ }
25
+
26
+ class SlotPreset {
27
+ id?: string;
28
+ modPreset?: string;
29
+ appearancePreset?: string;
30
+ isHidden: boolean;
31
+
32
+ constructor(slot: RawSlotPreset) {
33
+ if (slot?.ItemId?.$oid) this.id = slot.ItemId.$oid;
34
+
35
+ if (slot?.mod !== undefined) this.modPreset = numberToLetter(slot.mod);
36
+
37
+ if (slot?.cus !== undefined) this.appearancePreset = numberToLetter(slot.cus);
38
+
39
+ this.isHidden = slot?.hide ?? false;
40
+ }
41
+ }
42
+
43
+ export default class LoadOutPreset {
44
+ /**
45
+ * Focus School
46
+ */
47
+ focusSchool: string;
48
+ /**
49
+ * Preset icon
50
+ *
51
+ * Note:
52
+ * Icon in-game seems to be an image of whatever Warframe is equipped on it
53
+ */
54
+ icon: string;
55
+ /**
56
+ * Whether this preset is a favorite
57
+ */
58
+ isFavorite: boolean;
59
+ /**
60
+ * Preset name
61
+ */
62
+ name: string;
63
+
64
+ /**
65
+ * Warframe equipped in preset
66
+ */
67
+ warframe: SlotPreset;
68
+
69
+ /**
70
+ * Primary equipped in preset
71
+ */
72
+ primary?: SlotPreset;
73
+
74
+ /**
75
+ * Secondary equipped in preset
76
+ */
77
+ secondary?: SlotPreset;
78
+
79
+ /**
80
+ * Heavy equipped in preset
81
+ */
82
+ heavy?: SlotPreset;
83
+
84
+ /**
85
+ * Melee equiped in preset
86
+ */
87
+ melee?: SlotPreset;
88
+ /**
89
+ * Exalted ability
90
+ */
91
+ exalted?: SlotPreset;
92
+ /**
93
+ * Secondary exalted ability
94
+ *
95
+ * i.e Sevagoth has his shadow and his shadow's claws both of which can be modded separately
96
+ */
97
+ exaltedB?: SlotPreset;
98
+
99
+ constructor(preset: RawLoadOutPreset) {
100
+ this.focusSchool = translatePolarity(preset.FocusSchool);
101
+
102
+ this.icon = preset.PresetIcon;
103
+
104
+ this.isFavorite = preset.Favorite;
105
+
106
+ this.name = preset.n;
107
+
108
+ this.warframe = new SlotPreset(preset.s);
109
+
110
+ if (preset.l) this.primary = new SlotPreset(preset.l);
111
+
112
+ if (preset.p) this.secondary = new SlotPreset(preset.p);
113
+
114
+ if (preset.h) this.heavy = new SlotPreset(preset.h);
115
+
116
+ if (preset.m) this.melee = new SlotPreset(preset.m);
117
+
118
+ if (preset.a) this.exalted = new SlotPreset(preset.a);
119
+
120
+ if (preset.b) this.exaltedB = new SlotPreset(preset.b);
121
+ }
122
+ }
package/src/Mission.ts ADDED
@@ -0,0 +1,75 @@
1
+ import { Locale } from 'warframe-worldstate-data';
2
+ import { node, nodeEnemy, nodeMissionType } from 'warframe-worldstate-data/utilities';
3
+
4
+ export interface RawMission {
5
+ Tag?: string | undefined;
6
+ type?: string;
7
+ Mission?: string;
8
+ highScore?: number;
9
+ Completes?: number;
10
+ Tier?: number;
11
+ }
12
+
13
+ /**
14
+ * A mission completed by the player
15
+ * @module
16
+ */
17
+ export default class Mission {
18
+ /**
19
+ * Node name
20
+ */
21
+ node: string;
22
+
23
+ /**
24
+ * Node unique name
25
+ */
26
+ nodeKey: string;
27
+
28
+ /**
29
+ * Node mission type
30
+ */
31
+ missionType: string;
32
+
33
+ /**
34
+ * Node faction
35
+ */
36
+ faction: string;
37
+
38
+ /**
39
+ * Highest score earned in this mission
40
+ */
41
+ highScore?: number;
42
+
43
+ /**
44
+ * How many times the mission was completed
45
+ */
46
+ completes?: number;
47
+
48
+ /**
49
+ * Denotes a steel path node
50
+ */
51
+ tier?: number;
52
+
53
+ /**
54
+ *
55
+ * @param mission The mission data
56
+ * @param locale The locale to return in
57
+ */
58
+ constructor(mission: RawMission, locale: Locale = 'en') {
59
+ const uniqueName = (mission.type || mission.Tag)!;
60
+
61
+ this.node = node(uniqueName, locale);
62
+
63
+ this.nodeKey = uniqueName;
64
+
65
+ this.missionType = nodeMissionType(uniqueName, locale);
66
+
67
+ this.faction = nodeEnemy(uniqueName, locale);
68
+
69
+ if (mission.highScore) this.highScore = mission.highScore;
70
+
71
+ if (mission.Completes) this.completes = mission.Completes;
72
+
73
+ if (mission.Tier) this.tier = mission.Tier;
74
+ }
75
+ }
@@ -0,0 +1,108 @@
1
+ import { colors } from '@wfcd/items/utilities';
2
+
3
+ import Skin from './Skin';
4
+ import { mapToHex, type ProfileRawColors } from './Utils';
5
+ import type { ColorMap } from '@wfcd/items';
6
+ import { Locale } from 'warframe-worldstate-data';
7
+
8
+ export interface RawOperatorLoadOuts {
9
+ Skins: string[];
10
+ OperatorAmp?: { $oid: string };
11
+ Upgrades: string[];
12
+ AbilityOverride: any;
13
+ pricol?: ProfileRawColors;
14
+ sigcol?: ProfileRawColors;
15
+ attcol?: ProfileRawColors;
16
+ syancol?: ProfileRawColors;
17
+ eyecol?: ProfileRawColors;
18
+ facial?: ProfileRawColors;
19
+ cloth?: ProfileRawColors;
20
+ }
21
+
22
+ /**
23
+ * Player's operator loadout
24
+ * @module
25
+ */
26
+ export default class OperatorLoadOuts {
27
+ /**
28
+ * Skins that have been applied to the player's operator.
29
+ */
30
+ skins: Skin[];
31
+
32
+ /**
33
+ * Operator amp ID
34
+ */
35
+ operatorAmp?: string;
36
+
37
+ /**
38
+ * Applied upgrade IDs
39
+ */
40
+ upgrades: string[];
41
+ abilityOverride: any;
42
+
43
+ /**
44
+ * Operator primary colors
45
+ */
46
+ primaryColor?: ColorMap;
47
+
48
+ /**
49
+ * Operator sigil colors
50
+ */
51
+ sigilColor?: ColorMap;
52
+
53
+ /**
54
+ * Operator attachment colors
55
+ */
56
+ attachmentsColor?: ColorMap;
57
+
58
+ /**
59
+ * Operator syandana colors
60
+ */
61
+ syandanaColor?: ColorMap;
62
+
63
+ /**
64
+ * Operator eye colors
65
+ */
66
+ eyeColor?: ColorMap;
67
+
68
+ /**
69
+ * Operator facial colors
70
+ */
71
+ facial?: ColorMap;
72
+
73
+ /**
74
+ * Operator cloth colors
75
+ */
76
+ cloth?: ColorMap;
77
+
78
+ /**
79
+ *
80
+ * @param {Object} loadout The operator loadout
81
+ */
82
+ constructor(loadout: RawOperatorLoadOuts, locale: Locale = 'en') {
83
+ this.skins = loadout.Skins.filter(Boolean).map((s) => new Skin({ ItemType: s }, locale));
84
+
85
+ this.operatorAmp = loadout.OperatorAmp?.$oid;
86
+
87
+ /**
88
+ * Applied upgrade IDs
89
+ * @type {Array<String>}
90
+ */
91
+ this.upgrades = loadout.Upgrades;
92
+ this.abilityOverride = loadout.AbilityOverride;
93
+
94
+ if (loadout.pricol) this.primaryColor = colors.mapColors(mapToHex(loadout.pricol));
95
+
96
+ if (loadout.sigcol) this.sigilColor = colors.mapColors(mapToHex(loadout.sigcol));
97
+
98
+ if (loadout.attcol) this.attachmentsColor = colors.mapColors(mapToHex(loadout.attcol));
99
+
100
+ if (loadout.syancol) this.syandanaColor = colors.mapColors(mapToHex(loadout.syancol));
101
+
102
+ if (loadout.eyecol) this.eyeColor = colors.mapColors(mapToHex(loadout.eyecol));
103
+
104
+ if (loadout.facial) this.facial = colors.mapColors(mapToHex(loadout.facial));
105
+
106
+ if (loadout.cloth) this.cloth = colors.mapColors(mapToHex(loadout.cloth));
107
+ }
108
+ }
@@ -0,0 +1,31 @@
1
+ import { translatePolarity } from 'warframe-worldstate-data/utilities';
2
+
3
+ export interface RawPolarity {
4
+ Value: string;
5
+ Slot: number;
6
+ }
7
+
8
+ /**
9
+ * A polarity in a LoadOutItem
10
+ * @module
11
+ */
12
+ export default class Polarity {
13
+ /**
14
+ * Polarity name
15
+ */
16
+ polarity: string;
17
+
18
+ /**
19
+ * Polarized slot
20
+ */
21
+ slot: number;
22
+
23
+ /**
24
+ *
25
+ * @param {Object} raw The polarity to parse
26
+ */
27
+ constructor(raw: RawPolarity) {
28
+ this.polarity = translatePolarity(raw.Value);
29
+ this.slot = raw.Slot;
30
+ }
31
+ }
package/src/Profile.ts ADDED
@@ -0,0 +1,308 @@
1
+ import { parseDate, WorldStateDate } from 'warframe-worldstate-data/utilities';
2
+
3
+ import ChallengeProgress, { type RawChallengeProgress } from './ChallengeProgress';
4
+ import Intrinsics, { type RawIntrinsics } from './Intrinsics';
5
+ import LoadOutInventory, { type RawLoadOut } from './LoadOutInventory';
6
+ import Mission, { type RawMission } from './Mission';
7
+ import OperatorLoadOuts, { type RawOperatorLoadOuts } from './OperatorLoadOuts';
8
+ import Syndicate, { type RawAffiliation } from './Syndicate';
9
+ import LoadOutPreset, { type RawLoadOutPreset } from './LoadOutPreset';
10
+ import type { RawDate, RawId } from './Utils';
11
+ import { Locale } from 'warframe-worldstate-data';
12
+
13
+ export interface RawProfile {
14
+ AccountId: { $oid: string };
15
+ DisplayName: string;
16
+ PlatformNames?: string[];
17
+ PlayerLevel: number;
18
+ LoadOutPreset: RawLoadOutPreset;
19
+ LoadOutInventory: RawLoadOut;
20
+ PlayerSkills: RawIntrinsics;
21
+ ChallengeProgress: RawChallengeProgress[];
22
+ GuildId: RawId;
23
+ GuildName: string;
24
+ GuildTier: number;
25
+ GuildXp: number;
26
+ GuildClass: number;
27
+ GuildEmblem: boolean;
28
+ AllianceId?: RawId;
29
+ DeathMarks: string[];
30
+ Harvestable: boolean;
31
+ DeathSquadable: boolean;
32
+ Created: RawDate;
33
+ MigratedToConsole: boolean;
34
+ Missions: RawMission[];
35
+ Affiliations: RawAffiliation[];
36
+ DailyAffiliation: number;
37
+ DailyAffiliationPvp?: number;
38
+ DailyAffiliationLibrary?: number;
39
+ DailyAffiliationCetus?: number;
40
+ DailyAffiliationQuills?: number;
41
+ DailyAffiliationSolaris?: number;
42
+ DailyAffiliationVentkids?: number;
43
+ DailyAffiliationVox?: number;
44
+ DailyAffiliationEntrati?: number;
45
+ DailyAffiliationNecraloid?: number;
46
+ DailyAffiliationZariman?: number;
47
+ DailyAffiliationKahl?: number;
48
+ DailyAffiliationCavia?: number;
49
+ DailyAffiliationHex?: number;
50
+ DailyFocus?: number;
51
+ Wishlist?: any;
52
+ UnlockedOperator: boolean;
53
+ UnlockedAlignment: boolean;
54
+ OperatorLoadOuts: RawOperatorLoadOuts[];
55
+ Alignment: { Wisdom: number; Alignment: number };
56
+ }
57
+
58
+ /**
59
+ * A player's profile
60
+ * @module
61
+ */
62
+ export default class Profile {
63
+ /**
64
+ * Player's account ID
65
+ */
66
+ accountId: string;
67
+
68
+ /**
69
+ * In-game name
70
+ */
71
+ displayName: string;
72
+
73
+ /**
74
+ * List of usernames across supported platforms
75
+ */
76
+ platformNames: string[];
77
+
78
+ /**
79
+ * Mastery rank
80
+ */
81
+ masteryRank: number;
82
+
83
+ /**
84
+ * Load out preset equipped
85
+ */
86
+ preset?: LoadOutPreset;
87
+
88
+ /**
89
+ * Current loadout
90
+ */
91
+ loadout: LoadOutInventory;
92
+
93
+ /**
94
+ * Railjack and drifter Intrinsics
95
+ */
96
+ intrinsics?: Intrinsics;
97
+
98
+ /**
99
+ * Nightwave challenges progress
100
+ */
101
+ challengeProgress: ChallengeProgress[];
102
+
103
+ /**
104
+ * Guild ID
105
+ */
106
+ guildId?: string;
107
+
108
+ /**
109
+ * Guild name
110
+ */
111
+ guildName?: string;
112
+
113
+ /**
114
+ * Guild tier
115
+ */
116
+ guildTier?: number;
117
+
118
+ /**
119
+ * Guild XP
120
+ */
121
+ guildXp?: number;
122
+
123
+ /**
124
+ * Guild class
125
+ */
126
+ guildClass?: number;
127
+
128
+ /**
129
+ * Guild emblem.
130
+ */
131
+ guildEmblem: boolean;
132
+
133
+ /**
134
+ * Alliance ID
135
+ */
136
+ allianceId?: string;
137
+
138
+ /**
139
+ * Assassins currently asfter the player
140
+ */
141
+ deathMarks: string[];
142
+
143
+ /**
144
+ * Whether or not the player is qualified as a target for Zanuka
145
+ * @type {boolean}
146
+ */
147
+ harvestable: boolean;
148
+
149
+ /**
150
+ * Whether or not the player is qualified as a target for a syndicate death squad
151
+ */
152
+ deathSquadable: boolean;
153
+
154
+ /**
155
+ * Date the account was created
156
+ */
157
+ created: Date;
158
+
159
+ /**
160
+ * Whether the user has migrated to console or not
161
+ */
162
+ migratedToConsole: boolean;
163
+
164
+ /**
165
+ * List of completed missions and their completions
166
+ */
167
+ missions: Mission[];
168
+
169
+ /**
170
+ * Player standing and title across all syndicates
171
+ */
172
+ syndicates?: Syndicate[];
173
+
174
+ /**
175
+ * Daily standing per Syndicate
176
+ *
177
+ * Faction syndicates all share daily standing
178
+ */
179
+ dailyStanding: {
180
+ daily: number;
181
+ conclave?: number;
182
+ simaris?: number;
183
+ ostron?: number;
184
+ quills?: number;
185
+ solaris?: number;
186
+ ventKids?: number;
187
+ voxSolaris?: number;
188
+ entrati?: number;
189
+ necraloid?: number;
190
+ holdfasts?: number;
191
+ kahl?: number;
192
+ cavia?: number;
193
+ hex?: number;
194
+ };
195
+
196
+ /**
197
+ * Daily focus
198
+ */
199
+ dailyFocus?: number;
200
+
201
+ /**
202
+ * Player wishlist for in-game market items
203
+ */
204
+ wishList: any;
205
+
206
+ /**
207
+ * Whether the player has unlocked their operator or not
208
+ */
209
+ unlockedOperator: boolean;
210
+
211
+ /**
212
+ * Whether the player has unlocked their alignment or not
213
+ */
214
+ unlockedAlignment: boolean;
215
+
216
+ /**
217
+ * Operator loadout
218
+ */
219
+ operatorLoadouts?: OperatorLoadOuts[];
220
+
221
+ /**
222
+ * Player's alignment
223
+ */
224
+ alignment?: { wisdom: number; alignment: number };
225
+
226
+ /**
227
+ *
228
+ * @param profile The profile data to parse
229
+ * @param locale The locale to return in where possible
230
+ * @param withItem Whether or not to include items
231
+ */
232
+ constructor(profile: RawProfile, locale: Locale = 'en', withItem: boolean = false) {
233
+ this.accountId = profile.AccountId.$oid;
234
+
235
+ this.displayName = profile.DisplayName;
236
+
237
+ this.platformNames = profile.PlatformNames ?? [];
238
+
239
+ this.masteryRank = profile.PlayerLevel;
240
+
241
+ if (profile.LoadOutPreset) this.preset = new LoadOutPreset(profile.LoadOutPreset);
242
+
243
+ this.loadout = new LoadOutInventory(profile.LoadOutInventory, locale, withItem);
244
+
245
+ this.intrinsics = new Intrinsics(profile.PlayerSkills ?? {});
246
+
247
+ this.challengeProgress = profile.ChallengeProgress.map((c) => new ChallengeProgress(c));
248
+
249
+ if (profile.GuildId?.$oid) this.guildId = profile.GuildId.$oid;
250
+
251
+ this.guildName = profile.GuildName;
252
+
253
+ this.guildTier = profile.GuildTier;
254
+
255
+ this.guildXp = profile.GuildXp;
256
+
257
+ this.guildClass = profile.GuildClass;
258
+
259
+ this.guildEmblem = profile.GuildEmblem;
260
+
261
+ if (profile.AllianceId) this.allianceId = profile.AllianceId.$oid;
262
+
263
+ this.deathMarks = profile.DeathMarks;
264
+
265
+ this.harvestable = profile.Harvestable;
266
+
267
+ this.deathSquadable = profile.DeathSquadable;
268
+
269
+ this.created = parseDate(profile.Created);
270
+
271
+ this.migratedToConsole = profile.MigratedToConsole;
272
+
273
+ this.missions = profile.Missions.map((m) => new Mission(m, locale));
274
+
275
+ this.syndicates = profile.Affiliations?.map((a) => new Syndicate(a, locale)) ?? [];
276
+
277
+ this.dailyStanding = {
278
+ daily: profile.DailyAffiliation,
279
+ conclave: profile.DailyAffiliationPvp,
280
+ simaris: profile.DailyAffiliationLibrary,
281
+ ostron: profile.DailyAffiliationCetus,
282
+ quills: profile.DailyAffiliationQuills,
283
+ solaris: profile.DailyAffiliationSolaris,
284
+ ventKids: profile.DailyAffiliationVentkids,
285
+ voxSolaris: profile.DailyAffiliationVox,
286
+ entrati: profile.DailyAffiliationEntrati,
287
+ necraloid: profile.DailyAffiliationNecraloid,
288
+ holdfasts: profile.DailyAffiliationZariman,
289
+ kahl: profile.DailyAffiliationKahl,
290
+ cavia: profile.DailyAffiliationCavia,
291
+ hex: profile.DailyAffiliationHex,
292
+ };
293
+
294
+ this.dailyFocus = profile.DailyFocus;
295
+
296
+ this.wishList = profile.Wishlist;
297
+
298
+ this.unlockedOperator = profile.UnlockedOperator;
299
+
300
+ this.unlockedAlignment = profile.UnlockedAlignment;
301
+
302
+ this.operatorLoadouts = profile.OperatorLoadOuts?.map((ol) => new OperatorLoadOuts(ol, locale));
303
+
304
+ if (profile.Alignment) {
305
+ this.alignment = { wisdom: profile.Alignment?.Wisdom, alignment: profile.Alignment?.Alignment };
306
+ }
307
+ }
308
+ }
@@ -0,0 +1,66 @@
1
+ import { parseDate } from 'warframe-worldstate-data/utilities';
2
+
3
+ import Profile, { type RawProfile } from './Profile';
4
+ import Stats, { type RawStats } from './Stats';
5
+ import type { RawDate } from './Utils';
6
+ import { Locale } from 'warframe-worldstate-data';
7
+
8
+ interface ProfileData {
9
+ Results: RawProfile[];
10
+ TechProjects?: any;
11
+ XpCompoents?: any;
12
+ XpCacheExpiryDate?: RawDate;
13
+ CeremonyResetDate?: RawDate;
14
+ Stats: RawStats;
15
+ }
16
+
17
+ /**
18
+ * Parser entry point
19
+ * @module
20
+ */
21
+ export default class ProfileParser {
22
+ /**
23
+ * Player's profile
24
+ */
25
+ profile: Profile;
26
+
27
+ /**
28
+ * N/A
29
+ */
30
+ techProjects: any;
31
+
32
+ /**
33
+ * N/A
34
+ */
35
+ xpComponents: any;
36
+
37
+ /**
38
+ * N/A
39
+ */
40
+ xpCacheExpiryDate: Date;
41
+
42
+ /**
43
+ * N/A
44
+ */
45
+ ceremonyResetDate: Date;
46
+
47
+ /**
48
+ * Player stats
49
+ */
50
+ stats: Stats;
51
+
52
+ /**
53
+ *
54
+ * @param {Object} data The data returned by getProfile endpoint
55
+ * @param {string} locale The locale to return where possible
56
+ * @param {boolean} [withItem=false] Whether or not to include items
57
+ */
58
+ constructor(data: ProfileData, locale: Locale = 'en', withItem: boolean = false) {
59
+ this.profile = new Profile(data.Results[0], locale, withItem);
60
+ this.techProjects = data.TechProjects;
61
+ this.xpComponents = data.XpCompoents;
62
+ this.xpCacheExpiryDate = parseDate(data.XpCacheExpiryDate);
63
+ this.ceremonyResetDate = parseDate(data.CeremonyResetDate);
64
+ this.stats = new Stats(data.Stats);
65
+ }
66
+ }