hypixel-api-reborn 11.2.0 → 11.3.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 (101) hide show
  1. package/README.md +1 -1
  2. package/eslint.config.mjs +71 -0
  3. package/package.json +14 -20
  4. package/src/API/getAchievements.js +1 -0
  5. package/src/API/getBoosters.js +1 -0
  6. package/src/API/getChallenges.js +1 -0
  7. package/src/API/getGameCounts.js +1 -0
  8. package/src/API/getGuild.js +4 -3
  9. package/src/API/getGuildAchievements.js +1 -0
  10. package/src/API/getLeaderboards.js +1 -1
  11. package/src/API/getPlayer.js +1 -0
  12. package/src/API/getQuests.js +1 -0
  13. package/src/API/getRecentGames.js +5 -9
  14. package/src/API/getServerInfo.js +40 -37
  15. package/src/API/getStatus.js +1 -0
  16. package/src/API/getWatchdogStats.js +1 -0
  17. package/src/API/housing/getActiveHouses.js +7 -0
  18. package/src/API/housing/getHouse.js +9 -0
  19. package/src/API/housing/getPlayerHouses.js +11 -0
  20. package/src/API/index.js +6 -1
  21. package/src/API/skyblock/getAuction.js +8 -6
  22. package/src/API/skyblock/getAuctions.js +15 -12
  23. package/src/API/skyblock/getAuctionsByPlayer.js +1 -1
  24. package/src/API/skyblock/getBazaar.js +1 -3
  25. package/src/API/skyblock/getBingo.js +1 -2
  26. package/src/API/skyblock/getBingoByPlayer.js +3 -3
  27. package/src/API/skyblock/getEndedAuctions.js +1 -0
  28. package/src/API/skyblock/getFireSales.js +1 -1
  29. package/src/API/skyblock/getGarden.js +7 -0
  30. package/src/API/skyblock/getGovernment.js +1 -2
  31. package/src/API/skyblock/getMember.js +5 -2
  32. package/src/API/skyblock/getMuseum.js +1 -0
  33. package/src/API/skyblock/getNews.js +1 -0
  34. package/src/API/skyblock/getProfiles.js +5 -2
  35. package/src/Client.js +88 -16
  36. package/src/Private/rateLimit.js +7 -11
  37. package/src/Private/requests.js +12 -13
  38. package/src/Private/updater.js +2 -3
  39. package/src/Private/uuidCache.js +1 -2
  40. package/src/Private/validate.js +19 -19
  41. package/src/index.js +5 -0
  42. package/src/structures/APIIncident.js +1 -2
  43. package/src/structures/APIStatus.js +0 -1
  44. package/src/structures/Boosters/Booster.js +9 -8
  45. package/src/structures/Game.js +1 -1
  46. package/src/structures/Guild/Guild.js +19 -36
  47. package/src/structures/Guild/GuildMember.js +2 -2
  48. package/src/structures/House.js +54 -0
  49. package/src/structures/MiniGames/Arcade.js +798 -312
  50. package/src/structures/MiniGames/ArenaBrawl.js +98 -32
  51. package/src/structures/MiniGames/BedWars.js +197 -194
  52. package/src/structures/MiniGames/BlitzSurvivalGames.js +381 -129
  53. package/src/structures/MiniGames/BuildBattle.js +19 -8
  54. package/src/structures/MiniGames/CopsAndCrims.js +253 -25
  55. package/src/structures/MiniGames/Duels.js +905 -664
  56. package/src/structures/MiniGames/MegaWalls.js +390 -51
  57. package/src/structures/MiniGames/MurderMystery.js +151 -30
  58. package/src/structures/MiniGames/Paintball.js +31 -11
  59. package/src/structures/MiniGames/Pit.js +4 -5
  60. package/src/structures/MiniGames/Quakecraft.js +113 -50
  61. package/src/structures/MiniGames/SkyWars.js +528 -372
  62. package/src/structures/MiniGames/SmashHeroes.js +201 -73
  63. package/src/structures/MiniGames/SpeedUHC.js +77 -24
  64. package/src/structures/MiniGames/TNTGames.js +242 -73
  65. package/src/structures/MiniGames/TurboKartRacers.js +55 -115
  66. package/src/structures/MiniGames/UHC.js +144 -132
  67. package/src/structures/MiniGames/VampireZ.js +70 -37
  68. package/src/structures/MiniGames/Warlords.js +126 -1
  69. package/src/structures/MiniGames/WoolWars.js +60 -9
  70. package/src/structures/Pet.js +1 -1
  71. package/src/structures/Player.js +43 -128
  72. package/src/structures/PlayerCosmetics.js +5 -4
  73. package/src/structures/SkyBlock/Auctions/AuctionInfo.js +2 -1
  74. package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -1
  75. package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
  76. package/src/structures/SkyBlock/PlayerBingo.js +7 -14
  77. package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
  78. package/src/structures/SkyBlock/SkyblockInventoryItem.js +4 -28
  79. package/src/structures/SkyBlock/SkyblockMember.js +90 -228
  80. package/src/structures/SkyBlock/SkyblockPet.js +3 -4
  81. package/src/structures/SkyBlock/Static/Bingo.js +10 -11
  82. package/src/structures/SkyBlock/Static/BingoData.js +1 -1
  83. package/src/structures/Static/Achievement.js +16 -15
  84. package/src/structures/Static/AchievementTier.js +2 -2
  85. package/src/structures/Static/Quest.js +2 -2
  86. package/src/utils/Constants.js +522 -520
  87. package/src/utils/{guildExp.js → Guild.js} +42 -12
  88. package/src/utils/Player.js +112 -0
  89. package/src/utils/SkyblockUtils.js +482 -192
  90. package/src/utils/arrayTools.js +1 -1
  91. package/src/utils/divide.js +1 -1
  92. package/src/utils/index.js +2 -1
  93. package/src/utils/isGuildID.js +1 -1
  94. package/src/utils/oscillation.js +4 -2
  95. package/src/utils/removeSnakeCase.js +11 -7
  96. package/src/utils/rgbToHexColor.js +1 -1
  97. package/src/utils/romanize.js +3 -3
  98. package/src/utils/toUuid.js +4 -4
  99. package/src/utils/varInt.js +2 -2
  100. package/typings/index.d.ts +1186 -967
  101. package/src/utils/toIGN.js +0 -24
