forked from bribes/FaavJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsmc@v1.6-dev.min.js
252 lines (228 loc) · 16.4 KB
/
jsmc@v1.6-dev.min.js
1
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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
/* jshint esversion: 8 */
/* THIS IS A TEST VERSION OF JSMC v1.6 */
//CALCULATES NETWORK LEVEL
function getLevel(exp) {
const EXP_NEEDED = [100000, 150000, 250000, 500000, 750000, 1000000, 1250000, 1500000, 2000000, 2500000, 2500000, 2500000, 2500000, 2500000, 3000000];
let level = 0;
for (let i = 0; i <= 1000; i += 1) {
let need = 0;
if (i >= EXP_NEEDED.length) {
need = EXP_NEEDED[EXP_NEEDED.length - 1];
} else {
need = EXP_NEEDED[i];
}
if ((exp - need) < 0) {
return Math.round((level + (exp / need)) * 100) / 100;
}
level += 1;
exp -= need;
}
return 1000;
}
//CALCULATES SKYWARS LEVEL
function getSkyLevel(xp) {
var xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000];
let exactLevel = 0;
if (xp >= 15000) {
exactLevel = (xp - 15000) / 10000 + 12;
} else {
for (i = 0; i < xps.length; i++) {
if (xp < xps[i]) {
exactLevel = i + (xp - xps[i - 1]) / (xps[i] - xps[i - 1]);
break;
}
}
}
return exactLevel;
}
//ROUNDS THE NUMBER
function roundNumber(rnum, rlength) {
var newnumber = Math.round(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
return newnumber;
}
//JSMC FUNCTION
async function jsmc(a) {
//ACCOUNT STATUS
await fetch("https://api.gapple.pw/blocked/" + a).then(a => a.json()).then(e => {
player = new Object({}),
player.status = e.status,
"blocked" == player.status && !1 === /^[a-zA-Z0-9_]{3,16}$/.test(a) && (player.status = "invalid"),
//ACCOUNT TYPE
fetch("https://api.gapple.pw/status/" + a).then(a => a.json()).then(e => {
player.type = e.status,
//BASIC PLAYER INFO
fetch("https://playerdb.co/api/player/minecraft/" + a).then(a => a.json()).then(a => {
player.error = !1,
player.username = a.data.player.username,
player.uuid = a.data.player.id,
player.id = a.data.player.raw_id,
player.name_history = a.data.player.meta.name_history,
player.skin = `https://crafatar.com/skins/${player.id}`,
//AVATAR RENDERS
player.renders = new Object({}),
player.renders.icon = `https://crafatar.com/avatars/${player.id}?overlay`,
player.renders.avatar_1 = `https://crafatar.com/renders/body/${player.id}?overlay`,
player.renders.avatar_2 = `https://visage.surgeplay.com/full/${player.id}`,
player.renders.avatar_3 = `https://visage.surgeplay.com/frontfull/${player.id}?overlay`,
player.renders.bust_1 = `https://visage.surgeplay.com/front/${player.id}`,
player.renders.bust_2 = `https://visage.surgeplay.com/bust/${player.id}`,
player.renders.head_1 = `https://crafatar.com/renders/head/${player.id}?overlay`,
player.renders.head_2 = `https://visage.surgeplay.com/head/${player.id}`,
//COSMETICS
player.cosmetics = new Object({}),
//CAPES
player.cosmetics.cape = new Object({}),
player.cosmetics.cape.official = `https://crafatar.com/capes/${player.id}`,
player.cosmetics.cape.optifine = `https://api.gapple.pw/cors/optifine/${player.username}`,
player.cosmetics.cape.labymod = `https://api.gapple.pw/cors/labymod/cape/${player.id}`,
player.cosmetics.bandana = new Object({}),
//BANDANAS
player.cosmetics.bandana.labymod = `https://api.gapple.pw/cors/labymod/bandana/${player.id}`,
//SERVERS
player.servers = new Object({}),
//HYPIXEL
fetch("https://api.hypixel.net/player?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&uuid=" + player.id).then(a => a.json()).then(a => {
player.servers.hypixel = new Object({}),
player.servers.hypixel.success = a.success,
null !== a.player && (player.servers.hypixel.rank = a.player.rank,
player.servers.hypixel.newPackageRank = a.player.newPackageRank,
player.servers.hypixel.monthlyPackageRank = a.player.monthlyPackageRank,
player.servers.hypixel.firstLogin = a.player.firstLogin,
player.servers.hypixel.lastLogin = a.player.lastLogin,
player.servers.hypixel.lastLogout = a.player.lastLogout,
player.servers.hypixel.networkExp = a.player.networkExp,
player.servers.hypixel.networkLevel = roundNumber((Math.sqrt((2 * player.servers.hypixel.networkExp) + 30625) / 50) - 2.5, 2),
player.servers.hypixel.karma = a.player.karma,
//HYPIXEL SKYWARS STATS
player.servers.hypixel.skywars = new Object({}),
player.servers.hypixel.skywars.games_played = a.player.stats.SkyWars.games_played_skywars,
player.servers.hypixel.skywars.exp = a.player.stats.SkyWars.skywars_experience),
player.servers.hypixel.skywars.level = roundNumber(getSkyLevel(player.servers.hypixel.skywars.exp), 2),
player.servers.hypixel.skywars.levelFormatted = a.player.stats.SkyWars.levelFormatted,
player.servers.hypixel.skywars.win_streak = a.player.stats.SkyWars.win_streak,
player.servers.hypixel.skywars.wins = a.player.stats.SkyWars.wins,
player.servers.hypixel.skywars.losses = a.player.stats.SkyWars.losses,
player.servers.hypixel.skywars.kills = a.player.stats.SkyWars.kills,
player.servers.hypixel.skywars.deaths = a.player.stats.SkyWars.deaths,
player.servers.hypixel.skywars.assists = a.player.stats.SkyWars.assists,
player.servers.hypixel.skywars.kd = roundNumber(player.servers.hypixel.skywars.kills / player.servers.hypixel.skywars.deaths, 2),
player.servers.hypixel.skywars.wl = roundNumber(player.servers.hypixel.skywars.wins / player.servers.hypixel.skywars.losses, 2),
player.servers.hypixel.skywars.coins = a.player.stats.SkyWars.coins,
player.servers.hypixel.skywars.time_played = a.player.stats.SkyWars.time_played,
player.servers.hypixel.skywars.souls = a.player.stats.SkyWars.souls,
player.servers.hypixel.skywars.quits = a.player.stats.SkyWars.quits;
//HYPIXEL SKYWARS SOLO
player.servers.hypixel.skywars.solo = new Object({}),
player.servers.hypixel.skywars.solo.games_played = a.player.stats.SkyWars.games_solo,
player.servers.hypixel.skywars.solo.wins = a.player.stats.SkyWars.wins_solo,
player.servers.hypixel.skywars.solo.losses = a.player.stats.SkyWars.losses_solo,
player.servers.hypixel.skywars.solo.kills = a.player.stats.SkyWars.kills_solo,
player.servers.hypixel.skywars.solo.deaths = a.player.stats.SkyWars.deaths_solo,
player.servers.hypixel.skywars.solo.time_played = a.player.stats.SkyWars.time_played_solo,
player.servers.hypixel.skywars.solo.kd = roundNumber(player.servers.hypixel.skywars.solo.kills / player.servers.hypixel.skywars.solo.deaths, 2),
player.servers.hypixel.skywars.solo.wl = roundNumber(player.servers.hypixel.skywars.solo.wins / player.servers.hypixel.skywars.solo.losses, 2);
//HYPIXEL SKYWARS SOLO NORMAL
player.servers.hypixel.skywars.solo.normal = new Object({}),
player.servers.hypixel.skywars.solo.normal.wins = a.player.stats.SkyWars.wins_solo_normal,
player.servers.hypixel.skywars.solo.normal.losses = a.player.stats.SkyWars.losses_solo_normal,
player.servers.hypixel.skywars.solo.normal.games_played = (player.servers.hypixel.skywars.solo.normal.wins + player.servers.hypixel.skywars.solo.normal.losses),
player.servers.hypixel.skywars.solo.normal.kills = a.player.stats.SkyWars.kills_solo_normal,
player.servers.hypixel.skywars.solo.normal.deaths = a.player.stats.SkyWars.deaths_solo_normal,
player.servers.hypixel.skywars.solo.normal.kd = roundNumber(player.servers.hypixel.skywars.solo.normal.kills / player.servers.hypixel.skywars.solo.normal.deaths, 2),
player.servers.hypixel.skywars.solo.normal.wl = roundNumber(player.servers.hypixel.skywars.solo.normal.wins / player.servers.hypixel.skywars.solo.normal.losses, 2);
//HYPIXEL SKYWARS SOLO INSANE
player.servers.hypixel.skywars.solo.insane = new Object({}),
player.servers.hypixel.skywars.solo.insane.wins = a.player.stats.SkyWars.wins_solo_insane,
player.servers.hypixel.skywars.solo.insane.losses = a.player.stats.SkyWars.losses_solo_insane,
player.servers.hypixel.skywars.solo.insane.games_played = (player.servers.hypixel.skywars.solo.insane.wins + player.servers.hypixel.skywars.solo.insane.losses),
player.servers.hypixel.skywars.solo.insane.kills = a.player.stats.SkyWars.kills_solo_insane,
player.servers.hypixel.skywars.solo.insane.deaths = a.player.stats.SkyWars.deaths_solo_insane,
player.servers.hypixel.skywars.solo.insane.kd = roundNumber(player.servers.hypixel.skywars.solo.insane.kills / player.servers.hypixel.skywars.solo.insane.deaths, 2),
player.servers.hypixel.skywars.solo.insane.wl = roundNumber(player.servers.hypixel.skywars.solo.insane.wins / player.servers.hypixel.skywars.solo.insane.losses, 2);
//HYPIXEL SKYWARS DOUBLES
player.servers.hypixel.skywars.doubles = new Object({}),
player.servers.hypixel.skywars.doubles.games_played = a.player.stats.SkyWars.games_team,
player.servers.hypixel.skywars.doubles.wins = a.player.stats.SkyWars.wins_team,
player.servers.hypixel.skywars.doubles.losses = a.player.stats.SkyWars.losses_team,
player.servers.hypixel.skywars.doubles.kills = a.player.stats.SkyWars.kills_team,
player.servers.hypixel.skywars.doubles.deaths = a.player.stats.SkyWars.deaths_team,
player.servers.hypixel.skywars.doubles.time_played = a.player.stats.SkyWars.time_played_team,
player.servers.hypixel.skywars.doubles.kd = roundNumber(player.servers.hypixel.skywars.doubles.kills / player.servers.hypixel.skywars.doubles.deaths, 2),
player.servers.hypixel.skywars.doubles.wl = roundNumber(player.servers.hypixel.skywars.doubles.wins / player.servers.hypixel.skywars.doubles.losses, 2);
//HYPIXEL SKYWARS DOUBLES NORMAL
player.servers.hypixel.skywars.doubles.normal = new Object({}),
player.servers.hypixel.skywars.doubles.normal.wins = a.player.stats.SkyWars.wins_team_normal,
player.servers.hypixel.skywars.doubles.normal.losses = a.player.stats.SkyWars.losses_team_normal,
player.servers.hypixel.skywars.doubles.normal.games_played = (player.servers.hypixel.skywars.doubles.normal.wins + player.servers.hypixel.skywars.doubles.normal.losses),
player.servers.hypixel.skywars.doubles.normal.kills = a.player.stats.SkyWars.kills_team_normal,
player.servers.hypixel.skywars.doubles.normal.deaths = a.player.stats.SkyWars.deaths_team_normal,
player.servers.hypixel.skywars.doubles.normal.kd = roundNumber(player.servers.hypixel.skywars.doubles.normal.kills / player.servers.hypixel.skywars.doubles.normal.deaths, 2),
player.servers.hypixel.skywars.doubles.normal.wl = roundNumber(player.servers.hypixel.skywars.doubles.normal.wins / player.servers.hypixel.skywars.doubles.normal.losses, 2);
//HYPIXEL SKYWARS DOUBLES INSANE
player.servers.hypixel.skywars.doubles.insane = new Object({}),
player.servers.hypixel.skywars.doubles.insane.wins = a.player.stats.SkyWars.wins_team_insane,
player.servers.hypixel.skywars.doubles.insane.losses = a.player.stats.SkyWars.losses_team_insane,
player.servers.hypixel.skywars.doubles.insane.games_played = (player.servers.hypixel.skywars.doubles.insane.wins + player.servers.hypixel.skywars.doubles.insane.losses),
player.servers.hypixel.skywars.doubles.insane.kills = a.player.stats.SkyWars.kills_team_insane,
player.servers.hypixel.skywars.doubles.insane.deaths = a.player.stats.SkyWars.deaths_team_insane,
player.servers.hypixel.skywars.doubles.insane.kd = roundNumber(player.servers.hypixel.skywars.doubles.insane.kills / player.servers.hypixel.skywars.doubles.insane.deaths, 2),
player.servers.hypixel.skywars.doubles.insane.wl = roundNumber(player.servers.hypixel.skywars.doubles.insane.wins / player.servers.hypixel.skywars.doubles.insane.losses, 2);
//HYPIXEL PLAYER STATUS
fetch("https://api.hypixel.net/status?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&uuid=" + player.id).then(a => a.json()).then(a => {
player.servers.hypixel.online = a.session.online;
}),
//HYPIXEL GUILD
fetch("https://api.hypixel.net/guild?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&player=" + player.id).then(a => a.json()).then(e => {
player.servers.hypixel.guild = new Object({});
player.servers.hypixel.guild.success = e.success;
if (e.guild !== null) {
player.servers.hypixel.guild.id = e.guild._id,
player.servers.hypixel.guild.name = e.guild.name,
player.servers.hypixel.guild.createdAt = e.guild.created,
player.servers.hypixel.guild.members = e.guild.members,
player.servers.hypixel.guild.ranks = e.guild.ranks,
player.servers.hypixel.guild.exp = e.guild.exp,
player.servers.hypixel.guild.level = roundNumber(getLevel(player.servers.hypixel.guild.exp), 0),
player.servers.hypixel.guild.tag = e.guild.tag,
player.servers.hypixel.guild.tagColor = e.guild.tagColor,
player.servers.hypixel.guild.coins = e.guild.coins,
player.servers.hypixel.guild.coinsEver = e.guild.coinsEver,
player.servers.hypixel.guild.expByGameType = e.guild.guildExpByGameType;
}
//HYPIXEL FRIENDS
player.servers.hypixel.friends = new Object({});
fetch("https://api.hypixel.net/friends?key=63f20355-92d7-42d7-a2a5-6457160aa4eb&uuid=" + player.id).then(a => a.json()).then(e => {
var friends = '';
var started = '';
for (var i = 0; i < e.records.length; i++) {
if (e.records[i].uuidSender !== e.uuid) {
friends += e.records[i].uuidSender + ",";
}
if (e.records[i].uuidReceiver !== e.uuid) {
friends += e.records[i].uuidReceiver + ",";
}
started += e.records[i].started + ",";
}
var friends_arr = friends.slice(0, -1).split(",");
var friends_rev = [];
var friends_length = friends_arr.length;
for (var a = friends_length - 1; a >= 0; a--) {
friends_rev.push(friends_arr[a]);
}
var started_arr = started.slice(0, -1).split(",");
var started_rev = [];
var started_length = started_arr.length;
for (var c = started_length - 1; c >= 0; c--) {
started_rev.push(started_arr[c]);
}
player.servers.hypixel.friends.uuid = JSON.parse(JSON.stringify(friends_rev)); //RETURNS THE USERS FRIENDS UUIDS
player.servers.hypixel.friends.timestamp = JSON.parse(JSON.stringify(started_rev)); //RETURNS WHEN THE USER BECAME FRIENDS WITH THE PERSON
});
//RUNS THE USERS CODE
code();
});
}).catch(a => player.error = !0); //CATCHES ERROR
});
});
});
}