hypixel-api-reborn 10.0.0 → 11.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 (105) hide show
  1. package/.prettierrc +13 -0
  2. package/README.md +28 -16
  3. package/package.json +60 -58
  4. package/src/API/getAPIStatus.js +8 -8
  5. package/src/API/getBoosters.js +6 -6
  6. package/src/API/getGameCounts.js +6 -6
  7. package/src/API/getGuild.js +18 -18
  8. package/src/API/getLeaderboards.js +13 -13
  9. package/src/API/getPlayer.js +22 -27
  10. package/src/API/getRecentGames.js +18 -18
  11. package/src/API/getServerInfo.js +66 -77
  12. package/src/API/getStatus.js +8 -8
  13. package/src/API/getWatchdogStats.js +6 -6
  14. package/src/API/index.js +19 -23
  15. package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -10
  16. package/src/API/skyblock/getSkyblockAuctions.js +64 -64
  17. package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -11
  18. package/src/API/skyblock/getSkyblockBazaar.js +10 -10
  19. package/src/API/skyblock/getSkyblockMember.js +28 -25
  20. package/src/API/skyblock/getSkyblockNews.js +6 -6
  21. package/src/API/skyblock/getSkyblockProfiles.js +44 -41
  22. package/src/Client.js +406 -450
  23. package/src/Errors.js +44 -39
  24. package/src/Private/defaultCache.js +77 -78
  25. package/src/Private/rateLimit.js +79 -98
  26. package/src/Private/requests.js +65 -54
  27. package/src/Private/updater.js +45 -45
  28. package/src/Private/uuidCache.js +37 -33
  29. package/src/Private/validate.js +97 -97
  30. package/src/index.js +82 -83
  31. package/src/structures/APIIncident.js +78 -78
  32. package/src/structures/APIStatus.js +47 -47
  33. package/src/structures/Boosters/Booster.js +83 -87
  34. package/src/structures/Color.js +129 -129
  35. package/src/structures/Game.js +164 -160
  36. package/src/structures/GameCounts.js +151 -151
  37. package/src/structures/Guild/Guild.js +204 -218
  38. package/src/structures/Guild/GuildMember.js +66 -66
  39. package/src/structures/Guild/GuildRank.js +48 -48
  40. package/src/structures/ItemBytes.js +33 -36
  41. package/src/structures/Leaderboard.js +31 -31
  42. package/src/structures/MiniGames/Arcade.js +567 -569
  43. package/src/structures/MiniGames/ArenaBrawl.js +52 -56
  44. package/src/structures/MiniGames/BedWars.js +423 -351
  45. package/src/structures/MiniGames/BlitzSurvivalGames.js +172 -148
  46. package/src/structures/MiniGames/BuildBattle.js +53 -53
  47. package/src/structures/MiniGames/CopsAndCrims.js +90 -90
  48. package/src/structures/MiniGames/Duels.js +694 -630
  49. package/src/structures/MiniGames/MegaWalls.js +137 -137
  50. package/src/structures/MiniGames/MurderMystery.js +93 -93
  51. package/src/structures/MiniGames/Paintball.js +67 -67
  52. package/src/structures/MiniGames/Pit.js +19 -19
  53. package/src/structures/MiniGames/Quakecraft.js +101 -101
  54. package/src/structures/MiniGames/SkyWars.js +508 -559
  55. package/src/structures/MiniGames/SmashHeroes.js +144 -151
  56. package/src/structures/MiniGames/SpeedUHC.js +115 -57
  57. package/src/structures/MiniGames/TNTGames.js +116 -116
  58. package/src/structures/MiniGames/TurboKartRacers.js +201 -176
  59. package/src/structures/MiniGames/UHC.js +164 -143
  60. package/src/structures/MiniGames/VampireZ.js +60 -60
  61. package/src/structures/MiniGames/Walls.js +52 -52
  62. package/src/structures/MiniGames/Warlords.js +62 -62
  63. package/src/structures/MiniGames/WoolWars.js +123 -0
  64. package/src/structures/Pet.js +96 -97
  65. package/src/structures/Pets.js +64 -64
  66. package/src/structures/Player.js +433 -449
  67. package/src/structures/PlayerCosmetics.js +100 -95
  68. package/src/structures/RecentGame.js +57 -57
  69. package/src/structures/ServerInfo.js +78 -78
  70. package/src/structures/SkyBlock/Auctions/Auction.js +104 -104
  71. package/src/structures/SkyBlock/Auctions/AuctionInfo.js +54 -54
  72. package/src/structures/SkyBlock/Auctions/BaseAuction.js +45 -45
  73. package/src/structures/SkyBlock/Auctions/Bid.js +48 -48
  74. package/src/structures/SkyBlock/Auctions/PartialAuction.js +25 -25
  75. package/src/structures/SkyBlock/Bazzar/Order.js +38 -38
  76. package/src/structures/SkyBlock/Bazzar/Product.js +53 -53
  77. package/src/structures/SkyBlock/News/SkyblockNews.js +60 -68
  78. package/src/structures/SkyBlock/SkyblockInventoryItem.js +124 -130
  79. package/src/structures/SkyBlock/SkyblockMember.js +820 -687
  80. package/src/structures/SkyBlock/SkyblockPet.js +71 -71
  81. package/src/structures/SkyBlock/SkyblockProfile.js +60 -60
  82. package/src/structures/Status.js +41 -41
  83. package/src/structures/Watchdog/Stats.js +36 -36
  84. package/src/utils/Constants.js +2789 -809
  85. package/src/utils/SkyblockUtils.js +208 -164
  86. package/src/utils/arrayTools.js +4 -4
  87. package/src/utils/divide.js +5 -5
  88. package/src/utils/guildExp.js +57 -67
  89. package/src/utils/index.js +13 -13
  90. package/src/utils/isGuildID.js +3 -3
  91. package/src/utils/isUUID.js +5 -5
  92. package/src/utils/oscillation.js +15 -23
  93. package/src/utils/removeSnakeCase.js +22 -35
  94. package/src/utils/rgbToHexColor.js +8 -8
  95. package/src/utils/romanize.js +11 -13
  96. package/src/utils/toIGN.js +20 -20
  97. package/src/utils/toUuid.js +19 -19
  98. package/src/utils/varInt.js +17 -21
  99. package/typings/index.d.ts +3532 -2644
  100. package/src/API/getFriends.js +0 -14
  101. package/src/API/getKeyInfo.js +0 -10
  102. package/src/API/getRankedSkyWars.js +0 -11
  103. package/src/structures/Friend.js +0 -38
  104. package/src/structures/KeyInfo.js +0 -42
  105. package/src/structures/MiniGames/SkyWarsRanked.js +0 -45
