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,4 +1,108 @@
1
1
  const divide = require('../../utils/divide');
2
+
3
+ class SmashHeroesMode {
4
+ /**
5
+ * @param {object} data SmashHeroes data
6
+ * @param {string} mode SmashHeores mode
7
+ */
8
+ constructor(data, mode) {
9
+ /**
10
+ * kills
11
+ * @type {number}
12
+ */
13
+ this.kills = data[`kills_${mode}`] || 0;
14
+ /**
15
+ * deaths
16
+ * @type {number}
17
+ */
18
+ this.deaths = data[`deaths_${mode}`] || 0;
19
+ /**
20
+ * KDRatio
21
+ * @type {number}
22
+ */
23
+ this.KDRatio = divide(this.kills, this.deaths);
24
+ /**
25
+ * wins
26
+ * @type {number}
27
+ */
28
+ this.wins = data[`wins_${mode}`] || 0;
29
+ /**
30
+ * losses
31
+ * @type {number}
32
+ */
33
+ this.losses = data[`losses_${mode}`] || 0;
34
+ /**
35
+ * WLRatio
36
+ * @type {number}
37
+ */
38
+ this.WLRatio = divide(this.wins, this.losses);
39
+ }
40
+ }
41
+
42
+ class SmashHeoresHero {
43
+ /**
44
+ * @param {object} data SmashHeroes data
45
+ * @param {string} hero Hero name
46
+ */
47
+ constructor(data, hero) {
48
+ /**
49
+ * Hero Name
50
+ * @type {string}
51
+ */
52
+ this.name = hero;
53
+ /**
54
+ * Level
55
+ * @type {number}
56
+ */
57
+ this.level = data[`lastLevel_${hero}`] || 0;
58
+ /**
59
+ * Xp
60
+ * @type {number}
61
+ */
62
+ this.xp = data[`xp_${hero}`] || 0;
63
+ /**
64
+ * Prestige
65
+ * @type {number}
66
+ */
67
+ this.prestige = data[`pg_${hero}`] || 0;
68
+ /**
69
+ * Played Games
70
+ * @type {number}
71
+ */
72
+ this.playedGames = data.class_stats?.[hero]?.games || 0;
73
+ /**
74
+ * Kills
75
+ * @type {number}
76
+ */
77
+ this.kills = data.class_stats?.[hero]?.kills || 0;
78
+ /**
79
+ * Deaths
80
+ * @type {number}
81
+ */
82
+ this.deaths = data.class_stats?.[hero]?.deaths || 0;
83
+ /**
84
+ * KDRatio
85
+ * @type {number}
86
+ */
87
+ this.KDRatio = divide(this.kills, this.deaths);
88
+ /**
89
+ * Wins
90
+ * @type {number}
91
+ */
92
+ this.wins = data.class_stats?.[hero]?.wins || 0;
93
+ /**
94
+ * Losses
95
+ * @type {number}
96
+ */
97
+ this.losses = data.class_stats?.[hero]?.losses || 0;
98
+ /**
99
+ * WLRatio
100
+ * @type {number}
101
+ */
102
+ this.WLRatio = divide(this.wins, this.losses);
103
+ }
104
+ }
105
+
2
106
  /**
3
107
  * SmashHeroes class
4
108
  */
