hypixel-api-reborn 11.1.0 → 11.2.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 (113) hide show
  1. package/.prettierrc +3 -3
  2. package/README.md +6 -4
  3. package/eslint.config.mjs +71 -0
  4. package/package.json +21 -25
  5. package/src/API/getAchievements.js +7 -0
  6. package/src/API/getBoosters.js +1 -0
  7. package/src/API/getChallenges.js +7 -0
  8. package/src/API/getGameCounts.js +1 -0
  9. package/src/API/getGuild.js +5 -4
  10. package/src/API/getGuildAchievements.js +7 -0
  11. package/src/API/getLeaderboards.js +4 -2
  12. package/src/API/getPlayer.js +2 -1
  13. package/src/API/getQuests.js +7 -0
  14. package/src/API/getRecentGames.js +6 -10
  15. package/src/API/getServerInfo.js +42 -37
  16. package/src/API/getStatus.js +2 -1
  17. package/src/API/getWatchdogStats.js +1 -0
  18. package/src/API/index.js +28 -17
  19. package/src/API/skyblock/getAuction.js +21 -0
  20. package/src/API/skyblock/{getSkyblockAuctions.js → getAuctions.js} +19 -12
  21. package/src/API/skyblock/{getSkyblockAuctionsByPlayer.js → getAuctionsByPlayer.js} +2 -2
  22. package/src/API/skyblock/{getSkyblockBazaar.js → getBazaar.js} +1 -3
  23. package/src/API/skyblock/getBingo.js +7 -0
  24. package/src/API/skyblock/getBingoByPlayer.js +14 -0
  25. package/src/API/skyblock/{getEndedSkyblockAuctions.js → getEndedAuctions.js} +1 -0
  26. package/src/API/skyblock/getFireSales.js +7 -0
  27. package/src/API/skyblock/getGovernment.js +7 -0
  28. package/src/API/skyblock/{getSkyblockMember.js → getMember.js} +10 -3
  29. package/src/API/skyblock/getMuseum.js +15 -0
  30. package/src/API/skyblock/{getSkyblockNews.js → getNews.js} +1 -0
  31. package/src/API/skyblock/{getSkyblockProfiles.js → getProfiles.js} +14 -7
  32. package/src/Client.js +127 -25
  33. package/src/Errors.js +38 -17
  34. package/src/Private/rateLimit.js +17 -13
  35. package/src/Private/requests.js +27 -16
  36. package/src/Private/updater.js +11 -8
  37. package/src/Private/uuidCache.js +23 -30
  38. package/src/Private/validate.js +33 -22
  39. package/src/index.js +9 -0
  40. package/src/structures/APIIncident.js +4 -11
  41. package/src/structures/APIStatus.js +0 -1
  42. package/src/structures/Boosters/Booster.js +14 -13
  43. package/src/structures/Color.js +93 -48
  44. package/src/structures/Game.js +4 -2
  45. package/src/structures/Guild/Guild.js +35 -48
  46. package/src/structures/Guild/GuildMember.js +8 -8
  47. package/src/structures/Guild/GuildRank.js +2 -2
  48. package/src/structures/MiniGames/Arcade.js +242 -235
  49. package/src/structures/MiniGames/ArenaBrawl.js +11 -11
  50. package/src/structures/MiniGames/BedWars.js +262 -131
  51. package/src/structures/MiniGames/BlitzSurvivalGames.js +24 -23
  52. package/src/structures/MiniGames/CopsAndCrims.js +1 -0
  53. package/src/structures/MiniGames/Duels.js +92 -33
  54. package/src/structures/MiniGames/MegaWalls.js +3 -1
  55. package/src/structures/MiniGames/MurderMystery.js +2 -2
  56. package/src/structures/MiniGames/Pit.js +230 -2
  57. package/src/structures/MiniGames/PitInventoryItem.js +43 -0
  58. package/src/structures/MiniGames/SkyWars.js +211 -195
  59. package/src/structures/MiniGames/SmashHeroes.js +37 -35
  60. package/src/structures/MiniGames/SpeedUHC.js +17 -4
  61. package/src/structures/MiniGames/TNTGames.js +1 -1
  62. package/src/structures/MiniGames/UHC.js +33 -14
  63. package/src/structures/MiniGames/WoolWars.js +6 -5
  64. package/src/structures/Pet.js +1 -1
  65. package/src/structures/Player.js +26 -121
  66. package/src/structures/PlayerCosmetics.js +67 -12
  67. package/src/structures/ServerInfo.js +1 -1
  68. package/src/structures/SkyBlock/Auctions/Auction.js +3 -1
  69. package/src/structures/SkyBlock/Auctions/AuctionInfo.js +3 -1
  70. package/src/structures/SkyBlock/Auctions/BaseAuction.js +2 -1
  71. package/src/structures/SkyBlock/Auctions/Bid.js +1 -0
  72. package/src/structures/SkyBlock/Auctions/PartialAuction.js +1 -0
  73. package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
  74. package/src/structures/SkyBlock/PlayerBingo.js +49 -0
  75. package/src/structures/SkyBlock/SkyblockInventoryItem.js +76 -32
  76. package/src/structures/SkyBlock/SkyblockMember.js +252 -289
  77. package/src/structures/SkyBlock/SkyblockMuseum.js +60 -0
  78. package/src/structures/SkyBlock/SkyblockMuseumItem.js +54 -0
  79. package/src/structures/SkyBlock/SkyblockPet.js +3 -3
  80. package/src/structures/SkyBlock/SkyblockProfile.js +37 -23
  81. package/src/structures/SkyBlock/Static/Bingo.js +101 -0
  82. package/src/structures/SkyBlock/Static/BingoData.js +45 -0
  83. package/src/structures/SkyBlock/Static/Candidate.js +40 -0
  84. package/src/structures/SkyBlock/Static/FireSale.js +55 -0
  85. package/src/structures/SkyBlock/Static/Government.js +74 -0
  86. package/src/structures/SkyBlock/Static/Perk.js +24 -0
  87. package/src/structures/Static/Achievement.js +87 -0
  88. package/src/structures/Static/AchievementTier.js +33 -0
  89. package/src/structures/Static/Achievements.js +30 -0
  90. package/src/structures/Static/Challenges.js +29 -0
  91. package/src/structures/Static/GameAchievements.js +36 -0
  92. package/src/structures/Static/GameChallenges.js +40 -0
  93. package/src/structures/Static/GameQuests.js +24 -0
  94. package/src/structures/Static/GuildAchievements.js +34 -0
  95. package/src/structures/Static/Quest.js +66 -0
  96. package/src/structures/Static/Quests.js +31 -0
  97. package/src/structures/Status.js +2 -2
  98. package/src/utils/Constants.js +384 -543
  99. package/src/utils/{guildExp.js → Guild.js} +46 -13
  100. package/src/utils/Player.js +112 -0
  101. package/src/utils/SkyblockUtils.js +448 -186
  102. package/src/utils/arrayTools.js +1 -1
  103. package/src/utils/divide.js +1 -1
  104. package/src/utils/index.js +2 -1
  105. package/src/utils/isGuildID.js +1 -1
  106. package/src/utils/oscillation.js +4 -2
  107. package/src/utils/removeSnakeCase.js +19 -8
  108. package/src/utils/rgbToHexColor.js +1 -1
  109. package/src/utils/romanize.js +35 -4
  110. package/src/utils/toUuid.js +12 -7
  111. package/src/utils/varInt.js +2 -2
  112. package/typings/index.d.ts +1246 -446
  113. package/src/utils/toIGN.js +0 -20
