hive-bedrock-api 0.1.0-beta.2 → 0.1.0-beta.3
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/README.md +90 -1
- package/lib/format/gameFormat.d.ts +1 -1
- package/lib/format/gameFormat.js +13 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +17 -3
- package/lib/methods/getAllTimeLeaderboard.d.ts +1 -1
- package/lib/methods/getMonthlyLeaderboard.d.ts +3 -2
- package/lib/methods/getMonthlyLeaderboard.js +4 -0
- package/lib/methods/getMonthlyStats.d.ts +1 -0
- package/lib/methods/getMonthlyStats.js +40 -22
- package/lib/types/GAMES.d.ts +19 -0
- package/lib/types/GAME_INFO.d.ts +1 -0
- package/lib/types/GAME_INFO.js +27 -14
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hive Bedrock API
|
|
2
2
|
|
|
3
|
-
An API wrapper for the Hive Minecraft Bedrock Edition server. Which allows you to get stats for leaderboards and
|
|
3
|
+
An API wrapper for the Hive Minecraft Bedrock Edition server. Which allows you to get stats for leaderboards, players, cosmetics and total unique player counts.
|
|
4
4
|
|
|
5
5
|
## Getting started
|
|
6
6
|
|
|
@@ -8,3 +8,92 @@ An API wrapper for the Hive Minecraft Bedrock Edition server. Which allows you t
|
|
|
8
8
|
$ npm install hive-bedrock-api
|
|
9
9
|
$ yarn add hive-bedrock-api
|
|
10
10
|
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Fetch All-Time Player Statistics
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { getAllTimeStats, GAME } from "hive-bedrock-api";
|
|
18
|
+
|
|
19
|
+
// Returns all games
|
|
20
|
+
const { data, player, error } = await getAllTimeStats("ucdfiddes");
|
|
21
|
+
|
|
22
|
+
// Returns multiple specific games
|
|
23
|
+
const { data, player, error } = await getAllTimeStats("ucdfiddes", [
|
|
24
|
+
GAME.Deathrun,
|
|
25
|
+
GAME.TheBridge,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
// Returns a single game
|
|
29
|
+
const { data, error } = await getAllTimeStats("ucdfiddes", GAME.HideAndSeek);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Fetch Monthly Player Statistics
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { getMonthlyStats, GAME } from "hive-bedrock-api";
|
|
36
|
+
|
|
37
|
+
// Returns all games
|
|
38
|
+
const { data, error } = await getMonthlyStats("ucdfiddes");
|
|
39
|
+
|
|
40
|
+
// Returns multiple specific games
|
|
41
|
+
const { data, error } = await getMonthlyStats("ucdfiddes", [
|
|
42
|
+
GAME.Deathrun,
|
|
43
|
+
GAME.TheBridge,
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
// Returns a single game
|
|
47
|
+
const { data, error } = await getMonthlyStats("ucdfiddes", GAME.BlockDrop);
|
|
48
|
+
|
|
49
|
+
// Returns a single game in a previous month (can return muliple games)
|
|
50
|
+
const { data, error } = await getMonthlyStats("ucdfiddes", GAME.BlockDrop, {
|
|
51
|
+
year: 2023,
|
|
52
|
+
month: 1, // January
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Fetch All-Time Leaderboard
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { getAllTimeLeaderboard, GAME } from "hive-bedrock-api";
|
|
60
|
+
|
|
61
|
+
// Returns asingle game
|
|
62
|
+
const { data, error } = await getAllTimeLeaderboard(GAME.TreasureWars);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Fetch Monthly Leaderboard
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { getMonthlyLeaderboard, GAME } from "hive-bedrock-api";
|
|
69
|
+
|
|
70
|
+
// Returns asingle game
|
|
71
|
+
const { data, error } = await getMonthlyLeaderboard(GAME.TreasureWars);
|
|
72
|
+
|
|
73
|
+
// Returns a single game from a previous month
|
|
74
|
+
const { data, error } = await getMonthlyLeaderboard(GAME.BlockParty, {
|
|
75
|
+
year: 2023,
|
|
76
|
+
month: 11, // November
|
|
77
|
+
amount: 50,
|
|
78
|
+
skip: 20, // Sum of skip and amount must be <=100
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Fetch Global Statistics
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { getGlobalStatistics } from "hive-bedrock-api";
|
|
86
|
+
|
|
87
|
+
// Returns unqiue total player counts for different games
|
|
88
|
+
const { data, error } = await getGlobalStatistics();
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## API Response Changes
|
|
92
|
+
|
|
93
|
+
Different API responses are edited by the wrapper to provide more data:
|
|
94
|
+
|
|
95
|
+
- Game responses have a new value "id" showing the parent game
|
|
96
|
+
- "first_played" values are converted into a Date object
|
|
97
|
+
- A new value for "losses" is provided
|
|
98
|
+
- A new value for "kdr" is provided
|
|
99
|
+
- "xp" is converted and a "level" is provided
|
|
@@ -7,7 +7,7 @@ interface GameFormat {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const formats: {
|
|
9
9
|
main: (player: SingleGameFormat) => SingleGameFormat;
|
|
10
|
-
default: (gameType: GAME, game: SingleGameFormat) => {
|
|
10
|
+
default: (gameType: GAME, game: SingleGameFormat | null) => {
|
|
11
11
|
id: GAME;
|
|
12
12
|
} | null;
|
|
13
13
|
drop: (game: SingleGameFormat | null) => SingleGameFormat | null;
|
package/lib/format/gameFormat.js
CHANGED
|
@@ -41,6 +41,8 @@ exports.formats = (_a = {
|
|
|
41
41
|
return player;
|
|
42
42
|
},
|
|
43
43
|
default: function (gameType, game) {
|
|
44
|
+
if (!game)
|
|
45
|
+
return null;
|
|
44
46
|
if ("index" in game && game.index == 2147483646)
|
|
45
47
|
return null;
|
|
46
48
|
if ("xp" in game) {
|
|
@@ -50,8 +52,10 @@ exports.formats = (_a = {
|
|
|
50
52
|
return null;
|
|
51
53
|
if ("first_played" in game)
|
|
52
54
|
game.first_played = new Date(game.first_played * 1000);
|
|
53
|
-
if ("played" in game && "victories" in game)
|
|
55
|
+
if ("played" in game && "victories" in game) {
|
|
54
56
|
game.losses = game.played - game.victories;
|
|
57
|
+
game.win_percentage = parseFloat((game.victories / game.played).toFixed(2));
|
|
58
|
+
}
|
|
55
59
|
if ("kills" in game && "deaths" in game)
|
|
56
60
|
game.kdr = parseFloat((game.kills / game.deaths).toFixed(2));
|
|
57
61
|
return __assign({ id: gameType }, game);
|
|
@@ -73,12 +77,20 @@ exports.formats = (_a = {
|
|
|
73
77
|
return game;
|
|
74
78
|
},
|
|
75
79
|
_a[GAME_INFO_1.GAME.HideAndSeek] = function (game) {
|
|
80
|
+
if (!game)
|
|
81
|
+
return null;
|
|
82
|
+
if ("hider_kills" in game && "deaths" in game)
|
|
83
|
+
game.kdr = parseFloat((game.hider_kills / game.deaths).toFixed(2));
|
|
76
84
|
return game;
|
|
77
85
|
},
|
|
78
86
|
_a[GAME_INFO_1.GAME.JustBuild] = function (game) {
|
|
79
87
|
return game;
|
|
80
88
|
},
|
|
81
89
|
_a[GAME_INFO_1.GAME.MurderMystery] = function (game) {
|
|
90
|
+
if (!game)
|
|
91
|
+
return null;
|
|
92
|
+
if ("murders" in game && "deaths" in game)
|
|
93
|
+
game.kdr = parseFloat((game.murders / game.deaths).toFixed(2));
|
|
82
94
|
return game;
|
|
83
95
|
},
|
|
84
96
|
_a[GAME_INFO_1.GAME.Skywars] = function (game) {
|
package/lib/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ import getMonthlyLeaderboard from "./methods/getMonthlyLeaderboard";
|
|
|
3
3
|
import getAllTimeStats from "./methods/getAllTimeStats";
|
|
4
4
|
import getAllTimeLeaderboard from "./methods/getAllTimeLeaderboard";
|
|
5
5
|
import getGlobalStatistics from "./methods/getGlobalStatistics";
|
|
6
|
-
import {
|
|
7
|
-
export { getAllTimeStats, getAllTimeLeaderboard, getMonthlyStats, getMonthlyLeaderboard, getGlobalStatistics,
|
|
6
|
+
import { AVATAR, RANK } from "./types/API";
|
|
7
|
+
export { getAllTimeStats, getAllTimeLeaderboard, getMonthlyStats, getMonthlyLeaderboard, getGlobalStatistics, AVATAR, RANK, };
|
|
8
|
+
export * from "./types/GAME_INFO";
|
|
9
|
+
export * from "./types/GAMES";
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
5
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
20
|
+
exports.getGlobalStatistics = exports.getMonthlyLeaderboard = exports.getMonthlyStats = exports.getAllTimeLeaderboard = exports.getAllTimeStats = void 0;
|
|
7
21
|
var getMonthlyStats_1 = __importDefault(require("./methods/getMonthlyStats"));
|
|
8
22
|
exports.getMonthlyStats = getMonthlyStats_1.default;
|
|
9
23
|
var getMonthlyLeaderboard_1 = __importDefault(require("./methods/getMonthlyLeaderboard"));
|
|
@@ -14,5 +28,5 @@ var getAllTimeLeaderboard_1 = __importDefault(require("./methods/getAllTimeLeade
|
|
|
14
28
|
exports.getAllTimeLeaderboard = getAllTimeLeaderboard_1.default;
|
|
15
29
|
var getGlobalStatistics_1 = __importDefault(require("./methods/getGlobalStatistics"));
|
|
16
30
|
exports.getGlobalStatistics = getGlobalStatistics_1.default;
|
|
17
|
-
|
|
18
|
-
|
|
31
|
+
__exportStar(require("./types/GAME_INFO"), exports);
|
|
32
|
+
__exportStar(require("./types/GAMES"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LB_STATS } from "../types/GAMES";
|
|
2
2
|
import { GAME } from "../types/GAME_INFO";
|
|
3
3
|
import { MethodResponse } from "../types/METHODS";
|
|
4
|
-
export default function getAllTimeLeaderboard<G extends GAME>(game: G): Promise<MethodResponse<LB_STATS<G
|
|
4
|
+
export default function getAllTimeLeaderboard<G extends GAME>(game: G): Promise<MethodResponse<LB_STATS<G>[]>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LB_STATS } from "../types/GAMES";
|
|
2
2
|
import { GAME } from "../types/GAME_INFO";
|
|
3
3
|
import { MethodResponse } from "../types/METHODS";
|
|
4
|
-
export default function getMonthlyLeaderboard<G extends GAME>(game: G): Promise<MethodResponse<LB_STATS<G
|
|
4
|
+
export default function getMonthlyLeaderboard<G extends GAME>(game: G): Promise<MethodResponse<LB_STATS<G>[]>>;
|
|
5
5
|
export default function getMonthlyLeaderboard<G extends GAME>(game: G, options: {
|
|
6
6
|
year?: number;
|
|
7
7
|
month?: number;
|
|
8
|
+
date?: Date;
|
|
8
9
|
skip?: number;
|
|
9
10
|
amount?: number;
|
|
10
|
-
}): Promise<MethodResponse<LB_STATS<G
|
|
11
|
+
}): Promise<MethodResponse<LB_STATS<G>[]>>;
|
|
@@ -83,6 +83,10 @@ function getMonthlyLeaderboard(game, options) {
|
|
|
83
83
|
month = (_b = options.month) !== null && _b !== void 0 ? _b : new Date().getMonth() + 1;
|
|
84
84
|
amount = (_c = options.amount) !== null && _c !== void 0 ? _c : 100;
|
|
85
85
|
skip = (_d = options.skip) !== null && _d !== void 0 ? _d : 0;
|
|
86
|
+
if (options.date) {
|
|
87
|
+
year = options.date.getFullYear();
|
|
88
|
+
month = options.date.getMonth() + 1;
|
|
89
|
+
}
|
|
86
90
|
_g.label = 6;
|
|
87
91
|
case 6:
|
|
88
92
|
_g.trys.push([6, 8, , 9]);
|
|
@@ -6,6 +6,7 @@ export default function getMonthlyStats<G extends GAME>(playerIdentifier: string
|
|
|
6
6
|
export default function getMonthlyStats<G extends GAME>(playerIdentifier: string, game: G, options: {
|
|
7
7
|
year?: number;
|
|
8
8
|
month?: number;
|
|
9
|
+
date?: Date;
|
|
9
10
|
}): Promise<MethodResponse<GAME_STATS<BASE_GAME_MONTHLY>[G]>>;
|
|
10
11
|
export default function getMonthlyStats<G extends GAME>(playerIdentifier: string, game: G[]): Promise<MethodResponse<{
|
|
11
12
|
[M in G]: GAME_STATS_ALL<M>;
|
|
@@ -72,17 +72,18 @@ var fetchData_1 = __importDefault(require("./fetchData"));
|
|
|
72
72
|
function getMonthlyStats(playerIdentifier, game, options) {
|
|
73
73
|
var _a, _b;
|
|
74
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
-
var _c, data, error, gameData, filteredGamesEntries, filteredGames, err_1, year, month, _d, data, error, err_2, _e, data, error, err_3, _f, data, error, FILTER_GAMES_1, filteredGamesEntries, filteredGames, err_4;
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
var _c, data, error, gameData, filteredGamesEntries, filteredGames, err_1, year, month, _d, data, error, gameData, err_2, _e, data, error, gameData, err_3, _f, data, error, FILTER_GAMES_1, filteredGamesEntries, filteredGames, gameData, err_4;
|
|
76
|
+
var _g, _h;
|
|
77
|
+
return __generator(this, function (_j) {
|
|
78
|
+
switch (_j.label) {
|
|
78
79
|
case 0:
|
|
79
80
|
if (!!game) return [3 /*break*/, 4];
|
|
80
|
-
|
|
81
|
+
_j.label = 1;
|
|
81
82
|
case 1:
|
|
82
|
-
|
|
83
|
+
_j.trys.push([1, 3, , 4]);
|
|
83
84
|
return [4 /*yield*/, (0, fetchData_1.default)("/game/monthly/player/all/".concat(playerIdentifier))];
|
|
84
85
|
case 2:
|
|
85
|
-
_c =
|
|
86
|
+
_c = _j.sent(), data = _c.data, error = _c.error;
|
|
86
87
|
if (error || !data)
|
|
87
88
|
return [2 /*return*/, {
|
|
88
89
|
data: null,
|
|
@@ -96,55 +97,71 @@ function getMonthlyStats(playerIdentifier, game, options) {
|
|
|
96
97
|
filteredGames = Object.fromEntries(filteredGamesEntries);
|
|
97
98
|
return [2 /*return*/, { data: filteredGames, error: null }];
|
|
98
99
|
case 3:
|
|
99
|
-
err_1 =
|
|
100
|
+
err_1 = _j.sent();
|
|
100
101
|
console.error(err_1);
|
|
101
102
|
return [2 /*return*/, { data: null, error: { message: "Failed to fetch data." } }];
|
|
102
103
|
case 4:
|
|
103
104
|
if (!(options && typeof game === "string")) return [3 /*break*/, 8];
|
|
104
105
|
year = (_a = options.year) !== null && _a !== void 0 ? _a : new Date().getFullYear();
|
|
105
106
|
month = (_b = options.month) !== null && _b !== void 0 ? _b : new Date().getMonth() + 1;
|
|
106
|
-
|
|
107
|
+
if (options.date) {
|
|
108
|
+
year = options.date.getFullYear();
|
|
109
|
+
month = options.date.getMonth() + 1;
|
|
110
|
+
}
|
|
111
|
+
_j.label = 5;
|
|
107
112
|
case 5:
|
|
108
|
-
|
|
113
|
+
_j.trys.push([5, 7, , 8]);
|
|
109
114
|
return [4 /*yield*/, (0, fetchData_1.default)("/game/monthly/player/".concat(game, "/").concat(playerIdentifier, "/").concat(year, "/").concat(month))];
|
|
110
115
|
case 6:
|
|
111
|
-
_d =
|
|
116
|
+
_d = _j.sent(), data = _d.data, error = _d.error;
|
|
112
117
|
if (error || !data)
|
|
113
118
|
return [2 /*return*/, {
|
|
114
119
|
data: null,
|
|
115
120
|
error: __assign({ message: "Failed to fetch data." }, error),
|
|
116
121
|
}];
|
|
117
|
-
|
|
122
|
+
gameData = (0, gameFormat_1.default)((_g = {},
|
|
123
|
+
_g[game] = data,
|
|
124
|
+
_g), true);
|
|
125
|
+
return [2 /*return*/, {
|
|
126
|
+
data: gameData,
|
|
127
|
+
error: null,
|
|
128
|
+
}];
|
|
118
129
|
case 7:
|
|
119
|
-
err_2 =
|
|
130
|
+
err_2 = _j.sent();
|
|
120
131
|
console.error(err_2);
|
|
121
132
|
return [2 /*return*/, { data: null, error: { message: "Failed to fetch data." } }];
|
|
122
133
|
case 8:
|
|
123
134
|
if (!(typeof game === "string")) return [3 /*break*/, 12];
|
|
124
|
-
|
|
135
|
+
_j.label = 9;
|
|
125
136
|
case 9:
|
|
126
|
-
|
|
137
|
+
_j.trys.push([9, 11, , 12]);
|
|
127
138
|
return [4 /*yield*/, (0, fetchData_1.default)("/game/monthly/player/".concat(game, "/").concat(playerIdentifier))];
|
|
128
139
|
case 10:
|
|
129
|
-
_e =
|
|
140
|
+
_e = _j.sent(), data = _e.data, error = _e.error;
|
|
130
141
|
if (error || !data)
|
|
131
142
|
return [2 /*return*/, {
|
|
132
143
|
data: null,
|
|
133
144
|
error: __assign({ message: "Failed to fetch data." }, error),
|
|
134
145
|
}];
|
|
135
|
-
|
|
146
|
+
gameData = (0, gameFormat_1.default)((_h = {},
|
|
147
|
+
_h[game] = data,
|
|
148
|
+
_h), true);
|
|
149
|
+
return [2 /*return*/, {
|
|
150
|
+
data: gameData,
|
|
151
|
+
error: null,
|
|
152
|
+
}];
|
|
136
153
|
case 11:
|
|
137
|
-
err_3 =
|
|
154
|
+
err_3 = _j.sent();
|
|
138
155
|
console.error(err_3);
|
|
139
156
|
return [2 /*return*/, { data: null, error: { message: "Failed to fetch data." } }];
|
|
140
157
|
case 12:
|
|
141
158
|
if (!Array.isArray(game)) return [3 /*break*/, 16];
|
|
142
|
-
|
|
159
|
+
_j.label = 13;
|
|
143
160
|
case 13:
|
|
144
|
-
|
|
161
|
+
_j.trys.push([13, 15, , 16]);
|
|
145
162
|
return [4 /*yield*/, (0, fetchData_1.default)("/game/monthly/player/all/".concat(playerIdentifier))];
|
|
146
163
|
case 14:
|
|
147
|
-
_f =
|
|
164
|
+
_f = _j.sent(), data = _f.data, error = _f.error;
|
|
148
165
|
if (error || !data)
|
|
149
166
|
return [2 /*return*/, {
|
|
150
167
|
data: null,
|
|
@@ -156,9 +173,10 @@ function getMonthlyStats(playerIdentifier, game, options) {
|
|
|
156
173
|
return FILTER_GAMES_1.includes(key);
|
|
157
174
|
});
|
|
158
175
|
filteredGames = Object.fromEntries(filteredGamesEntries);
|
|
159
|
-
|
|
176
|
+
gameData = (0, gameFormat_1.default)(filteredGames);
|
|
177
|
+
return [2 /*return*/, { data: gameData, error: null }];
|
|
160
178
|
case 15:
|
|
161
|
-
err_4 =
|
|
179
|
+
err_4 = _j.sent();
|
|
162
180
|
console.error(err_4);
|
|
163
181
|
return [2 /*return*/, { data: null, error: { message: "Failed to fetch data." } }];
|
|
164
182
|
case 16: return [2 /*return*/, { data: null, error: { message: "Failed to detect game type." } }];
|
package/lib/types/GAMES.d.ts
CHANGED
|
@@ -27,12 +27,23 @@ export type LB_STATS<G extends GAME> = GAME_STATS<BASE_LB>[G];
|
|
|
27
27
|
export type GAME_STATS_ALL<G extends GAME> = GAME_STATS<BASE_GAME_ALL>[G];
|
|
28
28
|
export type GAME_STATS_MONTHLY<G extends GAME> = GAME_STATS<BASE_GAME_MONTHLY>[G];
|
|
29
29
|
export interface BASE_LB extends API_BASE_LB {
|
|
30
|
+
id: GAME;
|
|
31
|
+
level: number;
|
|
32
|
+
losses: number;
|
|
33
|
+
win_percentage: number;
|
|
30
34
|
}
|
|
31
35
|
export interface BASE_GAME_ALL extends Omit<API_BASE_GAME_ALL, "first_played"> {
|
|
32
36
|
id: GAME;
|
|
37
|
+
level: number;
|
|
38
|
+
losses: number;
|
|
33
39
|
first_played: Date;
|
|
40
|
+
win_percentage: number;
|
|
34
41
|
}
|
|
35
42
|
export interface BASE_GAME_MONTHLY extends API_BASE_GAME_MONTHLY {
|
|
43
|
+
id: GAME;
|
|
44
|
+
level: number;
|
|
45
|
+
losses: number;
|
|
46
|
+
win_percentage: number;
|
|
36
47
|
}
|
|
37
48
|
export interface USER_MAIN extends Omit<API_USER_MAIN, "first_played"> {
|
|
38
49
|
first_played: Date;
|
|
@@ -40,24 +51,32 @@ export interface USER_MAIN extends Omit<API_USER_MAIN, "first_played"> {
|
|
|
40
51
|
export interface GAME_HIDE extends API_GAME_HIDE {
|
|
41
52
|
}
|
|
42
53
|
export interface GAME_DR extends API_GAME_DR {
|
|
54
|
+
kdr: number;
|
|
43
55
|
}
|
|
44
56
|
export interface GAME_WARS extends API_GAME_WARS {
|
|
57
|
+
kdr: number;
|
|
45
58
|
}
|
|
46
59
|
export interface GAME_MURDER extends API_GAME_MURDER {
|
|
60
|
+
kdr: number;
|
|
47
61
|
}
|
|
48
62
|
export interface GAME_SG extends API_GAME_SG {
|
|
63
|
+
kdr: number;
|
|
49
64
|
}
|
|
50
65
|
export interface GAME_SKY extends API_GAME_SKY {
|
|
66
|
+
kdr: number;
|
|
51
67
|
}
|
|
52
68
|
export interface GAME_CTF extends API_GAME_CTF {
|
|
69
|
+
kdr: number;
|
|
53
70
|
}
|
|
54
71
|
export interface GAME_DROP extends API_GAME_DROP {
|
|
55
72
|
}
|
|
56
73
|
export interface GAME_GROUND extends API_GAME_GROUND {
|
|
74
|
+
kdr: number;
|
|
57
75
|
}
|
|
58
76
|
export interface GAME_BUILD extends API_GAME_BUILD {
|
|
59
77
|
}
|
|
60
78
|
export interface GAME_PARTY extends API_GAME_PARTY {
|
|
61
79
|
}
|
|
62
80
|
export interface GAME_BRIDGE extends API_GAME_BRIDGE {
|
|
81
|
+
kdr: number;
|
|
63
82
|
}
|
package/lib/types/GAME_INFO.d.ts
CHANGED
package/lib/types/GAME_INFO.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.GAME_INFO = exports.GAME = void 0;
|
|
4
5
|
var GAME;
|
|
@@ -16,77 +17,89 @@ var GAME;
|
|
|
16
17
|
GAME["BlockParty"] = "party";
|
|
17
18
|
GAME["TheBridge"] = "bridge";
|
|
18
19
|
})(GAME || (exports.GAME = GAME = {}));
|
|
19
|
-
exports.GAME_INFO = {
|
|
20
|
-
|
|
20
|
+
exports.GAME_INFO = (_a = {},
|
|
21
|
+
_a[GAME.TreasureWars] = {
|
|
22
|
+
id: GAME.TreasureWars,
|
|
21
23
|
maxLevel: 100,
|
|
22
24
|
increment: 150,
|
|
23
25
|
incrementCap: 52,
|
|
24
26
|
prestige: true,
|
|
25
27
|
},
|
|
26
|
-
|
|
28
|
+
_a[GAME.DeathRun] = {
|
|
29
|
+
id: GAME.DeathRun,
|
|
27
30
|
maxLevel: 75,
|
|
28
31
|
increment: 200,
|
|
29
32
|
incrementCap: 42,
|
|
30
33
|
prestige: false,
|
|
31
34
|
},
|
|
32
|
-
|
|
35
|
+
_a[GAME.HideAndSeek] = {
|
|
36
|
+
id: GAME.HideAndSeek,
|
|
33
37
|
maxLevel: 50,
|
|
34
38
|
increment: 100,
|
|
35
39
|
incrementCap: null,
|
|
36
40
|
prestige: false,
|
|
37
41
|
},
|
|
38
|
-
|
|
42
|
+
_a[GAME.MurderMystery] = {
|
|
43
|
+
id: GAME.MurderMystery,
|
|
39
44
|
maxLevel: 100,
|
|
40
45
|
increment: 100,
|
|
41
46
|
incrementCap: 82,
|
|
42
47
|
prestige: true,
|
|
43
48
|
},
|
|
44
|
-
|
|
49
|
+
_a[GAME.SurvivalGames] = {
|
|
50
|
+
id: GAME.SurvivalGames,
|
|
45
51
|
maxLevel: 30,
|
|
46
52
|
increment: 150,
|
|
47
53
|
incrementCap: null,
|
|
48
54
|
prestige: false,
|
|
49
55
|
},
|
|
50
|
-
|
|
56
|
+
_a[GAME.Skywars] = {
|
|
57
|
+
id: GAME.Skywars,
|
|
51
58
|
maxLevel: 75,
|
|
52
59
|
increment: 150,
|
|
53
60
|
incrementCap: 52,
|
|
54
61
|
prestige: false,
|
|
55
62
|
},
|
|
56
|
-
|
|
63
|
+
_a[GAME.JustBuild] = {
|
|
64
|
+
id: GAME.JustBuild,
|
|
57
65
|
maxLevel: 20,
|
|
58
66
|
increment: 100,
|
|
59
67
|
incrementCap: null,
|
|
60
68
|
prestige: false,
|
|
61
69
|
},
|
|
62
|
-
|
|
70
|
+
_a[GAME.GroundWars] = {
|
|
71
|
+
id: GAME.GroundWars,
|
|
63
72
|
maxLevel: 20,
|
|
64
73
|
increment: 150,
|
|
65
74
|
incrementCap: null,
|
|
66
75
|
prestige: false,
|
|
67
76
|
},
|
|
68
|
-
|
|
77
|
+
_a[GAME.BlockDrop] = {
|
|
78
|
+
id: GAME.BlockDrop,
|
|
69
79
|
maxLevel: 25,
|
|
70
80
|
increment: 150,
|
|
71
81
|
incrementCap: 22,
|
|
72
82
|
prestige: false,
|
|
73
83
|
},
|
|
74
|
-
|
|
84
|
+
_a[GAME.CaptureTheFlag] = {
|
|
85
|
+
id: GAME.CaptureTheFlag,
|
|
75
86
|
maxLevel: 20,
|
|
76
87
|
increment: 150,
|
|
77
88
|
incrementCap: null,
|
|
78
89
|
prestige: false,
|
|
79
90
|
},
|
|
80
|
-
|
|
91
|
+
_a[GAME.BlockParty] = {
|
|
92
|
+
id: GAME.BlockParty,
|
|
81
93
|
maxLevel: 25,
|
|
82
94
|
increment: 150,
|
|
83
95
|
incrementCap: null,
|
|
84
96
|
prestige: false,
|
|
85
97
|
},
|
|
86
|
-
|
|
98
|
+
_a[GAME.TheBridge] = {
|
|
99
|
+
id: GAME.TheBridge,
|
|
87
100
|
maxLevel: 20,
|
|
88
101
|
increment: 0,
|
|
89
102
|
incrementCap: null,
|
|
90
103
|
prestige: false,
|
|
91
104
|
},
|
|
92
|
-
|
|
105
|
+
_a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hive-bedrock-api",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
4
|
"description": "An API wrapper for the Hive Minecraft Bedrock Edition server.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -12,12 +12,18 @@
|
|
|
12
12
|
"author": "Cubeedge Studios",
|
|
13
13
|
"dependencies": {},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "tsc"
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"test": "jest"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"lib/**/*"
|
|
19
20
|
],
|
|
20
21
|
"devDependencies": {
|
|
22
|
+
"@types/jest": "^29.5.2",
|
|
23
|
+
"jest": "^29.5.0",
|
|
24
|
+
"jest-extended": "^4.0.0",
|
|
25
|
+
"ts-jest": "^29.1.0",
|
|
26
|
+
"ts-node": "^10.9.1",
|
|
21
27
|
"typescript": "^5.1.3"
|
|
22
28
|
}
|
|
23
29
|
}
|