@wfcd/profile-parser 2.0.0 → 2.0.2
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/dist/Ability-D1F1s_19.js +25 -0
- package/dist/Ability-DzKgEG5R.d.ts +19 -0
- package/dist/Ability.d.ts +2 -0
- package/dist/Ability.js +3 -0
- package/dist/ArchonCrystal.d.ts +23 -0
- package/dist/ArchonCrystal.js +29 -0
- package/dist/ChallengeProgress-B8Kv32oi.d.ts +20 -0
- package/dist/ChallengeProgress-DKKtijWw.js +26 -0
- package/dist/ChallengeProgress.d.ts +2 -0
- package/dist/ChallengeProgress.js +3 -0
- package/dist/Enemy-BqxhFdkB.js +44 -0
- package/{src/Enemy.ts → dist/Enemy-toy1Spyi.d.ts} +6 -17
- package/dist/Enemy.d.ts +2 -0
- package/dist/Enemy.js +3 -0
- package/dist/Intrinsics-CqFOpLxp.js +67 -0
- package/{src/Intrinsics.ts → dist/Intrinsics-azrsOZJd.d.ts} +6 -37
- package/dist/Intrinsics.d.ts +2 -0
- package/dist/Intrinsics.js +3 -0
- package/dist/ItemConfig-7as-gjPG.d.ts +51 -0
- package/dist/ItemConfig-uU36aJFJ.js +50 -0
- package/dist/ItemConfig.d.ts +4 -0
- package/dist/ItemConfig.js +5 -0
- package/{src/LoadOutInventory.ts → dist/LoadOutInventory-BsPRtXfG.d.ts} +10 -26
- package/dist/LoadOutInventory-CPVZJ_W5.js +52 -0
- package/dist/LoadOutInventory.d.ts +8 -0
- package/dist/LoadOutInventory.js +9 -0
- package/dist/LoadOutItem-B_6G9dXC.js +127 -0
- package/dist/LoadOutItem-BlRFZMNd.d.ts +120 -0
- package/dist/LoadOutItem.d.ts +6 -0
- package/dist/LoadOutItem.js +7 -0
- package/{src/LoadOutPreset.ts → dist/LoadOutPreset-BshJF0LH.d.ts} +11 -50
- package/dist/LoadOutPreset-CMbZo-II.js +83 -0
- package/dist/LoadOutPreset.d.ts +2 -0
- package/dist/LoadOutPreset.js +4 -0
- package/{src/Mission.ts → dist/Mission-BZgLMluh.d.ts} +7 -29
- package/dist/Mission-D2n1i5R2.js +55 -0
- package/dist/Mission.d.ts +2 -0
- package/dist/Mission.js +3 -0
- package/dist/OperatorLoadOuts-B8bEy2dp.js +76 -0
- package/dist/OperatorLoadOuts-Dk2uMwby.d.ts +75 -0
- package/dist/OperatorLoadOuts.d.ts +4 -0
- package/dist/OperatorLoadOuts.js +5 -0
- package/dist/Polarity--RYq3iwF.js +28 -0
- package/dist/Polarity-DDWqEVm2.d.ts +26 -0
- package/dist/Polarity.d.ts +2 -0
- package/dist/Polarity.js +3 -0
- package/dist/Profile-WWZ2BDf0.js +193 -0
- package/{src/Profile.ts → dist/Profile-rva_Xss5.d.ts} +27 -123
- package/dist/Profile.d.ts +15 -0
- package/dist/Profile.js +16 -0
- package/dist/ProfileParser.d.ts +71 -0
- package/dist/ProfileParser.js +71 -0
- package/{src/Pvp.ts → dist/Pvp-Cb1KNKvw.d.ts} +6 -13
- package/dist/Pvp-hyzYfVBB.js +36 -0
- package/dist/Pvp.d.ts +2 -0
- package/dist/Pvp.js +3 -0
- package/dist/Race-5Q0StEkE.js +35 -0
- package/{src/Race.ts → dist/Race-DCxzjMpC.d.ts} +9 -13
- package/dist/Race.d.ts +2 -0
- package/dist/Race.js +3 -0
- package/{src/Scan.ts → dist/Scan-BWfZiLoW.d.ts} +6 -9
- package/dist/Scan-Dlrv6viG.js +27 -0
- package/dist/Scan.d.ts +2 -0
- package/dist/Scan.js +3 -0
- package/dist/Skin-BbUkegH1.d.ts +28 -0
- package/dist/Skin-D6v6jC9U.js +36 -0
- package/dist/Skin.d.ts +2 -0
- package/dist/Skin.js +4 -0
- package/dist/Stats-Bm1bpQe5.js +305 -0
- package/{src/Stats.ts → dist/Stats-DtkR2w1A.d.ts} +22 -201
- package/dist/Stats.d.ts +9 -0
- package/dist/Stats.js +10 -0
- package/dist/Syndicate-CjUKKAsk.js +33 -0
- package/{src/Syndicate.ts → dist/Syndicate-FSUt1PP5.d.ts} +7 -13
- package/dist/Syndicate.d.ts +2 -0
- package/dist/Syndicate.js +3 -0
- package/dist/Utils-C3kZCO6a.js +60 -0
- package/dist/Utils-C7BZqK4e.d.ts +37 -0
- package/dist/Utils.d.ts +2 -0
- package/dist/Utils.js +3 -0
- package/dist/Weapon-4KlXEHQF.js +64 -0
- package/dist/Weapon-DAJp-nbn.d.ts +32 -0
- package/dist/Weapon.d.ts +2 -0
- package/dist/Weapon.js +3 -0
- package/dist/XpInfo-CXC3I0NQ.js +35 -0
- package/{src/XpInfo.ts → dist/XpInfo-ChJ_lJaH.d.ts} +7 -14
- package/dist/XpInfo.d.ts +2 -0
- package/dist/XpInfo.js +4 -0
- package/package.json +5 -5
- package/src/Ability.ts +0 -29
- package/src/ArchonCrystal.ts +0 -33
- package/src/ChallengeProgress.ts +0 -30
- package/src/ItemConfig.ts +0 -71
- package/src/LoadOutItem.ts +0 -194
- package/src/OperatorLoadOuts.ts +0 -108
- package/src/Polarity.ts +0 -31
- package/src/ProfileParser.ts +0 -66
- package/src/Skin.ts +0 -41
- package/src/Utils.ts +0 -85
- package/src/Weapon.ts +0 -79
package/src/Polarity.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
}
|
package/src/ProfileParser.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
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/Skin.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Item } from '@wfcd/items';
|
|
2
|
-
import { find } from './Utils';
|
|
3
|
-
|
|
4
|
-
export interface RawSkin {
|
|
5
|
-
ItemType: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A skin class
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
export default class Skin {
|
|
13
|
-
uniqueName: string;
|
|
14
|
-
item?: Item;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param skin The skin data to parse
|
|
19
|
-
* @param locale The locale to return skin item in
|
|
20
|
-
*/
|
|
21
|
-
constructor(skin: RawSkin, locale = 'en') {
|
|
22
|
-
/**
|
|
23
|
-
* Unique name
|
|
24
|
-
*/
|
|
25
|
-
this.uniqueName = skin.ItemType;
|
|
26
|
-
|
|
27
|
-
const item = find(skin.ItemType, locale);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The Warframe item that matches the unique name
|
|
31
|
-
*/
|
|
32
|
-
if (item) this.item = item;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Move to Skin, this is just here to not break anything for early users
|
|
38
|
-
* @param {Object} skin Skin object
|
|
39
|
-
* @returns {Skin} Skin object with possible item
|
|
40
|
-
*/
|
|
41
|
-
export const WeaponSkin = (skin: RawSkin) => new Skin(skin);
|
package/src/Utils.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
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));
|
package/src/Weapon.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Represents a player's used weapon stats
|
|
14
|
-
* @module
|
|
15
|
-
*/
|
|
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
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param weapon The weapon stats being parsed
|
|
29
|
-
*/
|
|
30
|
-
constructor(weapon: RawWeapon) {
|
|
31
|
-
/**
|
|
32
|
-
* Weapon unique name
|
|
33
|
-
* @type {String}
|
|
34
|
-
*/
|
|
35
|
-
this.uniqueName = weapon.type;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Earned XP with weapon
|
|
39
|
-
* @type {number}
|
|
40
|
-
*/
|
|
41
|
-
this.xp = weapon.xp;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Time using this weapon
|
|
45
|
-
* @type {number}
|
|
46
|
-
*/
|
|
47
|
-
this.equipTime = weapon.equipTime;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Headshots using this weapon
|
|
51
|
-
* @type {number}
|
|
52
|
-
*/
|
|
53
|
-
this.headShots = weapon.headShots;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Hits using weapon
|
|
57
|
-
* @type {number}
|
|
58
|
-
*/
|
|
59
|
-
this.hits = weapon.hits;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Assists using weapon
|
|
63
|
-
* @type {number}
|
|
64
|
-
*/
|
|
65
|
-
this.assists = weapon.assists;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Kills with weapon
|
|
69
|
-
* @type {number}
|
|
70
|
-
*/
|
|
71
|
-
this.kills = weapon.kills;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Shots fired
|
|
75
|
-
* @type {number}
|
|
76
|
-
*/
|
|
77
|
-
this.fired = weapon.fired;
|
|
78
|
-
}
|
|
79
|
-
}
|