@@ -1,5 +1,4 @@
1
- const rgbToHexColor = require('../../utils/rgbToHexColor');
2
-
1
+ const { parseRarity, parseGearScore } = require('../../utils/SkyblockUtils');
3
2
  /**
4
3
  * Item class
5
4
  */
@@ -22,12 +21,13 @@ class SkyblockInventoryItem {
22
21
  * Item name
23
22
  * @type {string}
24
23
  */
25
- this.name = data.tag.display.Name !== null ? data.tag.display.Name.toString().replace(/§([1-9]|[a-f])|§/gm, '') : null;
24
+ this.name =
25
+ null !== data.tag.display.Name ? data.tag.display.Name.toString().replace(/§([1-9]|[a-f])|§/gm, '') : null;
26
26
  /**
27
27
  * Item lore
28
28
  * @type {string}
29
29
  */
30
- this.lore = data.tag.display.Lore.join('<br>');
30
+ this.lore = data.tag.display.Lore.join('\n');
31
31
  /**
32
32
  * Item lore
33
33
  * @type {string[]}
@@ -40,34 +40,28 @@ class SkyblockInventoryItem {
40
40
  this.loreForEmbed = this.lore.replace(/§([0-9]|[a-f])|§/gm, '').replace(/<br>/gm, '\n');
41
41
  /**
42
42
  * Hexadecimal color code of armor
43
- * @type {string}
43
+ * @type {string|null}
44
44
  */
45
- this.color = data.tag.ExtraAttributes.color ? rgbToHexColor(data.tag.ExtraAttributes.color.split(':')) : null;
45
+ this.color = data.tag.ExtraAttributes.color ?? data.tag.display.color ?? null;
46
46
  /**
47
47
  * Item enchantments
48
- * @type {object}
48
+ * @type {Record<string, number>}
49
49
  */
50
- this.enchantments = data.tag.ExtraAttributes.enchantments ? data.tag.ExtraAttributes.enchantments : null;
50
+ this.enchantments = data.tag.ExtraAttributes.enchantments ?? null;
51
51
  /**
52
52
  * Armor reforge
53
53
  * @type {string}
54
54
  */
55
- this.reforge = data.tag.ExtraAttributes.modifier ? data.tag.ExtraAttributes.modifier : null;
55
+ this.reforge = data.tag.ExtraAttributes.modifier ?? null;
56
56
  /**
57
57
  * Equipment gemstones (if any)
58
58
  * @type {SkyblockItemGemstone}
59
59
  */
60
60
  this.gemstones = data.tag.ExtraAttributes.gems
61
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] });
62
+ return new Object({ type: gem[0].split('_')[0], quality: gem[1] });
64
63
  })
