// ==UserScript==
// @name Sploop++
// @version 0.1
// @description simple visuals
// @author nyannez
// @match *://sploop.io/*
// @run-at document-start
// @icon https://www.google.com/s2/favicons?sz=64&domain=sploop.io
// @grant none
// @namespace https://gf.qytechs.cn/users/960747
// ==/UserScript==
const serverInfo = document.createElement("span");
const servers = {
SFRA: "EU#1 Sand",
SFRA2: "EU#2",
SFRA2BIS: "EU#2 Sand",
SCA: "USA#1 Sand",
SCA2: "USA#2 Sand",
SGP: 'AS#1 Sand',
SGP2: 'AS#2 Sand',
SGP3BIS: "AS#3 Sand",
FRA1FFA: "EU Classic",
CA1FFA: "USA Classic",
SGP1FFA: "AS Classic",
};
window.addEventListener('DOMContentLoaded', event => {
const Comfortaa = document.createElement('style');
Comfortaa.innerHTML = `@import "https://fonts.googleapis.com/css2?family=Comfortaa&display=swap";`;
document.head.appendChild(Comfortaa);
serverInfo.style = `
position: absolute;
font-size: 120%;
z-index: 888;
top: 15px;
color: white;
left: 1%;
font-weight: 100;
pointer-events: none;
font-family: Comfortaa;
text-shadow: 1px 1px 5px black, 3px 3px 5px black;
`;
const pingCount = document.createElement("span");
pingCount.style = "position: absolute;z-index: 10;left: 1%;font-family: Comfortaa;pointer-events:none;top: 50px;font-size: 120%;color: white;font-weight: 100;text-shadow: 1px 1px 5px black, 3px 3px 5px black;"
pingCount.textContent = "Ping: unknown";
serverInfo.textContent = "Loading...";
document.body.append(serverInfo, pingCount);
setInterval(() => {
getSploopServers();
const serverName = currentServerUrl.toUpperCase();
const server = sploopServers.find(i => i.r === serverName);
serverInfo.textContent = `${servers[serverName]}: ${server.d[1]}`;
}, 1500)
})
let sploopServers, currentServerUrl, ws;
const getSploopServers = async () => {
await fetch("https://sploop.io/servers").then(e => e.text()).then(e => (sploopServers = JSON.parse(e)));
};
const entities = {
0: { health: 100 },
14: { health: 380 },
23: { health: 380 },
24: { health: 380 },
25: { health: 1000 },
27: { health: 5000 },
28: { health: 5000 },
36: { health: 380 },
};
const packetsID = {
item: 0,
move: 1,
hat: 5,
chat: 7,
place: 8,
joinGame: 11,
angle: 13,
upgrade: 14,
stopMove: 15,
clanAcc: 17,
stopAttack: 18,
hit: 19,
joinClan: 21,
clan: 22,
EAttack: 23,
clanLeave: 24
};
let myID, placing = true, copyMove = 0, onHand = 0, placed = false, isAlive = false;
const sendPacket = (packetID, ...values) => ws.send(new Uint8Array([packetID, ...values]));
const getAngle = (angle) => {
const vec = {
x: 0,
y: 0
};
if (angle & 1) vec.y--;
if (angle & 2) vec.y++;
if (angle & 4) vec.x--;
if (angle & 8) vec.x++;
vec.x *= -1;
vec.y *= -1;
return Math.atan2(vec.y, vec.x);
}
const checkChat = () => document.getElementById('chat-wrapper').style.display == "" || document.getElementById('chat-wrapper').style.display == "none";
window.addEventListener("keydown", event => {
const pressedKey = event.code;
if (pressedKey === "Digit1") {
onHand = 0;
} else if (pressedKey === "Digit2") onHand = 1;
if (checkChat() && ["KeyW", "KeyA", "KeyS", "KeyD"].includes(pressedKey)) {
if (pressedKey === "KeyW") copyMove |= 1;
if (pressedKey === "KeyA") copyMove |= 4;
if (pressedKey === "KeyS") copyMove |= 2;
if (pressedKey === "KeyD") copyMove |= 8;
}
})
window.addEventListener("keyup", event => {
const pressedKey = event.code;
if (checkChat() && ["KeyW", "KeyA", "KeyS", "KeyD"].includes(pressedKey)) {
if (pressedKey === "KeyW") copyMove &= -2;
if (pressedKey === "KeyA") copyMove &= -5;
if (pressedKey === "KeyS") copyMove &= -3;
if (pressedKey === "KeyD") copyMove &= -9;
}
})
window.receiveMsg = (msg) => {
const data = msg.data;
const decoded = typeof data === "string" ? JSON.parse(data) : new Uint8Array(data);
if (!ws) {
currentServerUrl = msg.target.url.split('//')[1].split('.')[0];
ws = msg.target;
ws.onclose = () => (ws = undefined);
};
switch (decoded) {
case 35:
isAlive = true;
break;
case 19:
isAlive = false;
placed = false;
break;
case 20: {
if (copyMove !== 0 && serverInfo.textContent.includes("Sand") && !placed && window.stats[Sploop.objCount][5] < 8 && placing) {
placing = false;
sendPacket(packetsID.item, 5);
const angle = getAngle(copyMove);
const transformedAngle = 65535 * (angle + Math.PI) / (2 * Math.PI);
sendPacket(packetsID.hit, 255 & transformedAngle, transformedAngle >> 8 & 255);
sendPacket(packetsID.stopAttack);
sendPacket(packetsID.item, onHand);
setTimeout(() => {
placing = true;
}, 100)
} else if (window.stats[Sploop.objCount][5] === 8) placed = true;
break;
}
case 33: (myID = decoded[1]);
}
};
let gameEntity;
let chests = [], queue = [];
window.attackAnimation = (type, id, weapon, isObject, entity) => {
try {
if (entity.type === 30) {
if (chests.some(chest => chest[Sploop.id2] === id)) {
queue.push(id);
}
} else if (entity.type === 0) {
let spike = queue.map(id => gameEntity.get(id));
queue = [];
if (!spike.length) return;
let hatAdditional = entity[Sploop.hat] === 11 ? 1.4 : entity[Sploop.hat] === 2 ? 1.25 : 1;
let damage = (window.weapons[weapon][Sploop.weaponDamage2] ? window.weapons[weapon][Sploop.weaponDamage2] : window.weapons[weapon][Sploop.weaponDamage]) * hatAdditional;
spike.forEach(entity => {
entity.health -= damage;
});
}
} catch(err) {}
};
window.drawChestHP = (target, id, ctx, step) => {
if (target.type === 30 && target.health === undefined) target.health = 380;
const exists = chests.some(chest => chest[Sploop.id2] === target[Sploop.id2]);
if (!exists && target.type === 30) chests.push(target);
if (exists) {
ctx.save();
ctx.beginPath();
ctx.textAlign = "center";
ctx.rotate(-target[Sploop.angle]);
ctx.font = "600 20px Comfortaa";
ctx.fillStyle = "#fff";
ctx.strokeStyle = "#000";
ctx.lineWidth = 3;
ctx.strokeText(target.health, 0, 5);
ctx.fillText(target.health, 0, 5);
ctx.fillRect
ctx.closePath();
ctx.restore();
};
};
window.removeEntity = (entity) => {
delete entity.health;
const index = chests.findIndex(chest => chest[Sploop.id2] === entity[Sploop.id2]);
if (index !== -1) {
chests.splice(index, 1);
}
};
window.draw = true;
window.getEntityData = async (entity, ctx, isTeammate, map) => {
gameEntity = map;
const entityX = entity[Sploop.x],
entityY = entity[Sploop.y];
const maxHealth = entities[entity.type].health;
const entityHealth = entity[Sploop.health] * maxHealth / 100;
const ceilHealth = Math.ceil(entityHealth / 255 * 100);
const distation = Math.hypot(window.myX - entityX, window.myY - entityY);
if (window.draw) {
ctx.font = "100 20px MV Boli";
ctx.shadowOffsetX = 2;
ctx.shadowOffsetY = 2;
ctx.shadowColor = "#000000";
ctx.shadowBlur = 5;
ctx.fillStyle = (entity[Sploop.id] === myID || isTeammate) ? window.myHPColor : "#802641";
ctx.fillText(`${ceilHealth}/${maxHealth}`, entityX - 50, entityY + window.sprites[entity.type][Sploop.size] + 70);
ctx.shadowBlur = 0;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
};
}
window.requestAnimationFrame = (t) => setTimeout(t, 0);
const TYPEOF = value => Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
const NumberSystem = [
{ radix: 2, prefix: "0b0*" },
{ radix: 8, prefix: "0+" },
{ radix: 10, prefix: "" },
{ radix: 16, prefix: "0x0*" }
];
class Regex {
constructor(code, unicode) {
this.code = this.COPY_CODE = code;
this.unicode = unicode || false;
this.hooks = {};
}
static parseValue = value => {
try { return Function(`return (${value})`)(); }
catch (err) { return null; }
};
isRegexp = value => TYPEOF(value) === "regexp";
generateNumberSystem = int => `(?:${NumberSystem.map(({ prefix, radix }) => prefix + int.toString(radix)).join("|")})`;
parseVariables = regex => regex.replace(/\{VAR\}/g, "(?:let|var|const)")
.replace(/\{QUOTE\}/g, "['\"`]")
.replace(/ARGS\{(\d+)\}/g, (_, count) => (Array(Number(count)).fill("\\w+")).join("\\s*,\\s*"))
.replace(/NUMBER\{(\d+)\}/g, (_, int) => this.generateNumberSystem(Number(int)));
format = (name, inputRegex, flags) => {
const regex = Array.isArray(inputRegex) ? inputRegex.map(exp => this.isRegexp(exp) ? exp.source : exp).join("\\s*") : this.isRegexp(inputRegex) ? inputRegex.source : "";
let parsedRegex = this.parseVariables(regex);
if (this.unicode) {
parsedRegex = parsedRegex.replace(/\\w/g, "(?:[^\\x00-\\x7F-]|\\$|\\w)");
}
const expression = new RegExp(parsedRegex.replace(/\{INSERT\}/, ""), flags);
return parsedRegex.includes("{INSERT}") ? new RegExp(parsedRegex, flags) : expression;
};
template = (type, name, regex, substr) => {
const expression = new RegExp(`(${this.format(name, regex).source})`);
const match = this.code.match(expression) || [];
this.code = this.code.replace(expression, type === 0 ? "$1" + substr : substr + "$1");
return match;
};
match = (name, regex, flags, debug = false) => {
const expression = this.format(name, regex, flags);
const match = this.code.match(expression) || [];
this.hooks[name] = { expression, match };
return match;
};
matchAll = (name, regex, debug = false) => {
const expression = this.format(name, regex, "g");
const matches = [...this.code.matchAll(expression)];
this.hooks[name] = { expression, match: matches };
return matches;
};
replace = (name, regex, substr, flags) => {
const expression = this.format(name, regex, flags);
this.code = this.code.replace(expression, substr);
return this.code.match(expression) || [];
};
replaceAll = (name, regex, substr, flags) => {
const expression = this.format(name, regex, "g");
this.code = this.code.replaceAll(expression, substr);
return this.code.match(expression) || [];
};
append = (name, regex, substr) => this.template(0, name, regex, substr);
prepend = (name, regex, substr) => this.template(1, name, regex, substr);
insert = (name, regex, substr) => {
const { source } = this.format(name, regex);
if (!source.includes("{INSERT}")) throw new Error("Your regexp must contain {INSERT} keyword");
const findExpression = new RegExp(source.replace(/^(.*)\{INSERT\}(.*)$/, "($1)($2)"));
this.code = this.code.replace(findExpression, `$1${substr}$2`);
return this.code.match(findExpression);
};
};
window.convertToEmoji = (text) => {
const emojiRegex = /:(\w+):/g;
const convertedText = text.replace(emojiRegex, (match, p1) => {
const emojiMap = {
smile: '😊',
grin: '😁',
joy: '😂',
laughing: '😆',
sweat_smile: '😅',
wink: '😉',
blush: '😊',
yum: '😋',
sunglasses: '😎',
heart_eyes: '😍',
kissing_heart: '😘',
kissing_closed_eyes: '😚',
stuck_out_tongue_winking_eye: '😜',
stuck_out_tongue_closed_eyes: '😝',
flushed: '😳',
relieved: '😌',
unamused: '😒',
sweat: '😓',
pensive: '😔',
sleep: '😴',
mask: '😷',
thermometer_face: '🤒',
head_bandage: '🤕',
sleeping: '😴',
zzz: '💤',
poop: '💩',
clap: '👏',
thumbs_up: '👍',
thumbs_down: '👎',
heart: '❤️',
broken_heart: '💔',
sparkling_heart: '💖',
star: '⭐',
fire: '🔥',
rainbow: '🌈',
rocket: '🚀',
hourglass: '⌛',
gift: '🎁',
tada: '🎉',
umbrella: '☔',
snowflake: '❄️',
sun: '☀️',
moon: '🌙',
beer: '🍺',
coffee: '☕',
cake: '🍰',
money_bag: '💰',
bomb: '💣',
airplane: '✈️',
anchor: '⚓',
guitar: '🎸',
alien: '👽',
skull: '💀',
ghost: '👻',
pumpkin: '🎃',
christmas_tree: '🎄',
santa: '🎅',
gift_box: '🎁',
bell: '🔔',
crossed_swords: '⚔️',
wizard: '🧙',
clinking_glasses: '🥂',
thinking_face: '🤔',
detective: '🕵️♂️',
scientist: '👨🔬',
astronaut: '👨🚀',
artist: '👩🎨',
pilot: '👨✈️',
bride_with_veil: '👰',
angel: '👼',
baby: '👶',
family: '👪',
thumbs_up: '👍',
thumbs_down: '👎',
};
return emojiMap[p1] || match;
});
return convertedText;
}
document.addEventListener("wheel", (event) => {
document.getElementById("hat_menu_content").scrollBy(0, event.deltaY < 0 ? -900 : 900);
});
window.rainb = true;
window.hue = 0;
let defaultHPColor = "#a4cc4f";
setInterval(() => {
if (window.rainb) {
window.myHPColor = `hsl(${window.hue}, 80%, 50%)`;
window.hue += 0.2;
window.hue >= 360 && (window.hue = 0);
} else {
window.myHPColor = defaultHPColor;
}
}, 20)
window.abbreviateNumber = (number) => {
const suffixes = {
't': 1e12,
'b': 1e9,
'm': 1e6,
'k': 1e3,
};
for (const [letter, value] of Object.entries(suffixes)) {
if (number >= value) {
const abbreviated = (number / value).toFixed(1).replace(/\.0$/, '');
return `${abbreviated}${letter}`;
}
}
return number.toString();
}
window.nameGold = false;
let Sploop;
const applyHooks = code => {
const Hook = new Regex(code, true);
window.COPY_CODE = (Hook.COPY_CODE.match(/^(\(function \w+\(\w+\)\{.+)\(.+?\);$/) || [])[1];
Hook.append("EXTERNAL fix", /\(function (\w+)\(\w+\)\{/, "let $2 = eval(`(() => ${COPY_CODE})()`);delete window.COPY_CODE;");
const ID = Hook.match('ID', /&&\w{2}===\w\.(\w{2})\){/)[1];
const myData = Hook.match('myPlayer', /=(\w.get\(\w{2}\));\w&&\w\(\)/)[1];
const X = Hook.match('playerX', /\{this\.(\w{2})=\w\|\|0/)[1];
const Y = Hook.match('playerY', /,this\.(\w{2})=\w\|\|0\}/)[1];
const ID2 = Hook.match('ID2', /-1!==\w+\.(\w+)&&/)[1];
const currentWeapon = Hook.match("crntWeapon", /,\w.(\w{2})===/)[1];
const angle = Hook.match("angle", /;\w.(\w{2})=\w\(\)/)[1];
const weaponName = Hook.match("wpnName", /(\w{2}):"XX/)[1];
const health = Hook.match("health", /(\w{2})<<8;/)[1];
const weaponDamage = Hook.match("wpnDamage", /(\w{2}):32,reload:300/)[1];
const weaponDamage2 = Hook.match("wpnDamage", /\w{2}:25,.{6}:300,(\w{2}):30/)[1];
const teamID = Hook.match('test', /,\w=\w.(\w{2})\|.+?\<\<8/)[1];
const radius = Hook.match("radius", /(\w{2}):220/)[1];
const [, currentItem, hat] = Hook.match("hat", /\(\w+\.(\w+)\|\w+\.(\w+)<<NUMBER{8}\)/);
const inWhichObject = Hook.match("iwo", /110\).+?,1===\w.(\w{2})&&!\w{2}/)[1];
const weaponID = Hook.match('el', /(\w{2}):0,\w{2}:22,reload:150/)[1];
const itemsID = Hook.match("IDs", />1\){.{3}(\w{2})/)[1];
const objCount = Hook.match("objCount", /\),this.(\w{2})=\w\):/)[1];
const size = Hook.match("size", /\(\)\[.{2}type\].(\w{2})\+50/)[1];
Sploop = {
x: X,
y: Y,
id: ID,
id2: ID2,
hat: hat,
size: size,
type: 'type',
angle: angle,
health: health,
radius: radius,
teamID: teamID,
itemsID: itemsID,
objCount: objCount,
weaponID: weaponID,
weaponName: weaponName,
weaponDamage: weaponDamage,
weaponDamage2: weaponDamage2,
currentWeapon: currentWeapon,
inWhichObject: inWhichObject
}
let args = Hook.match("drawEntityInfo", /-NUMBER{50},.+?function \w+\((ARGS{3})\)\{/)[1];
const weaponList = Hook.match("weaponList", /\?Math\.PI\/2.+?(\w\(\))/)[1];
Hook.append('removeEntity', /(\w).{8}\w.delete\(\w\);/, `window.removeEntity($2);`);
Hook.replace("renderItems", /(\(\w+\.\w+\+\w+,\w+\.\w+\+\w+\).+?\w+\(\).+?\w+\.\w+\.\w+\)([,;]))/, `$1window.drawChestHP(...arguments)$2`);
Hook.replace("defaultData", /(\W\w+>NUMBER{1}\W.+?(\w+)\.(\w+).+?)function/, `$1window.stats=$2;window.sprites = tt();window.weapons=${weaponList};function`);
Hook.append('drawEntityInfo', /h=.5;/, `try {window.getEntityData(${args}, A);} catch(err) {};`)
Hook.append("getMsg", /0;fu.{10}(\w).{2}/, `window.receiveMsg($2);`);
Hook.append("someFunction", /login\.hide\(\),\w{2}\(\)}/, `window.someFunction=lt;`);
Hook.replace('customClan', /"\["/, `"«"`);
Hook.replace('customClan', /"\]"/, `"»"`);
Hook.replace("particles", /(0,\w{2}=!1,\w{2}=)!1,/, `$1true,`);
Hook.replace("grid", /1,(\w{2})=!0/, `1, $1=false`);
Hook.replace("millMarker", /=false,(\w{2})=!0/, `=false,$1=false`);
Hook.replace("enablePing", /42.5\),(\w{2})=!1/, `42.5),$1=true`);
Hook.replace("nativeRender", /(true,\w{2}=)!1/, `$1true`);
Hook.replace("replaceOrigin", /("#8ecc51".{16}).{5}/, `$1let`);
Hook.replace("betterAGEBar", /AGE "\+(\w),\d{2},.+?\)/, `" + "«" + $1 + "»",24,"#fff","#303030")`)
Hook.replace("ColorMats", /\)\,24,\"\#\w{6}\"\)|\)\,24,\w\(\d{3}\)\)/, `),24,"#AE4D57", "#303030")`)
Hook.replace("ColorMats", /\)\,24,\"\#\w{6}\"\)|\)\,24,\w\(\d{3}\)\)/, `),24,"#935F3B", "#303030")`)
Hook.replace("ColorMats", /\)\,24,\"\#\w{6}\"\)|\)\,24,\w\(\d{3}\)\)/, `),24,"#7B7A91", "#303030")`)
Hook.replace("ColorMats", /\"\",24\,\D{9}|\"\",24\,\w\(\d{3}\)/, `"",24,"#FFD700", "#303030"`)
Hook.replace("ColorBioms", /"#ece5db"/, `"#A9A9A9"`);
Hook.replace('customLoader', /Loading Sploop.io/, `Loading cringe...`)
Hook.replace('customItemObvodka', /23,"#fff"/, `23,"#fff","#303030"`)
Hook.replace('customItemObvodka', /eec39d"/, `eec39d", "#303030"`)
Hook.replace('customItemInfo', /4f403c/, '4f403c80')
Hook.replace('customBar', /n\(643\)/, `"#FFF"`)
Hook.replace('customBar', /10,"#5D3A37"|10,\w\(\d{3}\)/, `10,"#00000080"`)
Hook.replace('customHP', /(,\.18.+?\:).+?\)}/, `$1window.myHPColor)}`)
Hook.replace('customHP', /(\.5;.+?\?).+?",/, `$1window.myHPColor : "#802641",`)
Hook.replace('customClan', /"#96C949","#404040"|"#96C949",\w\(\d{3}\)/, `"#0a80c9","#2e3336"`);
Hook.append('showFullMats', /10},\w{2}\Dfunction\((\w)\){/, `return $2;`);
Hook.replace('getPing', /((\w).{15};)\w{2}=.{37}\)/, `$1document.querySelector("body > span:nth-child(11)").textContent = "Ping: " + $2`)
Hook.append('attackAnim', /\+=NUMBER{5}.+?(\w+)=.+?(\w+)=.+?(\w+)=.+?(\w+)=.+?(\w+)=.+?;/, `window.attackAnimation($2, $3, $4, $5, $6);`);
//Hook.replace('showFullGold', /(\w)\>\d{7}.*?\+""/, `$1`);
Hook.append("goldNick", /mr\(pe\[t\(729\)\]/, `+ (window.nameGold ? " " + window.abbreviateNumber(document.getElementById("score-left-value").textContent) : "")`);
return Hook.code;
};
window.eval = new Proxy(window.eval, {
apply(target, _this, args) {
const code = args[0];
if (code.length > 100000) {
args[0] = applyHooks(code);
window.eval = target;
}
return target.apply(_this, args);
}
});
document.addEventListener('DOMContentLoaded', (event) => {
try {
document.querySelector("#hat-menu > div.pop-top.select").remove();
[...document.getElementsByClassName("green-button")].forEach(event => {
event.style.pointerEvents = "all";
});
["game-bottom-content", "game-right-content-main", "game-left-content-main", "cross-promo", "landscape"].forEach(e => document.getElementById(e).remove());
[...document.getElementsByClassName("description")].forEach(e => {
e.remove();
});
} catch(err) {}
const styleItem = `
.subcontent-bg {
box-shadow: none;
border: none;
}
#hat-menu {
height: 330px;
}
.green-button {
background-color: #ffffff5c;
box-shadow: none;
}
.green-button:hover {
box-shadow: none;
background-color: #ffffff87;
}
.green-button:active {
box-shadow: none;
background-color: #ffffff5c;
}
.menu .content .menu-item .menu-pricing .action {
border-radius: 0;
text-shadow: none;
border: 3px solid #ffffff;
}
.scrollbar::-webkit-scrollbar {
border: none;
border-radius: 0;
}
.scrollbar::-webkit-scrollbar-thumb {
border-radius: 0;
box-shadow: none;
}
.pop-box {
box-shadow: none;
border-radius: 0;
background: none !important;
}
.menu .content .menu-item {
border-bottom: none;
text-shadow: none;
}
#hat_menu_content {
pointer-events: none;
padding: 0;
border: none;
background: none;
box-shadow: none;
margin: 0px;
overflow: hidden;
}
.profile-scores {
width: 600px;
height: 76px;
color: white;
}
#profile-next-rank-text {
height: 100%;
color: white;
width: auto;
max-width: none;
}
#profile-next-rank-icons {
height: 100%;
width: 250px;
padding: 5px;
margin-right: 10px;
}
`;
const styleElement = document.createElement("style");
styleElement.innerHTML = styleItem;
document.head.appendChild(styleElement);
window.onload = () => {
const kd = document.createElement("div");
kd.innerHTML = `<div><div class="text-shadowed-3 profile-score">Kills/Deaths</div><div class="text-shadowed-3 profile-score yellow-text">
${(Number(document.querySelector("#total-kill").textContent) / Number(document.querySelector("#total-death").textContent)).toFixed(2)}
</div></div>`
document.querySelector("#profile-container > div.middle-main.profile-scores").appendChild(kd);
}
});