@@ -1,130 +1,124 @@
1
- const rgbToHexColor = require('../../utils/rgbToHexColor');
2
-
3
- /**
4
- * Item class
5
- */
6
- class SkyblockInventoryItem {
7
- /**
8
- * @param {object} data Item data
9
- */
10
- constructor (data) {
11
- /**
12
- * Item ID
13
- * @type {number}
14
- */
15
- this.itemId = data.id || 0;
16
- /**
17
- * Item count
18
- * @type {number}
19
- */
20
- this.count = data.Count || 0;
21
- /**
22
- * Item name
23
- * @type {string}
24
- */
25
- this.name = data.tag.display.Name !== null ? data.tag.display.Name.toString().replace(/§([1-9]|[a-f])|§/gm, '') : null;
26
- /**
27
- * Item lore
28
- * @type {string}
29
- */
30
- this.lore = data.tag.display.Lore.join('<br>');
31
- /**
32
- * Item lore
33
- * @type {string[]}
34
- */
35
- this.loreArray = data.tag.display.Lore;
36
- /**
37
- * Item lore for embed
38
- * @type {string}
39
- */
40
- this.loreForEmbed = this.lore.replace(/§([0-9]|[a-f])|§/gm, '').replace(/<br>/gm, '\n');
41
- /**
42
- * Hexadecimal color code of armor
43
- * @type {string}
44
- */
45
- this.color = data.tag.ExtraAttributes.color ? rgbToHexColor(data.tag.ExtraAttributes.color.split(':')) : null;
46
- /**
47
- * Item enchantments
48
- * @type {object}
49
- */
50
- this.enchantments = data.tag.ExtraAttributes.enchantments ? data.tag.ExtraAttributes.enchantments : null;
51
- /**
52
- * Armor reforge
53
- * @type {string}
54
- */
55
- this.reforge = data.tag.ExtraAttributes.modifier ? data.tag.ExtraAttributes.modifier : null;
56
- /**
57
- * Equipment gemstones (if any)
58
- * @type {SkyblockItemGemstone}
59
- */
60
- // eslint-disable-next-line no-new-object
61
- this.gemstones = data.tag.ExtraAttributes.gems ? Object.entries(data.tag.ExtraAttributes.gems).map((gem) => new Object({
62
- type: gem[0].split('_')[0],
63
- quality: gem[1]
64
- })) : null;
65
- /**
66
- * Anvil uses
67
- * @type {number}
68
- */
69
- this.anvilUses = data.tag.ExtraAttributes.anvil_uses ? data.tag.ExtraAttributes.anvil_uses : 0;
70
- /**
71
- * Damage
72
- * @type {number}
73
- */
74
- this.damage = data.Damage || 0;
75
- /**
76
- * What rarity the item has, as an uppercase string
77
- * @author linearaccelerator
78
- * @type {string}
79
- * @version >6.0.1
80
- */
81
- this.rarity = parseRarity(this.loreArray[this.loreArray.length - 1]);
82
- /**
83
- * The amount of dungeon stars the item has (each star equates to a 10% stat boost while in dungeons)
84
- * @author linearaccelerator
85
- * @type {number}
86
- */
87
- this.dungeonStars = this.name.match(/(\u272a)/g) ? this.name.match(/(\u272a)/g).length : 0;
88
- /**
89
- * Dungeon gear score of the item (or null if not present)
90
- * @author linearaccelerator
91
- * @type {number}
92
- */
93
- this.gearScore = parseGearScore(this.loreArray) || null;
94
- }
95
- /**
96
- * Item Name
97
- * @return {string}
98
- */
99
- toString () {
100
- return this.name;
101
- }
102
- }
103
- /**
104
- * parses rarity
105
- * @param {string} stringContainingRarity
106
- * @return {string}
107
- */
108
- function parseRarity (stringContainingRarity) {
109
- const rarityArray = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC', 'DIVINE', 'SPECIAL', 'VERY SPECIAL'];
110
- for (const rarity of rarityArray) {
111
- if (stringContainingRarity.includes(rarity)) return rarity;
112
- }
113
- }
114
- /**
115
- * @param {string[]} lore
116
- * @return {number}
117
- */
118
- function parseGearScore (lore) {
119
- for (const line of lore) {
120
- if (line.match(/Gear Score: §[0-9a-f](\d+)/)) return Number(line.match(/Gear Score: §d(\d+)/)[1]);
121
- }
122
- }
123
-
124
- /**
125
- * @typedef {object} SkyblockItemGemstone
126
- * @property {string} type Gemstone type
127
- * @property {string} quality Gemstone quality (rough, flawed, fine, flawless, perfect)
128
- */
129
-
130
- module.exports = SkyblockInventoryItem;
1
+ const rgbToHexColor = require('../../utils/rgbToHexColor');
2
+
3
+ /**
4
+ * Item class
5
+ */
6
+ class SkyblockInventoryItem {
7
+ /**
8
+ * @param {object} data Item data
9
+ */
10
+ constructor(data) {
11
+ /**
12
+ * Item ID
13
+ * @type {number}
14
+ */
15
+ this.itemId = data.id || 0;
16
+ /**
17
+ * Item count
18
+ * @type {number}
19
+ */
20
+ this.count = data.Count || 0;
21
+ /**
22
+ * Item name
23
+ * @type {string}
24
+ */
25
+ this.name = data.tag.display.Name !== null ? data.tag.display.Name.toString().replace(/§([1-9]|[a-f])|§/gm, '') : null;
26
+ /**
27
+ * Item lore
28
+ * @type {string}
29
+ */
30
+ this.lore = data.tag.display.Lore.join('<br>');
31
+ /**
32
+ * Item lore
33
+ * @type {string[]}
34
+ */
35
+ this.loreArray = data.tag.display.Lore;
36
+ /**
37
+ * Item lore for embed
38
+ * @type {string}
39
+ */
40
+ this.loreForEmbed = this.lore.replace(/§([0-9]|[a-f])|§/gm, '').replace(/<br>/gm, '\n');
41
+ /**
42
+ * Hexadecimal color code of armor
43
+ * @type {string}
44
+ */
45
+ this.color = data.tag.ExtraAttributes.color ? rgbToHexColor(data.tag.ExtraAttributes.color.split(':')) : null;
46
+ /**
47
+ * Item enchantments
48
+ * @type {object}
49
+ */
50
+ this.enchantments = data.tag.ExtraAttributes.enchantments ? data.tag.ExtraAttributes.enchantments : null;
51
+ /**
52
+ * Armor reforge
53
+ * @type {string}
54
+ */
55
+ this.reforge = data.tag.ExtraAttributes.modifier ? data.tag.ExtraAttributes.modifier : null;
56
+ /**
57
+ * Equipment gemstones (if any)
58
+ * @type {SkyblockItemGemstone}
59
+ */
60
+ this.gemstones = data.tag.ExtraAttributes.gems
61
+ ? Object.entries(data.tag.ExtraAttributes.gems).map((gem) => {
62
+ // eslint-disable-next-line no-new-object
63
+ new Object({ type: gem[0].split('_')[0], quality: gem[1] });
64
+ })
65
+ : null;
66
+ /**
67
+ * Anvil uses
68
+ * @type {number}
69
+ */
70
+ this.anvilUses = data.tag.ExtraAttributes.anvil_uses ? data.tag.ExtraAttributes.anvil_uses : 0;
71
+ /**
72
+ * Damage
73
+ * @type {number}
74
+ */
75
+ this.damage = data.Damage || 0;
76
+ /**
77
+ * What rarity the item has, as an uppercase string
78
+ * @author linearaccelerator
79
+ * @type {string}
80
+ * @version >6.0.1
81
+ */
82
+ this.rarity = parseRarity(this.loreArray[this.loreArray.length - 1]);
83
+ /**
84
+ * The amount of dungeon stars the item has (each star equates to a 10% stat boost while in dungeons)
85
+ * @author linearaccelerator
86
+ * @type {number}
87
+ */
88
+ this.dungeonStars = this.name.match(/(\u272a)/g) ? this.name.match(/(\u272a)/g).length : 0;
89
+ /**
90
+ * Dungeon gear score of the item (or null if not present)
91
+ * @author linearaccelerator
92
+ * @type {number}
93
+ */
94
+ this.gearScore = parseGearScore(this.loreArray) || null;
95
+ }
96
+ /**
97
+ * Item Name
98
+ * @return {string}
99
+ */
100
+ toString() {
101
+ return this.name;
102
+ }
103
+ }
104
+ // eslint-disable-next-line require-jsdoc
105
+ function parseRarity(stringContainingRarity) {
106
+ const rarityArray = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC', 'DIVINE', 'SPECIAL', 'VERY SPECIAL'];
107
+ for (const rarity of rarityArray) {
108
+ if (stringContainingRarity.includes(rarity)) return rarity;
109
+ }
110
+ }
111
+ // eslint-disable-next-line require-jsdoc
112
+ function parseGearScore(lore) {
113
+ for (const line of lore) {
114
+ if (line.match(/Gear Score: §[0-9a-f](\d+)/)) return Number(line.match(/Gear Score: §d(\d+)/)[1]);
115
+ }
116
+ }
117
+
118
+ /**
119
+ * @typedef {object} SkyblockItemGemstone
120
+ * @property {string} type Gemstone type
121
+ * @property {string} quality Gemstone quality (rough, flawed, fine, flawless, perfect)
122
+ */
123
+
124
+ module.exports = SkyblockInventoryItem;