@wfcd/profile-parser 2.0.0 → 2.0.1

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 (100) hide show
  1. package/dist/Ability-D1F1s_19.js +25 -0
  2. package/dist/Ability-DzKgEG5R.d.ts +19 -0
  3. package/dist/Ability.d.ts +2 -0
  4. package/dist/Ability.js +3 -0
  5. package/dist/ArchonCrystal.d.ts +23 -0
  6. package/dist/ArchonCrystal.js +29 -0
  7. package/dist/ChallengeProgress-B8Kv32oi.d.ts +20 -0
  8. package/dist/ChallengeProgress-DKKtijWw.js +26 -0
  9. package/dist/ChallengeProgress.d.ts +2 -0
  10. package/dist/ChallengeProgress.js +3 -0
  11. package/dist/Enemy-BqxhFdkB.js +44 -0
  12. package/{src/Enemy.ts → dist/Enemy-toy1Spyi.d.ts} +6 -17
  13. package/dist/Enemy.d.ts +2 -0
  14. package/dist/Enemy.js +3 -0
  15. package/dist/Intrinsics-CqFOpLxp.js +67 -0
  16. package/{src/Intrinsics.ts → dist/Intrinsics-azrsOZJd.d.ts} +6 -37
  17. package/dist/Intrinsics.d.ts +2 -0
  18. package/dist/Intrinsics.js +3 -0
  19. package/dist/ItemConfig-7as-gjPG.d.ts +51 -0
  20. package/dist/ItemConfig-uU36aJFJ.js +50 -0
  21. package/dist/ItemConfig.d.ts +4 -0
  22. package/dist/ItemConfig.js +5 -0
  23. package/{src/LoadOutInventory.ts → dist/LoadOutInventory-BsPRtXfG.d.ts} +10 -26
  24. package/dist/LoadOutInventory-CPVZJ_W5.js +52 -0
  25. package/dist/LoadOutInventory.d.ts +8 -0
  26. package/dist/LoadOutInventory.js +9 -0
  27. package/dist/LoadOutItem-B_6G9dXC.js +127 -0
  28. package/dist/LoadOutItem-BlRFZMNd.d.ts +120 -0
  29. package/dist/LoadOutItem.d.ts +6 -0
  30. package/dist/LoadOutItem.js +7 -0
  31. package/{src/LoadOutPreset.ts → dist/LoadOutPreset-BshJF0LH.d.ts} +11 -50
  32. package/dist/LoadOutPreset-CMbZo-II.js +83 -0
  33. package/dist/LoadOutPreset.d.ts +2 -0
  34. package/dist/LoadOutPreset.js +4 -0
  35. package/{src/Mission.ts → dist/Mission-BZgLMluh.d.ts} +7 -29
  36. package/dist/Mission-D2n1i5R2.js +55 -0
  37. package/dist/Mission.d.ts +2 -0
  38. package/dist/Mission.js +3 -0
  39. package/dist/OperatorLoadOuts-B8bEy2dp.js +76 -0
  40. package/dist/OperatorLoadOuts-Dk2uMwby.d.ts +75 -0
  41. package/dist/OperatorLoadOuts.d.ts +4 -0
  42. package/dist/OperatorLoadOuts.js +5 -0
  43. package/dist/Polarity--RYq3iwF.js +28 -0
  44. package/dist/Polarity-DDWqEVm2.d.ts +26 -0
  45. package/dist/Polarity.d.ts +2 -0
  46. package/dist/Polarity.js +3 -0
  47. package/dist/Profile-WWZ2BDf0.js +193 -0
  48. package/{src/Profile.ts → dist/Profile-rva_Xss5.d.ts} +27 -123
  49. package/dist/Profile.d.ts +15 -0
  50. package/dist/Profile.js +16 -0
  51. package/dist/ProfileParser.d.ts +71 -0
  52. package/dist/ProfileParser.js +71 -0
  53. package/{src/Pvp.ts → dist/Pvp-Cb1KNKvw.d.ts} +6 -13
  54. package/dist/Pvp-hyzYfVBB.js +36 -0
  55. package/dist/Pvp.d.ts +2 -0
  56. package/dist/Pvp.js +3 -0
  57. package/dist/Race-5Q0StEkE.js +35 -0
  58. package/{src/Race.ts → dist/Race-DCxzjMpC.d.ts} +9 -13
  59. package/dist/Race.d.ts +2 -0
  60. package/dist/Race.js +3 -0
  61. package/{src/Scan.ts → dist/Scan-BWfZiLoW.d.ts} +6 -9
  62. package/dist/Scan-Dlrv6viG.js +27 -0
  63. package/dist/Scan.d.ts +2 -0
  64. package/dist/Scan.js +3 -0
  65. package/dist/Skin-BbUkegH1.d.ts +28 -0
  66. package/dist/Skin-D6v6jC9U.js +36 -0
  67. package/dist/Skin.d.ts +2 -0
  68. package/dist/Skin.js +4 -0
  69. package/dist/Stats-Bm1bpQe5.js +305 -0
  70. package/{src/Stats.ts → dist/Stats-DtkR2w1A.d.ts} +22 -201
  71. package/dist/Stats.d.ts +9 -0
  72. package/dist/Stats.js +10 -0
  73. package/dist/Syndicate-CjUKKAsk.js +33 -0
  74. package/{src/Syndicate.ts → dist/Syndicate-FSUt1PP5.d.ts} +7 -13
  75. package/dist/Syndicate.d.ts +2 -0
  76. package/dist/Syndicate.js +3 -0
  77. package/dist/Utils-C3kZCO6a.js +60 -0
  78. package/dist/Utils-C7BZqK4e.d.ts +37 -0
  79. package/dist/Utils.d.ts +2 -0
  80. package/dist/Utils.js +3 -0
  81. package/dist/Weapon-4KlXEHQF.js +64 -0
  82. package/dist/Weapon-DAJp-nbn.d.ts +32 -0
  83. package/dist/Weapon.d.ts +2 -0
  84. package/dist/Weapon.js +3 -0
  85. package/dist/XpInfo-CXC3I0NQ.js +35 -0
  86. package/{src/XpInfo.ts → dist/XpInfo-ChJ_lJaH.d.ts} +7 -14
  87. package/dist/XpInfo.d.ts +2 -0
  88. package/dist/XpInfo.js +4 -0
  89. package/package.json +2 -2
  90. package/src/Ability.ts +0 -29
  91. package/src/ArchonCrystal.ts +0 -33
  92. package/src/ChallengeProgress.ts +0 -30
  93. package/src/ItemConfig.ts +0 -71
  94. package/src/LoadOutItem.ts +0 -194
  95. package/src/OperatorLoadOuts.ts +0 -108
  96. package/src/Polarity.ts +0 -31
  97. package/src/ProfileParser.ts +0 -66
  98. package/src/Skin.ts +0 -41
  99. package/src/Utils.ts +0 -85
  100. 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
- }
@@ -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
- }