@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.
Files changed (65) hide show
  1. package/package.json +33 -82
  2. package/src/{Ability.js → Ability.ts} +11 -4
  3. package/src/{ArchonCrystal.js → ArchonCrystal.ts} +12 -5
  4. package/src/{ChallengeProgress.js → ChallengeProgress.ts} +11 -4
  5. package/src/Enemy.ts +55 -0
  6. package/src/Intrinsics.ts +98 -0
  7. package/src/ItemConfig.ts +71 -0
  8. package/src/LoadOutInventory.ts +69 -0
  9. package/src/LoadOutItem.ts +194 -0
  10. package/src/LoadOutPreset.ts +122 -0
  11. package/src/Mission.ts +75 -0
  12. package/src/OperatorLoadOuts.ts +108 -0
  13. package/src/Polarity.ts +31 -0
  14. package/src/Profile.ts +308 -0
  15. package/src/ProfileParser.ts +66 -0
  16. package/src/Pvp.ts +43 -0
  17. package/src/Race.ts +36 -0
  18. package/src/Scan.ts +30 -0
  19. package/src/{Skin.js → Skin.ts} +14 -6
  20. package/src/Stats.ts +504 -0
  21. package/src/Syndicate.ts +39 -0
  22. package/src/Utils.ts +85 -0
  23. package/src/{Weapon.js → Weapon.ts} +23 -3
  24. package/src/XpInfo.ts +41 -0
  25. package/src/Enemy.js +0 -47
  26. package/src/Intrinsics.js +0 -77
  27. package/src/ItemConfig.js +0 -52
  28. package/src/LoadOutInventory.js +0 -53
  29. package/src/LoadOutItem.js +0 -155
  30. package/src/LoadOutPreset.js +0 -90
  31. package/src/Mission.js +0 -58
  32. package/src/OperatorLoadOuts.js +0 -77
  33. package/src/Polarity.js +0 -25
  34. package/src/Profile.js +0 -213
  35. package/src/ProfileParser.js +0 -50
  36. package/src/Pvp.js +0 -35
  37. package/src/Race.js +0 -33
  38. package/src/Scan.js +0 -22
  39. package/src/Stats.js +0 -340
  40. package/src/Syndicate.js +0 -34
  41. package/src/Utils.js +0 -66
  42. package/src/XpInfo.js +0 -35
  43. package/types/Ability.d.ts +0 -20
  44. package/types/ArchonCrystal.d.ts +0 -22
  45. package/types/ChallengeProgress.d.ts +0 -21
  46. package/types/Enemy.d.ts +0 -41
  47. package/types/Intrinsics.d.ts +0 -66
  48. package/types/ItemConfig.d.ts +0 -21
  49. package/types/LoadOutInventory.d.ts +0 -45
  50. package/types/LoadOutItem.d.ts +0 -92
  51. package/types/LoadOutPreset.d.ts +0 -45
  52. package/types/Mission.d.ts +0 -35
  53. package/types/OperatorLoadOuts.d.ts +0 -35
  54. package/types/Polarity.d.ts +0 -21
  55. package/types/Profile.d.ts +0 -154
  56. package/types/ProfileParser.d.ts +0 -41
  57. package/types/Pvp.d.ts +0 -31
  58. package/types/Race.d.ts +0 -28
  59. package/types/Scan.d.ts +0 -20
  60. package/types/Skin.d.ts +0 -19
  61. package/types/Stats.d.ts +0 -255
  62. package/types/Syndicate.d.ts +0 -26
  63. package/types/Utils.d.ts +0 -3
  64. package/types/Weapon.d.ts +0 -51
  65. package/types/XpInfo.d.ts +0 -28
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 'warframe-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:"warframe-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:"warframe-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:"warframe-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:"warframe-items".ColorMap | undefined}
49
- */
50
- if (config.syancol) this.syandanaColor = colors.mapColors(mapToHex(config.syancol));
51
- }
52
- }
@@ -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
- }
@@ -1,155 +0,0 @@
1
- import { colors } from 'warframe-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 Warframe-items
41
- * @type {module:"warframe-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:"warframe-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:"warframe-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:"warframe-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:"warframe-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:"warframe-items".ColorMap | undefined}
152
- */
153
- if (weapon.InfestationDate) this.infestationDate = parseDate(weapon.InfestationDate);
154
- }
155
- }
@@ -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
- }
@@ -1,77 +0,0 @@
1
- import { colors } from 'warframe-items/utilities';
2
-
3
- import Skin from './Skin.js';
4
- import { mapToHex } from './Utils.js';
5
-
6
- /**
7
- * Player's operator loadout
8
- * @module
9
- */
10
- export default class OperatorLoadOuts {
11
- /**
12
- *
13
- * @param {Object} loadout The operator loadout
14
- */
15
- constructor(loadout) {
16
- /**
17
- * Skins that have been applied to the player's operator.
18
- * @type {Array<Skin>}
19
- */
20
- this.skins = loadout.Skins.filter(Boolean).map((s) => new Skin({ ItemType: s }));
21
-
22
- /**
23
- * Operator amp ID
24
- * @type {String | undefined}
25
- */
26
- this.operatorAmp = loadout.OperatorAmp?.$oid;
27
-
28
- /**
29
- * Applied upgrade IDs
30
- * @type {Array<String>}
31
- */
32
- this.upgrades = loadout.Upgrades;
33
- this.abilityOverride = loadout.AbilityOverride;
34
-
35
- /**
36
- * Operator primary colors
37
- * @type {module:"warframe-items".ColorMap | undefined}
38
- */
39
- if (loadout.pricol) this.primaryColor = colors.mapColors(mapToHex(loadout.pricol));
40
-
41
- /**
42
- * Operator sigil colors
43
- * @type {module:"warframe-items".ColorMap | undefined}
44
- */
45
- if (loadout.sigcol) this.sigilColor = colors.mapColors(mapToHex(loadout.sigcol));
46
-
47
- /**
48
- * Operator attachment colors
49
- * @type {module:"warframe-items".ColorMap | undefined}
50
- */
51
- if (loadout.attcol) this.attachmentsColor = colors.mapColors(mapToHex(loadout.attcol));
52
-
53
- /**
54
- * Operator syandana colors
55
- * @type {module:"warframe-items".ColorMap | undefined}
56
- */
57
- if (loadout.syancol) this.syandanaColor = colors.mapColors(mapToHex(loadout.syancol));
58
-
59
- /**
60
- * Operator eye colors
61
- * @type {module:"warframe-items".ColorMap | undefined}
62
- */
63
- if (loadout.eyecol) this.eyeColor = colors.mapColors(mapToHex(loadout.eyecol));
64
-
65
- /**
66
- * Operator facial colors
67
- * @type {module:"warframe-items".ColorMap | undefined}
68
- */
69
- if (loadout.facial) this.facial = colors.mapColors(mapToHex(loadout.facial));
70
-
71
- /**
72
- * Operator cloth colors
73
- * @type {module:"warframe-items".ColorMap | undefined}
74
- */
75
- if (loadout.cloth) this.cloth = colors.mapColors(mapToHex(loadout.cloth));
76
- }
77
- }
package/src/Polarity.js DELETED
@@ -1,25 +0,0 @@
1
- import { translatePolarity } from 'warframe-worldstate-data/utilities';
2
-
3
- /**
4
- * A polarity in a LoadOutItem
5
- * @module
6
- */
7
- export default class Polarity {
8
- /**
9
- *
10
- * @param {Object} polarity The polarity to parse
11
- */
12
- constructor(polarity) {
13
- /**
14
- * Polarity name
15
- * @type {String}
16
- */
17
- this.polarity = translatePolarity(polarity.Value);
18
-
19
- /**
20
- * Polarized slot
21
- * @type {number}
22
- */
23
- this.slot = polarity.Slot;
24
- }
25
- }