@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
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
package/src/Polarity.ts
ADDED
|
@@ -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
|
+
}
|