hive-bedrock-api 2.1.11 → 3.0.0-alpha.2
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 +49 -69
- package/lib/index.d.ts +95 -14
- package/lib/index.js +378 -35
- package/lib/processors/game.d.ts +299 -0
- package/lib/processors/game.js +390 -0
- package/lib/processors/global_statistics.d.ts +9 -0
- package/lib/processors/global_statistics.js +2 -0
- package/lib/processors/map.d.ts +8 -0
- package/lib/processors/map.js +2 -0
- package/lib/processors/meta.d.ts +45 -0
- package/lib/processors/meta.js +2 -0
- package/lib/processors/player.d.ts +37 -8
- package/lib/processors/player.js +37 -30
- package/lib/processors/player_search.d.ts +6 -0
- package/lib/processors/player_search.js +11 -0
- package/lib/utils.d.ts +22 -0
- package/lib/utils.js +2 -0
- package/package.json +26 -27
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface ProcessedGameMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
shortName: string;
|
|
4
|
+
maxLevel: number;
|
|
5
|
+
allowPrestiging: boolean;
|
|
6
|
+
maxPrestige: number;
|
|
7
|
+
experienceToLevel: {
|
|
8
|
+
[xp: number]: number;
|
|
9
|
+
};
|
|
10
|
+
levelUnlocks: {
|
|
11
|
+
[level: number]: LevelUnlock[];
|
|
12
|
+
};
|
|
13
|
+
levelUnlockTypes: {
|
|
14
|
+
[type: string]: {
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string | null;
|
|
17
|
+
default: string | null;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export type LevelUnlock = {
|
|
22
|
+
name: string;
|
|
23
|
+
icon: string | null;
|
|
24
|
+
type: string;
|
|
25
|
+
global: false;
|
|
26
|
+
} & ({
|
|
27
|
+
global: false;
|
|
28
|
+
} | {
|
|
29
|
+
global: true;
|
|
30
|
+
globalCosmetic: GlobalUnlock;
|
|
31
|
+
});
|
|
32
|
+
export type GlobalUnlock = GlobalTitleUnlock | GlobalAvatarUnlock | GlobalCostumeUnlock;
|
|
33
|
+
export interface GlobalTitleUnlock {
|
|
34
|
+
type: "hub_title";
|
|
35
|
+
display: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GlobalAvatarUnlock {
|
|
38
|
+
type: "avatar";
|
|
39
|
+
name: string;
|
|
40
|
+
url: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GlobalCostumeUnlock {
|
|
43
|
+
type: "costume";
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
@@ -1,9 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export interface ProcessedPlayerResponse {
|
|
2
|
+
info: {
|
|
3
|
+
uuid: string;
|
|
4
|
+
xuid: string;
|
|
5
|
+
username: string;
|
|
6
|
+
rank: string;
|
|
7
|
+
first_played: number;
|
|
8
|
+
login_streak: {
|
|
9
|
+
current: number;
|
|
10
|
+
longest: number;
|
|
11
|
+
};
|
|
12
|
+
friend_count: number;
|
|
13
|
+
quest_count: number;
|
|
14
|
+
};
|
|
15
|
+
equipped_cosmetics: {
|
|
16
|
+
costume: string;
|
|
17
|
+
avatar: {
|
|
18
|
+
name: string;
|
|
19
|
+
url: string;
|
|
20
|
+
};
|
|
21
|
+
hub_title: string;
|
|
22
|
+
hat: string;
|
|
23
|
+
backbling: string;
|
|
24
|
+
};
|
|
25
|
+
owned_cosmetics: {
|
|
26
|
+
costume: string[];
|
|
27
|
+
avatar: {
|
|
28
|
+
name: string;
|
|
29
|
+
url: string;
|
|
30
|
+
}[];
|
|
31
|
+
hub_title: string[];
|
|
32
|
+
hat: string[];
|
|
33
|
+
pet: string[];
|
|
34
|
+
mount: string[];
|
|
35
|
+
backbling: string[];
|
|
36
|
+
};
|
|
8
37
|
}
|
|
9
|
-
export
|
|
38
|
+
export default function processPlayerInfo(playerResponse: any): ProcessedPlayerResponse | null;
|
package/lib/processors/player.js
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (!statistics || Array.isArray(statistics))
|
|
3
|
+
exports.default = processPlayerInfo;
|
|
4
|
+
function processPlayerInfo(playerResponse) {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
6
|
+
if (!playerResponse)
|
|
8
7
|
return null;
|
|
8
|
+
var player = playerResponse.main;
|
|
9
|
+
var info = {
|
|
10
|
+
uuid: player.UUID,
|
|
11
|
+
xuid: player.xuid.toString(),
|
|
12
|
+
username: player.username_cc,
|
|
13
|
+
rank: player.rank,
|
|
14
|
+
first_played: player.first_played,
|
|
15
|
+
login_streak: {
|
|
16
|
+
current: (_a = player.daily_login_streak) !== null && _a !== void 0 ? _a : 0,
|
|
17
|
+
longest: (_b = player.longest_daily_login_streak) !== null && _b !== void 0 ? _b : 0,
|
|
18
|
+
},
|
|
19
|
+
friend_count: (_c = player.friend_count) !== null && _c !== void 0 ? _c : 0,
|
|
20
|
+
quest_count: (_d = player.quest_count) !== null && _d !== void 0 ? _d : 0,
|
|
21
|
+
};
|
|
22
|
+
var equipped_cosmetics = {
|
|
23
|
+
costume: (_e = player.equipped_costume) !== null && _e !== void 0 ? _e : null,
|
|
24
|
+
avatar: (_f = player.equipped_avatar) !== null && _f !== void 0 ? _f : null,
|
|
25
|
+
hub_title: (_g = player.equipped_hub_title) !== null && _g !== void 0 ? _g : null,
|
|
26
|
+
hat: (_h = player.equipped_hat) !== null && _h !== void 0 ? _h : null,
|
|
27
|
+
backbling: (_j = player.equipped_backbling) !== null && _j !== void 0 ? _j : null,
|
|
28
|
+
};
|
|
29
|
+
var owned_cosmetics = {
|
|
30
|
+
costume: (_k = player.costume_unlocked) !== null && _k !== void 0 ? _k : [],
|
|
31
|
+
avatar: (_l = player.avatar_unlocked) !== null && _l !== void 0 ? _l : [],
|
|
32
|
+
hub_title: (_m = player.hub_title_unlocked) !== null && _m !== void 0 ? _m : [],
|
|
33
|
+
hat: (_o = player.hat_unlocked) !== null && _o !== void 0 ? _o : [],
|
|
34
|
+
pet: (_p = player.pets) !== null && _p !== void 0 ? _p : [],
|
|
35
|
+
mount: (_q = player.mounts) !== null && _q !== void 0 ? _q : [],
|
|
36
|
+
backbling: (_r = player["cosmetics.backbling"]) !== null && _r !== void 0 ? _r : [],
|
|
37
|
+
};
|
|
9
38
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
username_cc: statistics.username_cc,
|
|
14
|
-
rank: (_a = statistics.rank) !== null && _a !== void 0 ? _a : hive_bedrock_data_1.PlayerRank.Regular,
|
|
15
|
-
first_played: (_b = statistics.first_played) !== null && _b !== void 0 ? _b : null,
|
|
16
|
-
quest_count: (_c = statistics.quest_count) !== null && _c !== void 0 ? _c : 0,
|
|
17
|
-
friend_count: (_d = statistics.friend_count) !== null && _d !== void 0 ? _d : 0,
|
|
18
|
-
daily_login_streak: (_e = statistics.daily_login_streak) !== null && _e !== void 0 ? _e : 0,
|
|
19
|
-
longest_daily_login_streak: (_f = statistics.longest_daily_login_streak) !== null && _f !== void 0 ? _f : 0,
|
|
20
|
-
avatar_count: (_h = (_g = statistics.avatar_unlocked) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0,
|
|
21
|
-
avatar_unlocked: (_j = statistics.avatar_unlocked) !== null && _j !== void 0 ? _j : [],
|
|
22
|
-
equipped_avatar: (_k = statistics.equipped_avatar) !== null && _k !== void 0 ? _k : null,
|
|
23
|
-
hub_title_count: (_m = (_l = statistics.hub_title_unlocked) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0,
|
|
24
|
-
hub_title_unlocked: (_o = statistics.hub_title_unlocked) !== null && _o !== void 0 ? _o : [],
|
|
25
|
-
equipped_hub_title: (_p = statistics.equipped_hub_title) !== null && _p !== void 0 ? _p : null,
|
|
26
|
-
costume_count: (_r = (_q = statistics.costume_unlocked) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0,
|
|
27
|
-
costume_unlocked: (_s = statistics.costume_unlocked) !== null && _s !== void 0 ? _s : [],
|
|
28
|
-
equipped_costume: (_t = statistics.equipped_costume) !== null && _t !== void 0 ? _t : null,
|
|
29
|
-
backbling_count: (_v = (_u = statistics["cosmetics.backbling"]) === null || _u === void 0 ? void 0 : _u.length) !== null && _v !== void 0 ? _v : 0,
|
|
30
|
-
backbling_unlocked: (_w = statistics["cosmetics.backbling"]) !== null && _w !== void 0 ? _w : [],
|
|
31
|
-
hat_count: (_y = (_x = statistics.hat_unlocked) === null || _x === void 0 ? void 0 : _x.length) !== null && _y !== void 0 ? _y : 0,
|
|
32
|
-
hat_unlocked: (_z = statistics.hat_unlocked) !== null && _z !== void 0 ? _z : [],
|
|
33
|
-
pets: (_0 = statistics.pets) !== null && _0 !== void 0 ? _0 : [],
|
|
34
|
-
mounts: (_1 = statistics.mounts) !== null && _1 !== void 0 ? _1 : [],
|
|
39
|
+
info: info,
|
|
40
|
+
equipped_cosmetics: equipped_cosmetics,
|
|
41
|
+
owned_cosmetics: owned_cosmetics,
|
|
35
42
|
};
|
|
36
43
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = processPlayerSearch;
|
|
4
|
+
function processPlayerSearch(playerSearchResponse) {
|
|
5
|
+
if (!playerSearchResponse)
|
|
6
|
+
return null;
|
|
7
|
+
return playerSearchResponse.map(function (player) { return ({
|
|
8
|
+
uuid: player.UUID,
|
|
9
|
+
username: player.username_cc,
|
|
10
|
+
}); });
|
|
11
|
+
}
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface MethodResponseError {
|
|
2
|
+
status?: number;
|
|
3
|
+
message?: string;
|
|
4
|
+
}
|
|
5
|
+
export type MethodResponse<D extends any> = {
|
|
6
|
+
meta?: {
|
|
7
|
+
/** sss */
|
|
8
|
+
duration: number;
|
|
9
|
+
ratelimit?: {
|
|
10
|
+
limit: number;
|
|
11
|
+
remaining: number;
|
|
12
|
+
reset: number;
|
|
13
|
+
};
|
|
14
|
+
retryAfter?: number;
|
|
15
|
+
};
|
|
16
|
+
} & ({
|
|
17
|
+
data: D;
|
|
18
|
+
error: null;
|
|
19
|
+
} | {
|
|
20
|
+
data: null;
|
|
21
|
+
error: MethodResponseError;
|
|
22
|
+
});
|
package/lib/utils.js
ADDED
package/package.json
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hive-bedrock-api",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "An API wrapper for the Hive Minecraft Bedrock Edition server.",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/CubeEdge-Studios/hive-bedrock.git"
|
|
10
|
-
},
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"author": "Cubeedge Studios",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"hive-bedrock-data": "^
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc"
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"lib/**/*"
|
|
21
|
-
],
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"ts-node": "^10.9.1",
|
|
24
|
-
"typescript": "^5.1.3"
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "hive-bedrock-api",
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
4
|
+
"description": "An API wrapper for the Hive Minecraft Bedrock Edition server.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/CubeEdge-Studios/hive-bedrock.git"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Cubeedge Studios",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"hive-bedrock-data": "^2.0.0-alpha.0"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"lib/**/*"
|
|
21
|
+
],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"ts-node": "^10.9.1",
|
|
24
|
+
"typescript": "^5.1.3"
|
|
25
|
+
}
|
|
26
|
+
}
|