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.
- package/.prettierrc +13 -0
- package/README.md +28 -16
- package/package.json +60 -58
- package/src/API/getAPIStatus.js +8 -7
- package/src/API/getBoosters.js +6 -5
- package/src/API/getGameCounts.js +6 -5
- package/src/API/getGuild.js +18 -17
- package/src/API/getLeaderboards.js +13 -12
- package/src/API/getPlayer.js +22 -26
- package/src/API/getRecentGames.js +18 -17
- package/src/API/getServerInfo.js +66 -77
- package/src/API/getStatus.js +8 -7
- package/src/API/getWatchdogStats.js +6 -5
- package/src/API/index.js +19 -9
- package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -9
- package/src/API/skyblock/getSkyblockAuctions.js +64 -64
- package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -10
- package/src/API/skyblock/getSkyblockBazaar.js +10 -9
- package/src/API/skyblock/getSkyblockMember.js +28 -24
- package/src/API/skyblock/getSkyblockNews.js +6 -5
- package/src/API/skyblock/getSkyblockProfiles.js +44 -40
- package/src/Client.js +406 -430
- package/src/Errors.js +44 -38
- package/src/Private/defaultCache.js +77 -0
- package/src/Private/rateLimit.js +79 -98
- package/src/Private/requests.js +65 -39
- package/src/Private/updater.js +45 -42
- package/src/Private/uuidCache.js +37 -33
- package/src/Private/validate.js +97 -97
- package/src/index.js +82 -83
- package/src/structures/APIIncident.js +78 -78
- package/src/structures/APIStatus.js +47 -47
- package/src/structures/Boosters/Booster.js +83 -87
- package/src/structures/Color.js +129 -129
- package/src/structures/Game.js +164 -160
- package/src/structures/GameCounts.js +151 -151
- package/src/structures/Guild/Guild.js +204 -218
- package/src/structures/Guild/GuildMember.js +66 -66
- package/src/structures/Guild/GuildRank.js +48 -48
- package/src/structures/ItemBytes.js +33 -36
- package/src/structures/Leaderboard.js +31 -31
- package/src/structures/MiniGames/Arcade.js +567 -569
- package/src/structures/MiniGames/ArenaBrawl.js +52 -56
- package/src/structures/MiniGames/BedWars.js +423 -329
- package/src/structures/MiniGames/BlitzSurvivalGames.js +172 -148
- package/src/structures/MiniGames/BuildBattle.js +53 -53
- package/src/structures/MiniGames/CopsAndCrims.js +90 -90
- package/src/structures/MiniGames/Duels.js +694 -460
- package/src/structures/MiniGames/MegaWalls.js +137 -137
- package/src/structures/MiniGames/MurderMystery.js +93 -93
- package/src/structures/MiniGames/Paintball.js +67 -67
- package/src/structures/MiniGames/Pit.js +19 -19
- package/src/structures/MiniGames/Quakecraft.js +101 -101
- package/src/structures/MiniGames/SkyWars.js +508 -559
- package/src/structures/MiniGames/SmashHeroes.js +144 -151
- package/src/structures/MiniGames/SpeedUHC.js +115 -57
- package/src/structures/MiniGames/TNTGames.js +116 -116
- package/src/structures/MiniGames/TurboKartRacers.js +201 -71
- package/src/structures/MiniGames/UHC.js +164 -143
- package/src/structures/MiniGames/VampireZ.js +60 -60
- package/src/structures/MiniGames/Walls.js +52 -52
- package/src/structures/MiniGames/Warlords.js +62 -62
- package/src/structures/MiniGames/WoolWars.js +123 -0
- package/src/structures/Pet.js +96 -97
- package/src/structures/Pets.js +64 -64
- package/src/structures/Player.js +433 -453
- package/src/structures/PlayerCosmetics.js +100 -95
- package/src/structures/RecentGame.js +57 -57
- package/src/structures/ServerInfo.js +78 -78
- package/src/structures/SkyBlock/Auctions/Auction.js +104 -104
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +54 -54
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +45 -45
- package/src/structures/SkyBlock/Auctions/Bid.js +48 -48
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +25 -25
- package/src/structures/SkyBlock/Bazzar/Order.js +38 -38
- package/src/structures/SkyBlock/Bazzar/Product.js +53 -53
- package/src/structures/SkyBlock/News/SkyblockNews.js +60 -68
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +124 -102
- package/src/structures/SkyBlock/SkyblockMember.js +820 -675
- package/src/structures/SkyBlock/SkyblockPet.js +71 -71
- package/src/structures/SkyBlock/SkyblockProfile.js +60 -60
- package/src/structures/Status.js +41 -41
- package/src/structures/Watchdog/Stats.js +36 -36
- package/src/utils/Constants.js +2789 -795
- package/src/utils/SkyblockUtils.js +208 -164
- package/src/utils/arrayTools.js +4 -4
- package/src/utils/divide.js +5 -5
- package/src/utils/guildExp.js +57 -67
- package/src/utils/index.js +13 -9
- package/src/utils/isGuildID.js +3 -3
- package/src/utils/isUUID.js +5 -5
- package/src/utils/oscillation.js +15 -23
- package/src/utils/removeSnakeCase.js +22 -35
- package/src/utils/rgbToHexColor.js +8 -0
- package/src/utils/romanize.js +11 -0
- package/src/utils/toIGN.js +20 -20
- package/src/utils/toUuid.js +19 -19
- package/src/utils/varInt.js +17 -21
- package/typings/index.d.ts +3532 -2625
- package/src/API/getFriends.js +0 -13
- package/src/API/getKeyInfo.js +0 -9
- package/src/API/getRankedSkyWars.js +0 -10
- package/src/structures/Friend.js +0 -38
- package/src/structures/KeyInfo.js +0 -42
- package/src/structures/MiniGames/SkyWarsRanked.js +0 -45
|
@@ -1,148 +1,172 @@
|
|
|
1
|
-
const divide = require('../../utils/divide');
|
|
2
|
-
const kits = [
|
|
3
|
-
'arachnologist',
|
|
4
|
-
'
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
* * `
|
|
116
|
-
* * `
|
|
117
|
-
* * `
|
|
118
|
-
* * `
|
|
119
|
-
* * `
|
|
120
|
-
* * `
|
|
121
|
-
* * `
|
|
122
|
-
* * `
|
|
123
|
-
* * `
|
|
124
|
-
* * `
|
|
125
|
-
* * `
|
|
126
|
-
* * `
|
|
127
|
-
* * `
|
|
128
|
-
* * `
|
|
129
|
-
* * `
|
|
130
|
-
* * `
|
|
131
|
-
* * `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
const divide = require('../../utils/divide');
|
|
2
|
+
const kits = [
|
|
3
|
+
'arachnologist',
|
|
4
|
+
'archer',
|
|
5
|
+
'armorer',
|
|
6
|
+
'astronaut',
|
|
7
|
+
'baker',
|
|
8
|
+
'blaze',
|
|
9
|
+
'creepertamer',
|
|
10
|
+
'fisherman',
|
|
11
|
+
'horsetamer',
|
|
12
|
+
'hunter',
|
|
13
|
+
'knight',
|
|
14
|
+
'meatmaster',
|
|
15
|
+
'necromancer',
|
|
16
|
+
'pigman',
|
|
17
|
+
'reddragon',
|
|
18
|
+
'rogue',
|
|
19
|
+
'scout',
|
|
20
|
+
'slimeyslime',
|
|
21
|
+
'speleologist',
|
|
22
|
+
'tim',
|
|
23
|
+
'toxicologist',
|
|
24
|
+
'troll',
|
|
25
|
+
'wolftamer',
|
|
26
|
+
'paladin',
|
|
27
|
+
'shadow knight',
|
|
28
|
+
'hype train',
|
|
29
|
+
'jockey',
|
|
30
|
+
'reaper',
|
|
31
|
+
'golem',
|
|
32
|
+
'farmer',
|
|
33
|
+
'florist',
|
|
34
|
+
'snowman',
|
|
35
|
+
'guardian',
|
|
36
|
+
'warlock',
|
|
37
|
+
'viking',
|
|
38
|
+
'diver',
|
|
39
|
+
'ranger',
|
|
40
|
+
'donkeytamer',
|
|
41
|
+
'phoenix',
|
|
42
|
+
'warrior',
|
|
43
|
+
'rambo'
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Blitz SG class
|
|
47
|
+
*/
|
|
48
|
+
class BlitzSurvivalGames {
|
|
49
|
+
/**
|
|
50
|
+
* @param {object} data Blitz SG data
|
|
51
|
+
*/
|
|
52
|
+
constructor(data) {
|
|
53
|
+
/**
|
|
54
|
+
* Coins
|
|
55
|
+
* @type {number}
|
|
56
|
+
*/
|
|
57
|
+
this.coins = data.coins || 0;
|
|
58
|
+
/**
|
|
59
|
+
* Kills
|
|
60
|
+
* @type {number}
|
|
61
|
+
*/
|
|
62
|
+
this.kills = data.kills || 0;
|
|
63
|
+
/**
|
|
64
|
+
* Deaths
|
|
65
|
+
* @type {number}
|
|
66
|
+
*/
|
|
67
|
+
this.deaths = data.deaths || 0;
|
|
68
|
+
/**
|
|
69
|
+
* Kill Death ratio
|
|
70
|
+
* @type {number}
|
|
71
|
+
*/
|
|
72
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
73
|
+
/**
|
|
74
|
+
* Solo wins
|
|
75
|
+
* @type {number}
|
|
76
|
+
*/
|
|
77
|
+
this.winsSolo = data.wins || 0;
|
|
78
|
+
/**
|
|
79
|
+
* Team wins
|
|
80
|
+
* @type {number}
|
|
81
|
+
*/
|
|
82
|
+
this.winsTeam = data.wins_teams || 0;
|
|
83
|
+
/**
|
|
84
|
+
* Stats for each kit
|
|
85
|
+
* @type {BlitzSGKitStats[]}
|
|
86
|
+
*/
|
|
87
|
+
this.kitStats = generateKitStats(data);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// eslint-disable-next-line require-jsdoc
|
|
91
|
+
function generateKitStats(data) {
|
|
92
|
+
const stats = [];
|
|
93
|
+
for (let i = 0; i < kits.length; i++) {
|
|
94
|
+
if (data[kits[i]]) {
|
|
95
|
+
stats.push({
|
|
96
|
+
name: kits[i],
|
|
97
|
+
games: data[`games_played_${kits[i]}`] || 0,
|
|
98
|
+
level: data[kits[i]] + 1 || 1,
|
|
99
|
+
experience: data[`exp_${kits[i]}`] || 0,
|
|
100
|
+
prestige: data[`p${kits[i]}`] || 0,
|
|
101
|
+
kills: data[`kills_${kits[i]}`] || 0,
|
|
102
|
+
deaths: data[`deaths_${kits[i]}`] || 0,
|
|
103
|
+
KDRatio: divide(data[`kills_${kits[i]}`], data[`deaths_${kits[i]}`]),
|
|
104
|
+
wins: data[`wins_${kits[i]}`] || 0,
|
|
105
|
+
losses: data[`losses_${kits[i]}`] || 0,
|
|
106
|
+
WLRatio: divide(data[`wins_${kits[i]}`], data[`losses_${kits[i]}`]),
|
|
107
|
+
timePlayed: data[`time_played_${kits[i]}`] || null
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return stats;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @typedef {string} BlitzSGKit
|
|
115
|
+
* * `arachnologist`
|
|
116
|
+
* * `archer`
|
|
117
|
+
* * `armorer`
|
|
118
|
+
* * `astronaut`
|
|
119
|
+
* * `baker`
|
|
120
|
+
* * `blaze`
|
|
121
|
+
* * `creepertamer`
|
|
122
|
+
* * `fisherman`
|
|
123
|
+
* * `horsetamer`
|
|
124
|
+
* * `hunter`
|
|
125
|
+
* * `knight`
|
|
126
|
+
* * `meatmaster`
|
|
127
|
+
* * `necromancer`
|
|
128
|
+
* * `pigman`
|
|
129
|
+
* * `reddragon`
|
|
130
|
+
* * `rogue`
|
|
131
|
+
* * `scout`
|
|
132
|
+
* * `slimeyslime`
|
|
133
|
+
* * `speleologist`
|
|
134
|
+
* * `tim`
|
|
135
|
+
* * `toxicologist`
|
|
136
|
+
* * `troll`
|
|
137
|
+
* * `wolftamer`
|
|
138
|
+
* * `paladin`
|
|
139
|
+
* * `shadow knight`
|
|
140
|
+
* * `hype train`
|
|
141
|
+
* * `jockey`
|
|
142
|
+
* * `reaper`
|
|
143
|
+
* * `golem`
|
|
144
|
+
* * `farmer`
|
|
145
|
+
* * `florist`
|
|
146
|
+
* * `snowman`
|
|
147
|
+
* * `guardian`
|
|
148
|
+
* * `warlock`
|
|
149
|
+
* * `viking`
|
|
150
|
+
* * `diver`
|
|
151
|
+
* * `ranger`
|
|
152
|
+
* * `donkeytamer`
|
|
153
|
+
* * `phoenix`
|
|
154
|
+
* * `warrior`
|
|
155
|
+
* * `rambo`
|
|
156
|
+
*/
|
|
157
|
+
/**
|
|
158
|
+
* @typedef {object} BlitzSGKitStats
|
|
159
|
+
* @property {BlitzSGKit} name Kit name
|
|
160
|
+
* @property {number} games Played games
|
|
161
|
+
* @property {number} level level
|
|
162
|
+
* @property {number} experience Total experience
|
|
163
|
+
* @property {number} prestige Prestige
|
|
164
|
+
* @property {number} kills Kills
|
|
165
|
+
* @property {number} deaths Deaths
|
|
166
|
+
* @property {number} KDRatio Kill Death ratio
|
|
167
|
+
* @property {number} wins Wins
|
|
168
|
+
* @property {number} losses Losses
|
|
169
|
+
* @property {number} WLRatio Win Loss ratio
|
|
170
|
+
* @property {number|null} timePlayed Time played
|
|
171
|
+
*/
|
|
172
|
+
module.exports = BlitzSurvivalGames;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BuildBattle class
|
|
3
|
-
*/
|
|
4
|
-
class BuildBattle {
|
|
5
|
-
/**
|
|
6
|
-
* @param {object} data BuildBattle data
|
|
7
|
-
*/
|
|
8
|
-
constructor
|
|
9
|
-
/**
|
|
10
|
-
* Score
|
|
11
|
-
* @type {number}
|
|
12
|
-
*/
|
|
13
|
-
this.score = data.score || 0;
|
|
14
|
-
/**
|
|
15
|
-
* Played games
|
|
16
|
-
* @type {number}
|
|
17
|
-
*/
|
|
18
|
-
this.playedGames = data.games_played || 0;
|
|
19
|
-
/**
|
|
20
|
-
* Coins
|
|
21
|
-
* @type {number}
|
|
22
|
-
*/
|
|
23
|
-
this.coins = data.coins || 0;
|
|
24
|
-
/**
|
|
25
|
-
* Total votes
|
|
26
|
-
* @type {number}
|
|
27
|
-
*/
|
|
28
|
-
this.totalVotes = data.total_votes || 0;
|
|
29
|
-
/**
|
|
30
|
-
* Total wins
|
|
31
|
-
* @type {number}
|
|
32
|
-
*/
|
|
33
|
-
this.totalWins = data.wins || 0;
|
|
34
|
-
/**
|
|
35
|
-
* Wins for each mode
|
|
36
|
-
* @type {BuildBattleWins}
|
|
37
|
-
*/
|
|
38
|
-
this.wins = {
|
|
39
|
-
solo: data.wins_solo_normal || 0,
|
|
40
|
-
team: data.wins_teams_normal || 0,
|
|
41
|
-
pro: data.wins_solo_pro || 0,
|
|
42
|
-
gtb: data.wins_guess_the_build || 0
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {object} BuildBattleWins
|
|
48
|
-
* @property {number} solo BuildBattle Solo wins
|
|
49
|
-
* @property {number} team BuildBattle Team wins
|
|
50
|
-
* @property {number} pro BuildBattle Pro wins
|
|
51
|
-
* @property {number} gtb BuildBattle Guess The Build wins
|
|
52
|
-
*/
|
|
53
|
-
module.exports = BuildBattle;
|
|
1
|
+
/**
|
|
2
|
+
* BuildBattle class
|
|
3
|
+
*/
|
|
4
|
+
class BuildBattle {
|
|
5
|
+
/**
|
|
6
|
+
* @param {object} data BuildBattle data
|
|
7
|
+
*/
|
|
8
|
+
constructor(data) {
|
|
9
|
+
/**
|
|
10
|
+
* Score
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
this.score = data.score || 0;
|
|
14
|
+
/**
|
|
15
|
+
* Played games
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
this.playedGames = data.games_played || 0;
|
|
19
|
+
/**
|
|
20
|
+
* Coins
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
this.coins = data.coins || 0;
|
|
24
|
+
/**
|
|
25
|
+
* Total votes
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
this.totalVotes = data.total_votes || 0;
|
|
29
|
+
/**
|
|
30
|
+
* Total wins
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
this.totalWins = data.wins || 0;
|
|
34
|
+
/**
|
|
35
|
+
* Wins for each mode
|
|
36
|
+
* @type {BuildBattleWins}
|
|
37
|
+
*/
|
|
38
|
+
this.wins = {
|
|
39
|
+
solo: data.wins_solo_normal || 0,
|
|
40
|
+
team: data.wins_teams_normal || 0,
|
|
41
|
+
pro: data.wins_solo_pro || 0,
|
|
42
|
+
gtb: data.wins_guess_the_build || 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @typedef {object} BuildBattleWins
|
|
48
|
+
* @property {number} solo BuildBattle Solo wins
|
|
49
|
+
* @property {number} team BuildBattle Team wins
|
|
50
|
+
* @property {number} pro BuildBattle Pro wins
|
|
51
|
+
* @property {number} gtb BuildBattle Guess The Build wins
|
|
52
|
+
*/
|
|
53
|
+
module.exports = BuildBattle;
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
const divide = require('../../utils/divide');
|
|
2
|
-
/**
|
|
3
|
-
* Cops and crims class
|
|
4
|
-
*/
|
|
5
|
-
class CopsAndCrims {
|
|
6
|
-
/**
|
|
7
|
-
* @param {object} data Cops and crims data
|
|
8
|
-
*/
|
|
9
|
-
constructor
|
|
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.game_wins || 0;
|
|
35
|
-
/**
|
|
36
|
-
* Round wins
|
|
37
|
-
* @type {number}
|
|
38
|
-
*/
|
|
39
|
-
this.roundWins = data.round_wins || 0;
|
|
40
|
-
/**
|
|
41
|
-
* Shows fired
|
|
42
|
-
* @type {number}
|
|
43
|
-
*/
|
|
44
|
-
this.shotsFired = data.shots_fired || 0;
|
|
45
|
-
/**
|
|
46
|
-
* Headshot kills
|
|
47
|
-
* @type {number}
|
|
48
|
-
*/
|
|
49
|
-
this.headshotKills = data.headshot_kills || 0;
|
|
50
|
-
/**
|
|
51
|
-
* Bombs defused
|
|
52
|
-
* @type {number}
|
|
53
|
-
*/
|
|
54
|
-
this.bombsDefused = data.bombs_defused || 0;
|
|
55
|
-
/**
|
|
56
|
-
* Bombs planted
|
|
57
|
-
* @type {number}
|
|
58
|
-
*/
|
|
59
|
-
this.bombsPlanted = data.bombs_planted || 0;
|
|
60
|
-
/**
|
|
61
|
-
* Kills as Crim
|
|
62
|
-
* @type {number}
|
|
63
|
-
*/
|
|
64
|
-
this.killsAsCrim = data.criminal_kills || 0;
|
|
65
|
-
/**
|
|
66
|
-
* Kills as Cop
|
|
67
|
-
* @type {number}
|
|
68
|
-
*/
|
|
69
|
-
this.killsAsCop = data.cop_kills || 0;
|
|
70
|
-
/**
|
|
71
|
-
* Deathmatch stats
|
|
72
|
-
* @type {CopsAndCrimsDeathmatch}
|
|
73
|
-
*/
|
|
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
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
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
|
|
89
|
-
*/
|
|
90
|
-
module.exports = CopsAndCrims;
|
|
1
|
+
const divide = require('../../utils/divide');
|
|
2
|
+
/**
|
|
3
|
+
* Cops and crims class
|
|
4
|
+
*/
|
|
5
|
+
class CopsAndCrims {
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} data Cops and crims 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.game_wins || 0;
|
|
35
|
+
/**
|
|
36
|
+
* Round wins
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
this.roundWins = data.round_wins || 0;
|
|
40
|
+
/**
|
|
41
|
+
* Shows fired
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
44
|
+
this.shotsFired = data.shots_fired || 0;
|
|
45
|
+
/**
|
|
46
|
+
* Headshot kills
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
49
|
+
this.headshotKills = data.headshot_kills || 0;
|
|
50
|
+
/**
|
|
51
|
+
* Bombs defused
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
this.bombsDefused = data.bombs_defused || 0;
|
|
55
|
+
/**
|
|
56
|
+
* Bombs planted
|
|
57
|
+
* @type {number}
|
|
58
|
+
*/
|
|
59
|
+
this.bombsPlanted = data.bombs_planted || 0;
|
|
60
|
+
/**
|
|
61
|
+
* Kills as Crim
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
this.killsAsCrim = data.criminal_kills || 0;
|
|
65
|
+
/**
|
|
66
|
+
* Kills as Cop
|
|
67
|
+
* @type {number}
|
|
68
|
+
*/
|
|
69
|
+
this.killsAsCop = data.cop_kills || 0;
|
|
70
|
+
/**
|
|
71
|
+
* Deathmatch stats
|
|
72
|
+
* @type {CopsAndCrimsDeathmatch}
|
|
73
|
+
*/
|
|
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
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
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
|
|
89
|
+
*/
|
|
90
|
+
module.exports = CopsAndCrims;
|