@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.
- package/package.json +33 -31
- 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/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wfcd/profile-parser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Parser for Digital Extreme's profile data",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "src/ProfileParser.js",
|
|
7
6
|
"exports": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
7
|
+
"./Parser": {
|
|
8
|
+
"types": "./dist/ProfileParser.d.ts",
|
|
9
|
+
"default": "./dist/ProfileParser.js"
|
|
10
|
+
},
|
|
11
|
+
"./Profile": {
|
|
12
|
+
"types": "./dist/Profile.d.ts",
|
|
13
|
+
"default": "./dist/Profile.js"
|
|
11
14
|
},
|
|
12
15
|
"./XpInfo": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
16
|
+
"types": "./dist/XpInfo.d.ts",
|
|
17
|
+
"default": "./dist/XpInfo.js"
|
|
15
18
|
},
|
|
16
19
|
"./Stats": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
},
|
|
20
|
-
"./Profile": {
|
|
21
|
-
"import": "./src/Profile.js",
|
|
22
|
-
"types": "./types/index.d.ts"
|
|
20
|
+
"types": "./dist/Stats.d.ts",
|
|
21
|
+
"default": "./dist/Stats.js"
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
24
|
"public": true,
|
|
@@ -30,27 +29,30 @@
|
|
|
30
29
|
"types"
|
|
31
30
|
],
|
|
32
31
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"
|
|
32
|
+
"@biomejs/biome": "2.0.6",
|
|
33
|
+
"@types/chai": "^5.2.2",
|
|
34
|
+
"@types/mocha": "^10.0.10",
|
|
35
|
+
"@wfcd/eslint-config": "^1.6.3",
|
|
36
|
+
"c8": "^10.1.3",
|
|
37
|
+
"chai": "^5.2.0",
|
|
37
38
|
"chai-json-equal": "^0.0.1",
|
|
38
39
|
"coveralls": "^3.1.1",
|
|
39
|
-
"husky": "^9.
|
|
40
|
-
"install-peerdeps": "^3.0.
|
|
41
|
-
"lint-staged": "^
|
|
42
|
-
"mocha": "^
|
|
43
|
-
"
|
|
40
|
+
"husky": "^9.1.7",
|
|
41
|
+
"install-peerdeps": "^3.0.7",
|
|
42
|
+
"lint-staged": "^16.1.2",
|
|
43
|
+
"mocha": "^11.7.1",
|
|
44
|
+
"tsdown": "^0.12.9",
|
|
45
|
+
"tsx": "^4.20.3",
|
|
46
|
+
"typescript": "^5.8.3"
|
|
44
47
|
},
|
|
45
48
|
"scripts": {
|
|
46
|
-
"
|
|
49
|
+
"build": "tsdown",
|
|
50
|
+
"build:docs": "tsdown && jsdoc -c .github/docs/conf.json -d docs",
|
|
47
51
|
"coverage": "npm test && c8 report --reporter=text-lcov | coveralls",
|
|
48
|
-
"lint": "
|
|
49
|
-
"lint:fix": "
|
|
50
|
-
"prepublishOnly": "npm run build
|
|
51
|
-
"
|
|
52
|
-
"build:types": "tsc -p tsconfig.declaration.json",
|
|
53
|
-
"prepare": "husky && if [ \"$NODE_ENV\" = \"dev\" ] ; then npx -p install-peerdeps@latest install-peerdeps @wfcd/eslint-config@latest -S ; fi"
|
|
52
|
+
"lint": "biome lint",
|
|
53
|
+
"lint:fix": "biome lint --write",
|
|
54
|
+
"prepublishOnly": "npm run build",
|
|
55
|
+
"test": "c8 mocha"
|
|
54
56
|
},
|
|
55
57
|
"author": "SlayerOrnstein",
|
|
56
58
|
"license": "MIT",
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
"node": ">=20.0.0"
|
|
59
61
|
},
|
|
60
62
|
"peerDependencies": {
|
|
61
|
-
"@wfcd/items": "^1.1270.
|
|
62
|
-
"warframe-worldstate-data": "^
|
|
63
|
+
"@wfcd/items": "^1.1270.626",
|
|
64
|
+
"warframe-worldstate-data": "^3.0.0"
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
export interface RawAbility {
|
|
3
|
+
type: string;
|
|
4
|
+
used: number
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* Represents a players used ability
|
|
3
9
|
* @module
|
|
4
10
|
*/
|
|
5
11
|
export default class Ability {
|
|
12
|
+
uniqueName: string;
|
|
13
|
+
used: number;
|
|
14
|
+
|
|
6
15
|
/**
|
|
7
|
-
* @param
|
|
16
|
+
* @param ability The ability
|
|
8
17
|
*/
|
|
9
|
-
constructor(ability) {
|
|
18
|
+
constructor(ability: RawAbility) {
|
|
10
19
|
/**
|
|
11
20
|
* The ability unique name
|
|
12
|
-
* @type {String}
|
|
13
21
|
*/
|
|
14
22
|
this.uniqueName = ability.type;
|
|
15
23
|
|
|
16
24
|
/**
|
|
17
25
|
* How many time the ability was used in the player's lifetime
|
|
18
|
-
* @type {number}
|
|
19
26
|
*/
|
|
20
27
|
this.used = ability.used;
|
|
21
28
|
}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
+
import { Locale } from 'warframe-worldstate-data';
|
|
1
2
|
import { archonShardColor, archonShardUpgradeType } from 'warframe-worldstate-data/utilities';
|
|
2
3
|
|
|
4
|
+
interface RawArchonCrystal {
|
|
5
|
+
Color: string;
|
|
6
|
+
UpgradeType: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* Represents an Archon shard
|
|
5
11
|
* @module
|
|
6
12
|
*/
|
|
7
13
|
export default class ArchonCrystal {
|
|
14
|
+
color: string;
|
|
15
|
+
modifier: string;
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
19
|
+
* @param crystal The archon crystal object
|
|
20
|
+
* @param locale The locale to get translations in
|
|
12
21
|
*/
|
|
13
|
-
constructor(crystal, locale = 'en') {
|
|
22
|
+
constructor(crystal: RawArchonCrystal, locale: Locale = 'en') {
|
|
14
23
|
/**
|
|
15
24
|
* Archon shard color
|
|
16
|
-
* @type {String}
|
|
17
25
|
*/
|
|
18
26
|
this.color = archonShardColor(crystal.Color, locale);
|
|
19
27
|
|
|
20
28
|
/**
|
|
21
29
|
* Archon shard modifier
|
|
22
|
-
* @type {String}
|
|
23
30
|
*/
|
|
24
31
|
this.modifier = archonShardUpgradeType(crystal.Color, crystal.UpgradeType, locale);
|
|
25
32
|
}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
export interface RawChallengeProgress {
|
|
3
|
+
Name: string;
|
|
4
|
+
Progress: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* Player completed or in progress challenges
|
|
3
9
|
* @module
|
|
4
10
|
*/
|
|
5
11
|
export default class ChallengeProgress {
|
|
12
|
+
name: string
|
|
13
|
+
progress: number;
|
|
14
|
+
|
|
6
15
|
/**
|
|
7
16
|
*
|
|
8
|
-
* @param
|
|
17
|
+
* @param challenge The challenge object to parse
|
|
9
18
|
*/
|
|
10
|
-
constructor(challenge) {
|
|
19
|
+
constructor(challenge: RawChallengeProgress) {
|
|
11
20
|
/**
|
|
12
21
|
* Name of the challenge
|
|
13
|
-
* @type {String}
|
|
14
22
|
*/
|
|
15
23
|
this.name = challenge.Name;
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
26
|
* Progress towards completing this challenge
|
|
19
|
-
* @type {number}
|
|
20
27
|
*/
|
|
21
28
|
this.progress = challenge.Progress;
|
|
22
29
|
}
|
package/src/Enemy.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface RawEnemy {
|
|
2
|
+
type: string;
|
|
3
|
+
kills: number;
|
|
4
|
+
headshots: number;
|
|
5
|
+
executions: number;
|
|
6
|
+
assists: number;
|
|
7
|
+
deaths: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An enemy killed/executed by player
|
|
12
|
+
*/
|
|
13
|
+
export default class Enemy {
|
|
14
|
+
/**
|
|
15
|
+
* Enemy's unique name
|
|
16
|
+
*/
|
|
17
|
+
uniqueName: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* How many times the player has killed this enemy type
|
|
21
|
+
*/
|
|
22
|
+
kills: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The amount of kills that were headshots
|
|
26
|
+
*/
|
|
27
|
+
headshots: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The amount of kills that were finishers
|
|
31
|
+
*/
|
|
32
|
+
executions: number;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The amount of kills that were assits
|
|
36
|
+
*/
|
|
37
|
+
assists: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* How many times this enemy type has killed the player
|
|
41
|
+
*/
|
|
42
|
+
deaths: number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param enemy The enemy
|
|
46
|
+
*/
|
|
47
|
+
constructor(enemy: RawEnemy) {
|
|
48
|
+
this.uniqueName = enemy.type;
|
|
49
|
+
this.kills = enemy.kills;
|
|
50
|
+
this.headshots = enemy.headshots;
|
|
51
|
+
this.executions = enemy.executions;
|
|
52
|
+
this.assists = enemy.assists;
|
|
53
|
+
this.deaths = enemy.deaths;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export interface RawIntrinsics {
|
|
2
|
+
LPS_ENGINEERING?: number;
|
|
3
|
+
LPS_GUNNERY?: number;
|
|
4
|
+
LPS_PILOTING?: number;
|
|
5
|
+
LPS_TACTICAL?: number;
|
|
6
|
+
LPS_COMMAND?: number;
|
|
7
|
+
LPP_DRIFTER?: number;
|
|
8
|
+
LPS_DRIFT_RIDING?: number;
|
|
9
|
+
LPS_DRIFT_COMBAT?: number;
|
|
10
|
+
LPS_DRIFT_OPPORTUNITY?: number;
|
|
11
|
+
LPS_DRIFT_ENDURANCE?: number;
|
|
12
|
+
LPP_SPACE?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Player's intrinsics ranks
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export default class Intrinsics {
|
|
20
|
+
/**
|
|
21
|
+
* Intrinsic points for railjack
|
|
22
|
+
*/
|
|
23
|
+
railjack: number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Railjack engineering rank
|
|
27
|
+
*/
|
|
28
|
+
engineering: number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Railjack gunnery rank
|
|
32
|
+
*/
|
|
33
|
+
gunnery: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Railjack piloting rank
|
|
37
|
+
*/
|
|
38
|
+
piloting: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Railjack tactical rank
|
|
42
|
+
*/
|
|
43
|
+
tactical: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Railjack command rank
|
|
47
|
+
*/
|
|
48
|
+
command: number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Intrinsic points for railjack
|
|
52
|
+
*/
|
|
53
|
+
drifter: number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Drifter riding rank
|
|
57
|
+
*/
|
|
58
|
+
riding: number;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Drifter combat rank
|
|
62
|
+
*/
|
|
63
|
+
combat: number;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Drifter opportunity rank
|
|
67
|
+
*/
|
|
68
|
+
opportunity: number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Drifter endurance rank
|
|
72
|
+
*/
|
|
73
|
+
endurance: number;
|
|
74
|
+
|
|
75
|
+
constructor(skills: RawIntrinsics) {
|
|
76
|
+
this.railjack = Math.floor((skills.LPP_SPACE ?? 0) / 1000);
|
|
77
|
+
|
|
78
|
+
this.engineering = skills.LPS_ENGINEERING ?? 0;
|
|
79
|
+
|
|
80
|
+
this.gunnery = skills.LPS_GUNNERY ?? 0;
|
|
81
|
+
|
|
82
|
+
this.piloting = skills.LPS_PILOTING ?? 0;
|
|
83
|
+
|
|
84
|
+
this.tactical = skills.LPS_TACTICAL ?? 0;
|
|
85
|
+
|
|
86
|
+
this.command = skills.LPS_COMMAND ?? 0;
|
|
87
|
+
|
|
88
|
+
this.drifter = Math.floor((skills.LPP_DRIFTER ?? 0) / 1000);
|
|
89
|
+
|
|
90
|
+
this.riding = skills.LPS_DRIFT_RIDING ?? 0;
|
|
91
|
+
|
|
92
|
+
this.combat = skills.LPS_DRIFT_COMBAT ?? 0;
|
|
93
|
+
|
|
94
|
+
this.opportunity = skills.LPS_DRIFT_OPPORTUNITY ?? 0;
|
|
95
|
+
|
|
96
|
+
this.endurance = skills.LPS_DRIFT_ENDURANCE ?? 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
|
|
9
|
+
|
|
10
|
+
export interface RawItemConfig {
|
|
11
|
+
Skins?: string[];
|
|
12
|
+
PvpUpgrades?: string[];
|
|
13
|
+
pricol?: ProfileRawColors;
|
|
14
|
+
sigcol?: ProfileRawColors;
|
|
15
|
+
attcol?: ProfileRawColors;
|
|
16
|
+
syancol?: ProfileRawColors;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Item customizations such as colors and applied skins
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
export default class ItemConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Array of unique names for the skins applied to item
|
|
26
|
+
*/
|
|
27
|
+
skins?: Skin[];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Array of PVP unique name upgrades applied
|
|
31
|
+
*/
|
|
32
|
+
conclaveUpgrades?: string[];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Primary colors applied to item if they exist
|
|
36
|
+
*/
|
|
37
|
+
primaryColor?: ColorMap;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sigil colors applied to item if they exist
|
|
41
|
+
*/
|
|
42
|
+
sigilColor?: ColorMap;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Attachment colors applied to item if they exist
|
|
46
|
+
*/
|
|
47
|
+
attachmentsColor?: ColorMap;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Syandana colors applied to item if they exist
|
|
51
|
+
*/
|
|
52
|
+
syandanaColor?: ColorMap;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param config The configuration
|
|
57
|
+
*/
|
|
58
|
+
constructor(config: RawItemConfig, locale: Locale = 'en') {
|
|
59
|
+
this.skins = config.Skins?.filter(Boolean).map((s: string) => new Skin({ ItemType: s }, locale));
|
|
60
|
+
|
|
61
|
+
if (config.PvpUpgrades) this.conclaveUpgrades = config.PvpUpgrades;
|
|
62
|
+
|
|
63
|
+
if (config.pricol) this.primaryColor = colors.mapColors(mapToHex(config.pricol));
|
|
64
|
+
|
|
65
|
+
if (config.sigcol) this.sigilColor = colors.mapColors(mapToHex(config.sigcol));
|
|
66
|
+
|
|
67
|
+
if (config.attcol) this.attachmentsColor = colors.mapColors(mapToHex(config.attcol));
|
|
68
|
+
|
|
69
|
+
if (config.syancol) this.syandanaColor = colors.mapColors(mapToHex(config.syancol));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Locale } from 'warframe-worldstate-data';
|
|
2
|
+
import LoadOutItem, { type RawLoadOutItem } from './LoadOutItem';
|
|
3
|
+
import Skin, { type RawSkin } from './Skin';
|
|
4
|
+
import XpInfo, { type RawXpItem } from './XpInfo';
|
|
5
|
+
|
|
6
|
+
export interface RawLoadOut {
|
|
7
|
+
WeaponSkins: RawSkin[];
|
|
8
|
+
Suits: RawLoadOutItem[];
|
|
9
|
+
Pistols?: RawLoadOutItem[];
|
|
10
|
+
LongGuns?: RawLoadOutItem[];
|
|
11
|
+
Melee?: RawLoadOutItem[];
|
|
12
|
+
XPInfo: RawXpItem[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Player loudout
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export default class LoadOutInventory {
|
|
20
|
+
/**
|
|
21
|
+
* Skins applied to weapons
|
|
22
|
+
*/
|
|
23
|
+
weaponSkins: Skin[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* An array of the player's currently equiped Warframe (or powersuits)
|
|
27
|
+
*/
|
|
28
|
+
suits: LoadOutItem[];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An array of the player's currently equiped secondary weapon
|
|
32
|
+
*/
|
|
33
|
+
secondary?: LoadOutItem[];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An array of the player's currently equiped primary weapon
|
|
37
|
+
*/
|
|
38
|
+
primary?: LoadOutItem[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* An array of the player's currently equiped melee weapon
|
|
42
|
+
*/
|
|
43
|
+
melee?: LoadOutItem[];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Items that have counted towards the players mastery rank
|
|
47
|
+
*/
|
|
48
|
+
xpInfo: XpInfo[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param item The loadout data
|
|
53
|
+
* @param locale The locale to return loudout items in. Default is en
|
|
54
|
+
* @param withItem Whether or not to include items
|
|
55
|
+
*/
|
|
56
|
+
constructor(item: RawLoadOut, locale: Locale = 'en', withItem = false) {
|
|
57
|
+
this.weaponSkins = item.WeaponSkins.map((s) => new Skin(s, locale));
|
|
58
|
+
|
|
59
|
+
this.suits = item.Suits.map((s) => new LoadOutItem(s, locale));
|
|
60
|
+
|
|
61
|
+
this.secondary = item.Pistols?.map((p) => new LoadOutItem(p, locale));
|
|
62
|
+
|
|
63
|
+
this.primary = item.LongGuns?.map((lg) => new LoadOutItem(lg, locale));
|
|
64
|
+
|
|
65
|
+
this.melee = item.Melee?.map((m) => new LoadOutItem(m, locale));
|
|
66
|
+
|
|
67
|
+
this.xpInfo = item.XPInfo.map((xp) => new XpInfo(xp, locale, withItem));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { colors } from '@wfcd/items/utilities';
|
|
2
|
+
import { parseDate, toTitleCase, WorldStateDate } from 'warframe-worldstate-data/utilities';
|
|
3
|
+
|
|
4
|
+
import ItemConfig, { type RawItemConfig } from './ItemConfig';
|
|
5
|
+
import Polarity, { type RawPolarity } from './Polarity';
|
|
6
|
+
import { find, RawDate } from './Utils';
|
|
7
|
+
import type { ColorMap, Item, RawColors } from '@wfcd/items';
|
|
8
|
+
import { Locale } from 'warframe-worldstate-data';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export interface RawLoadOutItem {
|
|
12
|
+
ItemId: { $oid: string };
|
|
13
|
+
ItemType: string;
|
|
14
|
+
ItemName?: string;
|
|
15
|
+
Configs: RawItemConfig[];
|
|
16
|
+
UpgradeType?: string;
|
|
17
|
+
UpgradeFingerprint?: unknown;
|
|
18
|
+
Features: number;
|
|
19
|
+
UpgradeVer: number;
|
|
20
|
+
XP?: number;
|
|
21
|
+
Polarized?: number;
|
|
22
|
+
Polarity?: RawPolarity[];
|
|
23
|
+
FocusLens?: string;
|
|
24
|
+
CustomizationSlotPurchases?: number;
|
|
25
|
+
pricol?: RawColors;
|
|
26
|
+
sigcol?: RawColors;
|
|
27
|
+
ugly?: boolean;
|
|
28
|
+
attcol?: RawColors;
|
|
29
|
+
syancol?: RawColors;
|
|
30
|
+
InfestationDate?: RawDate;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An an item in LoadOutInventory
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
export default class LoadOutItem {
|
|
38
|
+
/**
|
|
39
|
+
* Item ID
|
|
40
|
+
*/
|
|
41
|
+
itemId: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Item unique name
|
|
45
|
+
*/
|
|
46
|
+
uniqueName: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Item in-game name
|
|
50
|
+
*/
|
|
51
|
+
name?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Complete item from @wfcd/items
|
|
55
|
+
*/
|
|
56
|
+
item?: Item;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The name of the Lich, Sister, or Technocyte
|
|
60
|
+
*/
|
|
61
|
+
nemesis?: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Configuration for this weapon. Such as colors and skins applied by the player
|
|
65
|
+
*/
|
|
66
|
+
configs: ItemConfig[];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The upgrade that was applied to this weapon
|
|
70
|
+
*/
|
|
71
|
+
upgradeType?: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Information on the upgradeType that was applied
|
|
75
|
+
* TODO need model for for fingerprint
|
|
76
|
+
*/
|
|
77
|
+
upgradeFingerprint: unknown;
|
|
78
|
+
|
|
79
|
+
features: number;
|
|
80
|
+
|
|
81
|
+
// Not sure what this is for
|
|
82
|
+
upgradeVer: number;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* XP earned with this weapon
|
|
86
|
+
*/
|
|
87
|
+
xp?: number;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* How many mod slots are currently polarized.
|
|
91
|
+
*/
|
|
92
|
+
polarized?: number;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Which polarity types exist on the weapon
|
|
96
|
+
*/
|
|
97
|
+
polarity?: Polarity[];
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Focus lens applied
|
|
101
|
+
*/
|
|
102
|
+
focuseLens?: string;
|
|
103
|
+
|
|
104
|
+
// Not sure what this is for
|
|
105
|
+
customizationSlotPurchases: number;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Primary colors applied to item if they exist
|
|
109
|
+
*/
|
|
110
|
+
primaryColor?: ColorMap;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Sigil colors applied to item if they exist
|
|
114
|
+
*/
|
|
115
|
+
sigilColor?: ColorMap;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Whether prime details are enabled or not
|
|
119
|
+
*/
|
|
120
|
+
enablePrime: boolean;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Attachment colors applied to item if they exist
|
|
124
|
+
*/
|
|
125
|
+
attachmentsColor?: ColorMap;
|
|
126
|
+
/**
|
|
127
|
+
* Syandana colors applied to item if they exist
|
|
128
|
+
*/
|
|
129
|
+
syandanaColor?: ColorMap;
|
|
130
|
+
/**
|
|
131
|
+
* If set will show when the player's warframe was infested.
|
|
132
|
+
*/
|
|
133
|
+
infestationDate?: Date;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @param {Object} loadOutItem The loadout item from LoadoutInventory
|
|
138
|
+
* @param {string} [locale='en'] The locale to return item in
|
|
139
|
+
*/
|
|
140
|
+
constructor(loadOutItem: RawLoadOutItem, locale: Locale = 'en') {
|
|
141
|
+
this.itemId = loadOutItem.ItemId.$oid;
|
|
142
|
+
|
|
143
|
+
this.uniqueName = loadOutItem.ItemType;
|
|
144
|
+
|
|
145
|
+
const item = find(loadOutItem.ItemType, locale);
|
|
146
|
+
if (item) {
|
|
147
|
+
this.name = item.name;
|
|
148
|
+
|
|
149
|
+
this.item = item;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (loadOutItem.ItemName) {
|
|
153
|
+
const [, nemesis] = loadOutItem.ItemName.split('|');
|
|
154
|
+
|
|
155
|
+
if (nemesis !== undefined) {
|
|
156
|
+
this.nemesis = toTitleCase(nemesis);
|
|
157
|
+
} else {
|
|
158
|
+
this.name = loadOutItem.ItemName;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
this.configs = loadOutItem.Configs.map((c) => new ItemConfig(c));
|
|
163
|
+
|
|
164
|
+
if (loadOutItem.UpgradeType) this.upgradeType = loadOutItem.UpgradeType;
|
|
165
|
+
|
|
166
|
+
this.upgradeFingerprint = loadOutItem.UpgradeFingerprint;
|
|
167
|
+
|
|
168
|
+
this.features = loadOutItem.Features;
|
|
169
|
+
|
|
170
|
+
this.upgradeVer = loadOutItem.UpgradeVer;
|
|
171
|
+
|
|
172
|
+
this.xp = loadOutItem.XP;
|
|
173
|
+
|
|
174
|
+
this.polarized = loadOutItem.Polarized;
|
|
175
|
+
|
|
176
|
+
this.polarity = loadOutItem.Polarity?.map((p) => new Polarity(p));
|
|
177
|
+
|
|
178
|
+
this.focuseLens = loadOutItem.FocusLens;
|
|
179
|
+
|
|
180
|
+
this.customizationSlotPurchases = loadOutItem.CustomizationSlotPurchases ?? 0;
|
|
181
|
+
|
|
182
|
+
if (loadOutItem.pricol) this.primaryColor = colors.mapColors(loadOutItem.pricol);
|
|
183
|
+
|
|
184
|
+
if (loadOutItem.sigcol) this.sigilColor = colors.mapColors(loadOutItem.sigcol);
|
|
185
|
+
|
|
186
|
+
this.enablePrime = loadOutItem.ugly ?? false;
|
|
187
|
+
|
|
188
|
+
if (loadOutItem.attcol) this.attachmentsColor = colors.mapColors(loadOutItem.attcol);
|
|
189
|
+
|
|
190
|
+
if (loadOutItem.syancol) this.syandanaColor = colors.mapColors(loadOutItem.syancol);
|
|
191
|
+
|
|
192
|
+
if (loadOutItem.InfestationDate) this.infestationDate = parseDate(loadOutItem.InfestationDate);
|
|
193
|
+
}
|
|
194
|
+
}
|