hypixel-api-reborn 9.0.3 → 11.0.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 (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 -7
  5. package/src/API/getBoosters.js +6 -5
  6. package/src/API/getGameCounts.js +6 -5
  7. package/src/API/getGuild.js +18 -17
  8. package/src/API/getLeaderboards.js +13 -12
  9. package/src/API/getPlayer.js +22 -26
  10. package/src/API/getRecentGames.js +18 -17
  11. package/src/API/getServerInfo.js +66 -77
  12. package/src/API/getStatus.js +8 -7
  13. package/src/API/getWatchdogStats.js +6 -5
  14. package/src/API/index.js +19 -9
  15. package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -9
  16. package/src/API/skyblock/getSkyblockAuctions.js +64 -64
  17. package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -10
  18. package/src/API/skyblock/getSkyblockBazaar.js +10 -9
  19. package/src/API/skyblock/getSkyblockMember.js +28 -24
  20. package/src/API/skyblock/getSkyblockNews.js +6 -5
  21. package/src/API/skyblock/getSkyblockProfiles.js +44 -40
  22. package/src/Client.js +406 -430
  23. package/src/Errors.js +44 -38
  24. package/src/Private/defaultCache.js +77 -0
  25. package/src/Private/rateLimit.js +79 -98
  26. package/src/Private/requests.js +65 -39
  27. package/src/Private/updater.js +45 -42
  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 -329
  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 -460
  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 -71
  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 -453
  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 -102
  79. package/src/structures/SkyBlock/SkyblockMember.js +820 -675
  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 -795
  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 -9
  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 -0
  95. package/src/utils/romanize.js +11 -0
  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 -2625
  100. package/src/API/getFriends.js +0 -13
  101. package/src/API/getKeyInfo.js +0 -9
  102. package/src/API/getRankedSkyWars.js +0 -10
  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,151 +1,144 @@
1
- const divide = require('../../utils/divide');
2
- /**
3
- * SmashHeroes class
4
- */
5
- class SmashHeroes {
6
- /**
7
- * @param {object} data SmashHeroes data
8
- */
9
- constructor (data) {
10
- /**
11
- * Coins
12
- * @type {number}
13
- */
14
- this.coins = data.coins || 0;
15
- /**
16
- * Level
17
- * @type {number}
18
- */
19
- this.level = data.smash_level_total || 0;
20
- /**
21
- * Winstreak
22
- * @type {number}
23
- */
24
- this.winstreak = data.win_streak || 0;
25
- /**
26
- * Played games
27
- * @type {number}
28
- */
29
- this.playedGames = data.games || 0;
30
- /**
31
- * Kills
32
- * @type {number}
33
- */
34
- this.kills = data.kills || 0;
35
- /**
36
- * Deaths
37
- * @type {number}
38
- */
39
- this.deaths = data.deaths || 0;
40
- /**
41
- * Kill/Death ratio
42
- * @type {number}
43
- */
44
- this.KDRatio = divide(this.kills, this.deaths);
45
- /**
46
- * Wins
47
- * @type {number}
48
- */
49
- this.wins = data.wins || 0;
50
- /**
51
- * Losses
52
- * @type {number}
53
- */
54
- this.losses = data.losses || 0;
55
- /**
56
- * Win/Loss ratio
57
- * @type {number}
58
- */
59
- this.WLRatio = divide(this.wins, this.losses);
60
- /**
61
- * Stats for each mode
62
- * @type {SmashHeroesModes}
63
- */
64
- this.mode = {
65
- '1v1v1v1': generateModeStats(data, 'normal'),
66
- '2v2': generateModeStats(data, '2v2'),
67
- '2v2v2': generateModeStats(data, 'teams')
68
- };
69
- /**
70
- * Active class
71
- * @type {string}
72
- */
73
- this.activeClass = data.active_class ? data.active_class : null;
74
- /**
75
- * Stats for each class
76
- * @type {SmashHeroesClassStats[]|null}
77
- */
78
- this.heroStats = data.class_stats ? generateHeroStats(data) : null;
79
- }
80
- }
81
- /**
82
- * @param {object} data
83
- * @param {string} mode
84
- * @return {object}
85
- */
86
- function generateModeStats (data, mode) {
87
- return {
88
- kills: data[`kills_${mode}`] || 0,
89
- deaths: data[`deaths_${mode}`] || 0,
90
- KDRatio: divide(data[`kills_${mode}`], data[`deaths_${mode}`]),
91
- wins: data[`wins_${mode}`] || 0,
92
- losses: data[`losses_${mode}`] || 0,
93
- WLRatio: divide(data[`wins_${mode}`], data[`losses_${mode}`])
94
- };
95
- }
96
- /**
97
- * @param {object} data
98
- * @return {object}
99
- */
100
- function generateHeroStats (data) {
101
- // eslint-disable-next-line no-useless-return
102
- const stats = [];
103
- for (const hero in data.class_stats) {
104
- if (Object.prototype.hasOwnProperty.call(data.class_stats, hero)) {
105
- stats.push({
106
- name: hero,
107
- level: data[`lastLevel_${hero}`] || 0,
108
- xp: data[`xp_${hero}`] || 0,
109
- prestige: data[`pg_${hero}`] || 0,
110
- playedGames: data.class_stats[hero].games || 0,
111
- kills: data.class_stats[hero].kills || 0,
112
- deaths: data.class_stats[hero].deaths || 0,
113
- KDRatio: divide(data.class_stats[hero].kills, data.class_stats[hero].deaths),
114
- wins: data.class_stats[hero].wins || 0,
115
- losses: data.class_stats[hero].losses || 0,
116
- WLRatio: divide(data.class_stats[hero].wins, data.class_stats[hero].losses)
117
- });
118
- }
119
- }
120
- return stats;
121
- }
122
- /**
123
- * @typedef {object} SmashHeroesModes
124
- * @property {SmashHeroesModeStats} '1v1v1v1' 1v1v1v1
125
- * @property {SmashHeroesModeStats} '2v2' 2v2
126
- * @property {SmashHeroesModeStats} '2v2v2' 2v2v2
127
- */
128
- /**
129
- * @typedef {object} SmashHeroesModeStats
130
- * @property {number} kills Kills
131
- * @property {number} deaths Deaths
132
- * @property {number} KDRatio Kill/Death ratio
133
- * @property {number} wins Wins
134
- * @property {number} losses Losses
135
- * @property {number} WLRatio Win/Loss ratio
136
- */
137
- /**
138
- * @typedef {object} SmashHeroesClassStats
139
- * @property {string} name Name
140
- * @property {number} level Level
141
- * @property {number} xp XP
142
- * @property {number} prestige Prestige
143
- * @property {number} playedGames Played games
144
- * @property {number} kills Kills
145
- * @property {number} deaths Deaths
146
- * @property {number} KDRatio Kill/Death ratio
147
- * @property {number} wins Wins
148
- * @property {number} losses Losses
149
- * @property {number} WLRatio Win/Loss ratio
150
- */
151
- module.exports = SmashHeroes;
1
+ const divide = require('../../utils/divide');
2
+ /**
3
+ * SmashHeroes class
4
+ */
5
+ class SmashHeroes {
6
+ /**
7
+ * @param {object} data SmashHeroes data
8
+ */
9
+ constructor(data) {
10
+ /**
11
+ * Coins
12
+ * @type {number}
13
+ */
14
+ this.coins = data.coins || 0;
15
+ /**
16
+ * Level
17
+ * @type {number}
18
+ */
19
+ this.level = data.smash_level_total || 0;
20
+ /**
21
+ * Winstreak
22
+ * @type {number}
23
+ */
24
+ this.winstreak = data.win_streak || 0;
25
+ /**
26
+ * Played games
27
+ * @type {number}
28
+ */
29
+ this.playedGames = data.games || 0;
30
+ /**
31
+ * Kills
32
+ * @type {number}
33
+ */
34
+ this.kills = data.kills || 0;
35
+ /**
36
+ * Deaths
37
+ * @type {number}
38
+ */
39
+ this.deaths = data.deaths || 0;
40
+ /**
41
+ * Kill/Death ratio
42
+ * @type {number}
43
+ */
44
+ this.KDRatio = divide(this.kills, this.deaths);
45
+ /**
46
+ * Wins
47
+ * @type {number}
48
+ */
49
+ this.wins = data.wins || 0;
50
+ /**
51
+ * Losses
52
+ * @type {number}
53
+ */
54
+ this.losses = data.losses || 0;
55
+ /**
56
+ * Win/Loss ratio
57
+ * @type {number}
58
+ */
59
+ this.WLRatio = divide(this.wins, this.losses);
60
+ /**
61
+ * Stats for each mode
62
+ * @type {SmashHeroesModes}
63
+ */
64
+ this.mode = {
65
+ '1v1v1v1': generateModeStats(data, 'normal'),
66
+ '2v2': generateModeStats(data, '2v2'),
67
+ '2v2v2': generateModeStats(data, 'teams')
68
+ };
69
+ /**
70
+ * Active class
71
+ * @type {string}
72
+ */
73
+ this.activeClass = data.active_class ? data.active_class : null;
74
+ /**
75
+ * Stats for each class
76
+ * @type {SmashHeroesClassStats[]|null}
77
+ */
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
+ }
112
+ }
113
+ return stats;
114
+ }
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
+ */
144
+ module.exports = SmashHeroes;
@@ -1,57 +1,115 @@
1
- const divide = require('../../utils/divide');
2
- /**
3
- * Speed UHC class
4
- */
5
- class SpeedUHC {
6
- /**
7
- * @param {object} data Speed UHC data
8
- */
9
- constructor (data) {
10
- /**
11
- * Coins
12
- * @type {number}
13
- */
14
- this.coins = data.coins || 0;
15
- /**
16
- * Kills
17
- * @type {number}
18
- */
19
- this.kills = data.kills || 0;
20
- /**
21
- * Deaths
22
- * @type {number}
23
- */
24
- this.deaths = data.deaths || 0;
25
- /**
26
- * Kill/Death ratio
27
- * @type {number}
28
- */
29
- this.KDRatio = divide(this.kills, this.deaths);
30
- /**
31
- * Wins
32
- * @type {number}
33
- */
34
- this.wins = data.wins || 0;
35
- /**
36
- * Losses
37
- * @type {number}
38
- */
39
- this.losses = data.losses || 0;
40
- /**
41
- * Win/Loss ratio
42
- * @type {number}
43
- */
44
- this.WLRatio = divide(this.wins, this.losses);
45
- /**
46
- * Played games
47
- * @type {number}
48
- */
49
- this.playedGames = data.games || 0;
50
- /**
51
- * Winstreak
52
- * @type {number}
53
- */
54
- this.winstreak = data.win_streak || 0;
55
- }
56
- }
57
- module.exports = SpeedUHC;
1
+ const divide = require('../../utils/divide');
2
+ /**
3
+ * Speed UHC class
4
+ */
5
+ class SpeedUHC {
6
+ /**
7
+ * @param {object} data Speed UHC data
8
+ */
9
+ constructor(data) {
10
+ /**
11
+ * Coins
12
+ * @type {number}
13
+ */
14
+ this.coins = data.coins || 0;
15
+ /**
16
+ * Kills
17
+ * @type {number}
18
+ */
19
+ this.kills = data.kills || 0;
20
+ /**
21
+ * Deaths
22
+ * @type {number}
23
+ */
24
+ this.deaths = data.deaths || 0;
25
+ /**
26
+ * Kill/Death ratio
27
+ * @type {number}
28
+ */
29
+ this.KDRatio = divide(this.kills, this.deaths);
30
+ /**
31
+ * Wins
32
+ * @type {number}
33
+ */
34
+ this.wins = data.wins || 0;
35
+ /**
36
+ * Losses
37
+ * @type {number}
38
+ */
39
+ this.losses = data.losses || 0;
40
+ /**
41
+ * Win/Loss ratio
42
+ * @type {number}
43
+ */
44
+ this.WLRatio = divide(this.wins, this.losses);
45
+ /**
46
+ * Played games
47
+ * @type {number}
48
+ */
49
+ this.playedGames = data.games || 0;
50
+ /**
51
+ * Winstreak
52
+ * @type {number}
53
+ */
54
+ this.winstreak = data.win_streak || 0;
55
+ /**
56
+ * Killstreak
57
+ * @type {number}
58
+ */
59
+ this.killstreak = data.killstreak || 0;
60
+ /**
61
+ * Blocks Broken
62
+ * @type {number}
63
+ */
64
+ this.blocksBroken = data.blocks_broken || 0;
65
+ /**
66
+ * Blocks Placed
67
+ * @type {number}
68
+ */
69
+ this.blocksPlaced = data.blocks_placed || 0;
70
+ /**
71
+ * Game Quits
72
+ * @type {number}
73
+ */
74
+ this.quits = data.quits || 0;
75
+ /**
76
+ * Items Enchanted
77
+ * @type {number}
78
+ */
79
+ this.itemsEnchanted = data.items_enchanted || 0;
80
+ /**
81
+ * Assists
82
+ * @type {number}
83
+ */
84
+ this.assists = data.assists || 0;
85
+ /**
86
+ * 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
+ };
99
+ /**
100
+ * 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
+ };
113
+ }
114
+ }
115
+ module.exports = SpeedUHC;