@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/src/Utils.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import Items, { type Category, type RawColors } from '@wfcd/items';
|
|
2
|
+
import { WorldStateDate } from 'warframe-worldstate-data/utilities';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* interface for DE's ID data
|
|
6
|
+
*/
|
|
7
|
+
export interface RawId {
|
|
8
|
+
$oid: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// {"$date":{"$numberLong":"1462464026233"}}
|
|
12
|
+
export type RawDate = WorldStateDate;
|
|
13
|
+
|
|
14
|
+
export interface ProfileRawColors {
|
|
15
|
+
t0?: number;
|
|
16
|
+
t1?: number;
|
|
17
|
+
t2?: number;
|
|
18
|
+
t3?: number;
|
|
19
|
+
m0?: number;
|
|
20
|
+
m1?: number;
|
|
21
|
+
en?: number;
|
|
22
|
+
e1?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Map base10 int colors to hex color strings
|
|
27
|
+
* @param colors color map
|
|
28
|
+
*/
|
|
29
|
+
export const mapToHex = (colors: ProfileRawColors): RawColors => {
|
|
30
|
+
const hex: Record<string, string> = {};
|
|
31
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
32
|
+
if (value) hex[key] = Math.abs(value).toString(16).toUpperCase();
|
|
33
|
+
});
|
|
34
|
+
return hex as RawColors;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const categories = [
|
|
38
|
+
'Skins',
|
|
39
|
+
'Primary',
|
|
40
|
+
'Secondary',
|
|
41
|
+
'Melee',
|
|
42
|
+
'Arch-Melee',
|
|
43
|
+
'Arch-Gun',
|
|
44
|
+
'Warframes',
|
|
45
|
+
'Archwing',
|
|
46
|
+
'Sentinels',
|
|
47
|
+
'Pets',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Find an item by Item#uniqueName
|
|
52
|
+
* @param name string with which to query
|
|
53
|
+
* @param locale locale to use for internationalization
|
|
54
|
+
* @returns {Item}
|
|
55
|
+
*/
|
|
56
|
+
export const find = (name: string, locale = 'en') => {
|
|
57
|
+
const items = new Items({
|
|
58
|
+
category: categories as (Category | 'SentinelWeapons')[],
|
|
59
|
+
i18n: [locale],
|
|
60
|
+
i18nOnObject: true,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const item = items.find((i) => i.uniqueName === name);
|
|
64
|
+
|
|
65
|
+
let itemClone: any = { ...item };
|
|
66
|
+
if (locale !== 'en' && itemClone.i18n[locale] && itemClone.i18n[locale]) {
|
|
67
|
+
itemClone = { ...itemClone, ...itemClone.i18n[locale] };
|
|
68
|
+
|
|
69
|
+
if (itemClone.abilities) {
|
|
70
|
+
itemClone.abilities = itemClone.abilities.map((ability: any) => ({
|
|
71
|
+
uniqueName: ability.abilityUniqueName || ability.uniqueName || undefined,
|
|
72
|
+
name: ability.abilityName || ability.name,
|
|
73
|
+
description: ability.abilityDescription || ability.description,
|
|
74
|
+
imageName: ability.imageName ?? undefined,
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
delete itemClone.i18n;
|
|
79
|
+
return itemClone;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return item;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const numberToLetter = (num: number) => String.fromCharCode(64 + (num + 1));
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
+
export interface RawWeapon {
|
|
2
|
+
type: string;
|
|
3
|
+
xp: number;
|
|
4
|
+
equipTime: number;
|
|
5
|
+
headShots: number;
|
|
6
|
+
hits: number;
|
|
7
|
+
assists: number;
|
|
8
|
+
kills: number;
|
|
9
|
+
fired: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
/**
|
|
2
13
|
* Represents a player's used weapon stats
|
|
3
14
|
* @module
|
|
4
15
|
*/
|
|
5
16
|
export default class Weapon {
|
|
17
|
+
uniqueName: string;
|
|
18
|
+
xp: number;
|
|
19
|
+
equipTime: number;
|
|
20
|
+
headShots: number;
|
|
21
|
+
hits: number;
|
|
22
|
+
assists: number;
|
|
23
|
+
kills: number;
|
|
24
|
+
fired: number;
|
|
25
|
+
|
|
6
26
|
/**
|
|
7
27
|
*
|
|
8
|
-
* @param
|
|
28
|
+
* @param weapon The weapon stats being parsed
|
|
9
29
|
*/
|
|
10
|
-
constructor(weapon) {
|
|
30
|
+
constructor(weapon: RawWeapon) {
|
|
11
31
|
/**
|
|
12
32
|
* Weapon unique name
|
|
13
33
|
* @type {String}
|
|
@@ -24,7 +44,7 @@ export default class Weapon {
|
|
|
24
44
|
* Time using this weapon
|
|
25
45
|
* @type {number}
|
|
26
46
|
*/
|
|
27
|
-
this.
|
|
47
|
+
this.equipTime = weapon.equipTime;
|
|
28
48
|
|
|
29
49
|
/**
|
|
30
50
|
* Headshots using this weapon
|
package/src/XpInfo.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Item } from '@wfcd/items';
|
|
2
|
+
import { find } from './Utils';
|
|
3
|
+
|
|
4
|
+
export interface RawXpItem {
|
|
5
|
+
ItemType: string;
|
|
6
|
+
XP: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* An item that has contributed to a player's mastery rank
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
export default class XpInfo {
|
|
14
|
+
/**
|
|
15
|
+
* Unique name
|
|
16
|
+
*/
|
|
17
|
+
uniqueName: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* XP earned
|
|
21
|
+
*/
|
|
22
|
+
xp: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The item corrosponding to the unique name.
|
|
26
|
+
*/
|
|
27
|
+
item?: Item;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param info The info for a given ranked item
|
|
32
|
+
* @param locale langauge to return item in
|
|
33
|
+
* @param withItem Whether or not to include items
|
|
34
|
+
*/
|
|
35
|
+
constructor(info: RawXpItem, locale = 'en', withItem = false) {
|
|
36
|
+
this.uniqueName = info.ItemType;
|
|
37
|
+
this.xp = info.XP;
|
|
38
|
+
|
|
39
|
+
if (withItem) this.item = find(info.ItemType, locale);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/Enemy.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An enemy killed/executed by player
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
export default class Enemy {
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {Object} enemy The enemy
|
|
9
|
-
*/
|
|
10
|
-
constructor(enemy) {
|
|
11
|
-
/**
|
|
12
|
-
* Enenmy's unique name
|
|
13
|
-
* @type {String}
|
|
14
|
-
*/
|
|
15
|
-
this.uniqueName = enemy.type;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* How many times the player has killed this enemy type
|
|
19
|
-
* @type {number}
|
|
20
|
-
*/
|
|
21
|
-
this.kills = enemy.kills;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The amount of kills that were headshots
|
|
25
|
-
* @type {number}
|
|
26
|
-
*/
|
|
27
|
-
this.headshots = enemy.headshots;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The amount of kills that were finishers
|
|
31
|
-
* @type {number}
|
|
32
|
-
*/
|
|
33
|
-
this.executions = enemy.executions;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The amount of kills that were assits
|
|
37
|
-
* @type {number}
|
|
38
|
-
*/
|
|
39
|
-
this.assists = enemy.assists;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* How many times this enemy type has killed the player
|
|
43
|
-
* @type {number}
|
|
44
|
-
*/
|
|
45
|
-
this.deaths = enemy.deaths;
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/Intrinsics.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Player's intrinsics ranks
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
export default class Intrinsics {
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {Object} skills The intrinsics object
|
|
9
|
-
*/
|
|
10
|
-
constructor(skills) {
|
|
11
|
-
/**
|
|
12
|
-
* Intrinsic points for railjack
|
|
13
|
-
* @type {number}
|
|
14
|
-
*/
|
|
15
|
-
this.railjack = Math.floor((skills.LPP_SPACE ?? 0) / 1000);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Railjack engineering rank
|
|
19
|
-
* @type {number}
|
|
20
|
-
*/
|
|
21
|
-
this.engineering = skills.LPS_ENGINEERING ?? 0;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Railjack gunnery rank
|
|
25
|
-
* @type {number}
|
|
26
|
-
*/
|
|
27
|
-
this.gunnery = skills.LPS_GUNNERY ?? 0;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Railjack piloting rank
|
|
31
|
-
* @type {number}
|
|
32
|
-
*/
|
|
33
|
-
this.piloting = skills.LPS_PILOTING ?? 0;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Railjack tactical rank
|
|
37
|
-
* @type {number}
|
|
38
|
-
*/
|
|
39
|
-
this.tactical = skills.LPS_TACTICAL ?? 0;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Railjack command rank
|
|
43
|
-
* @type {number}
|
|
44
|
-
*/
|
|
45
|
-
this.command = skills.LPS_COMMAND ?? 0;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Intrinsic points for railjack
|
|
49
|
-
* @type {number}
|
|
50
|
-
*/
|
|
51
|
-
this.drifter = Math.floor((skills.LPP_DRIFTER ?? 0) / 1000);
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Drifter riding rank
|
|
55
|
-
* @type {number}
|
|
56
|
-
*/
|
|
57
|
-
this.riding = skills.LPS_DRIFT_RIDING ?? 0;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Drifter combat rank
|
|
61
|
-
* @type {number}
|
|
62
|
-
*/
|
|
63
|
-
this.combat = skills.LPS_DRIFT_COMBAT ?? 0;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Drifter opportunity rank
|
|
67
|
-
* @type {number}
|
|
68
|
-
*/
|
|
69
|
-
this.opportunity = skills.LPS_DRIFT_OPPORTUNITY ?? 0;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Drifter endurance rank
|
|
73
|
-
* @type {number}
|
|
74
|
-
*/
|
|
75
|
-
this.endurance = skills.LPS_DRIFT_ENDURANCE ?? 0;
|
|
76
|
-
}
|
|
77
|
-
}
|
package/src/ItemConfig.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { colors } from '@wfcd/items/utilities';
|
|
2
|
-
|
|
3
|
-
import Skin from './Skin.js';
|
|
4
|
-
import { mapToHex } from './Utils.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Item customizations such as colors and applied skins
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
export default class ItemConfig {
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} config The configuration
|
|
14
|
-
*/
|
|
15
|
-
constructor(config) {
|
|
16
|
-
/**
|
|
17
|
-
* Array of unique names for the skins applied to item
|
|
18
|
-
* @type {Array<String> | undefined}
|
|
19
|
-
*/
|
|
20
|
-
this.skins = config.Skins?.filter(Boolean).map((s) => new Skin({ ItemType: s }));
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Array of PVP unique name upgrades applied
|
|
24
|
-
* @type {Array<String>}
|
|
25
|
-
*/
|
|
26
|
-
if (config.PvpUpgrades) this.conclaveUpgrades = config.PvpUpgrades;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Primary colors applied to item if they exist
|
|
30
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
31
|
-
*/
|
|
32
|
-
if (config.pricol) this.primaryColor = colors.mapColors(mapToHex(config.pricol));
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Sigil colors applied to item if they exist
|
|
36
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
37
|
-
*/
|
|
38
|
-
if (config.sigcol) this.sigilColor = colors.mapColors(mapToHex(config.sigcol));
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Attachment colors applied to item if they exist
|
|
42
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
43
|
-
*/
|
|
44
|
-
if (config.attcol) this.attachmentsColor = colors.mapColors(mapToHex(config.attcol));
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Syandana colors applied to item if they exist
|
|
48
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
49
|
-
*/
|
|
50
|
-
if (config.syancol) this.syandanaColor = colors.mapColors(mapToHex(config.syancol));
|
|
51
|
-
}
|
|
52
|
-
}
|
package/src/LoadOutInventory.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import LoadOutItem from './LoadOutItem.js';
|
|
2
|
-
import Skin from './Skin.js';
|
|
3
|
-
import XpInfo from './XpInfo.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Player loudout
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
export default class LoadOutInventory {
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} item The loadout data
|
|
13
|
-
* @param {string} [locale='en'] The locale to return loudout items in
|
|
14
|
-
* @param {boolean} [withItem=false] Whether or not to include items
|
|
15
|
-
*/
|
|
16
|
-
constructor(item, locale = 'en', withItem = false) {
|
|
17
|
-
/**
|
|
18
|
-
* Skins applied to weapons
|
|
19
|
-
* @type {WeaponSkin}
|
|
20
|
-
*/
|
|
21
|
-
this.weaponSkins = item.WeaponSkins.map((s) => new Skin(s));
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* An array of the player's currently equiped Warframe (or powersuits)
|
|
25
|
-
* @type {LoadOutItem}
|
|
26
|
-
*/
|
|
27
|
-
this.suits = item.Suits.map((s) => new LoadOutItem(s, locale));
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* An array of the player's currently equiped secondary weapon
|
|
31
|
-
* @type {LoadOutItem | undefined}
|
|
32
|
-
*/
|
|
33
|
-
this.secondary = item.Pistols?.map((p) => new LoadOutItem(p, locale));
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* An array of the player's currently equiped primary weapon
|
|
37
|
-
* @type {LoadOutItem | undefined}
|
|
38
|
-
*/
|
|
39
|
-
this.primary = item.LongGuns?.map((lg) => new LoadOutItem(lg, locale));
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* An array of the player's currently equiped melee weapon
|
|
43
|
-
* @type {LoadOutItem | undefined}
|
|
44
|
-
*/
|
|
45
|
-
this.melee = item.Melee?.map((m) => new LoadOutItem(m, locale));
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Items that have counted towards the players mastery rank
|
|
49
|
-
* @type {XpInfo}
|
|
50
|
-
*/
|
|
51
|
-
this.xpInfo = item.XPInfo.map((xp) => new XpInfo(xp, locale, withItem));
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/LoadOutItem.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { colors } from '@wfcd/items/utilities';
|
|
2
|
-
import { parseDate, toTitleCase } from 'warframe-worldstate-data/utilities';
|
|
3
|
-
|
|
4
|
-
import ItemConfig from './ItemConfig.js';
|
|
5
|
-
import Polarity from './Polarity.js';
|
|
6
|
-
import { find } from './Utils.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* An an item in LoadOutInventory
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
export default class LoadOutItem {
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @param {Object} weapon The loadout item from LoadoutInventory
|
|
16
|
-
* @param {string} [locale='en'] The locale to return item in
|
|
17
|
-
*/
|
|
18
|
-
constructor(weapon, locale = 'en') {
|
|
19
|
-
/**
|
|
20
|
-
* Item ID
|
|
21
|
-
* @type {String}
|
|
22
|
-
*/
|
|
23
|
-
this.itemId = weapon.ItemId.$oid;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Item unique name
|
|
27
|
-
* @type {String}
|
|
28
|
-
*/
|
|
29
|
-
this.uniqueName = weapon.ItemType;
|
|
30
|
-
|
|
31
|
-
const item = find(weapon.ItemType, locale);
|
|
32
|
-
if (item) {
|
|
33
|
-
/**
|
|
34
|
-
* Item in-game name
|
|
35
|
-
* @type {String}
|
|
36
|
-
*/
|
|
37
|
-
this.name = item.name;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Complete item from @wfcd/items
|
|
41
|
-
* @type {module:"@wfcd/items".Item}
|
|
42
|
-
*/
|
|
43
|
-
this.item = item;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (weapon.ItemName) {
|
|
47
|
-
const [, nemesis] = weapon.ItemName.split('|');
|
|
48
|
-
|
|
49
|
-
if (nemesis !== undefined) {
|
|
50
|
-
/**
|
|
51
|
-
* The name of the Lich, Sister, or Technocyte
|
|
52
|
-
* @type {String}
|
|
53
|
-
*/
|
|
54
|
-
this.nemesis = toTitleCase(nemesis);
|
|
55
|
-
} else {
|
|
56
|
-
this.name = weapon.ItemName;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Configuration for this weapon. Such as colors and skins applied by the player
|
|
62
|
-
* @type {Array<ItemConfig>}
|
|
63
|
-
*/
|
|
64
|
-
this.configs = weapon.Configs.map((c) => new ItemConfig(c));
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The upgrade that was applied to this weapon
|
|
68
|
-
* @type {String}
|
|
69
|
-
*/
|
|
70
|
-
if (weapon.upgradeType) this.upgradeType = weapon.UpgradeType;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Information on the upgradeType that was applied
|
|
74
|
-
* TODO need model for for fingerprint
|
|
75
|
-
*/
|
|
76
|
-
this.upgradeFingerprint = weapon.UpgradeFingerprint;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @type {number}
|
|
80
|
-
*/
|
|
81
|
-
this.features = weapon.Features;
|
|
82
|
-
|
|
83
|
-
// Not sure what this is for
|
|
84
|
-
/**
|
|
85
|
-
* @type {number}
|
|
86
|
-
*/
|
|
87
|
-
this.upgradeVer = weapon.UpgradeVer;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* XP earned with this weapon
|
|
91
|
-
* @type {number}
|
|
92
|
-
*/
|
|
93
|
-
this.xp = weapon.XP;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* How many mod slots are currently polarized.
|
|
97
|
-
* @type {number}
|
|
98
|
-
*/
|
|
99
|
-
this.polarized = weapon.Polarized;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Which polarity types exist on the weapon
|
|
103
|
-
* @type {Array<Polarity> | undefined}
|
|
104
|
-
*/
|
|
105
|
-
this.polarity = weapon.Polarity?.map((p) => new Polarity(p));
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Focus lens applied
|
|
109
|
-
* @type {String}
|
|
110
|
-
*/
|
|
111
|
-
this.focuseLens = weapon.FocusLens;
|
|
112
|
-
|
|
113
|
-
// Not sure what this is for
|
|
114
|
-
/**
|
|
115
|
-
* @type {number}
|
|
116
|
-
*/
|
|
117
|
-
this.customizationSlotPurchases = weapon.CustomizationSlotPurchases;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Primary colors applied to item if they exist
|
|
121
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
122
|
-
*/
|
|
123
|
-
if (weapon.pricol) this.primaryColor = colors.mapColors(weapon.pricol);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Sigil colors applied to item if they exist
|
|
127
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
128
|
-
*/
|
|
129
|
-
if (weapon.sigcol) this.sigilColor = colors.mapColors(weapon.sigcol.toString(16));
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Whether prime details are enabled or not
|
|
133
|
-
* @type {boolean}
|
|
134
|
-
*/
|
|
135
|
-
this.enablePrime = weapon.ugly ?? false;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Attachment colors applied to item if they exist
|
|
139
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
140
|
-
*/
|
|
141
|
-
if (weapon.attcol) this.attachmentsColor = colors.mapColors(weapon.attcol.toString(16));
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Syandana colors applied to item if they exist
|
|
145
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
146
|
-
*/
|
|
147
|
-
if (weapon.syancol) this.syandanaColor = colors.mapColors(weapon.syancol.toString(16));
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* If set will show when the player's warframe was infested.
|
|
151
|
-
* @type {module:"@wfcd/items".ColorMap | undefined}
|
|
152
|
-
*/
|
|
153
|
-
if (weapon.InfestationDate) this.infestationDate = parseDate(weapon.InfestationDate);
|
|
154
|
-
}
|
|
155
|
-
}
|
package/src/LoadOutPreset.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { translatePolarity } from 'warframe-worldstate-data/utilities';
|
|
2
|
-
|
|
3
|
-
import { numberToLetter } from './Utils.js';
|
|
4
|
-
|
|
5
|
-
class SlotPreset {
|
|
6
|
-
constructor(slot) {
|
|
7
|
-
if (slot?.ItemId?.$oid) this.id = slot.ItemId.$oid;
|
|
8
|
-
|
|
9
|
-
if (slot?.mod !== undefined) this.modPreset = numberToLetter(slot.mod);
|
|
10
|
-
|
|
11
|
-
if (slot?.cus !== undefined) this.appearancePreset = numberToLetter(slot.cus);
|
|
12
|
-
|
|
13
|
-
this.isHidden = slot?.hide ?? false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default class LoadOutPreset {
|
|
18
|
-
constructor(preset) {
|
|
19
|
-
/**
|
|
20
|
-
* Focus School
|
|
21
|
-
* @type {String}
|
|
22
|
-
*/
|
|
23
|
-
this.focusSchool = translatePolarity(preset.FocusSchool);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Preset icon
|
|
27
|
-
*
|
|
28
|
-
* Note:
|
|
29
|
-
* Icon in-game seems to be an image of whatever Warframe is equipped on it
|
|
30
|
-
* @type {String}
|
|
31
|
-
*/
|
|
32
|
-
this.icon = preset.PresetIcon;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Whether this preset is a favorite
|
|
36
|
-
* @type {boolean}
|
|
37
|
-
*/
|
|
38
|
-
this.isFavorite = preset.Favorite;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Preset name
|
|
42
|
-
* @type {String}
|
|
43
|
-
*/
|
|
44
|
-
this.name = preset.n;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Warframe equipped in preset
|
|
48
|
-
* @type {SlotPreset}
|
|
49
|
-
*/
|
|
50
|
-
this.warframe = new SlotPreset(preset.s);
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Primary equipped in preset
|
|
54
|
-
* @type {SlotPreset}
|
|
55
|
-
*/
|
|
56
|
-
if (preset.l) this.primary = new SlotPreset(preset.l);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Secondary equipped in preset
|
|
60
|
-
* @type {SlotPreset}
|
|
61
|
-
*/
|
|
62
|
-
if (preset.p) this.secondary = new SlotPreset(preset.p);
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Heavy equipped in preset
|
|
66
|
-
* @type {SlotPreset}
|
|
67
|
-
*/
|
|
68
|
-
if (preset.h) this.heavy = new SlotPreset(preset.h);
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Melee equiped in preset
|
|
72
|
-
* @type {SlotPreset}
|
|
73
|
-
*/
|
|
74
|
-
if (preset.m) this.melee = new SlotPreset(preset.m);
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Exalted ability
|
|
78
|
-
* @type {SlotPreset}
|
|
79
|
-
*/
|
|
80
|
-
if (preset.a) this.exalted = new SlotPreset(preset.a);
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Secondary exalted ability
|
|
84
|
-
*
|
|
85
|
-
* i.e Sevagoth has his shadow and his shadow's claws both of which can be modded separately
|
|
86
|
-
* @type {SlotPreset}
|
|
87
|
-
*/
|
|
88
|
-
if (preset.b) this.exaltedB = new SlotPreset(preset.b);
|
|
89
|
-
}
|
|
90
|
-
}
|
package/src/Mission.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { node, nodeEnemy, nodeMissionType } from 'warframe-worldstate-data/utilities';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A mission completed by the player
|
|
5
|
-
* @module
|
|
6
|
-
*/
|
|
7
|
-
export default class Mission {
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} mission The mission data
|
|
11
|
-
* @param {string} locale The locale to return in
|
|
12
|
-
*/
|
|
13
|
-
constructor(mission, locale = 'en') {
|
|
14
|
-
const uniqueName = mission.type || mission.Tag;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Node name
|
|
18
|
-
* @type {String}
|
|
19
|
-
*/
|
|
20
|
-
this.node = node(uniqueName, locale);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Node unique name
|
|
24
|
-
* @type {String}
|
|
25
|
-
*/
|
|
26
|
-
this.nodeKey = uniqueName;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Node mission type
|
|
30
|
-
* @type {String}
|
|
31
|
-
*/
|
|
32
|
-
this.missionType = nodeMissionType(uniqueName, locale);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Node faction
|
|
36
|
-
* @type {String}
|
|
37
|
-
*/
|
|
38
|
-
this.faction = nodeEnemy(uniqueName, locale);
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Highest score earned in this mission
|
|
42
|
-
* @type {number | undefined}
|
|
43
|
-
*/
|
|
44
|
-
if (mission.highScore) this.highScore = mission.highScore;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* How many times the mission was completed
|
|
48
|
-
* @type {number | undefined}
|
|
49
|
-
*/
|
|
50
|
-
if (mission.Completes) this.completes = mission.Completes;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Denotes a steel path node
|
|
54
|
-
* @type {number | undefined}
|
|
55
|
-
*/
|
|
56
|
-
if (mission.Tier) this.tier = mission.Tier;
|
|
57
|
-
}
|
|
58
|
-
}
|