@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.
- package/package.json +33 -82
- package/src/{Ability.js → Ability.ts} +11 -4
- package/src/{ArchonCrystal.js → ArchonCrystal.ts} +12 -5
- package/src/{ChallengeProgress.js → ChallengeProgress.ts} +11 -4
- package/src/Enemy.ts +55 -0
- package/src/Intrinsics.ts +98 -0
- package/src/ItemConfig.ts +71 -0
- package/src/LoadOutInventory.ts +69 -0
- package/src/LoadOutItem.ts +194 -0
- package/src/LoadOutPreset.ts +122 -0
- package/src/Mission.ts +75 -0
- package/src/OperatorLoadOuts.ts +108 -0
- package/src/Polarity.ts +31 -0
- package/src/Profile.ts +308 -0
- package/src/ProfileParser.ts +66 -0
- package/src/Pvp.ts +43 -0
- package/src/Race.ts +36 -0
- package/src/Scan.ts +30 -0
- package/src/{Skin.js → Skin.ts} +14 -6
- package/src/Stats.ts +504 -0
- package/src/Syndicate.ts +39 -0
- package/src/Utils.ts +85 -0
- package/src/{Weapon.js → Weapon.ts} +23 -3
- package/src/XpInfo.ts +41 -0
- package/src/Enemy.js +0 -47
- package/src/Intrinsics.js +0 -77
- package/src/ItemConfig.js +0 -52
- package/src/LoadOutInventory.js +0 -53
- package/src/LoadOutItem.js +0 -155
- package/src/LoadOutPreset.js +0 -90
- package/src/Mission.js +0 -58
- package/src/OperatorLoadOuts.js +0 -77
- package/src/Polarity.js +0 -25
- package/src/Profile.js +0 -213
- package/src/ProfileParser.js +0 -50
- package/src/Pvp.js +0 -35
- package/src/Race.js +0 -33
- package/src/Scan.js +0 -22
- package/src/Stats.js +0 -340
- package/src/Syndicate.js +0 -34
- package/src/Utils.js +0 -66
- package/src/XpInfo.js +0 -35
- package/types/Ability.d.ts +0 -20
- package/types/ArchonCrystal.d.ts +0 -22
- package/types/ChallengeProgress.d.ts +0 -21
- package/types/Enemy.d.ts +0 -41
- package/types/Intrinsics.d.ts +0 -66
- package/types/ItemConfig.d.ts +0 -21
- package/types/LoadOutInventory.d.ts +0 -45
- package/types/LoadOutItem.d.ts +0 -92
- package/types/LoadOutPreset.d.ts +0 -45
- package/types/Mission.d.ts +0 -35
- package/types/OperatorLoadOuts.d.ts +0 -35
- package/types/Polarity.d.ts +0 -21
- package/types/Profile.d.ts +0 -154
- package/types/ProfileParser.d.ts +0 -41
- package/types/Pvp.d.ts +0 -31
- package/types/Race.d.ts +0 -28
- package/types/Scan.d.ts +0 -20
- package/types/Skin.d.ts +0 -19
- package/types/Stats.d.ts +0 -255
- package/types/Syndicate.d.ts +0 -26
- package/types/Utils.d.ts +0 -3
- package/types/Weapon.d.ts +0 -51
- package/types/XpInfo.d.ts +0 -28
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
|
+
}
|
package/src/Pvp.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface RawPvp {
|
|
2
|
+
type: string;
|
|
3
|
+
suitDeaths?: number;
|
|
4
|
+
suitKills?: number;
|
|
5
|
+
weaponKills?: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Player's conclave stats
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
export default class Pvp {
|
|
13
|
+
/**
|
|
14
|
+
* PVP match unique name
|
|
15
|
+
*/
|
|
16
|
+
uniqueName: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Deaths for this match
|
|
20
|
+
*/
|
|
21
|
+
warframeDeaths?: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Warframe kills
|
|
25
|
+
*/
|
|
26
|
+
warframeKills?: number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Weapon killes
|
|
30
|
+
*/
|
|
31
|
+
weaponKills?: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} pvp PVP data to parse
|
|
36
|
+
*/
|
|
37
|
+
constructor(pvp: RawPvp) {
|
|
38
|
+
this.uniqueName = pvp.type;
|
|
39
|
+
this.warframeDeaths = pvp.suitDeaths;
|
|
40
|
+
this.warframeKills = pvp.suitKills;
|
|
41
|
+
this.weaponKills = pvp.weaponKills;
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/Race.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
export type RawRace = Record<string, { highScore: number }>;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a k-drive race
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
export default class Race {
|
|
9
|
+
/**
|
|
10
|
+
* Race name
|
|
11
|
+
*/
|
|
12
|
+
uniqueName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Race High score
|
|
15
|
+
*/
|
|
16
|
+
highScore: number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param type Race name
|
|
21
|
+
* @param highScore high score
|
|
22
|
+
*/
|
|
23
|
+
constructor(type: string, highScore: number) {
|
|
24
|
+
this.uniqueName = type;
|
|
25
|
+
this.highScore = highScore;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Created an array of Race objects from DE's Races array
|
|
30
|
+
* @param races Array of races
|
|
31
|
+
* @returns {Race[]} An array of races formatted in a more consumable way.
|
|
32
|
+
*/
|
|
33
|
+
static fromRaceObject(races: RawRace) {
|
|
34
|
+
return Object.entries(races ?? {}).map(([type, { highScore }]) => new Race(type, highScore));
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/Scan.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface RawScan {
|
|
2
|
+
type: string;
|
|
3
|
+
scans: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents an enemy scanned to the codex
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export default class Scan {
|
|
11
|
+
/**
|
|
12
|
+
* Enemy unique name
|
|
13
|
+
* @type {String}
|
|
14
|
+
*/
|
|
15
|
+
uniqueName: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Number of scans done
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
scans: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} scan The scanned Warframe object
|
|
25
|
+
*/
|
|
26
|
+
constructor(scan: RawScan) {
|
|
27
|
+
this.uniqueName = scan.type;
|
|
28
|
+
this.scans = scan.scans;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/{Skin.js → Skin.ts}
RENAMED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Item } from '@wfcd/items';
|
|
2
|
+
import { find } from './Utils';
|
|
3
|
+
|
|
4
|
+
export interface RawSkin {
|
|
5
|
+
ItemType: string
|
|
6
|
+
}
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* A skin class
|
|
5
10
|
* @module
|
|
6
11
|
*/
|
|
7
12
|
export default class Skin {
|
|
13
|
+
uniqueName: string;
|
|
14
|
+
item?: Item;
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
18
|
+
* @param skin The skin data to parse
|
|
19
|
+
* @param locale The locale to return skin item in
|
|
12
20
|
*/
|
|
13
|
-
constructor(skin, locale = 'en') {
|
|
21
|
+
constructor(skin: RawSkin, locale = 'en') {
|
|
14
22
|
/**
|
|
15
23
|
* Unique name
|
|
16
|
-
* @type {String}
|
|
17
24
|
*/
|
|
18
25
|
this.uniqueName = skin.ItemType;
|
|
19
26
|
|
|
20
27
|
const item = find(skin.ItemType, locale);
|
|
28
|
+
|
|
21
29
|
/**
|
|
22
30
|
* The Warframe item that matches the unique name
|
|
23
31
|
*/
|
|
@@ -30,4 +38,4 @@ export default class Skin {
|
|
|
30
38
|
* @param {Object} skin Skin object
|
|
31
39
|
* @returns {Skin} Skin object with possible item
|
|
32
40
|
*/
|
|
33
|
-
export const WeaponSkin = (skin) => new Skin(skin);
|
|
41
|
+
export const WeaponSkin = (skin: RawSkin) => new Skin(skin);
|