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,22 +1,28 @@
1
1
  const divide = require('../../utils/divide');
2
2
  /**
3
- * Cops and crims class
3
+ * Cops and crims Defusal class
4
4
  */
5
- class CopsAndCrims {
5
+ class CopsAndCrimsDefusal {
6
6
  /**
7
7
  * @param {object} data Cops and crims data
8
+
8
9
  */
9
10
  constructor(data) {
10
11
  /**
11
- * Coins
12
+ * Kills
12
13
  * @type {number}
13
14
  */
14
- this.coins = data.coins || 0;
15
+ this.kills = data.kills || 0;
15
16
  /**
16
- * Kills
17
+ * Headshot kills
17
18
  * @type {number}
18
19
  */
19
- this.kills = data.kills || 0;
20
+ this.headshotKills = data.headshot_kills || 0;
21
+ /**
22
+ * Assists
23
+ * @type {number}
24
+ */
25
+ this.assists = data.assists || 0;
20
26
  /**
21
27
  * Deaths
22
28
  * @type {number}
@@ -32,6 +38,21 @@ class CopsAndCrims {
32
38
  * @type {number}
33
39
  */
34
40
  this.wins = data.game_wins || 0;
41
+ /**
42
+ * Games played
43
+ * @type {number}
44
+ */
45
+ this.gamesPlayed = data.game_plays || 0;
46
+ /**
47
+ * Losses
48
+ * @type {number}
49
+ */
50
+ this.losses = this.gamesPlayed - this.wins;
51
+ /**
52
+ * Win Loss ratio
53
+ * @type {number}
54
+ */
55
+ this.WLRatio = divide(this.wins, this.losses);
35
56
  /**
36
57
  * Round wins
37
58
  * @type {number}
@@ -42,11 +63,6 @@ class CopsAndCrims {
42
63
  * @type {number}
43
64
  */
44
65
  this.shotsFired = data.shots_fired || 0;
45
- /**
46
- * Headshot kills
47
- * @type {number}
48
- */
49
- this.headshotKills = data.headshot_kills || 0;
50
66
  /**
51
67
  * Bombs defused
52
68
  * @type {number}
@@ -67,24 +83,236 @@ class CopsAndCrims {
67
83
  * @type {number}
68
84
  */
69
85
  this.killsAsCop = data.cop_kills || 0;
86
+ }
87
+ }
88
+ /**
89
+ * Cops and crims Deathmatch class
90
+ */
91
+ class CopsAndCrimsDeathmatch {
92
+ /**
93
+ * @param {object} data Cops and crims data
94
+
95
+ */
96
+ constructor(data) {
70
97
  /**
71
- * Deathmatch stats
72
- * @type {CopsAndCrimsDeathmatch}
98
+ * Kills
99
+ * @type {number}
100
+ */
101
+ this.kills = data.kills_deathmatch || 0;
102
+ /**
103
+ * Assists
104
+ * @type {number}
105
+ */
106
+ this.assists = data.assists_deathmatch || 0;
107
+ /**
108
+ * Deaths
109
+ * @type {number}
110
+ */
111
+ this.deaths = data.deaths_deathmatch || 0;
112
+ /**
113
+ * Kill Death ratio
114
+ * @type {number}
115
+ */
116
+ this.KDRatio = divide(this.kills, this.deaths);
117
+ /**
118
+ * Wins
119
+ * @type {number}
120
+ */
121
+ this.wins = data.game_wins_deathmatch || 0;
122
+ /**
123
+ * Games played
124
+ * @type {number}
125
+ */
126
+ this.gamesPlayed = data.game_plays_deathmatch || 0;
127
+ /**
128
+ * Losses
129
+ * @type {number}
130
+ */
131
+ this.losses = this.gamesPlayed - this.wins;
132
+ /**
133
+ * Win Loss ratio
134
+ * @type {number}
135
+ */
136
+ this.WLRatio = divide(this.wins, this.losses);
137
+ /**
138
+ * Kills as Crim
139
+ * @type {number}
140
+ */
141
+ this.killsAsCrim = data.criminal_kills_deathmatch || 0;
142
+ /**
143
+ * Kills as Cop
144
+ * @type {number}
145
+ */
146
+ this.killsAsCop = data.cop_kills_deathmatch || 0;
147
+ }
148
+ }
149
+ /**
150
+ * Cops and crims Gun Game class
151
+ */
152
+ class CopsAndCrimsGunGame {
153
+ /**
154
+ * @param {object} data Cops and crims data
155
+
156
+ */
157
+ constructor(data) {
158
+ /**
159
+ * Kills
160
+ * @type {number}
161
+ */
162
+ this.kills = data.kills_gungame || 0;
163
+ /**
164
+ * Assists
165
+ * @type {number}
166
+ */
167
+ this.assists = data.assists_gungame || 0;
168
+ /**
169
+ * Deaths
170
+ * @type {number}
171
+ */
172
+ this.deaths = data.deaths_gungame || 0;
173
+ /**
174
+ * Kill Death ratio
175
+ * @type {number}
176
+ */
177
+ this.KDRatio = divide(this.kills, this.deaths);
178
+ /**
179
+ * Wins
180
+ * @type {number}
181
+ */
182
+ this.wins = data.game_wins_gungame || 0;
183
+ /**
184
+ * Games played
185
+ * @type {number}
186
+ */
187
+ this.gamesPlayed = data.game_plays_gungame || 0;
188
+ /**
189
+ * Losses
190
+ * @type {number}
191
+ */
192
+ this.losses = this.gamesPlayed - this.wins;
193
+ /**
194
+ * Win Loss ratio
195
+ * @type {number}
196
+ */
197
+ this.WLRatio = divide(this.wins, this.losses);
198
+ /**
199
+ * Kills as Crim
200
+ * @type {number}
201
+ */
202
+ this.killsAsCrim = data.criminal_kills_gungame || 0;
203
+ /**
204
+ * Kills as Cop
205
+ * @type {number}
73
206
  */
74
- this.deathmatch = {
75
- kills: data.kills_deathmatch || 0,
76
- deaths: data.deaths_deathmatch || 0,
77
- KDRatio: divide(data.kills_deathmatch, data.deaths_deathmatch),
78
- killsAsCrim: data.criminal_kills_deathmatch || 0,
79
- killsAsCop: data.cop_kills_deathmatch || 0
80
- };
207
+ this.killsAsCop = data.cop_kills_gungame || 0;
208
+ /**
209
+ * Fastest Win
210
+ * ! WARNING This number is most likely wrong as it can be negative
211
+ * @type {number}
212
+ */
213
+ this.fastestWin = data.fastest_win_gungame || 0;
81
214
  }
82
215
  }
83
216
  /**
84
- * @typedef {object} CopsAndCrimsDeathmatch
85
- * @property {number} kills Deathmatch kills
86
- * @property {number} deaths Deathmatch deaths
87
- * @property {number} killsAsCrim Deathmatch kills as crim
88
- * @property {number} killsAsCop Deathmatch kills as cop
217
+ * Cops and crims class
89
218
  */
219
+ class CopsAndCrims {
220
+ /**
221
+ * @param {object} data Cops and crims data
222
+
223
+ */
224
+ constructor(data) {
225
+ /**
226
+ * Defusal stats
227
+ * @type {CopsAndCrimsDefusal}
228
+ */
229
+ this.defusal = new CopsAndCrimsDefusal(data);
230
+ /**
231
+ * Deathmatch stats
232
+ * @type {CopsAndCrimsDeathmatch}
233
+ */
234
+ this.deathmath = new CopsAndCrimsDeathmatch(data);
235
+ /**
236
+ * Gun Game stats
237
+ * @type {CopsAndCrimsGunGame}
238
+ */
239
+ this.gunGame = new CopsAndCrimsGunGame(data);
240
+ /**
241
+ * Coins
242
+ * @type {number}
243
+ */
244
+ this.coins = data.coins || 0;
245
+ /**
246
+ * Kills
247
+ * @type {number}
248
+ */
249
+ this.kills = this.defusal.kills + this.deathmath.kills + this.gunGame.kills;
250
+ /**
251
+ * Assists
252
+ * @type {number}
253
+ */
254
+ this.assists = this.defusal.assists + this.deathmath.assists + this.gunGame.assists;
255
+ /**
256
+ * Deaths
257
+ * @type {number}
258
+ */
259
+ this.deaths = this.defusal.deaths + this.deathmath.deaths + this.gunGame.deaths;
260
+ /**
261
+ * Kill Death ratio
262
+ * @type {number}
263
+ */
264
+ this.KDRatio = divide(this.kills, this.deaths);
265
+ /**
266
+ * Wins
267
+ * @type {number}
268
+ */
269
+ this.wins = this.defusal.wins + this.deathmath.wins + this.gunGame.wins;
270
+ /**
271
+ * Games played
272
+ * @type {number}
273
+ */
274
+ this.gamesPlayed = this.defusal.gamesPlayed + this.deathmath.gamesPlayed + this.gunGame.gamesPlayed;
275
+ /**
276
+ * Losses
277
+ * @type {number}
278
+ */
279
+ this.losses = this.gamesPlayed - this.wins;
280
+ /**
281
+ * Win Loss ratio
282
+ * @type {number}
283
+ */
284
+ this.WLRatio = divide(this.wins, this.losses);
285
+ /**
286
+ * Kills as Crim
287
+ * @type {number}
288
+ */
289
+ this.killsAsCrim = this.defusal.killsAsCrim + this.deathmath.killsAsCrim + this.gunGame.killsAsCrim;
290
+ /**
291
+ * Kills as Cop
292
+ * @type {number}
293
+ */
294
+ this.killsAsCop = this.defusal.killsAsCop + this.deathmath.killsAsCop + this.gunGame.killsAsCop;
295
+ /**
296
+ * Prefix Color
297
+ * @type {string}
298
+ */
299
+ this.prefixColor = data.lobbyPrefixColor || '';
300
+ /**
301
+ * Show Prefix
302
+ * @type {boolean}
303
+ */
304
+ this.showPrefix = data.show_lobby_prefix || false;
305
+ /**
306
+ * Selected Prefix
307
+ * @type {string}
308
+ */
309
+ this.selectedPrefix = data.selected_lobby_prefix || '';
310
+ /**
311
+ * Kills In Prefix
312
+ * @type {boolean}
313
+ */
314
+ this.killsInPrefix = data.show_kills_in_prefix || false;
315
+ }
316
+ }
317
+
90
318
  module.exports = CopsAndCrims;