@@ -1,5 +1,5 @@
1
1
  module.exports = (a = 0, b = 1) => {
2
- const out = +((a || 0) / (b || 0)).toFixed(2) || 0;
2
+ const out = Number(((a || 0) / (b || 0)).toFixed(2)) || 0;
3
3
  if (isFinite(out)) return out;
4
4
  return a;
5
5
  };
@@ -2,12 +2,13 @@ module.exports = {
2
2
  arrayTool: require('./arrayTools'),
3
3
  Constants: require('./Constants'),
4
4
  divide: require('./divide'),
5
+ guild: require('./Guild'),
5
6
  isGuildID: require('./isGuildID'),
6
7
  isUUID: require('./isUUID'),
7
8
  oscillation: require('./oscillation'),
9
+ player: require('./Player'),
8
10
  removeSnakeCase: require('./removeSnakeCase'),
9
11
  SkyblockUtils: require('./SkyblockUtils'),
10
- toIGN: require('./toIGN'),
11
12
  toUuid: require('./toUuid'),
12
13
  varInt: require('./varInt')
13
14
  };
@@ -1,3 +1,3 @@
1
1
  module.exports = (id) => {
2
- return id.length === 24;
2
+ return 24 === id.length;
3
3
  };
@@ -1,13 +1,15 @@
1
1
  // See https://github.com/HypixelDev/PublicAPI/blob/db26b5fd3b7bb29da14e40e6d211143ec44a4519/Documentation/misc/Oscillation.md
2
2
  // Month oscillation started in December 2014, so every month that is pair ( odd in js!! ) is month A
3
3
  // Weekly oscillation started... just refer to the code in the docs
4
- // eslint-disable-next-line require-jsdoc
4
+
5
+ // eslint-disable-next-line jsdoc/require-jsdoc
5
6
  function monthAB(date = Date.now()) {
6
7
  return new Date(date).getMonth() % 2 ? 'a' : 'b';
7
8
  }
8
9
 
9
10
  const weeklyOscillationStart = 1417237200000;
10
- // eslint-disable-next-line require-jsdoc
11
+
12
+ // eslint-disable-next-line jsdoc/require-jsdoc
11
13
  function weekAB(date = Date.now()) {
12
14
  return (Math.abs(new Date(date).getTime() - weeklyOscillationStart) / 604800000) % 2 ? 'a' : 'b';
13
15
  }