65
64
  : null;
66
- /**
67
- * Anvil uses
68
- * @type {number}
69
- */
70
- this.anvilUses = data.tag.ExtraAttributes.anvil_uses ? data.tag.ExtraAttributes.anvil_uses : 0;
71
65
  /**
72
66
  * Damage
73
67
  * @type {number}
@@ -77,21 +71,84 @@ class SkyblockInventoryItem {
77
71
  * What rarity the item has, as an uppercase string
78
72
  * @author linearaccelerator
79
73
  * @type {string}
80
- * @version >6.0.1
81
74
  */
82
75
  this.rarity = parseRarity(this.loreArray[this.loreArray.length - 1]);
83
76
  /**
84
77
  * The amount of dungeon stars the item has (each star equates to a 10% stat boost while in dungeons)
85
- * @author linearaccelerator
86
78
  * @type {number}
87
79
  */
88
- this.dungeonStars = this.name.match(/(\u272a)/g) ? this.name.match(/(\u272a)/g).length : 0;
80
+ this.dungeonStars = data.tag.ExtraAttributes.upgrade_level ?? 0;
89
81
  /**
90
82
  * Dungeon gear score of the item (or null if not present)
91
83
  * @author linearaccelerator
92
84
  * @type {number}
93
85
  */
94
86
  this.gearScore = parseGearScore(this.loreArray) || null;
87
+ /**
88
+ * UUID of the item
89
+ * @type {string}
90
+ */
91
+ this.uuid = data.tag.ExtraAttributes.uuid ?? '';
92
+ /**
93
+ * Is the item soulbound
94
+ * @type {boolean}
95
+ */
96
+ this.soulbound = 1 === data.tag.ExtraAttributes.donated_museum;
97
+ /**
98
+ * Amount of art of war books applied to the item
99
+ * @type {number}
100
+ */
101
+ this.artOfWar = data.tag.ExtraAttributes.art_of_war_count ?? 0;
102
+ /**
103
+ * Rune
104
+ * @type {object}
105
+ */
106
+ this.rune = data.tag.ExtraAttributes.runes ?? null;
107
+ /**
108
+ * The amount of applied potato books
109
+ * @type {number}
110
+ */
111
+ this.hotPotatoBooks = data.tag.ExtraAttributes.hot_potato_count ?? 0;
112
+ /**
113
+ * Is the item recombobulated
114
+ * @type {boolean}
115
+ */
116
+ this.recombobulated = 1 === data.tag.ExtraAttributes.rarity_upgrades;
117
+ /**
118
+ * Item attributes
119
+ * @type {object}
120
+ */
121
+ this.attributes = data.tag.ExtraAttributes.attributes ?? {};
122
+ /**
123
+ * Hecatomb runs
124
+ * @type {number}
125
+ */
126
+ this.hecatomb = data.tag.ExtraAttributes.hecatomb_s_runs ?? 0;
127
+ /**
128
+ * Champion xp
129
+ * @type {number}
130
+ */
131
+ this.champion = data.tag.ExtraAttributes.champion_combat_xp ?? 0;
132
+ /**
133
+ * Cultivating
134
+ * @type {number}
135
+ */
136
+ this.cultivating = data.tag.ExtraAttributes.farmed_cultivating ?? 0;
137
+ /**
138
+ * Expertise Kills
139
+ * @type {number}
140
+ */
141
+ this.expertise = data.tag.ExtraAttributes.expertise_kills ?? 0;
142
+ /**
143
+ * Compact blocks Mined
144
+ * @type {number}
145
+ */
146
+ this.compact = data.tag.ExtraAttributes.compact_blocks ?? 0;
147
+ /**
148
+ * Armadillos Blocks Walked
149
+ * @type {number}
150
+ */
151
+ this.blocksWalked = data.tag.ExtraAttributes.blocks_walked ?? 0;
95
152
  }
96
153
  /**
97
154
  * Item Name
@@ -101,19 +158,6 @@ class SkyblockInventoryItem {
101
158
  return this.name;
102
159
  }
103
160
  }
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
161
 
118
162
  /**
119
163
  * @typedef {object} SkyblockItemGemstone