gj-boomlings-api 1.5.6 → 2.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/LICENSE +1 -1
- package/README.md +31 -7
- package/functions/blockUser.js +29 -30
- package/functions/deleteAccountPost.js +22 -32
- package/functions/deleteComment.js +20 -20
- package/functions/deleteLevel.js +23 -29
- package/functions/dlLevel.js +1 -8
- package/functions/dlMessage.js +30 -36
- package/functions/getAccountPosts.js +23 -36
- package/functions/getBlockedList.js +47 -63
- package/functions/getCommentHistory.js +59 -39
- package/functions/getComments.js +46 -27
- package/functions/getCreatorScores.js +18 -30
- package/functions/getDailyLevel.js +5 -9
- package/functions/getFriendsList.js +48 -56
- package/functions/getGauntlets.js +18 -24
- package/functions/getLevelByID.js +13 -10
- package/functions/getLevelScores.js +63 -46
- package/functions/getMapPacks.js +40 -28
- package/functions/getMessages.js +36 -41
- package/functions/getOfficialSongInfo.js +9 -87
- package/functions/getProfile.js +1 -7
- package/functions/getSongInfo.js +22 -31
- package/functions/getSongsLibrary.js +1 -0
- package/functions/getTab.js +16 -7
- package/functions/getTop100.js +18 -27
- package/functions/getTopLists.js +14 -0
- package/functions/getUserLevels.js +24 -88
- package/functions/getWeeklyDemon.js +5 -9
- package/functions/reportLevel.js +9 -22
- package/functions/searchLevels.js +15 -84
- package/functions/searchLists.js +15 -0
- package/functions/unblockUser.js +29 -30
- package/functions/updateLevelDesc.js +27 -43
- package/functions/uploadAccountPost.js +23 -36
- package/functions/uploadComment.js +43 -57
- package/functions/uploadMessage.js +32 -41
- package/gjReq.js +1 -0
- package/index.js +2 -1
- package/misc/GJDecode.js +1 -1
- package/misc/colors.json +1 -1
- package/misc/gauntlets.json +1 -0
- package/misc/officialsongs.json +1 -1
- package/misc/rgbToHEX.js +1 -1
- package/package.json +2 -6
- package/xor.js +1 -0
- package/.nvmrc +0 -1
- package/config.json +0 -1
- package/functions/searchUsers.js +0 -27
- package/misc/decB64.js +0 -4
- package/misc/demonlist.js +0 -1
- package/misc/encB64.js +0 -1
- package/misc/gjReq.js +0 -1
- package/misc/gjWReq.js +0 -1
- package/misc/gjp.js +0 -1
- package/misc/xor.js +0 -5
|
@@ -1,47 +1,67 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @param {*} mode - The mode of fetching the history. `0` is for recent, `1` is for most liked.
|
|
7
|
-
*/
|
|
8
|
-
getCommentHistory:
|
|
9
|
-
async function(str, page = 1, mode = 1) {
|
|
10
|
-
if(!str) throw new Error("Please provide a player ID or name!");
|
|
11
|
-
if(page && isNaN(page)) throw new Error("Please provide a page!");
|
|
12
|
-
if(mode && isNaN(mode)) throw new Error("Please provide a valid mode ID! 0 for recent, 1 for most liked.");
|
|
2
|
+
getCommentHistory: async function (str, page = 1, mode = 1) {
|
|
3
|
+
if (!str) throw new Error("Please provide a player ID or name!");
|
|
4
|
+
if (page && isNaN(page)) throw new Error("Please provide a page!");
|
|
5
|
+
if (mode && isNaN(mode)) throw new Error("Please provide a valid mode ID! 0 for recent, 1 for most liked.");
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const {getProfile} = require("./getProfile.js");
|
|
19
|
-
|
|
20
|
-
const user = await getProfile(str);
|
|
21
|
-
if(user.commentHistory != "all") throw new Error("Whoops! This user has disabled viewing his comment history!");
|
|
7
|
+
const { gjReq } = require("../gjReq.js");
|
|
8
|
+
const { getProfile } = require("./getProfile.js");
|
|
9
|
+
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
10
|
+
const colors = require("../misc/colors.json");
|
|
22
11
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
userID: user.playerID,
|
|
26
|
-
page: Number(page) - 1,
|
|
27
|
-
mode: Number(mode)
|
|
28
|
-
}
|
|
12
|
+
const user = await getProfile(str);
|
|
13
|
+
if (user.commentHistory != "all") throw new Error("Whoops! This user has disabled viewing his comment history!");
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
let res = await gjReq("getGJCommentHistory", {
|
|
16
|
+
secret: "Wmfd2893gb7",
|
|
17
|
+
userID: user.playerID,
|
|
18
|
+
page: Number(page) - 1,
|
|
19
|
+
mode: Number(mode)
|
|
20
|
+
});
|
|
21
|
+
if (res.data == -1) return [];
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if(res.status == 403) throw new Error(res.data.error);
|
|
36
|
-
return res.data;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let comments = res.data.split("|");
|
|
40
|
-
let result = [];
|
|
41
|
-
comments.forEach(c => {
|
|
42
|
-
result.push(decCommentFromHistory(c));
|
|
43
|
-
})
|
|
23
|
+
let comments = res.data.split("#")[0].split("|");
|
|
24
|
+
let result = [];
|
|
44
25
|
|
|
45
|
-
|
|
26
|
+
let iconObj = {
|
|
27
|
+
0: "cube",
|
|
28
|
+
1: "ship",
|
|
29
|
+
2: "ball",
|
|
30
|
+
3: "ufo",
|
|
31
|
+
4: "wave",
|
|
32
|
+
5: "robot",
|
|
33
|
+
6: "spider",
|
|
34
|
+
7: "swing",
|
|
35
|
+
8: "jetpack"
|
|
46
36
|
}
|
|
37
|
+
|
|
38
|
+
comments.forEach(c => {
|
|
39
|
+
let comment = c.split(":")[0].split("~");
|
|
40
|
+
let user = c.split(":")[1].split("~");
|
|
41
|
+
let obj = {
|
|
42
|
+
levelID: Number(comment[3]),
|
|
43
|
+
content: Buffer.from(comment[1], "base64").toString(),
|
|
44
|
+
likes: Number(comment[7]),
|
|
45
|
+
disliked: comment[7] < 0 ? true : false,
|
|
46
|
+
percent: Number(comment[9]),
|
|
47
|
+
id: Number(comment[13]),
|
|
48
|
+
age: comment[11],
|
|
49
|
+
username: user[1],
|
|
50
|
+
iconID: Number(user[3]),
|
|
51
|
+
c1: rgbToHEX(colors[user[5]]),
|
|
52
|
+
c2: rgbToHEX(colors[user[7]]),
|
|
53
|
+
iconType: iconObj[user[9]],
|
|
54
|
+
glow: Boolean(Number(user[11])),
|
|
55
|
+
playerID: Number(comment[5]),
|
|
56
|
+
accountID: Number(user[13])
|
|
57
|
+
};
|
|
58
|
+
if (comment.length > 14) {
|
|
59
|
+
obj.mod = comment[15] == "1" ? "mod" : "elder";
|
|
60
|
+
obj.color = rgbToHEX(comment[17]);
|
|
61
|
+
}
|
|
62
|
+
result.push(obj);
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
47
67
|
}
|
package/functions/getComments.js
CHANGED
|
@@ -1,41 +1,60 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
/**
|
|
3
|
-
* Gets the comments from a specified level.
|
|
4
|
-
* @param {*} level - The level ID to get the comments from.
|
|
5
|
-
* @param {*} page - The page.
|
|
6
|
-
* @param {*} mode - The mode of fetching the comments. `0` is for recent, `1` is for most liked.
|
|
7
|
-
*/
|
|
8
2
|
getComments:
|
|
9
|
-
async function(level, page = 1, mode = 1) {
|
|
10
|
-
if(
|
|
11
|
-
if(isNaN(
|
|
12
|
-
if(mode && isNaN(mode)) throw new Error("Please provide a mode ID! 0 for recent, 1 for most liked.");
|
|
3
|
+
async function (level, page = 1, mode = 1) {
|
|
4
|
+
if (isNaN(level)) throw new Error("Please provide a valid level ID!");
|
|
5
|
+
if (mode && isNaN(mode)) throw new Error("Please provide a mode ID! 0 for recent, 1 for most liked.");
|
|
13
6
|
|
|
14
|
-
const {gjReq} = require("../
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
const { decodeGJComment } = new GJDecode();
|
|
7
|
+
const { gjReq } = require("../gjReq");
|
|
8
|
+
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
9
|
+
const colors = require("../misc/colors.json");
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
let res = await gjReq("getGJComments21", {
|
|
20
12
|
levelID: level,
|
|
21
13
|
page: Number(page) - 1,
|
|
22
14
|
mode: Number(mode),
|
|
23
|
-
secret: "Wmfd2893gb7"
|
|
24
|
-
}
|
|
15
|
+
secret: "Wmfd2893gb7"
|
|
16
|
+
});
|
|
17
|
+
if (res.data == -1 || res.data.startsWith("#")) return [];
|
|
25
18
|
|
|
26
|
-
let
|
|
27
|
-
|
|
19
|
+
let comments = res.data.split("#")[0].split("|");
|
|
20
|
+
let result = [];
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
let iconObj = {
|
|
23
|
+
0: "cube",
|
|
24
|
+
1: "ship",
|
|
25
|
+
2: "ball",
|
|
26
|
+
3: "ufo",
|
|
27
|
+
4: "wave",
|
|
28
|
+
5: "robot",
|
|
29
|
+
6: "spider",
|
|
30
|
+
7: "swing",
|
|
31
|
+
8: "jetpack"
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
let comments = res.data.split("|");
|
|
36
|
-
let result = [];
|
|
33
|
+
|
|
37
34
|
comments.forEach(c => {
|
|
38
|
-
|
|
35
|
+
let comment = c.split(":")[0].split("~");
|
|
36
|
+
let user = c.split(":")[1].split("~");
|
|
37
|
+
let obj = {
|
|
38
|
+
content: Buffer.from(comment[1], "base64").toString(),
|
|
39
|
+
playerID: Number(comment[3]),
|
|
40
|
+
likes: Number(comment[5]),
|
|
41
|
+
disliked: comment[5] < 0 ? true : false,
|
|
42
|
+
percent: Number(comment[9]),
|
|
43
|
+
id: Number(comment[13]),
|
|
44
|
+
age: comment[11],
|
|
45
|
+
username: user[1],
|
|
46
|
+
iconID: Number(user[3]),
|
|
47
|
+
c1: rgbToHEX(colors[user[5]]),
|
|
48
|
+
c2: rgbToHEX(colors[user[7]]),
|
|
49
|
+
iconType: iconObj[user[9]],
|
|
50
|
+
glow: Boolean(Number(user[11])),
|
|
51
|
+
accountID: Number(user[13])
|
|
52
|
+
};
|
|
53
|
+
if (comment.length > 14) {
|
|
54
|
+
obj.mod = comment[15] == "1" ? "mod" : "elder";
|
|
55
|
+
obj.color = rgbToHEX(comment[17]);
|
|
56
|
+
}
|
|
57
|
+
result.push(obj);
|
|
39
58
|
})
|
|
40
59
|
|
|
41
60
|
return result;
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
async function() {
|
|
7
|
-
let GJDecode = require("../misc/GJDecode.js");
|
|
8
|
-
const { decScoresUser } = new GJDecode();
|
|
9
|
-
const {gjReq} = require("../misc/gjReq.js");
|
|
10
|
-
const {gjWReq} = require("../misc/gjWReq.js");
|
|
11
|
-
const { secret } = require("../config.json");
|
|
2
|
+
getCreatorScores: async function () {
|
|
3
|
+
let GJDecode = require("../misc/GJDecode");
|
|
4
|
+
const { decodeScoresUser } = new GJDecode;
|
|
5
|
+
const { gjReq } = require("../gjReq");
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let res = await gjReq("getGJScores20", data);
|
|
20
|
-
if(res.data == "error code: 1005") {
|
|
21
|
-
res = await gjWReq("getCreatorScores");
|
|
22
|
-
return res.data;
|
|
23
|
-
}
|
|
7
|
+
const data = {
|
|
8
|
+
secret: "Wmfd2893gb7",
|
|
9
|
+
type: "creators",
|
|
10
|
+
count: 100
|
|
11
|
+
}
|
|
24
12
|
|
|
25
|
-
|
|
26
|
-
let emptyElem = players[100];
|
|
13
|
+
let res = await gjReq("getGJScores20", data);
|
|
27
14
|
|
|
28
|
-
|
|
15
|
+
let players = res.data.split("|");
|
|
16
|
+
players.pop();
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
let result = [];
|
|
19
|
+
players.forEach(p => {
|
|
20
|
+
result.push(decodeScoresUser(p));
|
|
21
|
+
});
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
37
25
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { dlLevel } = require("./dlLevel.js")
|
|
8
|
-
let res = await dlLevel(-1);
|
|
9
|
-
return res;
|
|
10
|
-
}
|
|
2
|
+
getDailyLevel: async function () {
|
|
3
|
+
const { dlLevel } = require("./dlLevel")
|
|
4
|
+
let res = await dlLevel(-1);
|
|
5
|
+
return res;
|
|
6
|
+
}
|
|
11
7
|
}
|
|
@@ -1,67 +1,59 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
getFriendsList: async function (user, pass) {
|
|
3
|
+
if (!user) throw new Error("Please provide a player ID or username!");
|
|
4
|
+
if (!pass) throw new Error("Please provide a password!");
|
|
5
|
+
|
|
6
|
+
const { gjReq } = require("../gjReq");
|
|
7
|
+
const XOR = require("../xor");
|
|
8
|
+
const xor = new XOR;
|
|
9
|
+
|
|
10
|
+
let search = await gjReq("getGJUsers20", {
|
|
11
|
+
str: user,
|
|
12
|
+
secret: "Wmfd2893gb7"
|
|
13
|
+
});
|
|
14
|
+
if (search.data == -1) return [];
|
|
15
|
+
let accID = search.data.split(":")[21];
|
|
16
|
+
|
|
17
|
+
const data = {
|
|
18
|
+
accountID: accID,
|
|
19
|
+
gjp: xor.encrypt(pass, 37526),
|
|
20
|
+
secret: "Wmfd2893gb7"
|
|
21
|
+
}
|
|
11
22
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const {gjp} = require("../misc/gjp.js");
|
|
15
|
-
const { searchUsers } = require("./searchUsers.js");
|
|
23
|
+
let res = await gjReq("getGJUserList20", data);
|
|
24
|
+
if (res.data == -1 || res.data == -2) return [];
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
let players = res.data.split("|");
|
|
27
|
+
let result = [];
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
gjp: gjp(pass),
|
|
22
|
-
secret: "Wmfd2893gb7"
|
|
23
|
-
}
|
|
29
|
+
let colors = require("../misc/colors.json");
|
|
30
|
+
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
players.forEach(p => {
|
|
33
|
+
let s=p.split(":");
|
|
34
|
+
let username = s[1];
|
|
35
|
+
let playerID = s[3];
|
|
36
|
+
let p1 = s[7];
|
|
37
|
+
let p2 = s[9];
|
|
38
|
+
let accID = s[15];
|
|
39
|
+
let msg = s[17];
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
let msgObj = {
|
|
42
|
+
"0": "all",
|
|
43
|
+
"1": "friends",
|
|
44
|
+
"2": "none"
|
|
33
45
|
}
|
|
34
|
-
|
|
35
|
-
let players = res.data.split("|");
|
|
36
|
-
let result = [];
|
|
37
|
-
|
|
38
|
-
let colors = require("../misc/colors.json");
|
|
39
|
-
const { rgbToHEX } = require("../misc/rgbToHEX.js");
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let msgState = {
|
|
50
|
-
"0": "all",
|
|
51
|
-
"1": "friends",
|
|
52
|
-
"2": "none"
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
result.push({
|
|
56
|
-
username: username,
|
|
57
|
-
playerID: Number(playerID),
|
|
58
|
-
accountID: Number(accID),
|
|
59
|
-
color1: rgbToHEX(colors[p1]),
|
|
60
|
-
color2: rgbToHEX(colors[p2]),
|
|
61
|
-
messages: msgState[msg]
|
|
62
|
-
})
|
|
47
|
+
result.push({
|
|
48
|
+
username: username,
|
|
49
|
+
playerID: Number(playerID),
|
|
50
|
+
accountID: Number(accID),
|
|
51
|
+
color1: rgbToHEX(colors[p1]),
|
|
52
|
+
color2: rgbToHEX(colors[p2]),
|
|
53
|
+
messages: msgObj[msg]
|
|
63
54
|
})
|
|
55
|
+
})
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
67
59
|
}
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
getGauntlets:
|
|
6
|
-
async function() {
|
|
7
|
-
const {gjReq} = require("../misc/gjReq.js");
|
|
8
|
-
const {gjWReq} = require("../misc/gjWReq.js");
|
|
9
|
-
let GJDecode = require("../misc/GJDecode.js");
|
|
10
|
-
const { decodeGJGauntlet } = new GJDecode();
|
|
2
|
+
getGauntlets: async function () {
|
|
3
|
+
const glIDs = require("../misc/gauntlets.json");
|
|
4
|
+
const { gjReq } = require("../gjReq");
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
secret: "Wmfd2893gb7"
|
|
14
|
-
}
|
|
6
|
+
let res = await gjReq("getGJGauntlets21", { secret: "Wmfd2893gb7", special: 1 })
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
let gauntlets = res.data.split("#")[0].split("|");
|
|
9
|
+
let result = [];
|
|
10
|
+
gauntlets.forEach(g => {
|
|
11
|
+
let arr = g.split(":")[3].split(",");
|
|
12
|
+
let list = [];
|
|
13
|
+
for (let level of arr) {
|
|
14
|
+
list.push(Number(level));
|
|
20
15
|
}
|
|
16
|
+
result.push({
|
|
17
|
+
name: `${glIDs[g.split(":")[1]]} Gauntlet`,
|
|
18
|
+
levels: list
|
|
19
|
+
});
|
|
20
|
+
})
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
gauntlets.forEach(g => {
|
|
25
|
-
result.push(decodeGJGauntlet(g));
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
30
24
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
getLevelByID: async function (id) {
|
|
3
|
+
if (isNaN(id)) throw new Error("Please provide a valid level ID!");
|
|
4
|
+
const { gjReq } = require("../gjReq");
|
|
5
|
+
const GJDecode = require("../misc/GJDecode");
|
|
6
|
+
const { decodeSearchResults } = new GJDecode;
|
|
7
|
+
const res = await gjReq("getGJLevels21", {
|
|
8
|
+
secret: "Wmfd2893gb7",
|
|
9
|
+
str: id,
|
|
10
|
+
type: 0
|
|
11
|
+
});
|
|
12
|
+
if (res.data == -1) return {};
|
|
13
|
+
return decodeSearchResults(res.data)[0];
|
|
14
|
+
}
|
|
12
15
|
}
|
|
@@ -1,50 +1,67 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
let {decodeScore} = new GJDecode();
|
|
30
|
-
|
|
31
|
-
const data = {
|
|
32
|
-
accountID: user.accountID,
|
|
33
|
-
gjp: gjp(pass),
|
|
34
|
-
levelID: lvl,
|
|
35
|
-
secret: secret,
|
|
36
|
-
type: types[type.toLowerCase()]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let res = await gjReq("getGJLevelScores211", data);
|
|
40
|
-
|
|
41
|
-
let scores = res.data.split("|");
|
|
42
|
-
let result = [];
|
|
43
|
-
|
|
44
|
-
scores.forEach(s =>{
|
|
45
|
-
result.push(decodeScore(s));
|
|
46
|
-
})
|
|
2
|
+
getLevelScores: async function (lvl, type, user, pass) {
|
|
3
|
+
let types = { week: "2", top: "1", friends: "0" }
|
|
4
|
+
if (!lvl) throw new Error("Please provide a level ID!");
|
|
5
|
+
if (!types[type.toLowerCase()]) throw new Error("Please provide a valid leaderboard type! Possible types: \"week\", \"top\", \"friends\".")
|
|
6
|
+
if (!user) throw new Error("Please provide a username or a Player ID!");
|
|
7
|
+
if (!pass) throw new Error("Please provide a password!");
|
|
8
|
+
|
|
9
|
+
const { gjReq } = require("../gjReq.js");
|
|
10
|
+
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
11
|
+
const colors = require("../misc/colors.json");
|
|
12
|
+
let search = await gjReq("getGJUsers20", {
|
|
13
|
+
str: user,
|
|
14
|
+
secret: "Wmfd2893gb7"
|
|
15
|
+
});
|
|
16
|
+
if (search.data == -1) return [];
|
|
17
|
+
let accID = search.data.split(":")[21];
|
|
18
|
+
|
|
19
|
+
const XOR = require("../xor.js");
|
|
20
|
+
const xor = new XOR;
|
|
21
|
+
|
|
22
|
+
const data = {
|
|
23
|
+
accountID: accID,
|
|
24
|
+
gjp: xor.encrypt(pass, 37526),
|
|
25
|
+
levelID: lvl,
|
|
26
|
+
secret: "Wmfd2893gb7",
|
|
27
|
+
type: types[type.toLowerCase()]
|
|
28
|
+
}
|
|
47
29
|
|
|
48
|
-
|
|
30
|
+
let res = await gjReq("getGJLevelScores211", data);
|
|
31
|
+
|
|
32
|
+
let scores = res.data.split("|");
|
|
33
|
+
let result = [];
|
|
34
|
+
|
|
35
|
+
let iconObj = {
|
|
36
|
+
0: "cube",
|
|
37
|
+
1: "ship",
|
|
38
|
+
2: "ball",
|
|
39
|
+
3: "ufo",
|
|
40
|
+
4: "wave",
|
|
41
|
+
5: "robot",
|
|
42
|
+
6: "spider",
|
|
43
|
+
7: "swing",
|
|
44
|
+
8: "jetpack"
|
|
49
45
|
}
|
|
46
|
+
|
|
47
|
+
scores.forEach(sc => {
|
|
48
|
+
let s = sc.split(":");
|
|
49
|
+
result.push({
|
|
50
|
+
username: s[1],
|
|
51
|
+
playerID: Number(s[3]),
|
|
52
|
+
accountID: Number(s[15]),
|
|
53
|
+
rank: Number(s[19]),
|
|
54
|
+
c1: rgbToHEX(colors[user[7]]),
|
|
55
|
+
c2: rgbToHEX(colors[user[9]]),
|
|
56
|
+
iconID: Number(s[5]),
|
|
57
|
+
iconType: iconObj[s[11]],
|
|
58
|
+
glow: s[13] == "2" ? true : false,
|
|
59
|
+
percent: Number(s[17]),
|
|
60
|
+
coins: Number(s[21]),
|
|
61
|
+
age: s[23]
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
50
67
|
}
|