@@ -57,88 +161,112 @@ class SmashHeroes {
57
161
  * @type {number}
58
162
  */
59
163
  this.WLRatio = divide(this.wins, this.losses);
164
+ /**
165
+ * Smashed
166
+ * @type {number}
167
+ */
168
+ this.smashed = data.smashed || 0;
169
+ /**
170
+ * Stats for each mode
171
+ * @type {SmashHeroesMode}
172
+ */
173
+ this['1v1v1v1'] = new SmashHeroesMode(data, 'normal');
174
+ /**
175
+ * Stats for each mode
176
+ * @type {SmashHeroesMode}
177
+ */
178
+ this['2v2'] = new SmashHeroesMode(data, '2v2');
60
179
  /**
61
180
  * Stats for each mode
62
- * @type {SmashHeroesModes}
181
+ * @type {SmashHeroesMode}
63
182
  */
64
- this.mode = {
65
- '1v1v1v1': generateModeStats(data, 'normal'),
66
- '2v2': generateModeStats(data, '2v2'),
67
- '2v2v2': generateModeStats(data, 'teams')
68
- };
183
+ this['2v2v2'] = new SmashHeroesMode(data, 'teams');
69
184
  /**
70
185
  * Active class
71
186
  * @type {string}
72
187
  */
73
- this.activeClass = data.active_class ?? null;
188
+ this.activeClass = data.active_class || null;
74
189
  /**
75
- * Stats for each class
76
- * @type {SmashHeroesClassStats[]|null}
190
+ * The Bulk
191
+ * @type {SmashHeoresHero}
77
192
  */
78
- this.heroStats = data.class_stats ? generateHeroStats(data) : null;
79
- }
80
- }
81
- // eslint-disable-next-line require-jsdoc
82
- function generateModeStats(data, mode) {
83
- return {
84
- kills: data[`kills_${mode}`] || 0,
85
- deaths: data[`deaths_${mode}`] || 0,
86
- KDRatio: divide(data[`kills_${mode}`], data[`deaths_${mode}`]),
87
- wins: data[`wins_${mode}`] || 0,
88
- losses: data[`losses_${mode}`] || 0,
89
- WLRatio: divide(data[`wins_${mode}`], data[`losses_${mode}`])
90
- };
91
- }
92
- // eslint-disable-next-line require-jsdoc
93
- function generateHeroStats(data) {
94
- // eslint-disable-next-line no-useless-return
95
- const stats = [];
96
- for (const hero in data.class_stats) {
97
- if (Object.prototype.hasOwnProperty.call(data.class_stats, hero)) {
98
- stats.push({
99
- name: hero,
100
- level: data[`lastLevel_${hero}`] || 0,
101
- xp: data[`xp_${hero}`] || 0,
102
- prestige: data[`pg_${hero}`] || 0,
103
- playedGames: data.class_stats[hero].games || 0,
104
- kills: data.class_stats[hero].kills || 0,
105
- deaths: data.class_stats[hero].deaths || 0,
106
- KDRatio: divide(data.class_stats[hero].kills, data.class_stats[hero].deaths),
107
- wins: data.class_stats[hero].wins || 0,
108
- losses: data.class_stats[hero].losses || 0,
109
- WLRatio: divide(data.class_stats[hero].wins, data.class_stats[hero].losses)
110
- });
111
- }
193
+ this.theBulk = new SmashHeoresHero(data, 'THE_BULK');
194
+ /**
195
+ * Cake Monster
196
+ * @type {SmashHeoresHero}
197
+ */
198
+ this.cakeMonster = new SmashHeoresHero(data, 'CAKE_MONSTER');
199
+ /**
200
+ * General Cluck
201
+ * @type {SmashHeoresHero}
202
+ */
203
+ this.generalCluck = new SmashHeoresHero(data, 'GENERAL_CLUCK');
204
+ /**
205
+ * Botmun
206
+ * @type {SmashHeoresHero}
207
+ */
208
+ this.botmun = new SmashHeoresHero(data, 'BOTMUN');
209
+ /**
210
+ * Marauder
211
+ * @type {SmashHeoresHero}
212
+ */
213
+ this.marauder = new SmashHeoresHero(data, 'MARAUDER');
214
+ /**
215
+ * Pug
216
+ * @type {SmashHeoresHero}
217
+ */
218
+ this.pug = new SmashHeoresHero(data, 'PUG');
219
+ /**
220
+ * Tinman
221
+ * @type {SmashHeoresHero}
222
+ */
223
+ this.tinman = new SmashHeoresHero(data, 'TINMAN');
224
+ /**
225
+ * Spoderman
226
+ * @type {SmashHeoresHero}
227
+ */
228
+ this.spoderman = new SmashHeoresHero(data, 'SPODERMAN');
229
+ /**
230
+ * Frosty
231
+ * @type {SmashHeoresHero}
232
+ */
233
+ this.frosty = new SmashHeoresHero(data, 'FROSTY');
234
+ /**
235
+ * Sergeant Shield
236
+ * @type {SmashHeoresHero}
237
+ */
238
+ this.sergeantShield = new SmashHeoresHero(data, 'SERGEANT_SHIELD');
239
+ /**
240
+ * Skullfire
241
+ * @type {SmashHeoresHero}
242
+ */
243
+ this.skullfire = new SmashHeoresHero(data, 'SKULLFIRE');
244
+ /**
245
+ * Goku
246
+ * @type {SmashHeoresHero}
247
+ */
248
+ this.goku = new SmashHeoresHero(data, 'GOKU');
249
+ /**
250
+ * Sanic
251
+ * @type {SmashHeoresHero}
252
+ */
253
+ this.sanic = new SmashHeoresHero(data, 'SANIC');
254
+ /**
255
+ * Dusk Crawler
256
+ * @type {SmashHeoresHero}
257
+ */
258
+ this.duskCrawler = new SmashHeoresHero(data, 'DUSK_CRAWLER');
259
+ /**
260
+ * Shoop Da Whoop
261
+ * @type {SmashHeoresHero}
262
+ */
263
+ this.shoopDaWhoop = new SmashHeoresHero(data, 'SHOOP_DA_WHOOP');
264
+ /**
265
+ * Green Hood
266
+ * @type {SmashHeoresHero}
267
+ */
268
+ this.greenHood = new SmashHeoresHero(data, 'GREEN_HOOD');
112
269
  }
113
- return stats;
114
270
  }
