@wfcd/profile-parser 1.4.0 → 1.4.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/Intrinsics.js +11 -11
- package/src/Profile.js +15 -15
- package/src/Stats.js +8 -8
- package/types/Profile.d.ts +18 -22
- package/types/Stats.d.ts +7 -7
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ $ npm i -S @wfcd/profile-parser
|
|
|
23
23
|
import { ProfileParser } from 'profile-parser';
|
|
24
24
|
|
|
25
25
|
const profileData = await fetch('https://content.warframe.com/dynamic/getProfileViewingData.php?n=${username}');
|
|
26
|
-
const user = new ProfileParser(await profileData.
|
|
26
|
+
const user = new ProfileParser(await profileData.json());
|
|
27
27
|
|
|
28
28
|
console.log(user.profile.displayName);
|
|
29
29
|
```
|
package/package.json
CHANGED
package/src/Intrinsics.js
CHANGED
|
@@ -12,66 +12,66 @@ export default class Intrinsics {
|
|
|
12
12
|
* Intrinsic points for railjack
|
|
13
13
|
* @type {number}
|
|
14
14
|
*/
|
|
15
|
-
this.railjack = Math.floor(skills.LPP_SPACE / 1000);
|
|
15
|
+
this.railjack = Math.floor((skills.LPP_SPACE ?? 0) / 1000);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Railjack engineering rank
|
|
19
19
|
* @type {number}
|
|
20
20
|
*/
|
|
21
|
-
this.engineering = skills.LPS_ENGINEERING;
|
|
21
|
+
this.engineering = skills.LPS_ENGINEERING ?? 0;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Railjack gunnery rank
|
|
25
25
|
* @type {number}
|
|
26
26
|
*/
|
|
27
|
-
this.gunnery = skills.LPS_GUNNERY;
|
|
27
|
+
this.gunnery = skills.LPS_GUNNERY ?? 0;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Railjack piloting rank
|
|
31
31
|
* @type {number}
|
|
32
32
|
*/
|
|
33
|
-
this.piloting = skills.LPS_PILOTING;
|
|
33
|
+
this.piloting = skills.LPS_PILOTING ?? 0;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Railjack tactical rank
|
|
37
37
|
* @type {number}
|
|
38
38
|
*/
|
|
39
|
-
this.tactical = skills.LPS_TACTICAL;
|
|
39
|
+
this.tactical = skills.LPS_TACTICAL ?? 0;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Railjack command rank
|
|
43
43
|
* @type {number}
|
|
44
44
|
*/
|
|
45
|
-
this.command = skills.LPS_COMMAND;
|
|
45
|
+
this.command = skills.LPS_COMMAND ?? 0;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Intrinsic points for railjack
|
|
49
49
|
* @type {number}
|
|
50
50
|
*/
|
|
51
|
-
this.drifter = Math.floor(skills.LPP_DRIFTER / 1000);
|
|
51
|
+
this.drifter = Math.floor((skills.LPP_DRIFTER ?? 0) / 1000);
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Drifter riding rank
|
|
55
55
|
* @type {number}
|
|
56
56
|
*/
|
|
57
|
-
this.riding = skills.LPS_DRIFT_RIDING;
|
|
57
|
+
this.riding = skills.LPS_DRIFT_RIDING ?? 0;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Drifter combat rank
|
|
61
61
|
* @type {number}
|
|
62
62
|
*/
|
|
63
|
-
this.combat = skills.LPS_DRIFT_COMBAT;
|
|
63
|
+
this.combat = skills.LPS_DRIFT_COMBAT ?? 0;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Drifter opportunity rank
|
|
67
67
|
* @type {number}
|
|
68
68
|
*/
|
|
69
|
-
this.opportunity = skills.LPS_DRIFT_OPPORTUNITY;
|
|
69
|
+
this.opportunity = skills.LPS_DRIFT_OPPORTUNITY ?? 0;
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Drifter endurance rank
|
|
73
73
|
* @type {number}
|
|
74
74
|
*/
|
|
75
|
-
this.endurance = skills.LPS_DRIFT_ENDURANCE;
|
|
75
|
+
this.endurance = skills.LPS_DRIFT_ENDURANCE ?? 0;
|
|
76
76
|
}
|
|
77
77
|
}
|
package/src/Profile.js
CHANGED
|
@@ -21,8 +21,8 @@ export default class Profile {
|
|
|
21
21
|
*/
|
|
22
22
|
constructor(profile, locale = 'en', withItem = false) {
|
|
23
23
|
/**
|
|
24
|
-
* Player's
|
|
25
|
-
* @type {
|
|
24
|
+
* Player's account ID
|
|
25
|
+
* @type {String}
|
|
26
26
|
*/
|
|
27
27
|
this.accountId = profile.AccountId.$oid;
|
|
28
28
|
|
|
@@ -45,7 +45,7 @@ export default class Profile {
|
|
|
45
45
|
this.masteryRank = profile.PlayerLevel;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Load out preset
|
|
48
|
+
* Load out preset equipped
|
|
49
49
|
* @type {LoadOutPreset | undefined}
|
|
50
50
|
*/
|
|
51
51
|
if (profile.LoadOutPreset) this.preset = new LoadOutPreset(profile.LoadOutPreset);
|
|
@@ -60,7 +60,7 @@ export default class Profile {
|
|
|
60
60
|
* Railjack and drifter Intrinsics
|
|
61
61
|
* @type {Intrinsics}
|
|
62
62
|
*/
|
|
63
|
-
this.intrinsics = new Intrinsics(profile.PlayerSkills);
|
|
63
|
+
this.intrinsics = new Intrinsics(profile.PlayerSkills ?? {});
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Nightwave challenges progress
|
|
@@ -72,7 +72,7 @@ export default class Profile {
|
|
|
72
72
|
* Guild ID
|
|
73
73
|
* @type {String}
|
|
74
74
|
*/
|
|
75
|
-
this.guildId = profile.GuildId.$oid;
|
|
75
|
+
if (profile.GuildId?.$oid) this.guildId = profile.GuildId.$oid;
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Guild name
|
|
@@ -118,13 +118,13 @@ export default class Profile {
|
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Whether or not the player is qualified as a target for Zanuka
|
|
121
|
-
* @type {
|
|
121
|
+
* @type {boolean}
|
|
122
122
|
*/
|
|
123
123
|
this.harvestable = profile.Harvestable;
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Whether or not the player is qualified as a target for a syndicate death squad
|
|
127
|
-
* @type {
|
|
127
|
+
* @type {boolean}
|
|
128
128
|
*/
|
|
129
129
|
this.deathSquadable = profile.DeathSquadable;
|
|
130
130
|
|
|
@@ -136,7 +136,7 @@ export default class Profile {
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Whether the user has migrated to console or not
|
|
139
|
-
* @type {
|
|
139
|
+
* @type {boolean}
|
|
140
140
|
*/
|
|
141
141
|
this.migratedToConsole = profile.MigratedToConsole;
|
|
142
142
|
|
|
@@ -150,7 +150,7 @@ export default class Profile {
|
|
|
150
150
|
* Player standing and title across all syndicates
|
|
151
151
|
* @type {Array<Syndicate>}
|
|
152
152
|
*/
|
|
153
|
-
this.syndicates = profile.Affiliations
|
|
153
|
+
this.syndicates = profile.Affiliations?.map((a) => new Syndicate(a)) ?? [];
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Daily standing per Syndicate
|
|
@@ -187,14 +187,14 @@ export default class Profile {
|
|
|
187
187
|
this.wishList = profile.Wishlist;
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
|
-
*
|
|
191
|
-
* @type {
|
|
190
|
+
* Whether the player has unlocked their operator or not
|
|
191
|
+
* @type {boolean}
|
|
192
192
|
*/
|
|
193
193
|
this.unlockedOperator = profile.UnlockedOperator;
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
|
-
* Whether the player has unlocked their
|
|
197
|
-
* @type {
|
|
196
|
+
* Whether the player has unlocked their alignment or not
|
|
197
|
+
* @type {boolean}
|
|
198
198
|
*/
|
|
199
199
|
this.unlockedAlignment = profile.UnlockedAlignment;
|
|
200
200
|
|
|
@@ -206,8 +206,8 @@ export default class Profile {
|
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
208
|
* Player's alignment
|
|
209
|
-
* @type {Map<String,number>}
|
|
209
|
+
* @type {Map<String,number | undefined>}
|
|
210
210
|
*/
|
|
211
|
-
this.alignment = { wisdom: profile.Alignment
|
|
211
|
+
this.alignment = { wisdom: profile.Alignment?.Wisdom, alignment: profile.Alignment?.Alignment };
|
|
212
212
|
}
|
|
213
213
|
}
|
package/src/Stats.js
CHANGED
|
@@ -23,7 +23,7 @@ export default class Stats {
|
|
|
23
23
|
this.guildName = stats.GuildName;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Player's total
|
|
26
|
+
* Player's total accumulated xp
|
|
27
27
|
* @type {String}
|
|
28
28
|
*/
|
|
29
29
|
this.xp = stats.XP;
|
|
@@ -35,25 +35,25 @@ export default class Stats {
|
|
|
35
35
|
this.missionsCompleted = stats.MissionsCompleted;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Missions quit
|
|
39
39
|
* @type {number}
|
|
40
40
|
*/
|
|
41
41
|
this.missionsQuit = stats.MissionsQuit;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Misions failed
|
|
45
45
|
* @type {number}
|
|
46
46
|
*/
|
|
47
47
|
this.missionsFailed = stats.missionsFailed;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Missions interrupted
|
|
51
51
|
* @type {number}
|
|
52
52
|
*/
|
|
53
53
|
this.missionsInterrupted = stats.MissionsInterrupted;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Missions dumped
|
|
57
57
|
* @type {number}
|
|
58
58
|
*/
|
|
59
59
|
this.missionsDumped = stats.MissionsDumped;
|
|
@@ -95,7 +95,7 @@ export default class Stats {
|
|
|
95
95
|
this.forestEventScoreSum = stats.ForestEventScoreSum;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Melee
|
|
98
|
+
* Melee kills
|
|
99
99
|
* @type {number}
|
|
100
100
|
*/
|
|
101
101
|
this.meleeKills = stats.MeleeKills;
|
|
@@ -107,7 +107,7 @@ export default class Stats {
|
|
|
107
107
|
this.abilities = stats.Abilities.map((a) => new Ability(a));
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* Ciphers completed
|
|
110
|
+
* Ciphers completed successfully
|
|
111
111
|
* @type {number}
|
|
112
112
|
*/
|
|
113
113
|
this.ciphersSolved = stats.CiphersSolved;
|
|
@@ -194,7 +194,7 @@ export default class Stats {
|
|
|
194
194
|
* List of scanned Warframe objects
|
|
195
195
|
* @type {Array<Scan>}
|
|
196
196
|
*/
|
|
197
|
-
this.scans = stats.Scans
|
|
197
|
+
this.scans = stats.Scans?.map((s) => new Scan(s)) ?? [];
|
|
198
198
|
|
|
199
199
|
/**
|
|
200
200
|
* Team revives
|
package/types/Profile.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ export default class Profile {
|
|
|
11
11
|
*/
|
|
12
12
|
constructor(profile: any, locale?: string, withItem?: boolean);
|
|
13
13
|
/**
|
|
14
|
-
* Player's
|
|
15
|
-
* @type {
|
|
14
|
+
* Player's account ID
|
|
15
|
+
* @type {String}
|
|
16
16
|
*/
|
|
17
|
-
accountId:
|
|
17
|
+
accountId: string;
|
|
18
18
|
/**
|
|
19
19
|
* In-game name
|
|
20
20
|
* @type {String}
|
|
@@ -46,11 +46,7 @@ export default class Profile {
|
|
|
46
46
|
* @type {Array<ChallengeProgress>}
|
|
47
47
|
*/
|
|
48
48
|
challengeProgress: Array<ChallengeProgress>;
|
|
49
|
-
|
|
50
|
-
* Guild ID
|
|
51
|
-
* @type {String}
|
|
52
|
-
*/
|
|
53
|
-
guildId: string;
|
|
49
|
+
guildId: any;
|
|
54
50
|
/**
|
|
55
51
|
* Guild name
|
|
56
52
|
* @type {String}
|
|
@@ -84,14 +80,14 @@ export default class Profile {
|
|
|
84
80
|
deathMarks: Array<string>;
|
|
85
81
|
/**
|
|
86
82
|
* Whether or not the player is qualified as a target for Zanuka
|
|
87
|
-
* @type {
|
|
83
|
+
* @type {boolean}
|
|
88
84
|
*/
|
|
89
|
-
harvestable:
|
|
85
|
+
harvestable: boolean;
|
|
90
86
|
/**
|
|
91
87
|
* Whether or not the player is qualified as a target for a syndicate death squad
|
|
92
|
-
* @type {
|
|
88
|
+
* @type {boolean}
|
|
93
89
|
*/
|
|
94
|
-
deathSquadable:
|
|
90
|
+
deathSquadable: boolean;
|
|
95
91
|
/**
|
|
96
92
|
* Date the account was created
|
|
97
93
|
* @type {Date}
|
|
@@ -99,9 +95,9 @@ export default class Profile {
|
|
|
99
95
|
created: Date;
|
|
100
96
|
/**
|
|
101
97
|
* Whether the user has migrated to console or not
|
|
102
|
-
* @type {
|
|
98
|
+
* @type {boolean}
|
|
103
99
|
*/
|
|
104
|
-
migratedToConsole:
|
|
100
|
+
migratedToConsole: boolean;
|
|
105
101
|
/**
|
|
106
102
|
* List of completed missions and their completions
|
|
107
103
|
* @type {Mission}
|
|
@@ -129,15 +125,15 @@ export default class Profile {
|
|
|
129
125
|
*/
|
|
130
126
|
wishList: any;
|
|
131
127
|
/**
|
|
132
|
-
*
|
|
133
|
-
* @type {
|
|
128
|
+
* Whether the player has unlocked their operator or not
|
|
129
|
+
* @type {boolean}
|
|
134
130
|
*/
|
|
135
|
-
unlockedOperator:
|
|
131
|
+
unlockedOperator: boolean;
|
|
136
132
|
/**
|
|
137
|
-
* Whether the player has unlocked their
|
|
138
|
-
* @type {
|
|
133
|
+
* Whether the player has unlocked their alignment or not
|
|
134
|
+
* @type {boolean}
|
|
139
135
|
*/
|
|
140
|
-
unlockedAlignment:
|
|
136
|
+
unlockedAlignment: boolean;
|
|
141
137
|
/**
|
|
142
138
|
* Operator loadout
|
|
143
139
|
* @type {OperatorLoadOuts | undefined}
|
|
@@ -145,9 +141,9 @@ export default class Profile {
|
|
|
145
141
|
operatorLoadouts: OperatorLoadOuts | undefined;
|
|
146
142
|
/**
|
|
147
143
|
* Player's alignment
|
|
148
|
-
* @type {Map<String,number>}
|
|
144
|
+
* @type {Map<String,number | undefined>}
|
|
149
145
|
*/
|
|
150
|
-
alignment: Map<string, number>;
|
|
146
|
+
alignment: Map<string, number | undefined>;
|
|
151
147
|
}
|
|
152
148
|
import LoadOutPreset from './LoadOutPreset.js';
|
|
153
149
|
import LoadOutInventory from './LoadOutInventory.js';
|
package/types/Stats.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export default class Stats {
|
|
|
14
14
|
*/
|
|
15
15
|
guildName: string;
|
|
16
16
|
/**
|
|
17
|
-
* Player's total
|
|
17
|
+
* Player's total accumulated xp
|
|
18
18
|
* @type {String}
|
|
19
19
|
*/
|
|
20
20
|
xp: string;
|
|
@@ -24,22 +24,22 @@ export default class Stats {
|
|
|
24
24
|
*/
|
|
25
25
|
missionsCompleted: number;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Missions quit
|
|
28
28
|
* @type {number}
|
|
29
29
|
*/
|
|
30
30
|
missionsQuit: number;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Misions failed
|
|
33
33
|
* @type {number}
|
|
34
34
|
*/
|
|
35
35
|
missionsFailed: number;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Missions interrupted
|
|
38
38
|
* @type {number}
|
|
39
39
|
*/
|
|
40
40
|
missionsInterrupted: number;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Missions dumped
|
|
43
43
|
* @type {number}
|
|
44
44
|
*/
|
|
45
45
|
missionsDumped: number;
|
|
@@ -74,7 +74,7 @@ export default class Stats {
|
|
|
74
74
|
*/
|
|
75
75
|
forestEventScoreSum: number;
|
|
76
76
|
/**
|
|
77
|
-
* Melee
|
|
77
|
+
* Melee kills
|
|
78
78
|
* @type {number}
|
|
79
79
|
*/
|
|
80
80
|
meleeKills: number;
|
|
@@ -84,7 +84,7 @@ export default class Stats {
|
|
|
84
84
|
*/
|
|
85
85
|
abilities: number;
|
|
86
86
|
/**
|
|
87
|
-
* Ciphers completed
|
|
87
|
+
* Ciphers completed successfully
|
|
88
88
|
* @type {number}
|
|
89
89
|
*/
|
|
90
90
|
ciphersSolved: number;
|