@@ -1,11 +1,13 @@
1
- // eslint-disable-next-line require-jsdoc
2
- const single = (obj) =>
1
+ const single = (obj) => {
3
2
  Object.keys(obj).reduce((pV, cV) => ({ ...pV, [cV.replace(/_[a-z]/gi, (x) => x[1].toUpperCase())]: obj[cV] }), {});
4
- // eslint-disable-next-line require-jsdoc
3
+ };
4
+
5
+ // eslint-disable-next-line jsdoc/require-jsdoc
5
6
  function validateJSON(obj) {
6
- return typeof obj === 'object' && JSON.stringify(obj)[0] === '{';
7
+ return 'object' === typeof obj && '{' === JSON.stringify(obj)[0];
7
8
  }
8
- // eslint-disable-next-line require-jsdoc
9
+
10
+ // eslint-disable-next-line jsdoc/require-jsdoc
9
11
  function recursive(obj, lowerCase = false) {
10
12
  if (!validateJSON(obj)) return obj;
11
13
  return Object.keys(obj).reduce(
@@ -16,11 +18,13 @@ function recursive(obj, lowerCase = false) {
16
18
  {}
17
19
  );
18
20
  }
19
- // eslint-disable-next-line require-jsdoc
21
+
22
+ // eslint-disable-next-line jsdoc/require-jsdoc
20
23
  function removeSnakeCaseString(str) {
21
- if (typeof str !== 'string') return null;
24
+ if ('string' !== typeof str) return null;
22
25
  return str.toLowerCase().replace(/_[a-z]/gi, (x) => x[1].toUpperCase());
23
26
  }
27
+
24
28
  module.exports = {
25
29
  single,
26
30
  recursive,
@@ -2,7 +2,7 @@ module.exports = (rgb) => {
2
2
  let hexCode = '#';
3
3
  for (const num of rgb) {
4
4
  const hex = Number(num).toString(16);
5
- hexCode += hex.length === 1 ? '0' + hex : hex;
5
+ hexCode += 1 === hex.length ? '0' + hex : hex;
6
6
  }
7
7
  return hexCode;
8
8
  };
@@ -1,6 +1,6 @@
1
1
  module.exports = (num) => {
2
2
  if (isNaN(num)) return NaN;
3
- const digits = String(+num).split('');
3
+ const digits = String(Number(num)).split('');
4
4
  const key = [
5
5
  '',
6
6
  'C',
@@ -36,7 +36,7 @@ module.exports = (num) => {
36
36
  let roman = '';
37
37
  let i = 3;
38
38
  while (i--) {
39
- roman = (key[+digits.pop() + i * 10] || '') + roman;
39
+ roman = (key[Number(digits.pop()) + i * 10] || '') + roman;
40
40
  }
41
- return Array(+digits.join('') + 1).join('M') + roman;
41
+ return Array(Number(digits.join('')) + 1).join('M') + roman;
42
42
  };
@@ -4,15 +4,15 @@ const Errors = require('../Errors');
4
4
 
5
5
  module.exports = async (input, cacheTime = 600, useThirdPartyAPI = '') => {
6
6
  if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
7
- if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
7
+ if ('string' !== typeof input) throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
8
8
  if (isUUID(input)) return input.replace(/-/g, '');
9
9
  try {
10
- const customUrl = useThirdPartyAPI === true ? 'https://api.minetools.eu/uuid/' : useThirdPartyAPI;
10
+ const customUrl = true === useThirdPartyAPI ? 'https://api.minetools.eu/uuid/' : useThirdPartyAPI;
11
11
  const url = useThirdPartyAPI ? `${customUrl}${input}` : `https://mowojang.matdoes.dev/${input}`;
12
12
  const res = await fetch(url, input, cacheTime);
13
- if (res.status === 404) {
13
+ if (404 === res.status) {
14
14
  return Promise.reject(new Error(Errors.PLAYER_DOES_NOT_EXIST));
15
- } else if (res.status !== 200) {
15
+ } else if (200 !== res.status) {
16
16
  throw new Error('Unknown Error whilst retrieving player information');
17
17
  }
18
18
  return res.id;
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line require-jsdoc
1
+ // eslint-disable-next-line jsdoc/require-jsdoc
2
2
  function readVarInt(bytes) {
3
3
  let numRead = 0;
4
4
  let result = 0;
@@ -7,7 +7,7 @@ function readVarInt(bytes) {
7
7
  const value = read & 0b01111111;
8
8
  result |= value << (7 * numRead);
9
9
  numRead++;
10
- if (numRead > 5) {
10
+ if (5 < numRead) {
11
11
  return NaN;
12
12
  }
13
13
  } while (numRead < bytes.length);