gj-boomlings-api 2.0.2 → 2.1.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/LICENSE +1 -1
- package/README.md +4 -4
- package/functions/acceptFriendRequest.js +39 -0
- package/functions/blockUser.js +12 -13
- package/functions/deleteAccountPost.js +12 -11
- package/functions/deleteComment.js +11 -12
- package/functions/deleteFriendRequest.js +43 -0
- package/functions/deleteLevel.js +10 -13
- package/functions/deleteMessage.js +37 -0
- package/functions/{dlLevel.js → downloadLevel.js} +46 -38
- package/functions/{dlMessage.js → downloadMessage.js} +9 -8
- package/functions/getAccountPosts.js +3 -4
- package/functions/getBlockedList.js +31 -12
- package/functions/getCommentHistory.js +8 -6
- package/functions/getComments.js +11 -7
- package/functions/getCreatorScores.js +13 -4
- package/functions/getDailyLevel.js +3 -3
- package/functions/getFriendRequests.js +87 -0
- package/functions/getFriendsList.js +25 -11
- package/functions/getGauntlets.js +5 -3
- package/functions/getLevelByID.js +2 -2
- package/functions/getLevelScores.js +22 -21
- package/functions/getMapPacks.js +1 -1
- package/functions/getMessages.js +10 -10
- package/functions/getProfile.js +139 -41
- package/functions/getSongInfo.js +3 -3
- package/functions/getTab.js +2 -2
- package/functions/getTop100.js +1 -1
- package/functions/getTopLists.js +1 -1
- package/functions/getUserLevels.js +3 -3
- package/functions/getWeeklyDemon.js +3 -3
- package/functions/removeFriend.js +40 -0
- package/functions/reportLevel.js +2 -2
- package/functions/searchLevels.js +1 -1
- package/functions/searchLists.js +2 -2
- package/functions/unblockUser.js +13 -14
- package/functions/updateLevelDesc.js +9 -10
- package/functions/uploadAccountPost.js +10 -11
- package/functions/uploadComment.js +15 -15
- package/functions/uploadFriendRequest.js +42 -0
- package/functions/uploadMessage.js +15 -15
- package/index.js +29 -3
- package/misc/GJDecode.js +12 -9
- package/misc/gauntlets.json +13 -1
- package/misc/gjp2.js +5 -0
- package/package.json +1 -1
- /package/{gjReq.js → misc/gjReq.js} +0 -0
- /package/{xor.js → misc/xor.js} +0 -0
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* @property {string} iconID - The commenter's icon ID.
|
|
12
12
|
* @property {string} color1 - The commenter's primary color.
|
|
13
13
|
* @property {string} color2 - The commenter's secondary color.
|
|
14
|
-
* @property {
|
|
15
|
-
* @property {
|
|
14
|
+
* @property {("cube"|"ship"|"ball"|"ufo"|"wave"|"robot"|"spider"|"swing"|"jetpack")} iconType - The commenter's selected game mode to be displayed as an icon.
|
|
15
|
+
* @property {Boolean} glow - Whether the commenter's icon has the "glow" feature enabled.
|
|
16
|
+
* @property {string} glowColor - The commenter's glow color.
|
|
16
17
|
* @property {number} playerID - The commenter's player ID.
|
|
17
18
|
* @property {number} accountID - The commenter's account ID.
|
|
18
19
|
* @property {string|null} mod - Whether the commenter is a moderator. Returns `null` if not, "mod" if the user is a regular moderator and "elder" if the user is an elder moderator.
|
|
@@ -31,7 +32,7 @@ module.exports = {
|
|
|
31
32
|
if (page && isNaN(page)) throw new Error("Please provide a page!");
|
|
32
33
|
if (mode && isNaN(mode)) throw new Error("Please provide a valid mode ID! 0 for recent, 1 for most liked.");
|
|
33
34
|
|
|
34
|
-
const { gjReq } = require("../gjReq
|
|
35
|
+
const { gjReq } = require("../misc/gjReq");
|
|
35
36
|
const { getProfile } = require("./getProfile.js");
|
|
36
37
|
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
37
38
|
const colors = require("../misc/colors.json");
|
|
@@ -77,10 +78,11 @@ module.exports = {
|
|
|
77
78
|
iconID: Number(user[3]),
|
|
78
79
|
color1: rgbToHEX(colors[user[5]]),
|
|
79
80
|
color2: rgbToHEX(colors[user[7]]),
|
|
80
|
-
iconType: iconObj[user[
|
|
81
|
-
glow: Boolean(Number(user[
|
|
81
|
+
iconType: iconObj[user[11]],
|
|
82
|
+
glow: Boolean(Number(user[13])),
|
|
83
|
+
glowColor: rgbToHEX(colors[user[9]]),
|
|
82
84
|
playerID: Number(comment[5]),
|
|
83
|
-
accountID: Number(user[
|
|
85
|
+
accountID: Number(user[15]),
|
|
84
86
|
mod: null,
|
|
85
87
|
color: null
|
|
86
88
|
};
|
package/functions/getComments.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @property {string} content - The comment's content.
|
|
4
4
|
* @property {number} likes - The amount of likes the comment has.
|
|
5
5
|
* @property {boolean} disliked - Whether the comment is disliked (i.e. if the likes count is less than 0).
|
|
6
|
+
* @property {boolean} spam - Whether the comment is marked as spam.
|
|
6
7
|
* @property {number} percent - The achieved level percentage at the time of publishing the comment.
|
|
7
8
|
* @property {number} id - The comment's ID.
|
|
8
9
|
* @property {string} age - How long ago the comment was published.
|
|
@@ -10,8 +11,9 @@
|
|
|
10
11
|
* @property {string} iconID - The commenter's icon ID.
|
|
11
12
|
* @property {string} color1 - The commenter's primary color.
|
|
12
13
|
* @property {string} color2 - The commenter's secondary color.
|
|
13
|
-
* @property {
|
|
14
|
-
* @property {
|
|
14
|
+
* @property {("cube"|"ship"|"ball"|"ufo"|"wave"|"robot"|"spider"|"swing"|"jetpack")} iconType - The commenter's selected game mode to be displayed as an icon.
|
|
15
|
+
* @property {Boolean} glow - Whether the commenter's icon has the "glow" feature enabled.
|
|
16
|
+
* @property {string} glowColor - The commenter's glow color.
|
|
15
17
|
* @property {number} playerID - The commenter's player ID.
|
|
16
18
|
* @property {number} accountID - The commenter's account ID.
|
|
17
19
|
* @property {string|null} mod - Whether the user is a moderator. Returns `null` if not, "mod" if the user is a regular moderator and "elder" if the user is an elder moderator.
|
|
@@ -22,7 +24,7 @@ module.exports = {
|
|
|
22
24
|
* Gets a list of comments on a level.
|
|
23
25
|
* @param {number} level - The level ID.
|
|
24
26
|
* @param {number} page - The page to search through. Defaults to 1.
|
|
25
|
-
* @param {
|
|
27
|
+
* @param {(0|1)} mode - The viewing mode. Can be either 0 (most recent) or 1 (most liked). Defaults to 1.
|
|
26
28
|
* @returns {Comment[]}
|
|
27
29
|
*/
|
|
28
30
|
getComments:
|
|
@@ -30,7 +32,7 @@ module.exports = {
|
|
|
30
32
|
if (isNaN(level)) throw new Error("Please provide a valid level ID!");
|
|
31
33
|
if (mode && isNaN(mode)) throw new Error("Please provide a mode ID! 0 for recent, 1 for most liked.");
|
|
32
34
|
|
|
33
|
-
const { gjReq } = require("../gjReq");
|
|
35
|
+
const { gjReq } = require("../misc/gjReq");
|
|
34
36
|
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
35
37
|
const colors = require("../misc/colors.json");
|
|
36
38
|
|
|
@@ -65,6 +67,7 @@ module.exports = {
|
|
|
65
67
|
playerID: Number(comment[3]),
|
|
66
68
|
likes: Number(comment[5]),
|
|
67
69
|
disliked: comment[5] < 0 ? true : false,
|
|
70
|
+
spam: Boolean(Number(comment[7])),
|
|
68
71
|
percent: Number(comment[9]),
|
|
69
72
|
id: Number(comment[13]),
|
|
70
73
|
age: comment[11],
|
|
@@ -72,9 +75,10 @@ module.exports = {
|
|
|
72
75
|
iconID: Number(user[3]),
|
|
73
76
|
color1: rgbToHEX(colors[user[5]]),
|
|
74
77
|
color2: rgbToHEX(colors[user[7]]),
|
|
75
|
-
iconType: iconObj[user[
|
|
76
|
-
glow: Boolean(Number(user[
|
|
77
|
-
|
|
78
|
+
iconType: iconObj[user[11]],
|
|
79
|
+
glow: Boolean(Number(user[13])),
|
|
80
|
+
glowColor: rgbToHEX(colors[user[9]]),
|
|
81
|
+
accountID: Number(user[15]),
|
|
78
82
|
mod: null,
|
|
79
83
|
color: null
|
|
80
84
|
};
|
|
@@ -11,26 +11,35 @@
|
|
|
11
11
|
* @property {number} demons - The amount of demons the player has completed.
|
|
12
12
|
* @property {number} moons - The amount of moons the player has.
|
|
13
13
|
* @property {number} creatorPoints - The amount of creator points the player has.
|
|
14
|
+
* @property {number} iconID - The icon ID.
|
|
15
|
+
* @property {string} color1 - The HEX code of the player's primary color.
|
|
16
|
+
* @property {string} color2 - The HEX code of the player's secondary color.
|
|
17
|
+
* @property {Boolean} glow - Whether the commenter's icon has the "glow" feature enabled.
|
|
18
|
+
* @property {string} glowColor - The commenter's glow color.
|
|
19
|
+
* @property {("cube"|"ship"|"ball"|"ufo"|"wave"|"robot"|"spider"|"swing"|"jetpack")} iconType - The commenter's selected game mode to be displayed as an icon.
|
|
14
20
|
*/
|
|
15
21
|
module.exports = {
|
|
16
22
|
/**
|
|
17
23
|
* Fetches the player leaderboard based on the amount of creator points.
|
|
24
|
+
* @param {number} count - The amount the leaderboard will be capped at. Defaults to 100.
|
|
18
25
|
* @returns {ScoresUser[]}
|
|
19
26
|
*/
|
|
20
|
-
getCreatorScores: async function () {
|
|
27
|
+
getCreatorScores: async function (count = 100) {
|
|
28
|
+
if (isNaN(count)) throw new Error("The count should be a valid number!");
|
|
29
|
+
|
|
21
30
|
let GJDecode = require("../misc/GJDecode");
|
|
22
31
|
const { decodeScoresUser } = new GJDecode;
|
|
23
|
-
const { gjReq } = require("../gjReq");
|
|
32
|
+
const { gjReq } = require("../misc/gjReq");
|
|
24
33
|
|
|
25
34
|
const data = {
|
|
26
35
|
secret: "Wmfd2893gb7",
|
|
27
36
|
type: "creators",
|
|
28
|
-
count:
|
|
37
|
+
count: count
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
let res = await gjReq("getGJScores20", data);
|
|
32
41
|
|
|
33
|
-
let players = res.data.split("|");
|
|
42
|
+
let players = res.data.replaceAll("||", "|").split("|");
|
|
34
43
|
players.pop();
|
|
35
44
|
|
|
36
45
|
let result = [];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
/**
|
|
3
3
|
* Gets the current daily level.
|
|
4
|
-
* @returns {import("./
|
|
4
|
+
* @returns {import("./downloadLevel").Level}
|
|
5
5
|
*/
|
|
6
6
|
getDailyLevel: async function () {
|
|
7
|
-
const {
|
|
8
|
-
let res = await
|
|
7
|
+
const { downloadLevel } = require("./downloadLevel");
|
|
8
|
+
let res = await downloadLevel(-1);
|
|
9
9
|
return res;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} FriendRequest
|
|
3
|
+
* @property {string} username - The username of the person who sent the friend request.
|
|
4
|
+
* @property {number} id - The friend request's ID.
|
|
5
|
+
* @property {string} comment - The message attached to the friend request.
|
|
6
|
+
* @property {number} playerID - The player ID of the person who sent the friend request.
|
|
7
|
+
* @property {number} accountID - The account ID of the person who sent the friend request.
|
|
8
|
+
* @property {number} iconID - The icon ID.
|
|
9
|
+
* @property {string} color1 - The HEX code of the primary color of the person who sent the friend request.
|
|
10
|
+
* @property {string} color2 - The HEX code of the secondary color of the person who sent the friend request.
|
|
11
|
+
* @property {("cube"|"ship"|"ball"|"ufo"|"wave"|"robot"|"spider"|"swing"|"jetpack")} iconType - The selected game mode to be displayed as an icon.
|
|
12
|
+
* @property {boolean} glow - Whether the person who sent the friend request has the "glow" feature enabled on their icon.
|
|
13
|
+
* @property {boolean} new - Whether the friend request is unread (displayed as "!" in-game).
|
|
14
|
+
* @property {string} age - How long ago the friend request was sent.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
/**
|
|
19
|
+
* Gets a list of pending friend requests.
|
|
20
|
+
* @param {string} username - The username or player ID.
|
|
21
|
+
* @param {string} password - The password.
|
|
22
|
+
* @param {number} page - The page to search through. Defaults to 1.
|
|
23
|
+
* @param {boolean} isSender - Whether the person specified in `username` was the one sending the friend request. Defaults to false (the person is the one receiving friend requests).
|
|
24
|
+
* @returns {FriendRequest[]}
|
|
25
|
+
*/
|
|
26
|
+
getFriendRequests: async function (username, password, page = 1, isSender = false) {
|
|
27
|
+
if (!username) throw new Error("Please provide the username or the player ID!");
|
|
28
|
+
if (!password) throw new Error("Please provide the password!");
|
|
29
|
+
if (isSender && isNaN(isSender)) throw new Error("Please provide either false or true for isSender!");
|
|
30
|
+
|
|
31
|
+
const { gjReq } = require("../misc/gjReq");
|
|
32
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
33
|
+
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
34
|
+
const colors = require("../misc/colors.json");
|
|
35
|
+
|
|
36
|
+
let userSearch = await gjReq("getGJUsers20", {
|
|
37
|
+
str: username,
|
|
38
|
+
secret: "Wmfd2893gb7"
|
|
39
|
+
});
|
|
40
|
+
if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
41
|
+
let userAccID = userSearch.data.split(":")[23];
|
|
42
|
+
|
|
43
|
+
let res = await gjReq("getGJFriendRequests20", {
|
|
44
|
+
accountID: userAccID,
|
|
45
|
+
gjp2: gjp2(password),
|
|
46
|
+
secret: "Wmfd2893gb7",
|
|
47
|
+
getSent: Number(isSender),
|
|
48
|
+
page: Number(page) - 1
|
|
49
|
+
});
|
|
50
|
+
if (res.data == -1) throw new Error(-1);
|
|
51
|
+
if (res.data == -2) return [];
|
|
52
|
+
|
|
53
|
+
const friendRequests = res.data.split("#")[0].split("|");
|
|
54
|
+
const requestList = [];
|
|
55
|
+
|
|
56
|
+
let iconObj = {
|
|
57
|
+
0: "cube",
|
|
58
|
+
1: "ship",
|
|
59
|
+
2: "ball",
|
|
60
|
+
3: "ufo",
|
|
61
|
+
4: "wave",
|
|
62
|
+
5: "robot",
|
|
63
|
+
6: "spider",
|
|
64
|
+
7: "swing",
|
|
65
|
+
8: "jetpack"
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
for (let request of friendRequests) {
|
|
69
|
+
requestList.push({
|
|
70
|
+
username: request.split(":")[1],
|
|
71
|
+
id: Number(request.split(":")[19]),
|
|
72
|
+
comment: Buffer.from(request.split(":")[21], "base64").toString(),
|
|
73
|
+
playerID: Number(request.split(":")[3]),
|
|
74
|
+
accountID: Number(request.split(":")[17]),
|
|
75
|
+
iconID: Number(request.split(":")[5]),
|
|
76
|
+
color1: rgbToHEX(colors[request.split(":")[7]]),
|
|
77
|
+
color2: rgbToHEX(colors[request.split(":")[9]]),
|
|
78
|
+
iconType: iconObj[Number(request.split(":")[13])],
|
|
79
|
+
glow: request.split(":")[15] == "2",
|
|
80
|
+
new: request.split(":")[23] == "1",
|
|
81
|
+
age: request.split(":")[25]
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return requestList;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -9,29 +9,28 @@
|
|
|
9
9
|
*/
|
|
10
10
|
module.exports = {
|
|
11
11
|
/**
|
|
12
|
-
* Gets the list of a
|
|
12
|
+
* Gets the list of a player's friends.
|
|
13
13
|
* @param {string} username - The user's username or player ID.
|
|
14
14
|
* @param {string} password - The user's password.
|
|
15
15
|
* @returns {Friend[]}
|
|
16
16
|
*/
|
|
17
17
|
getFriendsList: async function (username, password) {
|
|
18
|
-
if (!username) throw new Error("Please provide
|
|
19
|
-
if (!password) throw new Error("Please provide
|
|
18
|
+
if (!username) throw new Error("Please provide the player ID or username!");
|
|
19
|
+
if (!password) throw new Error("Please provide the password!");
|
|
20
20
|
|
|
21
|
-
const { gjReq } = require("../gjReq");
|
|
22
|
-
const
|
|
23
|
-
const xor = new XOR;
|
|
21
|
+
const { gjReq } = require("../misc/gjReq");
|
|
22
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
24
23
|
|
|
25
24
|
let search = await gjReq("getGJUsers20", {
|
|
26
25
|
str: username,
|
|
27
26
|
secret: "Wmfd2893gb7"
|
|
28
27
|
});
|
|
29
|
-
if (search.data == -1)
|
|
30
|
-
let accID = search.data.split(":")[
|
|
28
|
+
if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
29
|
+
let accID = search.data.split(":")[23];
|
|
31
30
|
|
|
32
31
|
const data = {
|
|
33
32
|
accountID: accID,
|
|
34
|
-
|
|
33
|
+
gjp2: gjp2(password),
|
|
35
34
|
secret: "Wmfd2893gb7"
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -43,15 +42,28 @@ module.exports = {
|
|
|
43
42
|
|
|
44
43
|
let colors = require("../misc/colors.json");
|
|
45
44
|
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
45
|
+
let iconObj = {
|
|
46
|
+
0: "cube",
|
|
47
|
+
1: "ship",
|
|
48
|
+
2: "ball",
|
|
49
|
+
3: "ufo",
|
|
50
|
+
4: "wave",
|
|
51
|
+
5: "robot",
|
|
52
|
+
6: "spider",
|
|
53
|
+
7: "swing",
|
|
54
|
+
8: "jetpack"
|
|
55
|
+
};
|
|
46
56
|
|
|
47
57
|
players.forEach(p => {
|
|
48
58
|
let s = p.split(":");
|
|
49
59
|
let username = s[1];
|
|
50
60
|
let playerID = s[3];
|
|
61
|
+
let iconID = s[5];
|
|
51
62
|
let p1 = s[7];
|
|
52
63
|
let p2 = s[9];
|
|
53
|
-
let
|
|
54
|
-
let
|
|
64
|
+
let iconType = s[13];
|
|
65
|
+
let accID = s[17];
|
|
66
|
+
let msg = s[19];
|
|
55
67
|
|
|
56
68
|
let msgObj = {
|
|
57
69
|
"0": "all",
|
|
@@ -63,8 +75,10 @@ module.exports = {
|
|
|
63
75
|
username: username,
|
|
64
76
|
playerID: Number(playerID),
|
|
65
77
|
accountID: Number(accID),
|
|
78
|
+
iconID: Number(iconID),
|
|
66
79
|
color1: rgbToHEX(colors[p1]),
|
|
67
80
|
color2: rgbToHEX(colors[p2]),
|
|
81
|
+
iconType: iconObj[Number(iconType)],
|
|
68
82
|
messages: msgObj[msg]
|
|
69
83
|
})
|
|
70
84
|
})
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
module.exports = {
|
|
8
8
|
/**
|
|
9
|
-
* Gets the list of gauntlets.
|
|
9
|
+
* Gets the list of all gauntlets.
|
|
10
10
|
* @returns {Gauntlet[]}
|
|
11
11
|
*/
|
|
12
12
|
getGauntlets: async function () {
|
|
13
13
|
const glIDs = require("../misc/gauntlets.json");
|
|
14
|
-
const { gjReq } = require("../gjReq");
|
|
14
|
+
const { gjReq } = require("../misc/gjReq");
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
// the only time i've ever used binaryVersion lmao
|
|
17
|
+
// for some reason it does make a difference though
|
|
18
|
+
let res = await gjReq("getGJGauntlets21", { secret: "Wmfd2893gb7", special: 1, binaryVersion: 48 });
|
|
17
19
|
|
|
18
20
|
let gauntlets = res.data.split("#")[0].split("|");
|
|
19
21
|
let result = [];
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
*/
|
|
39
39
|
module.exports = {
|
|
40
40
|
/**
|
|
41
|
-
* Gets a level by its ID. Works considerably faster than
|
|
41
|
+
* Gets a level by its ID. Works considerably faster than downloadLevel(), yet lacks the last update/upload date, password, LDM, accurate object count, SFX and additional songs (if any).
|
|
42
42
|
* @param {number} id - The level's ID.
|
|
43
43
|
* @returns {Level}
|
|
44
44
|
*/
|
|
45
45
|
getLevelByID: async function (id) {
|
|
46
46
|
if (isNaN(id)) throw new Error("Please provide a valid level ID!");
|
|
47
|
-
const { gjReq } = require("../gjReq");
|
|
47
|
+
const { gjReq } = require("../misc/gjReq");
|
|
48
48
|
const GJDecode = require("../misc/GJDecode");
|
|
49
49
|
const { decodeSearchResults } = new GJDecode;
|
|
50
50
|
const res = await gjReq("getGJLevels21", {
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* @property {number} playerID - The player's player ID.
|
|
5
5
|
* @property {number} accountID - The player's account ID.
|
|
6
6
|
* @property {number} rank - The player's ranking on the leaderboard.
|
|
7
|
-
* @property {string} color1 - The player's primary color.
|
|
8
|
-
* @property {string} color2 - The player's secondary color.
|
|
7
|
+
* @property {string} color1 - The HEX code of the player's primary color.
|
|
8
|
+
* @property {string} color2 - The HEX code of the player's secondary color.
|
|
9
9
|
* @property {string} iconID - The player's icon ID.
|
|
10
|
-
* @property {
|
|
10
|
+
* @property {("cube"|"ship"|"ball"|"ufo"|"wave"|"robot"|"spider"|"swing"|"jetpack")} iconType - The player's selected game mode to be displayed as an icon.
|
|
11
11
|
* @property {string} glow - Whether the player's icon has the "glow" feature enabled.
|
|
12
|
+
* @property {string} glowColor - The HEX code of the player's glow color.
|
|
12
13
|
* @property {string} percent - The record's percentage.
|
|
13
14
|
* @property {string} coins - The amount of coins collected.
|
|
14
15
|
* @property {string} age - How long ago the record was published.
|
|
@@ -24,27 +25,26 @@ module.exports = {
|
|
|
24
25
|
*/
|
|
25
26
|
getLevelScores: async function (level, type, username, password) {
|
|
26
27
|
let types = { week: "2", top: "1", friends: "0" }
|
|
27
|
-
if (!level) throw new Error("Please provide
|
|
28
|
+
if (!level) throw new Error("Please provide the level ID!");
|
|
28
29
|
if (!types[type.toLowerCase()]) throw new Error("Please provide a valid leaderboard type! Possible types: \"week\", \"top\", \"friends\".")
|
|
29
|
-
if (!username) throw new Error("Please provide
|
|
30
|
-
if (!password) throw new Error("Please provide
|
|
30
|
+
if (!username) throw new Error("Please provide the username or player ID!");
|
|
31
|
+
if (!password) throw new Error("Please provide the password!");
|
|
31
32
|
|
|
32
|
-
const { gjReq } = require("../gjReq
|
|
33
|
+
const { gjReq } = require("../misc/gjReq");
|
|
33
34
|
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
34
35
|
const colors = require("../misc/colors.json");
|
|
35
36
|
let search = await gjReq("getGJUsers20", {
|
|
36
37
|
str: username,
|
|
37
38
|
secret: "Wmfd2893gb7"
|
|
38
39
|
});
|
|
39
|
-
if (search.data == -1)
|
|
40
|
-
let accID = search.data.split(":")[
|
|
40
|
+
if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
41
|
+
let accID = search.data.split(":")[23];
|
|
41
42
|
|
|
42
|
-
const
|
|
43
|
-
const xor = new XOR;
|
|
43
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
44
44
|
|
|
45
45
|
const data = {
|
|
46
46
|
accountID: accID,
|
|
47
|
-
|
|
47
|
+
gjp2: gjp2(password),
|
|
48
48
|
levelID: level,
|
|
49
49
|
secret: "Wmfd2893gb7",
|
|
50
50
|
type: types[type.toLowerCase()]
|
|
@@ -72,16 +72,17 @@ module.exports = {
|
|
|
72
72
|
result.push({
|
|
73
73
|
username: s[1],
|
|
74
74
|
playerID: Number(s[3]),
|
|
75
|
-
accountID: Number(s[
|
|
76
|
-
rank: Number(s[
|
|
77
|
-
color1: rgbToHEX(colors[
|
|
78
|
-
color2: rgbToHEX(colors[
|
|
75
|
+
accountID: Number(s[17]),
|
|
76
|
+
rank: Number(s[21]),
|
|
77
|
+
color1: rgbToHEX(colors[s[7]]),
|
|
78
|
+
color2: rgbToHEX(colors[s[9]]),
|
|
79
79
|
iconID: Number(s[5]),
|
|
80
|
-
iconType: iconObj[s[
|
|
81
|
-
glow: s[
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
iconType: iconObj[s[13]],
|
|
81
|
+
glow: s[15] == "2" ? true : false,
|
|
82
|
+
glowColor: rgbToHEX(colors[s[11]]),
|
|
83
|
+
percent: Number(s[19]),
|
|
84
|
+
coins: Number(s[23]),
|
|
85
|
+
age: s[25]
|
|
85
86
|
})
|
|
86
87
|
})
|
|
87
88
|
|
package/functions/getMapPacks.js
CHANGED
package/functions/getMessages.js
CHANGED
|
@@ -16,29 +16,29 @@ module.exports = {
|
|
|
16
16
|
* @param {number} page - The page to search through. Defaults to 1.
|
|
17
17
|
* @returns {Message[]}
|
|
18
18
|
*/
|
|
19
|
-
getMessages: async function (username, password, page = 1) {
|
|
20
|
-
if (!username) throw new Error("Please provide
|
|
21
|
-
if (!password) throw new Error("Please provide
|
|
19
|
+
getMessages: async function (username, password, page = 1,) {
|
|
20
|
+
if (!username) throw new Error("Please provide the player ID or username!");
|
|
21
|
+
if (!password) throw new Error("Please provide the password!");
|
|
22
22
|
if (isNaN(page)) throw new Error("The page should be a number!");
|
|
23
23
|
|
|
24
|
-
const { gjReq } = require("../gjReq");
|
|
25
|
-
const
|
|
26
|
-
const xor = new XOR;
|
|
24
|
+
const { gjReq } = require("../misc/gjReq");
|
|
25
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
27
26
|
|
|
28
27
|
let search = await gjReq("getGJUsers20", {
|
|
29
28
|
str: username,
|
|
30
29
|
secret: "Wmfd2893gb7"
|
|
31
30
|
});
|
|
32
|
-
if (search.data == -1)
|
|
33
|
-
let accID = search.data.split(":")[
|
|
31
|
+
if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
32
|
+
let accID = search.data.split(":")[23];
|
|
34
33
|
|
|
35
34
|
let res = await gjReq("getGJMessages20", {
|
|
36
35
|
accountID: accID,
|
|
37
|
-
|
|
36
|
+
gjp2: gjp2(password),
|
|
38
37
|
secret: "Wmfd2893gb7",
|
|
39
38
|
page: page - 1
|
|
40
39
|
});
|
|
41
|
-
if (res.data == -1
|
|
40
|
+
if (res.data == -1) throw new Error(-1);
|
|
41
|
+
if (res.data.startsWith("#") || res.data == -2) return [];
|
|
42
42
|
|
|
43
43
|
let msgs = res.data.split("#")[0].split("|");
|
|
44
44
|
let result = [];
|