115
- /**
116
- * @typedef {object} SmashHeroesModes
117
- * @property {SmashHeroesModeStats} '1v1v1v1' 1v1v1v1
118
- * @property {SmashHeroesModeStats} '2v2' 2v2
119
- * @property {SmashHeroesModeStats} '2v2v2' 2v2v2
120
- */
121
- /**
122
- * @typedef {object} SmashHeroesModeStats
123
- * @property {number} kills Kills
124
- * @property {number} deaths Deaths
125
- * @property {number} KDRatio Kill/Death ratio
126
- * @property {number} wins Wins
127
- * @property {number} losses Losses
128
- * @property {number} WLRatio Win/Loss ratio
129
- */
130
- /**
131
- * @typedef {object} SmashHeroesClassStats
132
- * @property {string} name Name
133
- * @property {number} level Level
134
- * @property {number} xp XP
135
- * @property {number} prestige Prestige
136
- * @property {number} playedGames Played games
137
- * @property {number} kills Kills
138
- * @property {number} deaths Deaths
139
- * @property {number} KDRatio Kill/Death ratio
140
- * @property {number} wins Wins
141
- * @property {number} losses Losses
142
- * @property {number} WLRatio Win/Loss ratio
143
- */
271
+
144
272
  module.exports = SmashHeroes;
@@ -1,4 +1,54 @@
1
1
  const divide = require('../../utils/divide');
2
+
3
+ class SpeedUHCMode {
4
+ /**
5
+ * @param {object} data Speed UHC data
6
+ * @param {string} data Speed UHC data
7
+ */
8
+ constructor(data, mode) {
9
+ /**
10
+ * Kills
11
+ * @type {number}
12
+ */
13
+ this.kills = data[`kills_${mode}`] || 0;
14
+ /**
15
+ * Deaths
16
+ * @type {number}
17
+ */
18
+ this.deaths = data[`deaths_${mode}`] || 0;
19
+ /**
20
+ * Wins
21
+ * @type {number}
22
+ */
23
+ this.wins = data[`wins_${mode}`] || 0;
24
+ /**
25
+ * Losses
26
+ * @type {number}
27
+ */
28
+ this.losses = data[`losses_${mode}`] || 0;
29
+ /**
30
+ * Played Games
31
+ * @type {number}
32
+ */
33
+ this.playedGames = data[`games_${mode}`] || 0;
34
+ /**
35
+ * Winstreak
36
+ * @type {number}
37
+ */
38
+ this.winstreak = data[`win_streak_${mode}`] || 0;
39
+ /**
40
+ * Kill Streak
41
+ * @type {number}
42
+ */
43
+ this.killStreak = data[`killstreak_${mode}`] || 0;
44
+ /**
45
+ * Assists
46
+ * @type {number}
47
+ */
48
+ this.assists = data[`assists_${mode}`] || 0;
49
+ }
50
+ }
51
+
2
52
  /**
3
53
  * Speed UHC class
4
54
  */
@@ -84,32 +134,35 @@ class SpeedUHC {
84
134
  this.assists = data.assists || 0;
85
135
  /**
86
136
  * Solo
87
- * @type {SpeedUHCModeStats}
88
- */
89
- this.solo = {
90
- kills: data.kills_solo || 0,
91
- deaths: data.deaths_solo || 0,
92
- wins: data.wins_solo || 0,
93
- losses: data.losses_solo || 0,
94
- playedGames: data.games_solo || 0,
95
- winstreak: data.win_streak_solo || 0,
96
- killstreak: data.killstreak_solo || 0,
97
- assists: data.assists_solo || 0
98
- };
137
+ * @type {SpeedUHCMode}
138
+ */
139
+ this.solo = new SpeedUHCMode(data, 'solo');
140
+ /**
141
+ * Solo Normal
142
+ * @type {SpeedUHCMode}
143
+ */
144
+ this.soloNormal = new SpeedUHCMode(data, 'solo_normal');
145
+ /**
146
+ * Solo Insane
147
+ * @type {SpeedUHCMode}
148
+ */
149
+ this.soloInsane = new SpeedUHCMode(data, 'solo_insane');
99
150
  /**
100
151
  * Team
101
- * @type {SpeedUHCModeStats}
102
- */
103
- this.teams = {
104
- kills: data.kills_team || 0,
105
- deaths: data.deaths_team || 0,
106
- wins: data.wins_team || 0,
107
- losses: data.losses_team || 0,
108
- playedGames: data.games_team || 0,
109
- winstreak: data.win_streak_team || 0,
110
- killstreak: data.killstreak_team || 0,
111
- assists: data.assists_team || 0
112
- };
152
+ * @type {SpeedUHCMode}
153
+ */
154
+ this.team = new SpeedUHCMode(data, 'team');
155
+ /**
156
+ * Team Normal
157
+ * @type {SpeedUHCMode}
158
+ */
159
+ this.teamNormal = new SpeedUHCMode(data, 'team_normal');
160
+ /**
161
+ * Team Insane
162
+ * @type {SpeedUHCMode}
163
+ */
164
+ this.teamInsane = new SpeedUHCMode(data, 'team_insane');
113
165
  }
114
166
  }
167
+
115
168
  module.exports = SpeedUHC;