// ==UserScript==
// @name ZOMBS.io Hack Fireball Mod X
// @namespace -
// @version BETA
// @description Best Script Ever Working 2022
// @author DarkResurgence
// @match zombs.io
// @icon https://cdn.discordapp.com/channel-icons/855622511553937429/c4ae7994d1bf46c69d63bd08ff302745.png
// @grant none
// @license MIT
// @downloadURL https://update.greasyfork.icu/scripts/448958/ZOMBSio%20Hack%20Fireball%20Mod%20X.user.js
// @updateURL https://update.greasyfork.icu/scripts/448958/ZOMBSio%20Hack%20Fireball%20Mod%20X.meta.js
// ==/UserScript==
let css2 = `
.btn:hover {
cursor: pointer;
}
.btn-blue {
background-color:#ffff00;
}
.btn-blue:hover .btn-blue:active {
background-color: #ffff00;
}
.box {
display: block;
width: 100%;
height: 50px;
line-height: 34px;
padding: 8px 14px;
margin: 0 0 10px;
background:#ffff00;
border: 0;
font-size: 14px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
border-radius: 4px;
}
.codeIn, .joinOut {
height: 50px;
}
.hud-menu-zipp2 {
display: none;
position: fixed;
top: 48%;
left: 50%;
width: 600px;
height: 470px;
margin: -270px 0 0 -300px;
padding: 20px;
background: hsl(0, 100%, 30%)
color: #ffff00;
border-radius: 4px;
z-index: 15;
}
.hud-menu-zipp2 h3 {
display: block;
margin: 0;
line-height: 30px;
}
.hud-menu-zipp2 .hud-zipp-grid2 {
background-color: rgba(28, 92, 65, 0.55); border: 5px solid white; overflow: scroll; display: block;"
display: block;
height: 440px;
padding: 15px;
margin-top: 20px;
background: rgba(0, 0, 0, 0.6);
color: #eee;
border-radius: 4px;
z-index: 15;
overflow-y: auto;
opacity: 0.75;
background-size: cover;
}
.hud-spell-icons .hud-spell-icon[data-type="Zippity2"]::before {
background-image: url("https://media.discordapp.net/attachments/838437616566796288/904966032425365514/sirromedit-removebg-preview.png");
}
.hud-menu-zipp2 .hud-the-tab {
position: relative;
height: 80px;
line-height: 80px;
margin: 20px;
border: 0px solid rgb(0, 0, 0, 0);
}
.hud-menu-zipp2 .hud-the-tab {
display: block;
float: left;
padding: 0 14px;
margin: 0 1px 0 0;
font-size: 15px;
background: rgba(81, 123, 91, 1);
color: rgba(81, 123, 91, 1);
transition: all 0.15s ease-in-out;
}
.hud-menu-zipp2 .hud-the-tab:hover {
background: rgba(81, 123, 91, 1)
color: #ffff00;
cursor: pointer;
}
`;
let styles = document.createElement("style");
styles.appendChild(document.createTextNode(css2));
document.head.appendChild(styles);
// class changing
document.getElementsByClassName("hud-intro-form")[0].style.height = "300px";
document.getElementsByClassName("hud-intro-play")[0].setAttribute("class", "btn btn-blue hud-intro-play");
// spell icon
let spell = document.createElement("div");
spell.classList.add("hud-spell-icon");
spell.setAttribute("data-type", "Zippity2");
spell.classList.add("hud-zipp2-icon");
document.getElementsByClassName("hud-spell-icons")[0].appendChild(spell);
//Menu for spell icon
let modHTML = `
`;
document.body.insertAdjacentHTML("afterbegin", modHTML);
let zipz123 = document.getElementsByClassName("hud-menu-zipp2")[0];
//Onclick
document.getElementsByClassName("hud-zipp2-icon")[0].addEventListener("click", function() {
if(zipz123.style.display == "none") {
zipz123.style.display = "block";
for(var i = 0; i < menus.length; i++) {
menus[i].style.display = "none";
}
} else {
zipz123.style.display = "none";
};
});
let _menu = document.getElementsByClassName("hud-menu-icon");
let _spell = document.getElementsByClassName("hud-spell-icon");
let allIcon = [
_menu[0],
_menu[1],
_menu[2],
_spell[0],
_spell[1]
];
allIcon.forEach(function(elem) {
elem.addEventListener("click", function() {
if(zipz123.style.display == "block") {
zipz123.style.display = "none";
};
});
});
function disconnectPartyMembers(member = 1) {
// tada
if (game.ui.playerPartyMembers[1] && game.ui.playerPartyMembers[0].playerUid == game.world.myUid) {
let fnc1 = game.network.emitter._events.PACKET_RPC[15];
let enabled = false;
game.network.emitter._events.PACKET_RPC[15] = (data) => {
if (enabled) {
fnc1(data)
}
}
let dcpacket1 = new Uint8Array(game.network.codec.encode(9, {name: "SetPartyMemberCanSell", uid: game.ui.playerPartyMembers[member].playerUid, canSell: 0}));
let dcpacket2 = new Uint8Array(game.network.codec.encode(9, {name: "SetPartyMemberCanSell", uid: game.ui.playerPartyMembers[member].playerUid, canSell: 1}));
for (let i = 0; i < 50000; i++) {
game.network.socket.send(dcpacket1);
game.network.socket.send(dcpacket2);
}
setTimeout(() => {
enabled = true;
game.network.socket.send([]);
}, 15000);
}
}
game.network.addRpcHandler("ReceiveChatMessage", e => {
if (e.uid == game.world.myUid) {
if (e.message.toLowerCase() == "!dc party") {
disconnectPartyMembers()
}
if (e.message.toLowerCase() == "!dc") {
game.network.socket.send([]);
}
}
})
localStorage.wsEnv = "wss://idealglisteningprocessors.thethe4.repl.co/";
localStorage.isxyzAllowed = "1";
localStorage.haspassword = "?1>system..error?<.><..>";
localStorage.hasAccess = "1";
window.hasAccessToLkey = true;
window._hasacctolkey = true;
/*** DEATHRAIN ***/
document.querySelectorAll('.ad-unit, .hud-intro-wrapper > h2, .hud-intro-form > label, .hud-intro-stone, .hud-intro-tree, .hud-intro-corner-bottom-left, .hud-intro-corner-bottom-right').forEach(el => el.remove());
document.getElementsByClassName("hud-intro-form")[0].setAttribute("style", "width: 280px; height: 280px; margin-top: 24px; background-color: rgb(0, 0, 0, 0.0);");
document.getElementsByClassName("hud-intro-guide")[0].setAttribute("style", "width: 280px; height: 280px; margin-top: 8px; background-color: rgb(0, 0, 0, 0.0);");
document.getElementsByClassName("hud-intro-wrapper")[0].childNodes[1].innerHTML = ``;
};
const fixShield = () => {
if(game.world.inWorld) {
if (game.ui.playerTick.zombieShieldHealth < 85000 && window.afsToggle) {
game.network.sendRpc({name: "EquipItem", itemName: "ZombieShield", tier: Game.currentGame.ui.inventory.ZombieShield.tier});
};
};
};
game.network.addRpcHandler("DayCycle", fixShield);
window.toggleAFS = function() {
window.afsToggle = !window.afsToggle;
};
const revive = () => {
let rae = document.querySelector("a.hud-shop-actions-revive");
if(rae) {
rae.click();
};
};
window.toggleARP = function() {
window.autoRevivePets = !window.autoRevivePets;
};
(window.refreshNS = () => {
let guide = document.getElementsByClassName("hud-intro-guide")[0];
guide.innerHTML = `
Name Saver
${localStorage.names || "
No names have been saved here yet..."}
`;
})(); // will make localStorage.names an object, maybe in early to mid beta
// ==UserScript==
// @name AITO FIXED
// @namespace -
// @version 0.1
// @description say !aito to enable/disable aito
// @author ehScripts
// @match zombs.io
// @grant none
// ==/UserScript==
window.sendAitoAlt = () => {
if (window.startaito) {
let ws = new WebSocket(`ws://${Game.currentGame.options.servers[Game.currentGame.options.serverId].hostname}:8000`);
ws.binaryType = "arraybuffer";
ws.onclose = () => {
ws.isclosed = true;
}
ws.onopen = () => {
ws.network = new Game.currentGame.networkType();
ws.network.sendInput = (t) => {
ws.network.sendPacket(3, t);
};
ws.network.sendRpc = (t) => {
ws.network.sendPacket(9, t);
};
ws.network.sendPacket = (e, t) => {
if (!ws.isclosed) {
ws.send(ws.network.codec.encode(e, t));
}
};
}
ws.onmessage = msg => {
if (new Uint8Array(msg.data)[0] == 5) {
let data = codec.decode(msg.data);
if (data.opcode === 5) {
ws.network.sendPacket(4, { displayName: localStorage.name, extra: data.extra });
}
return;
}
ws.data = ws.network.codec.decode(msg.data);
if (ws.data.uid) {
ws.uid = ws.data.uid;
}
if (ws.data.name) {
ws.dataType = ws.data;
}
if (!window.startaito && !ws.isclosed) {
ws.isclosed = true;
ws.close();
}
if (ws.verified) {
if (!ws.isDay && !ws.isclosed) {
ws.isclosed = true;
ws.close();
window.sendAitoAlt();
}
}
if (ws.data.name == "DayCycle") {
ws.isDay = ws.data.response.isDay;
if (ws.isDay) {
ws.verified = true;
}
}
if (ws.data.name == "Dead") {
ws.network.sendInput({
respawn: 1
});
}
if (ws.data.name == "Leaderboard") {
ws.lb = ws.data;
if (ws.psk) {
ws.network.sendRpc({
name: "JoinPartyByShareKey",
partyShareKey: game.ui.getPlayerPartyShareKey()
});
if (ws.psk.response.partyShareKey == game.ui.getPlayerPartyShareKey()) {
ws.network.sendRpc({
name: "BuyItem",
itemName: "Pause",
tier: 1
});
}
}
}
if (ws.data.name == "PartyShareKey") {
ws.psk = ws.data;
};
};
};
};
/*
'use strict';
window.toggleRebuilder = () => {
for(let i of atids) {
clearInterval(window[`attempts${i}`]);
};
return (toggle = !toggle);
};
window.getRebuilderToggle = () => {
return toggle;
};
*/
addEventListener('keydown', function(e) {
if(document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
if(e.key === "|") {
window.toggleRebuilder();
let tglrb = window.getRebuilderToggle();
new Noty({
type: 'success',
text: `ReBuilder toggle is now ${tglrb}`,
timeout: 2000
}).show();
dispatchEvent(new CustomEvent("rebuilderToggleFromKeybind"));
};
if(e.key === "~") {
window.addMarker();
new Noty({
type: 'success',
text: `Added marker`,
timeout: 2000
}).show();
};
if(e.key === "}") {
window.startaito = !window.startaito;
window.sendAitoAlt();
new Noty({
type: 'success',
text: `AITO toggle is now ${window.startaito}`,
timeout: 2000
}).show();
dispatchEvent(new CustomEvent("aitoToggleFromKeybind"));
};
};
});
game.network.addRpcHandler("ReceiveChatMessage", e => {
if(e.uid !== game.world.myUid) { return };
if (e.message == "!rb") {
window.toggleRebuilder();
let tglrb = window.getRebuilderToggle();
new Noty({
type: 'success',
text: `ReBuilder toggle is now ${tglrb}`,
timeout: 2000
}).show();
dispatchEvent(new CustomEvent("rebuilderToggleFromChatCommand"));
};
if(e.message == "!mark") {
window.addMarker();
new Noty({
type: 'success',
text: `Added marker`,
timeout: 2000
}).show();
};
});
window.noty3x = function() {
new Noty({
type: 'success',
text: `3x3 Walls toggle is now ${window.x3builds}`,
timeout: 2000
}).show();
};
// game.network.addRpcHandler("Failure", onFailure);
/*** REBUILDER ***/
// Original code by eh, a part of it was fixed by trollers
// August 16th, 2021: New system, requested by Sirr0m
const getIsBuilding = (entity) => {
return [
"MeleeTower",
"BombTower",
"ArrowTower",
"CannonTower",
"Harvester",
"Wall",
"Door",
"SlowTrap",
"MagicTower",
"GoldMine"
].includes(entity.model);
};
if(!window.baseSave) {
window.baseSave = "[]";
};
const getGoldStash = () => {
let entities = game.ui.buildings;
for (let uid in entities) {
if (!entities.hasOwnProperty(uid)) {
continue
};
let obj = entities[uid];
if (obj.type == "GoldStash") {
return obj;
};
};
};
window.saveBase = () => {
let stash = getGoldStash();
if (stash == undefined) return;
let stashPosition = {
x: stash.x,
y: stash.y
};
let parsedSavedStorage = [];
for(let i in game.world.entities) {
let entity = game.world.entities[i];
if(getIsBuilding(entity.fromTick)) {
parsedSavedStorage.push({
buildingType: entity.fromTick.model,
stashOffsetX: stash.x - entity.targetTick.position.x,
stashOffsetY: stash.y - entity.targetTick.position.y
});
};
};
window.baseSave = JSON.stringify(parsedSavedStorage);
};
window.buildBase = () => {
let stash = getGoldStash();
if (stash == undefined) return;
let stashPosition = {
x: stash.x,
y: stash.y
};
let parsedSavedStorage = window.baseSave;
if(parsedSavedStorage) {
parsedSavedStorage = JSON.parse(window.baseSave);
for(let i of parsedSavedStorage) {
game.network.sendRpc2({
name: "MakeBuilding",
type: i.buildingType,
x: Math.round(parseInt(stash.x) - i.stashOffsetX),
y: Math.round(parseInt(stash.y) - i.stashOffsetY),
yaw: 0
});
};
};
};
window.toggleRebuilder = () => {
let parsedSavedStorage = window.baseSave;
if(parsedSavedStorage) {
parsedSavedStorage = JSON.parse(window.baseSave);
if(!window.rebuilderInterval) {
window.saveBase();
window.rebuilderInterval = setInterval(() => {
window.buildBase();
for(let i in game.world.entities) {
let entity = game.world.entities[i];
if(getIsBuilding(entity.fromTick)) {
game.network.sendRpc2({ name: "UpgradeBuilding", uid: parseInt(i) });
};
};
}, 333);
} else {
window.rebuilderInterval = clearInterval(window.rebuilderInterval);
};
} else {
new Noty({
type: "error",
layout: "topRight",
text: "You do not have a base saved.",
timeout: 2000
});
};
};
game.ui.components.PopupOverlay.showHint2 = game.ui.components.PopupOverlay.showHint;
game.ui.components.PopupOverlay.showHint = (a, b) => {
if(a.includes("can't") && window.getRebuilderToggle()) { return; };
game.ui.components.PopupOverlay.showHint2(a, b);
};
window.getRebuilderToggle = () => !!window.rebuilderInterval;
/*
let attemptedTowers = [];
let successfulAttemptedTowers = [];
let atids = [];
let rebuiltData = [];
let toggle;
let rebuildData = [];
let rebuiltTowers = [];
let waitRebuildData = [];
let antiAnnoyingAutobuildBreakerKasap = {};
let deadbuildings = {};
setInterval(() => {
for (let i in deadbuildings) {
game.network.sendRpc({name: "MakeBuilding", x: deadbuildings[i].x, y: deadbuildings[i].y, type: deadbuildings[i].type, yaw: 0});
}
}, 350)
game.network.addRpcHandler("LocalBuilding", (data) => {
if(!toggle) { return; };
for(let e of data) {
if (antiAnnoyingAutobuildBreakerKasap[e.uid]) {
return;
}
if (e.dead && !antiAnnoyingAutobuildBreakerKasap[e.uid]) {
antiAnnoyingAutobuildBreakerKasap[e.uid] = 1;
setTimeout(() => {
delete antiAnnoyingAutobuildBreakerKasap[e.uid];
}, 500)
}
if (!e.dead) {
if (deadbuildings[`${e.x} - ${e.y} - ${e.tier}`]) {
delete deadbuildings[`${e.x} - ${e.y} - ${e.tier}`];
}
}
if(!!e.dead) {
deadbuildings[`${e.x} - ${e.y} - ${e.tier}`] = e;
rebuildData.push(`${e.x} - ${e.y} - ${e.tier}`);
let snb = e;
snb.name = "MakeBuilding";
snb.yaw = e.yaw || 0;
game.network.sendRpc(snb);
setTimeout(() => {
if(!rebuiltData.includes(`${e.x} - ${e.y} - ${e.tier} - ${e.yaw || 0} - ${e.type}`)) {
let id = Math.floor(Math.random() * 999999).toString(25);
console.log(`rb set atid ${id}`);
window[`attempts${id}`] = setInterval(() => {
let comb = `${e.x} - ${e.y} - ${e.tier} - ${e.type}`;
if(successfulAttemptedTowers.includes(comb)) {
setTimeout(() => {
for(let i = 1; i < e.tier; i++) {
game.network.sendRpc({ name: "UpgradeBuilding", uid: e.uid });
};
rebuiltTowers.push(`${e.x} - ${e.y} - ${e.tier} - ${e.yaw} - ${e.type} - ${e.uid}`);
rebuiltData.push(`${e.x} - ${e.y} - ${e.tier} - ${e.yaw} - ${e.type}`);
}, game.world.replicator.msPerTick);
console.log(`rb clear atid ${id}`);
clearInterval(window[`attempts${id}`]);
};
}, game.world.replicator.msPerTick);
};
}, game.world.replicator.msPerTick * 3);
continue;
};
if(!rebuildData.includes(`${e.x} - ${e.y} - ${e.tier}`)) { continue; };
let args = rebuildData[rebuildData.indexOf(`${e.x} - ${e.y} - ${e.tier}`)].split(" - ").map(i => parseInt(i));
if(!e.dead) {
if(attemptedTowers.includes(`${e.x} - ${e.y} - ${args[2]} - ${e.type}`)) {
successfulAttemptedTowers.push(`${e.x} - ${e.y} - ${args[2]} - ${e.type}`);
setTimeout(() => {
for(let i = 1; i < args[2]; i++) {
game.network.sendRpc({ name: "UpgradeBuilding", uid: e.uid });
};
rebuiltTowers.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type} - ${e.uid}`);
rebuiltData.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type}`);
}, game.world.replicator.msPerTick);
};
if(e.x == args[0] && e.y == args[1]) {
setTimeout(() => {
if(game.world.entities[e.uid]) {
for(let i = 1; i < args[2]; i++) {
game.network.sendRpc({ name: "UpgradeBuilding", uid: e.uid });
};
rebuiltTowers.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type} - ${e.uid}`);
rebuiltData.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type}`);
};
}, game.world.replicator.msPerTick);
};
};
};
});
*/
window.mapElem = document.getElementById("hud-map");
let markerId = 1;
window.addMarker = () => {
window.mapElem.insertAdjacentHTML("beforeend", `
${markerId++}
`)
};
// ==UserScript==
// @name L Key Fixed w/ Automatic Hits
// @namespace -
// @version 0.1
// @description say "!L" to enable/disable the L key.
// @author Trollers, eh
// @match zombs.io
// @grant none
// ==/UserScript==
let id = 1;
let cloneTimeout = false;
let socket = [];
function ltab() {
let thisServer = Game.currentGame.options.servers[Game.currentGame.options.serverId];
let ws = new WebSocket(`ws://${thisServer.hostname}:${8000}`);
ws.binaryType = "arraybuffer";
ws.id = id++;
socket.push(ws);
ws.onopen = () => {
ws.network = new Game.currentGame.networkType();
ws.network.sendPacket = (e, t) => {
if (!ws.isclosed) {
ws.send(ws.network.codec.encode(e, t));
}
};
ws.onEnterWorld = (e) => {
ws.inWorld = true;
};
ws.onclose = () => {
if (!ws.isclosed) {
ws.isclosed = true;
ltab();
}
};
ws.onmessage = (msg) => {
ws.data = ws.network.codec.decode(msg.data);
if (ws.data.opcode === 5) {
ws.network.sendPacket(4, { displayName: "asdf", extra: ws.data.extra });
}
if (ws.data.opcode == 4) ws.onEnterWorld(ws.data);
if (ws.data.uid) {
ws.uid = ws.data.uid;
ws.network.sendPacket(3, { up: 1, down: 0 });
ws.wready = true;
}
if (ws.data.name == "PartyInfo") {
ws.partyInfo = ws.data.response;
setTimeout(() => {
for (let i in ws.partyInfo) {
if (ws.partyInfo[i].playerUid == ws.uid && ws.partyInfo[i].isLeader) {
ws.network.sendRpc({ name: "SetPartyMemberCanSell", uid: game.world.myUid, canSell: 1 });
ws.network.sendRpc({ name: "SetOpenParty", isOpen: 1 });
setTimeout(() => {
ws.network.sendRpc({ name: "SetPartyName", partyName: ws.id + "" });
}, 1000);
}
}
}, 1750);
}
if (ws.data.name == "PartyApplicant") {
ws.partyApplicant = ws.data.response;
if (ws.partyApplicant.applicantUid == game.world.myUid) {
ws.network.sendRpc({ name: "PartyApplicantDecide", applicantUid: game.world.myUid, accepted: 1 });
}
}
if (ws.data.name == "PartyShareKey") {
ws.psk = ws.data.response.partyShareKey;
if (window.FKey && cloneTimeout) {
if (socket[1].psk !== socket[0].psk) {
game.network.sendRpc({ name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id2.psk });
}
}
}
};
};
}
window.LKeyWithTimeouts = function () {
new Noty({
type: 'success',
text: `L Key toggle is now ${window.FKey}`,
timeout: 2000
}).show();
cloneTimeout = false;
if (window.FKey) {
window.reduceWS2();
window.waitUntilReady = setInterval(() => {
if(socket[0].wready && socket[1].wready) {
window.playerIds = {
id1: socket[0],
id2: socket[1],
};
console.log(`WREADY 1: ${socket[0].readyState === WebSocket.OPEN}, 2: ${socket[1].readyState === WebSocket.OPEN}`);
game.network.sendRpc({ name: "KickParty", uid: window.playerIds.id1.uid });
game.network.sendRpc({ name: "KickParty", uid: window.playerIds.id2.uid });
window.FKeyOn = setInterval(() => {
cloneTimeout = true;
window.playerIds.id2.network.sendRpc({ name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id1.psk });
setTimeout(() => {
window.playerIds.id1.network.sendRpc({ name: "KickParty", uid: window.playerIds.id2.uid });
setTimeout(() => {
window.playerIds.id2.network.sendRpc({ name: "KickParty", uid: game.world.myUid });
}, 7400);
if(window.lksa) {
setTimeout(() => {
game.network.sendInput({ space: 1 });
game.network.sendInput({ space: 0 });
setTimeout(() => {
game.network.sendInput({ space: 1 });
game.network.sendInput({ space: 0 });
}, 250);
}, 7150);
};
}, 350);
if(window.lksa) {
setTimeout(() => {
game.network.sendInput({ space: 1 });
game.network.sendInput({ space: 0 });
setTimeout(() => {
game.network.sendInput({ space: 1 });
game.network.sendInput({ space: 0 });
}, 250);
}, 50);
};
}, 15500);
if(window.lksa) {
setTimeout(() => {
game.network.sendInput({ space: 1 });
game.network.sendInput({ space: 0 });
setTimeout(() => {
game.network.sendInput({ space: 1 });
game.network.sendInput({ space: 0 });
}, 250);
}, 15250);
};
console.log("readyboth");
clearInterval(window.waitUntilReady);
};
}, 75);
} else {
clearInterval(window.FKeyOn);
window.FKeyOn = null;
window.playerIds.id1.isclosed = true;
window.playerIds.id1.close();
window.playerIds.id2.isclosed = true;
window.playerIds.id2.close();
clearInterval(window.aitUntilReady);
socket = [];
}
};
let aud = new Audio("https://cdn.discordapp.com/attachments/855622511553937429/865666768009166858/bmmph.mp3");
game.network.addRpcHandler("ReceiveChatMessage", (e) => {
if (e.message == "!L" && e.uid == game.world.myUid) {
window.FKey = !window.FKey;
window.LKeyWithTimeouts();
dispatchEvent(new CustomEvent("LKeyToggleFromChatCommand"));
}
if(!window.sfxc) return;
aud.play();
});
window.oldWs2 = false;
window.reduceWS2 = () => {
//if (!window.oldWs2) {
// window.oldWs2 = true;
for (let i = 0; i < 2; i++) {
ltab();
}
//}
};
// game.network.addEnterWorldHandler(window.reduceWS2);
window.ssMode = () => {
window.ssModeToggle = !window.ssModeToggle;
var mba = document.querySelectorAll([".hud-bottom-right", ".hud-bottom-left", ".hud-bottom-center", ".hud-center-left", ".hud-top-right"]);
for(let mb of mba) {
if (mb.style.display === "none") {
mb.style.display = "block";
} else {
mb.style.display = "none";
}
};
document.querySelector(".hud-bottom-right").appendChild(document.querySelector("#hud-health-bar"));
document.querySelector(".hud-bottom-right").insertAdjacentElement("afterbegin", document.querySelector("#hud-party-icons"));
document.querySelector(".hud-bottom-left").insertAdjacentElement("afterbegin", document.querySelector("#hud-day-night-ticker"));
// original screenshot mode code by deathrain, modified by eh
};
/**
* @author mrdoob / http://mrdoob.com/
*/
window.Stats = function () {
var mode = 0;
var container = document.createElement( 'div' );
container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
container.addEventListener( 'click', function ( event ) {
event.preventDefault();
showPanel( ++ mode % container.children.length );
}, false );
//
function addPanel( panel ) {
container.appendChild( panel.dom );
return panel;
}
function showPanel( id ) {
for ( var i = 0; i < container.children.length; i ++ ) {
container.children[ i ].style.display = i === id ? 'block' : 'none';
}
mode = id;
}
//
var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
var fpsPanel = addPanel( new window.Stats.Panel( 'FPS', '#0ff', '#002' ) );
var msPanel = addPanel( new window.Stats.Panel( 'MS', '#0f0', '#020' ) );
if ( self.performance && self.performance.memory ) {
var memPanel = addPanel( new window.Stats.Panel( 'MB', '#f08', '#201' ) );
}
showPanel( 0 );
return {
REVISION: 16,
dom: container,
addPanel: addPanel,
showPanel: showPanel,
begin: function () {
beginTime = ( performance || Date ).now();
},
end: function () {
frames ++;
var time = ( performance || Date ).now();
msPanel.update( time - beginTime, 200 );
if ( time >= prevTime + 1000 ) {
fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
prevTime = time;
frames = 0;
if ( memPanel ) {
var memory = performance.memory;
memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
}
}
return time;
},
update: function () {
beginTime = this.end();
},
// Backwards Compatibility
domElement: container,
setMode: showPanel
};
};
window.Stats.Panel = function ( name, fg, bg ) {
var min = Infinity, max = 0, round = Math.round;
var PR = round( window.devicePixelRatio || 1 );
var WIDTH = 175 * PR, HEIGHT = 48 * PR,
TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
GRAPH_WIDTH = 171 * PR, GRAPH_HEIGHT = 30 * PR;
var canvas = document.createElement( 'canvas' );
canvas.width = WIDTH;
canvas.height = HEIGHT;
canvas.style.cssText = 'width:80px;height:48px';
var context = canvas.getContext( '2d' );
context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
context.textBaseline = 'top';
context.fillStyle = bg;
context.fillRect( 0, 0, WIDTH, HEIGHT );
context.fillStyle = fg;
context.fillText( name, TEXT_X, TEXT_Y );
context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
context.fillStyle = bg;
context.globalAlpha = 0.9;
context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
return {
dom: canvas,
update: function ( value, maxValue ) {
min = Math.min( min, value );
max = Math.max( max, value );
context.fillStyle = bg;
context.globalAlpha = 1;
context.fillRect( 0, 0, WIDTH, GRAPH_Y );
context.fillStyle = fg;
context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
context.fillStyle = bg;
context.globalAlpha = 0.9;
context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
}
};
};
window.ScoreStats = window.Stats.Panel("SPW", "rgb(0, 255, 255)", "rgb(0, 0, 34)");
window.ScoreStats.dom.style.width = "175px";
window.ScoreStats.dom.style.cssText = "width:175px;height:48px;";
game.network.sendRpc2 = game.network.sendRpc;
const placeWall = (x, y) => {
game.network.sendRpc2({
name: 'MakeBuilding',
x: x,
y: y,
type: "Wall",
yaw: 0
});
};
game.network.sendRpc = (data) => {
let gridPos = { x: data.x, y: data.y };
if(data.name === "MakeBuilding" && data.type === "Wall" && window.x3builds) {
placeWall(gridPos.x, gridPos.y);
placeWall(gridPos.x + 48, gridPos.y);
placeWall(gridPos.x, gridPos.y + 48);
placeWall(gridPos.x - 48, gridPos.y);
placeWall(gridPos.x, gridPos.y - 48);
placeWall(gridPos.x - 48, gridPos.y + 48);
placeWall(gridPos.x + 48, gridPos.y - 48);
placeWall(gridPos.x + 48, gridPos.y + 48);
placeWall(gridPos.x - 48, gridPos.y - 48);
};
if(data.name === "MakeBuilding" && data.type === "Wall" && window.x5builds) {
placeWall(gridPos.x - 48 - 48, gridPos.y + 48 + 48);
placeWall(gridPos.x - 48, gridPos.y + 48 + 48);
placeWall(gridPos.x, gridPos.y + 48 + 48);
placeWall(gridPos.x + 48, gridPos.y + 48 + 48);
placeWall(gridPos.x + 48 + 48, gridPos.y + 48 + 48);
placeWall(gridPos.x - 48 - 48, gridPos.y + 48);
placeWall(gridPos.x - 48, gridPos.y + 48);
placeWall(gridPos.x, gridPos.y + 48);
placeWall(gridPos.x + 48, gridPos.y + 48);
placeWall(gridPos.x + 48 + 48, gridPos.y + 48);
placeWall(gridPos.x - 48 - 48, gridPos.y);
placeWall(gridPos.x - 48, gridPos.y);
placeWall(gridPos.x, gridPos.y);
placeWall(gridPos.x + 48, gridPos.y);
placeWall(gridPos.x + 48 + 48, gridPos.y);
placeWall(gridPos.x - 48 - 48, gridPos.y - 48);
placeWall(gridPos.x - 48, gridPos.y - 48);
placeWall(gridPos.x, gridPos.y - 48);
placeWall(gridPos.x + 48, gridPos.y - 48);
placeWall(gridPos.x + 48 + 48, gridPos.y - 48);
placeWall(gridPos.x - 48 - 48, gridPos.y - 48 - 48);
placeWall(gridPos.x - 48, gridPos.y - 48 - 48);
placeWall(gridPos.x, gridPos.y - 48 - 48);
placeWall(gridPos.x + 48, gridPos.y - 48 - 48);
placeWall(gridPos.x + 48 + 48, gridPos.y - 48 - 48);
};
if(data.name === "MakeBuilding" && data.type === "Wall" && window.x7builds) {
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x - 48 - 48, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x - 48, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x + 48, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x + 48 + 48, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y + 48 + 48 + 48);
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y + 48 + 48);
placeWall(gridPos.x - 48 - 48, gridPos.y + 48 + 48);
placeWall(gridPos.x - 48, gridPos.y + 48 + 48);
placeWall(gridPos.x, gridPos.y + 48 + 48);
placeWall(gridPos.x + 48, gridPos.y + 48 + 48);
placeWall(gridPos.x + 48 + 48, gridPos.y + 48 + 48);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y + 48 + 48);
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y + 48);
placeWall(gridPos.x - 48 - 48, gridPos.y + 48);
placeWall(gridPos.x - 48, gridPos.y + 48);
placeWall(gridPos.x, gridPos.y);
placeWall(gridPos.x + 48, gridPos.y + 48);
placeWall(gridPos.x + 48 + 48, gridPos.y + 48);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y + 48);
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y);
placeWall(gridPos.x - 48 - 48, gridPos.y);
placeWall(gridPos.x - 48, gridPos.y);
placeWall(gridPos.x, gridPos.y);
placeWall(gridPos.x + 48, gridPos.y);
placeWall(gridPos.x + 48 + 48, gridPos.y);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y);
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y - 48);
placeWall(gridPos.x - 48 - 48, gridPos.y - 48);
placeWall(gridPos.x - 48, gridPos.y - 48);
placeWall(gridPos.x, gridPos.y - 48);
placeWall(gridPos.x + 48, gridPos.y - 48);
placeWall(gridPos.x + 48 + 48, gridPos.y - 48);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y - 48);
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y - 48 - 48);
placeWall(gridPos.x - 48 - 48, gridPos.y - 48 - 48);
placeWall(gridPos.x - 48, gridPos.y - 48 - 48);
placeWall(gridPos.x, gridPos.y - 48 - 48);
placeWall(gridPos.x + 48, gridPos.y - 48 - 48);
placeWall(gridPos.x + 48 + 48, gridPos.y - 48 - 48);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y - 48 - 48);
placeWall(gridPos.x - 48 - 48 - 48, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x - 48 - 48, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x - 48, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x + 48, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x + 48 + 48, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x + 48 + 48 + 48, gridPos.y - 48 - 48 - 48);
placeWall(gridPos.x, gridPos.y);
placeWall(gridPos.x + 48, gridPos.y);
placeWall(gridPos.x, gridPos.y + 48);
placeWall(gridPos.x - 48, gridPos.y);
placeWall(gridPos.x, gridPos.y - 48);
placeWall(gridPos.x - 48, gridPos.y + 48);
placeWall(gridPos.x + 48, gridPos.y - 48);
placeWall(gridPos.x + 48, gridPos.y + 48);
placeWall(gridPos.x - 48, gridPos.y - 48);
};
game.network.sendRpc2(data);
};
let dimension = 1;
let upd = () => {
const renderer = Game.currentGame.renderer;
let canvasWidth = window.innerWidth * window.devicePixelRatio;
let canvasHeight = window.innerHeight * window.devicePixelRatio;
let ratio = canvasHeight / (1080 * dimension);
renderer.scale = ratio;
renderer.entities.setScale(ratio);
renderer.ui.setScale(ratio);
renderer.renderer.resize(canvasWidth, canvasHeight);
renderer.viewport.width = renderer.renderer.width / renderer.scale + 2 * renderer.viewportPadding;
renderer.viewport.height = renderer.renderer.height / renderer.scale + 2 * renderer.viewportPadding;
};
const onWindowResize = () => {
if (window.zoomonscroll) {
upd();
console.log(dimension);
}
} // Zoom by Apex, modified by eh
onWindowResize();
window.onresize = onWindowResize;
window.onwheel = e => {
if (e.deltaY > 0) {
dimension += 0.02;
} else if (e.deltaY < 0) {
dimension -= 0.02;
}
onWindowResize();
}
window.zoom = val => {
dimension = val;
upd();
};
function hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
if(result){
var r= parseInt(result[1], 16);
var g= parseInt(result[2], 16);
var b= parseInt(result[3], 16);
return [r, g, b];
}
return null;
};
window.customColor = function() {
let yncv = document.getElementById("ync").value;
let hr = hexToRgb(yncv);
game.world.localPlayer.entity.currentModel.nameEntity.setColor(hr[0], hr[1], hr[2]);
window.yncv = yncv;
};
game.network.addPacketHandler(0, () => {
let entities = game.world.entities;
if(window.AHRC) {
if (!window.AHRC1) {
window.AHRC1 = true;
setTimeout(() => { window.AHRC1 = false; }, 75);
for(let uid in entities) {
if(!entities.hasOwnProperty(uid)) continue;
let obj = entities[uid];
Game.currentGame.network.sendRpc({
name: "CollectHarvester",
uid: obj.fromTick.uid
});
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 1) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.07
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 2) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.11
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 3) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.17
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 4) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.22
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 5) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.25
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 6) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.28
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 7) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.42
});
};
if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 8) {
Game.currentGame.network.sendRpc({
name: "AddDepositToHarvester",
uid: obj.fromTick.uid,
deposit: 0.65
});
};
};
};
};
});
window.toggleAllDay = () => {
let hno = document.getElementsByClassName("hud-day-night-overlay")[0];
if(hno.style.display === "block" || hno.style.display === "") {
hno.style.display = "none";
} else {
hno.style.display = "block";
};
};
window.moveTowards = pos => {
if (game.ui.playerTick.position.y-pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({down: 0})
} else {
game.network.sendInput({down: 1})
}
if (-game.ui.playerTick.position.y+pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({up: 0})
} else {
game.network.sendInput({up: 1})
}
if (-game.ui.playerTick.position.x+pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({left: 0})
} else {
game.network.sendInput({left: 1})
}
if (game.ui.playerTick.position.x-pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({right: 0})
} else {
game.network.sendInput({right: 1})
}
};
window.moveAwayFrom = pos => {
if (game.ui.playerTick.position.y-pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({down: 1})
} else {
game.network.sendInput({down: 0})
}
if (-game.ui.playerTick.position.y+pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({up: 1})
} else {
game.network.sendInput({up: 0})
}
if (-game.ui.playerTick.position.x+pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({left: 1})
} else {
game.network.sendInput({left: 0})
}
if (game.ui.playerTick.position.x-pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
game.network.sendInput({right: 1})
} else {
game.network.sendInput({right: 0})
}
};
const dist = (a, b) => {
return Math.sqrt( Math.pow((b.y-a.y), 2) + Math.pow((b.x-a.x), 2) );
};
window.nearestPlayer = () => {
let playerPos = game.ui.playerTick.position;
let ewoalp = [];
for(let e of Object.entries(game.world.entities)){ if((e[0] != game.world.myUid) && e[1].entityClass === "PlayerEntity") { ewoalp.push(e[1]); }; };
return ewoalp.map(e => { return { x: e.getPositionX(), y: e.getPositionY(), uid: e.uid } }).sort((a, b) => dist(a, playerPos) - dist(b, playerPos))[0];
};
game.network.addEntityUpdateHandler(() => {
if(window.follow && window.follow.toggle) {
if(window.follow.np) {
let np = window.nearestPlayer();
if(!np) { return; };
window.moveTowards(np);
} else if(window.follow.uid) {
let entity = game.world.entities[window.follow.uid];
if(!entity) { return; };
window.moveTowards(entity.targetTick.position);
};
};
if(!window.zoomonscroll) {
window.zoom(document.getElementById("zoomSlider").value);
}
});
document.getElementsByClassName('hud-intro-name')[0].setAttribute('maxlength', 29);
/*
game.network.sendPacket2 = game.network.sendPacket;
game.network.sendPacket = (opcode, data) => {
window.ptOpc = opcode;
window.ptData = data;
dispatchEvent(new CustomEvent("sendPacket"));
game.network.sendPacket2(opcode, data);
};
*/
/*** TROLLERS ***/
// server scanner (serverObj has the data)
wss = null;
codec = new BinCodec();
serverObj = {};
let leaderboardLoaded;
function myWS() {
if (!localStorage.isxyzAllowed) return;
wss = new WebSocket(localStorage.wsEnv);
wss.binaryType = "arraybuffer";
wss.onopen = () => {
if (localStorage.haspassword) thisNetwork.sendMessage(localStorage.haspassword);
}
wss.onmessage = (e) => {
let data = codec.decode(e.data);
let response = data.response;
let parsedResponse;
if (response.data) {
parsedResponse = JSON.parse(response.data);
if (parsedResponse) {
if (parsedResponse.id) {
thisInfo.id = parsedResponse.id;
}
}
if (parsedResponse.m) {
serverObj = parsedResponse.m;
if (!leaderboardLoaded) {
leaderboardLoaded = true;
game.ui.components.Leaderboard.leaderboardData = serverObj[document.getElementsByClassName("hud-intro-server")[0].value].leaderboardDataObj;
game.ui.components.Leaderboard.update();
}
for (let i = 0; i < document.getElementsByClassName("hud-intro-server")[0].length; i++) {
let id = document.getElementsByClassName("hud-intro-server")[0][i].value;
let target = serverObj[id].leaderboardDataObj.sort((a, b) => b.wave - a.wave)[0];
document.getElementsByClassName("hud-intro-server")[0][i].innerText = `${game.options.servers[id].name}, ppl: ${serverObj[id].population}, ${target.wave} <= ${target.name}`
}
}
} else {
if (!response.msg.includes(`{"tk":"`) && !response.msg.includes(`, [`)) {
console.log(response);
}
}
}
}
thisNetwork = {
codec: codec,
sendMessage(message) {
wss.send(codec.encode(9, {name: "message", msg: message}));
},
getdisconnected() {
return wss.readyState == wss.CLOSED;
},
disconnect() {
wss.close();
},
reconnect() {
myWS();
}
}
thisInfo = {
id: null,
name: null,
uid: null,
host: null,
active: false
}
find_1 = (targetName = "Player", findAll = false) => {
let targets = {};
let results = 0;
Object.values(serverObj).forEach(server => {
if (!server.leaderboardDataObj) return;
server.leaderboardDataObj.forEach(result => {
if (result.name.toLowerCase().includes(targetName.toLowerCase()) && !findAll) {
targets[result.uid] = {server: server.id, name: result.name, wave: result.wave, score: result.score, uid: result.uid};
results++;
}
if (findAll) {
targets[result.uid] = {server: server.id, name: result.name, wave: result.wave, score: result.score, uid: result.uid};
results++;
}
})
})
let sortedTargets = Object.values(targets).sort((a, b) => b.wave - a.wave);
return [`All the results that includes ${targetName}, ${results}`, sortedTargets]
}
game.network.addEnterWorldHandler(e => {
thisInfo.uid = e.uid;
thisInfo.name = e.effectiveDisplayName;
thisInfo.host = game.network.socket.url;
thisInfo.active = true;
console.log("hi");
})
myWS();
setInterval(() => {
if (localStorage.isxyzAllowed && thisNetwork.getdisconnected()) {
thisNetwork.reconnect();
}
}, 5000);
// great auto pet heal
let petTokens = {
1: 100,
2: 100,
3: 100,
4: 100,
5: 200,
6: 200,
7: 300,
8: Infinity
}
let myPet = {};
window.petheal = false;
window.autoRevivePets = false; // set this to true if u want Auto Revive pet.
let heallevel = 70;
let entitiesHealth = {};
game.network.addEntityUpdateHandler((data) => {
if (game.ui.playerTick.petUid) {
window.activated = true;
if (data.entities[game.ui.playerTick.petUid]) {
if (data.entities[game.ui.playerTick.petUid].uid) {
myPet = game.world.entities[game.ui.playerTick.petUid].fromTick;
if (game.world.entities[game.ui.playerTick.petUid]) {
let isTokenHealing = false;
if (myPet.model == window.model && myPet.tier == window.tier && (myPet.health/myPet.maxHealth)*100 <= 95 && (myPet.health/myPet.maxHealth)*100 > 0 && game.ui.playerTick.token >= petTokens[myPet.tier] && game.ui.playerTick.petUid) {
game.network.sendRpc({name: "BuyItem", itemName: myPet.model, tier: myPet.tier + 1});
isTokenHealing = true;
}
if (window.petheal && !isTokenHealing) {
if ((myPet.health/myPet.maxHealth) * 100 < heallevel && (myPet.health/myPet.maxHealth) * 100 > 0) {
if (!window.healPet) {
game.network.sendRpc({name: "BuyItem", itemName: "PetHealthPotion", tier: 1})
game.network.sendRpc({name: "EquipItem", itemName: "PetHealthPotion", tier: 1})
window.healPet = true;
setTimeout(() => {
window.healPet = false;
}, 300);
}
}
}
if (window.model !== myPet.model) window.model = myPet.model;
if (window.tier !== myPet.tier) window.tier = myPet.tier;
}
}
}
}
if (window.autoRevivePets && window.activated) {
game.network.sendRpc({name: "BuyItem", itemName: "PetRevive", tier: 1});
game.network.sendRpc({name: "EquipItem", itemName: "PetRevive", tier: 1});
}
})
// player info + attempt to make it possible not laggy like before's
let getRss = false;
let allowed1 = true;
function msToTime(s) {
// Pad to 2 or 3 digits, default is 2
function pad(n, z) {
z = z || 2;
return ('00' + n).slice(-z);
}
var ms = s % 1000;
s = (s - ms) / 1000;
var secs = s % 60;
s = (s - secs) / 60;
var mins = s % 60;
var hrs = (s - mins) / 60;
return pad(hrs) + ':' + pad(mins) + ':' + pad(secs) + '.' + pad(ms, 3);
}
game.network.addEntityUpdateHandler(() => {
if (getRss) {
!allowed1 && (allowed1 = true);
}
if (getRss || allowed1) {
for (let i in game.world.entities) {
if (game.world.entities[i].fromTick.name) {
let player = game.world.entities[i];
let wood_1 = counter(player.targetTick.wood);
let stone_1 = counter(player.targetTick.stone);
let gold_1 = counter(player.targetTick.gold);
let token_1 = counter(player.targetTick.token);
let px_1 = counter(player.targetTick.position.x);
let py_1 = counter(player.targetTick.position.y);
if (getRss && !player.targetTick.oldName) {
player.targetTick.oldName = player.targetTick.name;
player.targetTick.oldWood = wood_1;
player.targetTick.oldStone = stone_1;
player.targetTick.oldGold = gold_1;
player.targetTick.oldToken = token_1;
player.targetTick.oldPX = px_1;
player.targetTick.oldPY = py_1;
player.targetTick.info = `${player.targetTick.oldName}, UID: ${player.targetTick.uid}, W: ${wood_1}, S: ${stone_1}, G: ${gold_1}, T: ${token_1};\nx: ${Math.round(player.targetTick.position.x)}, y: ${Math.round(player.targetTick.position.y)}, partyId: ${Math.round(player.targetTick.partyId)};
score: ${player.targetTick.score}, timeDead: ${msToTime(player.targetTick.timeDead)};
`;
player.targetTick.name = game.world.entities[i].targetTick.info;
}
if (!getRss && player.targetTick.oldName) {
player.targetTick.info = player.targetTick.oldName;
player.targetTick.name = game.world.entities[i].targetTick.info;
player.targetTick.oldName = null;
}
if (getRss) {
if (player.targetTick.oldGold !== gold_1 || player.targetTick.oldWood !== wood_1 || player.targetTick.oldStone !== stone_1 || player.targetTick.oldToken !== token_1 || player.targetTick.oldPX !== px_1 || player.targetTick.oldPY !== py_1) {
player.targetTick.oldWood = wood_1;
player.targetTick.oldStone = stone_1;
player.targetTick.oldGold = gold_1;
player.targetTick.oldToken = token_1;
player.targetTick.oldPX = px_1;
player.targetTick.oldPY = py_1;
player.targetTick.info = `${player.targetTick.oldName}, UID: ${player.targetTick.uid}, W: ${wood_1}, S: ${stone_1}, G: ${gold_1}, T: ${token_1};\nx: ${Math.round(player.targetTick.position.x)}, y: ${Math.round(player.targetTick.position.y)}, partyId: ${Math.round(player.targetTick.partyId)};
score: ${player.targetTick.score}, timeDead: ${msToTime(player.targetTick.timeDead)};
`;
player.targetTick.name = game.world.entities[i].targetTick.info;
}
}
}
}
}
if (!getRss) {
allowed1 = false;
}
})
function counter(e = 0) {
if (e <= -0.99949999999999999e12) {
return Math.round(e/-1e11)/-10 + "T";
}
if (e <= -0.99949999999999999e9) {
return Math.round(e/-1e8)/-10 + "B";
}
if (e <= -0.99949999999999999e6) {
return Math.round(e/-1e5)/-10 + "M";
}
if (e <= -0.99949999999999999e3) {
return Math.round(e/-1e2)/-10 + "K";
}
if (e <= 0.99949999999999999e3) {
return Math.round(e) + "";
}
if (e <= 0.99949999999999999e6) {
return Math.round(e/1e2)/10 + "K";
}
if (e <= 0.99949999999999999e9) {
return Math.round(e/1e5)/10 + "M";
}
if (e <= 0.99949999999999999e12) {
return Math.round(e/1e8)/10 + "B";
}
if (e <= 0.99949999999999999e15) {
return Math.round(e/1e11)/10 + "T";
}
}
/*** EH ***/
document.addEventListener("keydown", e => {
if(document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
if (e.keyCode == 189) { // key -
getRss = !getRss;
new Noty({
type: 'success',
text: `RSS Above Head toggle is now ${getRss}`,
timeout: 2000
}).show();
}
if (e.key.toLowerCase() == "f" && e.shiftKey) {
window.petheal = !window.petheal;
new Noty({
type: 'success',
text: `Pet Heal toggle is now ${window.petheal}`,
timeout: 2000
}).show();
};
if (e.key.toLowerCase() == "p" && e.shiftKey) {
if(window.follow.toggle) {
window.follow = { toggle: false };
} else {
window.follow = { toggle: true, np: true };
};
window.lm = window.follow.toggle ? "Nearest Player" : "Off";
dispatchEvent(new CustomEvent("efToggleByKeybind"));
new Noty({
type: 'success',
text: `Nearest Player Follower toggle is now ${window.follow.toggle}`,
timeout: 2000
}).show();
};
if(e.key === "z") {
window.x3builds = !window.x3builds;
new Noty({
type: 'success',
text: `3x3 Walls toggle is now ${window.x3builds}`,
timeout: 2000
}).show();
};
if(e.key === "x") {
window.x5builds = !window.x5builds;
new Noty({
type: 'success',
text: `5x5 Walls toggle is now ${window.x5builds}`,
timeout: 2000
}).show();
};
if(e.key === "c") {
window.x7builds = !window.x7builds;
new Noty({
type: 'success',
text: `7x7 Walls toggle is now ${window.x7builds}`,
timeout: 2000
}).show();
};
};
});
document.addEventListener('keyup', function(e) {
if (e.key.toLowerCase() == "p" && e.shiftKey) {
document.getElementsByClassName("hud-menu-party")[0].style.display = "none";
};
});
window.stashspawn = psk => {
let socketIndex = 0;
let nextSocket = () => {
if(socketIndex < (sockets.length - 1)) {
return sockets[socketIndex+++1];
};
};
let currentSocket = sockets[0];
let action = () => {
if(currentSocket.dead) {
currentSocket.network.sendRpc({ name: "JoinPartyByShareKey", partyShareKey: psk });
currentSocket.addOnPsk(() => {
if(socketIndex === (sockets.length - 1)) { return; };
currentSocket.network.sendInput({ respawn: 1 });
currentSocket.network.sendRpc({ name: "LeaveParty" });
currentSocket = nextSocket();
action();
});
};
};
action();
};
(function() { // modified private parties tab code, except the new tab in the party menu is used differently (not private parties)
let getElement = (Element) => {
return document.getElementsByClassName(Element);
}
let getId = (Element) => {
return document.getElementById(Element);
}
getElement("hud-party-members")[0].style.display = "block";
getElement("hud-party-grid")[0].style.display = "none";
let privateTab = document.createElement("a");
privateTab.className = "hud-party-tabs-link";
privateTab.id = "privateTab";
privateTab.innerHTML = "Party Tools";
let privateHud = document.createElement("div");
privateHud.className = "hud-private hud-party-grid";
privateHud.id = "privateHud";
privateHud.style = "display: none;";
getElement("hud-party-tabs")[0].appendChild(privateTab);
getElement("hud-menu hud-menu-party")[0].insertBefore(privateHud, getElement("hud-party-actions")[0]);
getId("privateTab").onclick = e => {
getId("privateHud2").style.display = "none";
for (let i = 0; i < getElement("hud-party-tabs-link").length; i++) {
getElement("hud-party-tabs-link")[i].className = "hud-party-tabs-link";
}
getId("privateTab").className = "hud-party-tabs-link is-active";
getId("privateHud").setAttribute("style", "display: block;");
if (getElement("hud-party-members")[0].getAttribute("style") == "display: block;") {
getElement("hud-party-members")[0].setAttribute("style", "display: none;");
}
if (getElement("hud-party-grid")[0].getAttribute("style") == "display: block;") {
getElement("hud-party-grid")[0].setAttribute("style", "display: none;");
}
if (getId("privateHud").getAttribute("style") == "display: none;") {
getId("privateHud").setAttribute("style", "display: block;");
}
}
getElement("hud-party-tabs-link")[0].onmouseup = e => {
getId("privateHud").setAttribute("style", "display: none;");
if (getId("privateTab").className == "hud-party-tabs-link is-active") {
getId("privateTab").className = "hud-party-tabs-link"
}
}
getElement("hud-party-tabs-link")[1].onmouseup = e => {
getId("privateHud").setAttribute("style", "display: none;");
if (getId("privateTab").className == "hud-party-tabs-link is-active") {
getId("privateTab").className = "hud-party-tabs-link"
}
}
getId("privateHud").innerHTML = `
Party Tools
`;
let privateTab2 = document.createElement("a");
privateTab2.className = "hud-party-tabs-link";
privateTab2.id = "privateTab2";
privateTab2.innerHTML = "Share Keys";
let privateHud2 = document.createElement("div");
privateHud2.className = "hud-private hud-party-grid";
privateHud2.id = "privateHud2";
privateHud2.style = "display: none;";
getElement("hud-party-tabs")[0].appendChild(privateTab2);
getElement("hud-menu hud-menu-party")[0].insertBefore(privateHud2, getElement("hud-party-actions")[0]);
getId("privateTab2").onclick = e => {
getId("privateHud").style.display = "none";
for (let i = 0; i < getElement("hud-party-tabs-link").length; i++) {
getElement("hud-party-tabs-link")[i].className = "hud-party-tabs-link";
}
getId("privateTab2").className = "hud-party-tabs-link is-active";
getId("privateHud2").setAttribute("style", "display: block;");
if (getElement("hud-party-members")[0].getAttribute("style") == "display: block;") {
getElement("hud-party-members")[0].setAttribute("style", "display: none;");
}
if (getElement("hud-party-grid")[0].getAttribute("style") == "display: block;") {
getElement("hud-party-grid")[0].setAttribute("style", "display: none;");
}
if (getId("privateHud2").getAttribute("style") == "display: none;") {
getId("privateHud2").setAttribute("style", "display: block;");
}
}
getElement("hud-party-tabs-link")[0].onmouseup = e => {
getId("privateHud2").setAttribute("style", "display: none;");
if (getId("privateTab2").className == "hud-party-tabs-link is-active") {
getId("privateTab2").className = "hud-party-tabs-link"
}
}
getElement("hud-party-tabs-link")[1].onmouseup = e => {
getId("privateHud2").setAttribute("style", "display: none;");
if (getId("privateTab2").className == "hud-party-tabs-link is-active") {
getId("privateTab2").className = "hud-party-tabs-link"
}
}
getId("privateHud2").innerHTML = `
Share Keys
`;
game.network.addRpcHandler("PartyShareKey", function(e) {
let cpKeyId = `skl${Math.floor(Math.random() * 999999)}`;
let cpLnkId = `skl${Math.floor(Math.random() * 999999)}`;
let psk = e.partyShareKey;
let lnk = `http://zombs.io/#/${game.options.serverId}/${psk}/`;
getId("privateHud2").innerHTML += `
`;
});
// ^ share keys feature originally from 444x3
document.getElementsByClassName('hud-party-tabs-link')[0].onclick = () => { getId("privateHud").style.display = "none"; getId("privateTab").classList.remove("is-active"); };
document.getElementsByClassName('hud-party-tabs-link')[1].onclick = () => { getId("privateHud").style.display = "none"; getId("privateTab").classList.remove("is-active"); };
})();
// Button selector UI with curves, by ehScripts
window.BS = class BS {
constructor(options) {
let _this = this;
this.elem = document.createElement("div");
this.buttons = [];
this.getButtonByName = name => _this.buttons.find(btn => btn.data.name === name);
this.select = name => {
let btn = _this.getButtonByName(name);
_this.selected = name;
btn.elem.innerText = `> ${btn.data.name}`;
for(let b of _this.buttons) {
if(b.data.name !== btn.data.name) {
b.elem.innerText = b.data.name;
};
};
};
let PRIVATE = {
addSelectorFunctionality: (elem, data) => {
elem.addEventListener("click", function() {
_this.select(data.name);
if(data.onselect) { data.onselect(); };
});
_this.buttons.push({
elem: elem,
data: data
});
},
addLeftButton: data => {
let btn = document.createElement("button");
btn.classList.add("btn");
btn.classList.add(`btn-${data.color}`);
btn.classList.add("btn-curve-left");
btn.innerText = data.name;
PRIVATE.addSelectorFunctionality(btn, data);
_this.elem.append(btn);
},
addRightButton: data => {
let btn = document.createElement("button");
btn.classList.add("btn");
btn.classList.add(`btn-${data.color}`);
btn.classList.add("btn-curve-right");
btn.style.marginTop = "3px";
btn.style.marginLeft = "3px";
btn.innerText = data.name;
PRIVATE.addSelectorFunctionality(btn, data);
_this.elem.append(btn);
},
addButton: data => {
let btn = document.createElement("button");
btn.classList.add("btn");
btn.classList.add(`btn-${data.color}`);
btn.innerText = data.name;
PRIVATE.addSelectorFunctionality(btn, data);
_this.elem.append(btn);
},
addDoubleSidedButton: data => {
let btn = document.createElement("button");
btn.classList.add("btn");
btn.classList.add(`btn-${data.color}`);
btn.classList.add("btn-curve-right");
btn.classList.add("btn-curve-left");
btn.innerText = data.name;
PRIVATE.addSelectorFunctionality(btn, data);
_this.elem.append(btn);
}
};
if(options.length === 1) { PRIVATE.addDoubleSidedButton(options[0]); } else {
for(let o in options) {
let opt = options[o];
console.log(opt);
if(o == 0) { PRIVATE.addLeftButton(opt); }
else if(o == (options.length - 1)) { PRIVATE.addRightButton(opt); }
else { PRIVATE.addButton(opt); };
};
};
};
};
const fullRSS = () => {
if(!window.frss) { return; };
let resources = ["wood", "stone", "gold"];
let pt = game.ui.playerTick;
let rc = game.ui.components.Resources;
for(let i = 0; i < resources.length; i++) {
let rs = resources[i];
rc[`${rs}Elem`].innerHTML = Math.round(pt[rs]).toLocaleString("en");
};
rc.tokensElem.innerHTML = Math.round(pt.token).toLocaleString("en");
};
let sipt = setInterval(() => {
game.ui.addListener('playerTickUpdate', fullRSS);
}, 10);
setTimeout(() => { clearInterval(sipt); }, 90);
/*** TROLLERS ***/
isOnOrNot = false;
stashhitalarm = false;
deadalarm = false;
disconnectalarm = false;
health65palarm = false;
onlyOpenOnceOnTimeout = false;
pingalarm = false;
tower65palarm = false;
game.network.addRpcHandler("LocalBuilding", e => {
for (let i in e) {
if (e[i].dead) {
if (e[i].type !== "Wall" && e[i].type !== "Door") {
if (isOnOrNot) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
}
}
}
}
})
game.network.addEntityUpdateHandler((e) => {
let gl = GetGoldStash();
if (gl) {
if (e.entities[gl.uid]) {
if (e.entities[gl.uid].health !== e.entities[gl.uid].maxHealth) {
if (stashhitalarm) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 24000))
}
}
}
}
if (e.entities[game.world.myUid]) {
if (e.entities[game.world.myUid].health) {
if ((e.entities[game.world.myUid].health / 500) * 100 < 65) {
if (health65palarm) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 24000));
}
}
}
}
if((game.network.ping > 2000) && pingalarm) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
};
for (let i in e.entities) {
if (e.entities[i].partyId == game.ui.playerTick.partyId) {
if (e.entities[i].model == "Harvester" || e.entities[i].model == "ArrowTower" || e.entities[i].model == "CannonTower" || e.entities[i].model == "BombTower" || e.entities[i].model == "MagicTower" || e.entities[i].model == "MeleeTower") {
entitiesHealth[e.entities[i].uid] = {uid: e.entities[i].uid, health: e.entities[i].health, maxHealth: e.entities[i].maxHealth}
}
}
if (entitiesHealth[i]) {
e.entities[i].health && (entitiesHealth[i].health = e.entities[i].health);
e.entities[i].maxHealth && (entitiesHealth[i].maxHealth = e.entities[i].maxHealth);
}
}
for (let i in entitiesHealth) {
if ((entitiesHealth[i].health / entitiesHealth[i].maxHealth) * 100 < 65) {
if (tower65palarm) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 30000))
}
}
if (!e.entities[i]) {
delete entitiesHealth[i];
}
}
})
game.network.addRpcHandler("Dead", () => {
if (deadalarm) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
}
})
game.network.addCloseHandler(() => {
if (disconnectalarm) {
!onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
}
})
videoalert = () => {
let a = new Audio();
a.src = "https://cdn.discordapp.com/attachments/870020008128958525/871587235324117052/Canadian_EAS_Alarm_EXTREME_LOUD.mp3"
a.volume = 1;
a.play();
Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Stop Alert?", 10000, function() {
a.pause();
})
setTimeout(() => {
a.pause();
}, 30000);
}
alarm = () => {
isOnOrNot = !isOnOrNot;
document.getElementsByClassName("alarm")[0].innerText = document.getElementsByClassName("alarm")[0].innerText.replace(isOnOrNot ? "Enable" : "Disable", isOnOrNot ? "Disable" : "Enable");
document.getElementsByClassName("alarm")[0].className = document.getElementsByClassName("alarm")[0].className.replace(isOnOrNot ? "grey" : "red", isOnOrNot ? "red" : "grey");
}
stashHitAlarm = () => {
stashhitalarm = !stashhitalarm;
document.getElementsByClassName("stashHitAlarm")[0].innerText = document.getElementsByClassName("stashHitAlarm")[0].innerText.replace(stashhitalarm ? "Enable" : "Disable", stashhitalarm ? "Disable" : "Enable");
document.getElementsByClassName("stashHitAlarm")[0].className = document.getElementsByClassName("stashHitAlarm")[0].className.replace(stashhitalarm ? "grey" : "red", stashhitalarm ? "red" : "grey");
}
deadAlarm = () => {
deadalarm = !deadalarm;
document.getElementsByClassName("deadAlarm")[0].innerText = document.getElementsByClassName("deadAlarm")[0].innerText.replace(deadalarm ? "Enable" : "Disable", deadalarm ? "Disable" : "Enable");
document.getElementsByClassName("deadAlarm")[0].className = document.getElementsByClassName("deadAlarm")[0].className.replace(deadalarm ? "grey" : "red", deadalarm ? "red" : "grey");
}
disconnectAlarm = () => {
disconnectalarm = !disconnectalarm;
document.getElementsByClassName("disconnectAlarm")[0].innerText = document.getElementsByClassName("disconnectAlarm")[0].innerText.replace(disconnectalarm ? "Enable" : "Disable", disconnectalarm ? "Disable" : "Enable");
document.getElementsByClassName("disconnectAlarm")[0].className = document.getElementsByClassName("disconnectAlarm")[0].className.replace(disconnectalarm ? "grey" : "red", disconnectalarm ? "red" : "grey");
}
health65pAlarm = () => {
health65palarm = !health65palarm;
document.getElementsByClassName("health65pAlarm")[0].innerText = document.getElementsByClassName("health65pAlarm")[0].innerText.replace(health65palarm ? "Enable" : "Disable", health65palarm ? "Disable" : "Enable");
document.getElementsByClassName("health65pAlarm")[0].className = document.getElementsByClassName("health65pAlarm")[0].className.replace(health65palarm ? "grey" : "red", health65palarm ? "red" : "grey");
}
pingAlarm = () => {
pingalarm = !pingalarm;
document.getElementsByClassName("pingAlarm")[0].innerText = document.getElementsByClassName("pingAlarm")[0].innerText.replace(pingalarm ? "Enable" : "Disable", pingalarm ? "Disable" : "Enable");
document.getElementsByClassName("pingAlarm")[0].className = document.getElementsByClassName("pingAlarm")[0].className.replace(pingalarm ? "grey" : "red", pingalarm ? "red" : "grey");
}
tower65pAlarm = () => {
tower65palarm = !tower65palarm;
document.getElementsByClassName("tower65pAlarm")[0].innerText = document.getElementsByClassName("tower65pAlarm")[0].innerText.replace(tower65palarm ? "Enable" : "Disable", tower65palarm ? "Disable" : "Enable");
document.getElementsByClassName("tower65pAlarm")[0].className = document.getElementsByClassName("tower65pAlarm")[0].className.replace(tower65palarm ? "grey" : "red", tower65palarm ? "red" : "grey");
}
GetGoldStash = () => {
for (let i in game.ui.buildings) {
if (game.ui.buildings[i].type == "GoldStash") {
return game.ui.buildings[i];
}
}
}
let blockedNames = [];
window.blockPlayer = name => {
game.ui.components.PopupOverlay.showConfirmation(`Are you sure you want to block ${name}?`, 3500, () => {
blockedNames.push(name);
for(let msg of Array.from(document.getElementsByClassName("hud-chat-message"))) {
if(msg.childNodes[2].innerText === name) {
let bl = msg.childNodes[0];
bl.innerHTML = "Unblock";
bl.style.color = "red";
bl.onclick = () => {
window.unblockPlayer(name);
};
};
};
}, () => {});
};
window.unblockPlayer = name => {
blockedNames.splice(blockedNames.indexOf(name), 1);
for(let msg of Array.from(document.getElementsByClassName("hud-chat-message"))) {
if(msg.childNodes[2].innerText === name) {
let bl = msg.childNodes[0];
bl.innerHTML = "Block";
bl.style.color = "red";
bl.onclick = () => {
window.blockPlayer(name);
};
};
};
};
const getClock = () => {
var date = new Date();
var d = date.getDate();
var d1 = date.getDay();
var h = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds()
var session = "PM";
if(h == 2){
h = 12;
};
if(h < 13) {
session = "AM"
};
if(h > 12){
session = "PM";
h -= 12;
};
h = (h < 10) ? "0" + h : h;
m = (m < 10) ? "0" + m : m;
s = (s < 10) ? "0" + s : s;
return `${h}:${m} ${session}`;
}
Game.currentGame.network.emitter.removeListener("PACKET_RPC", Game.currentGame.network.emitter._events.PACKET_RPC[1]);
let onMessageReceived = (msg => {
if(blockedNames.includes(msg.displayName) || window.chatDisabled) { return; };
let a = Game.currentGame.ui.getComponent("Chat"),
b = msg.displayName.replace(/<(?:.|\n)*?>/gm, ''),
c = msg.message.replace(/<(?:.|\n)*?>/gm, ''),
d = a.ui.createElement(`
Block ${b} at ${getClock()}: ${c}
`);
a.messagesElem.appendChild(d);
a.messagesElem.scrollTop = a.messagesElem.scrollHeight;
})
Game.currentGame.network.addRpcHandler("ReceiveChatMessage", onMessageReceived);
window.toggleChat = () => {
window.chatDisabled = !window.chatDisabled;
let hcm = document.getElementsByClassName("hud-chat-messages")[0];
if(window.chatDisabled) {
window.oldChatHTML = hcm.innerHTML;
hcm.innerHTML = "
Disabled Chat
";
} else {
hcm.innerHTML = window.oldChatHTML;
};
};
const shouldKeep = uid => {
let entity = game.world.entities[uid];
if(["Tree", "Stone"].includes(entity.fromTick.model)) { return true; };
return false;
};
game.world.removeEntity2 = game.world.removeEntity;
game.world.removeEntity = (uid) => {
if (shouldKeep(uid)) return;
game.world.removeEntity2(uid);
};
window.httpGet = url => {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", url, false); // false for synchronous request
xmlHttp.send();
return xmlHttp.responseText;
};
window.reGS = (username, password) => {
let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/register?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`);
if(k.startsWith("ERROR: ")) {
new Noty({
type: "error",
layout: "topRight",
text: k.replace("ERROR: ", ""),
timeout: 2000
}).show();
} else {
new Noty({
type: "success",
layout: "topRight",
text: k,
timeout: 2000
}).show();
document.getElementById("bfl").style.display = "none";
let act = document.getElementById("act");
act.style.display = "block";
document.getElementById("hiu").innerHTML = `Hello, ${username}`;
window.username = username;
localStorage.ig_auth = JSON.stringify({ username: username, password: password });
};
};
window.siGN = (username, password, al = true) => {
let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/login?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`);
if(k.startsWith("ERROR: ") && al) {
new Noty({
type: "error",
layout: "topRight",
text: k.replace("ERROR: ", ""),
timeout: 2000
}).show();
} else {
if(al) {
new Noty({
type: "success",
layout: "topRight",
text: k,
timeout: 2000
}).show();
};
document.getElementById("bfl").style.display = "none";
let act = document.getElementById("act");
act.style.display = "block";
document.getElementById("hiu").innerHTML = `Hello, ${username}`;
window.username = username;
localStorage.ig_auth = JSON.stringify({ username: username, password: password });
window.ud = JSON.parse(window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/user?username=${encodeURIComponent(username)}`));
};
};
window.toggleZoS = () => {
window.zoomonscroll = !window.zoomonscroll;
let zs = document.getElementById("zsd");
zs.style.display = zs.style.display == "none" ? "block" : "none";
};
window.zoomOut = () => {
let zs = document.getElementById("zoomSlider");
zs.value = parseInt(zs.value) + 1;
};
window.zoomIn = () => {
let zs = document.getElementById("zoomSlider");
zs.value = parseInt(zs.value) - 1;
};
window.resetZoom = () => {
document.getElementById("zoomSlider").value = 1;
};
window.sgNO = () => {
document.getElementById("act").style.display = "none";
document.getElementById("bfl").style.display = "block";
localStorage.ig_auth = undefined;
};
window.loadGopt = json => {
json.dbg ? game.debug.show() : game.debug.hide();
if(json.ssm) {
if(!window.ssModeToggle) {
window.ssMode();
};
} else if(window.ssModeToggle) {
window.ssMode();
};
if(json.zos) {
if(!window.zoomonscroll) {
window.toggleZoS();
};
} else if(window.zoomonscroll) {
window.toggleZoS();
};
if(json.ync) {
let hr = hexToRgb(json.ync);
game.world.localPlayer.entity.currentModel.nameEntity.setColor(hr[0], hr[1], hr[2]);
window.yncv = json.ync;
};
let hno = document.getElementsByClassName("hud-day-night-overlay")[0];
if(json.tad) {
if(hno.style.display !== "none") {
hno.style.display = "none";
};
} else if(hno.style.display === "none") {
hno.style.display = "block";
};
window.frss = !!json.frss;
if(json.cdt) {
if(!window.chatDisabled) {
window.toggleChat();
};
} else if(window.chatDisabled) {
window.toggleChat();
};
};
window.saveGopt = username => {
let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/gopt/save?username=${encodeURIComponent(username)}&gopt=${encodeURIComponent(JSON.stringify(window.gopt))}`);
if(k.startsWith("ERROR: ")) {
new Noty({
type: "error",
layout: "topRight",
text: k.replace("ERROR: ", ""),
timeout: 2000
}).show();
} else {
new Noty({
type: "success",
layout: "topRight",
text: k,
timeout: 2000
}).show();
};
};
window.loadGoptReq = username => {
let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/gopt/load?username=${encodeURIComponent(username)}`);
if(k.startsWith("ERROR: ")) {
new Noty({
type: "error",
layout: "topRight",
text: k.replace("ERROR: ", ""),
timeout: 2000
}).show();
} else {
new Noty({
type: "success",
layout: "topRight",
text: "Successfully loaded Game Options from your account.",
timeout: 2000
}).show();
window.loadGopt(JSON.parse(k));
};
};
window.rmw = () => {
for(let sck of sockets) {
if(!sck.iframe && !sck.closed) {
sck.close();
sck.closed = true;
window.nlt--;
};
};
window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
new Noty({
type: "success",
layout: "topRight",
text: "Successfully removed all WebSockets",
timeout: 2000
}).show();
};
window.rmi = () => {
for(let sck of sockets) {
if(sck.iframe && !sck.closed) {
sck.close();
sck.closed = true;
window.nlt--;
};
};
window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
new Noty({
type: "success",
layout: "topRight",
text: "Successfully removed all iFrames",
timeout: 2000
}).show();
};
window.rma = () => {
for(let sck of sockets) {
if(sck.closed) { continue; };
sck.close();
sck.closed = true;
window.nlt--;
};
window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
new Noty({
type: "success",
layout: "topRight",
text: "Successfully removed all WebSockets",
timeout: 2000
}).show();
};
var Vector = function(x, y) {
this.x = x || 0;
this.y = y || 0;
};
// return the angle of the vector in radians
Vector.prototype.getDirection = function() {
return Math.atan2(this.y, this.x);
};
// set the direction of the vector in radians
Vector.prototype.setDirection = function(direction) {
var magnitude = this.getMagnitude();
this.x = Math.cos(direction) * magnitude;
this.y = Math.sin(direction) * magnitude;
};
// get the magnitude of the vector
Vector.prototype.getMagnitude = function() {
// use pythagoras theorem to work out the magnitude of the vector
return Math.sqrt(this.x * this.x + this.y * this.y);
};
// set the magnitude of the vector
Vector.prototype.setMagnitude = function(magnitude) {
var direction = this.getDirection();
this.x = Math.cos(direction) * magnitude;
this.y = Math.sin(direction) * magnitude;
};
// add two vectors together and return a new one
Vector.prototype.add = function(v2) {
return new Vector(this.x + v2.x, this.y + v2.y);
};
// add a vector to this one
Vector.prototype.addTo = function(v2) {
this.x += v2.x;
this.y += v2.y;
};
// subtract two vectors and reutn a new one
Vector.prototype.subtract = function(v2) {
return new Vector(this.x - v2.x, this.y - v2.y);
};
// subtract a vector from this one
Vector.prototype.subtractFrom = function(v2) {
this.x -= v2.x;
this.y -= v2.y;
};
// multiply this vector by a scalar and return a new one
Vector.prototype.multiply = function(scalar) {
return new Vector(this.x * scalar, this.y * scalar);
};
// multiply this vector by the scalar
Vector.prototype.multiplyBy = function(scalar) {
this.x *= scalar;
this.y *= scalar;
};
// scale this vector by scalar and return a new vector
Vector.prototype.divide = function(scalar) {
return new Vector(this.x / scalar, this.y / scalar);
};
// scale this vector by scalar
Vector.prototype.divideBy = function(scalar) {
this.x /= scalar;
this.y /= scalar;
};
// Aliases
Vector.prototype.getLength = Vector.prototype.getMagnitude;
Vector.prototype.setLength = Vector.prototype.setMagnitude;
Vector.prototype.getAngle = Vector.prototype.getDirection;
Vector.prototype.setAngle = Vector.prototype.setDirection;
// Utilities
Vector.prototype.copy = function() {
return new Vector(this.x, this.y);
};
Vector.prototype.toString = function() {
return 'x: ' + this.x + ', y: ' + this.y;
};
Vector.prototype.toArray = function() {
return [this.x, this.y];
};
Vector.prototype.toObject = function() {
return {x: this.x, y: this.y};
};
const angleConverter = { radiansToDegrees: e => e * 180 / Math.PI, degreesToRadians: e => e / 180 * Math.PI };
window.freq = username => {
let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/friends/add?username=${encodeURIComponent(window.username)}&username2=${encodeURIComponent(username)}`);
if(k.startsWith("ERROR: ")) {
new Noty({
type: "error",
layout: "topRight",
text: k.replace("ERROR: ", ""),
timeout: 2000
}).show();
} else {
new Noty({
type: "success",
layout: "topRight",
text: k,
timeout: 2000
}).show();
};
};
window.rfUpg = () => {
let tab = getTabById(window.focusedTab);
window.userPg(tab.ud.username);
};
window.rlUD = () => {
window.ud = JSON.parse(window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/user?username=${encodeURIComponent(username)}`));
};
window.rfreq = username => {
let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/friends/remove?username=${encodeURIComponent(window.username)}&username2=${encodeURIComponent(username)}`);
if(k.startsWith("ERROR: ")) {
new Noty({
type: "error",
layout: "topRight",
text: k.replace("ERROR: ", ""),
timeout: 2000
}).show();
} else {
new Noty({
type: "success",
layout: "topRight",
text: k,
timeout: 2000
}).show();
};
};
window.sck = (hostname, cb) => {
const ws = new WebSocket(`ws://${hostname}:80`);
ws.binaryType = "arraybuffer";
ws.onopen = () => {
ws.network = new game.networkType();
ws.network.sendRpc = (e) => { ws.send(ws.network.codec.encode(9, e)) };
ws.network.sendInput = (e) => { ws.send(ws.network.codec.encode(3, e)) };
ws.onmessage = msg => {
const data = ws.network.codec.decode(msg.data)
switch (data.opcode) {
case 4:
ws.send(ws.network.codec.encode(3, { up: 1 }));
ws.send(ws.network.codec.encode(3, { left: 1 }));
ws.uid = data.uid;
ws.position = { x: null, y: null };
window.findTC[ws.name] = ws;
cb(ws);
break;
case 5:
game.network.connectionOptions.hostname = hostname;
game.network.connected = true;
var dn = `${Math.floor(Math.random() * 9999)}`;
ws.send(ws.network.codec.encode(4, { displayName: dn, extra: data.extra }));
ws.name = dn;
window.findTC[dn] = ws;
break;
};
if(data.entities) {
if(data.entities[ws.uid] && data.entities[ws.uid] !== true) {
if(data.entities[ws.uid].position) {
let pos = { x: data.entities[ws.uid].position.x || ws.position.x, y: data.entities[ws.uid].position.y || ws.position.y };
ws.position = pos;
window.findTC[ws.name].position = pos;
};
};
};
};
};
};
window.findTC = () => {
let v1 = find_1("ƬƇ")[1];
let v2 = find_1("TC")[1];
let v3 = find_1("TƇ")[1];
let v4 = find_1("ƬC")[1];
let all = [...v1, ...v2, ...v3, ...v4];
for(let item in all) {
all[item].server = game.options.servers[all[item].server];
delete all[item].selected;
// sendMessage(`\`\`\`JSON\n${JSON.stringify(all[item], null, 2)}\`\`\``);
window.sck(all[item].server.hostname, e => {
all[item].ws = e;
console.log("done");
window.coverMap(e);
e.addEventListener('message', msg => {
if(all[item].found) { return };
const data = e.network.codec.decode(msg.data);
if(data.entities) {
for(let i in data.entities) {
if(data.entities[i].name) {
if(data.entities[i].name == all[item].name) {
if(data.entities[i].position) {
alert(JSON.stringify(data.entities[i].position));
all[item].found = true;
clearInterval(all[item].mvInterval);
};
};
};
};
};
});
});
};
return all;
};
var changeHeight = document.createElement("style")
changeHeight.type = "text/css"
document.body.appendChild(changeHeight)
var widget = `
Server Scanner
Click on the Scan button to show the data of the selected server here.
`;
let hil = document.getElementsByClassName("hud-intro-left")[0];
hil.innerHTML = widget;
hil.style.marginTop = "30px";
window.copyText = t => {
const elem = document.createElement('textarea');
elem.value = t;
document.body.appendChild(elem);
elem.select();
document.execCommand('copy');
document.body.removeChild(elem);
new Noty({
type: 'success',
text: `Copied to clipboard`,
timeout: 2000
}).show();
};
window.coverMap = ws => {
let max = 23973;
let min = 27;
let time = 0;
ws.network.sendInput({ up: 0, down: 0, left: 0, right: 0 });
let _moveTowards = pos => {
if (ws.position.y-pos.y > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
ws.network.sendInput({down: 0})
} else {
ws.network.sendInput({down: 1})
}
if (-ws.position.y+pos.y > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
ws.network.sendInput({up: 0})
} else {
ws.network.sendInput({up: 1})
}
if (-ws.position.x+pos.x > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
ws.network.sendInput({left: 0})
} else {
ws.network.sendInput({left: 1})
}
if (ws.position.x-pos.x > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
ws.network.sendInput({right: 0})
} else {
ws.network.sendInput({right: 1})
}
};
let mv = (x, y, cb) => {
ws.mvInterval = setInterval(() => {
let pos = ws.position;
if(((pos.x + 144) > x) && ((pos.y + 144) > y) && ((pos.x - 144) < x) && ((pos.y - 144) < y)) { cb(pos.x, pos.y); clearInterval(interval); };
time += 250;
_moveTowards({ x: x, y: y });
}, 250);
};
let start = (x, y) => {
mv(max, y + 1200, end);
};
let end = (x, y) => {
let pos = ws.position;
if(((pos.y + 144) > max) && ((pos.x + 144) > max) && ((pos.x - 144) < max) && ((pos.y - 144) < max)) {
return;
};
mv(min, y + 1200, start);
};
mv(min, min, start);
};
document.getElementsByClassName("hud-intro-form")[0].insertAdjacentHTML("beforeend", `
`);
window.ssfi = () => {
let ssrs = document.getElementById("ssrs");
ssrs.innerHTML = `
Loading...`;
let selected = document.getElementsByClassName("hud-intro-server")[0].value;
let server = game.options.servers[selected];
let hostname = server.hostname;
let url = `ws://${hostname}:80/`;
game.network.connectionOptions = { hostname: hostname };
game.network.connected = true;
let ws = new WebSocket(url);
ws.binaryType = "arraybuffer";
const loadLbPacket = () => {
for (let i = 0; i < 30; i++) ws.send(new Uint8Array([3, 17, 123, 34, 117, 112, 34, 58, 49, 44, 34, 100, 111, 119, 110, 34, 58, 48, 125]));
ws.send(new Uint8Array([7, 0]));
ws.send(new Uint8Array([9,6,0,0,0,126,8,0,0,108,27,0,0,146,23,0,0,82,23,0,0,8,91,11,0,8,91,11,0,0,0,0,0,32,78,0,0,76,79,0,0,172,38,0,0,120,155,0,0,166,39,0,0,140,35,0,0,36,44,0,0,213,37,0,0,100,0,0,0,120,55,0,0,0,0,0,0,0,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,6,0,0]));
};
ws.onopen = (data) => {
ws.network = new game.networkType();
ws.network.sendPacket = (e, t) => {
ws.send(ws.network.codec.encode(e, t));
};
ws.onRpc = (data) => {
if(data.name === "SetPartyList") {
ws.parties = data.response;
};
if(data.name === "Leaderboard") {
if(ws.b4) { window.appSsrs({ population: ws.pop, leaderboard: data.response, parties: ws.parties }); ws.close(); return; };
loadLbPacket();
ws.b4 = true;
};
};
ws.onmessage = msg => {
let data = ws.network.codec.decode(msg.data);
switch(data.opcode) {
case 5:
ws.network.sendPacket(4, { displayName: `LB-${Math.floor(Math.random() * 99999)}`, extra: data.extra });
break;
case 4:
ws.network.sendPacket(3, { left: 1, up: 1 });
ws.pop = data.players - 1;
break;
case 9:
ws.onRpc(data);
break;
};
};
};
};
window.appSsrs = res => {
console.log(res);
let ssrs = document.getElementById("ssrs");
ssrs.style.overflow = "scroll";
ssrs.style.height = "175px";
ssrs.innerHTML = `
Population: ${res.population}
Leaderboard
${res.leaderboard.map(lb => {
return `
Rank: #${lb.rank + 1},
Nickname: ${lb.name},
Wave: ${lb.wave.toLocaleString("en")},
Score: ${lb.score}
`;
}).join("
")}
Parties
${res.parties.map(p => {
return `
Name: ${p.partyName},
ID: ${p.partyId},
Members: ${p.memberCount},
Public: ${p.isOpen}
`;
}).join("
")}
`;
};
document.getElementsByClassName("hud-menu-icons")[0].insertAdjacentHTML("beforeend", `
`);
document.body.insertAdjacentHTML('beforeend', `
`);
window.moreMenu = () => {
let mm = document.getElementsByClassName("hud-menu-more")[0];
if(["none", ""].includes(mm.style.display)) {
mm.style.display = "block";
for(let i of Array.from(document.getElementsByClassName("hud-menu"))) {
if(i.classList.contains('hud-menu-more')) { return; };
i.style.display = "none";
};
} else {
mm.style.display = "none";
};
};
let hasBeenInWorld = false;
game.network.addEnterWorldHandler(() => {
if(hasBeenInWorld) { return };
hasBeenInWorld = true;
for(let i of Array.from(document.getElementsByClassName("hud-menu-icon"))) {
console.log(i.dataset.type);
if(i.dataset.type !== "More") {
i.addEventListener('click', function() {
document.getElementsByClassName("hud-menu-more")[0].style.display = "none";
});
};
};
/*
let newCanvas = document.createElement("canvas");
newCanvas.style.position = "absolute";
newCanvas.style.top = "0";
newCanvas.style.left = "0";
newCanvas.width = document.querySelector('canvas').width;
newCanvas.height = document.querySelector('canvas').height;
newCanvas.style.zIndex = 4;
document.body.append(newCanvas);
window.newCtx = newCanvas.getContext("2d");
*/
});
window.Find = {
Instance: class {
constructor(rank) {
this.target = rank;
let _this = this;
let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:80/`);
ws.binaryType = "arraybuffer";
ws.onopen = () => {
ws.network = new game.networkType();
ws.network.sendPacket = (e, t) => { ws.send(ws.network.codec.encode(e, t)); };
ws.tryEnterWorld = data => {
ws.network.sendPacket(4, { displayName: `FIND-${Math.floor(Math.random() * 99999)}`, extra: data.extra });
setTimeout(() => {
if(!ws.uid && ws.readyState === 1) {
ws.tryEnterWorld(data);
};
}, 4000);
};
};
ws.onmessage = msg => {
const data = ws.network.codec.decode(msg.data);
let uid = game.ui.components.Leaderboard.leaderboardData[rank - 1].uid;
if(data.entities) {
if(uid in data.entities) {
_this.found = { pos: data.entities[i].position, done: true };
};
window.findPlayer(rank, _this.found);
// window.mapElem.insertAdjacentHTML("beforeend", `
${markerId++}
`)
ws.close();
};
switch(data.opcode) {
case 5:
ws.tryEnterWorld(data);
console.log("e");
break;
case 4:
ws.network.sendPacket(3, { left: 1, up: 1 });
ws.uid = data.uid;
console.log("e2");
break;
};
};
};
}
};
window.findPlayer = (rank, data) => {
if(data) {
alert(`Successfully found #${rank} on the leaderboard: ${JSON.stringify(data)}`);
} else {
setTimeout(() => {
new window.Find.Instance(rank);
}, 1750);
};
};
document.getElementsByClassName("1i")[0].addEventListener('click', function() {
for(let uid in game.ui.buildings) {
if(game.ui.buildings[uid].type !== "GoldStash") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: game.ui.buildings[uid].uid
});
}
}
})
document.getElementsByClassName("2i")[0].addEventListener('click', function() {
for(let uid in game.ui.buildings) {
if(game.ui.buildings[uid].type == "Wall") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: game.ui.buildings[uid].uid
});
}
}
})
document.getElementsByClassName("3i")[0].addEventListener('click', function() {
for(let uid in game.ui.buildings) {
if(game.ui.buildings[uid].type == "Door") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: game.ui.buildings[uid].uid
});
}
}
})
document.getElementsByClassName("4i")[0].addEventListener('click', function() {
for(let uid in game.ui.buildings) {
if(game.ui.buildings[uid].type == "SlowTrap") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: game.ui.buildings[uid].uid
});
}
}
})
document.getElementsByClassName("5i")[0].addEventListener('click', function() {
for(let uid in game.ui.buildings) {
if(game.ui.buildings[uid].type == "ArrowTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: game.ui.buildings[uid].uid
});
}
}
})
document.getElementsByClassName("6i")[0].addEventListener('click', function() {
for(let uid in game.ui.buildings) {
if(game.ui.buildings[uid].type == "MagicTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: game.ui.buildings[uid].uid
});
}
}
})
window.spamParty = (id, amount) => {
let spammers = [];
let startSpam = () => {
for(let ws of spammers) {
ws.network.sendPacket(9, { name: "JoinParty", partyId: id });
};
};
let addSpammer = () => {
let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:80/`);
spammers.push(ws);
ws.binaryType = "arraybuffer";
ws.onopen = () => {
ws.network = new game.networkType();
ws.network.sendPacket = (e, t) => { ws.send(ws.network.codec.encode(e, t)); };
ws.sendEnterWorld = d => {
ws.network.sendPacket(4, { displayName: `SPAM-${Math.floor(Math.random() * 99999)}`, extra: d.extra });
};
ws.onEnterWorld = () => {
if(spammers.length >= amount) {
startSpam();
} else {
addSpammer();
};
};
ws.onmessage = msg => {
const data = ws.network.codec.decode(msg.data);
switch(data.opcode) {
case 5:
ws.sendEnterWorld(data);
break;
case 4:
ws.onEnterWorld();
break;
};
};
};
};
addSpammer();
};
window.noob = () => {
let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:80/`);
ws.binaryType = "arraybuffer";
ws.onopen = () => {
ws.network = new game.networkType();
ws.network.sendPacket = (e, t) => { ws.send(ws.network.codec.encode(e, t)); };
ws.sendEnterWorld = d => {
ws.network.sendPacket(4, { displayName: `NOOB-${Math.floor(Math.random() * 99)}`, extra: d.extra });
};
ws.onEnterWorld = data => {
ws.uid = data.uid;
ws.close();
};
ws.onmessage = msg => {
const data = ws.network.codec.decode(msg.data);
switch(data.opcode) {
case 5:
ws.sendEnterWorld(data);
break;
case 4:
ws.onEnterWorld(data);
break;
};
};
};
};
window.rmMarker = id => {
let rmmrkbtn = document.getElementById("rmmrkbtn");
let nomrkerr = document.getElementById("nomrkerr");
nomrkerr.style.display = "none";
let marker = document.getElementById(`marker${id}`);
if(marker) {
marker.remove();
} else {
nomrkerr.style.display = "block";
};
};
window.rmAllMarkers = () => {
for(let i = 1; i <= markerId; i++) {
document.getElementById(`marker${i}`).remove();
};
new Noty({
type: 'success',
text: `Removed all markers`,
timeout: 2000
}).show();
};
window.httpGet("https://PoorNavyLead.asdfqwerty2.repl.co/r");
let scorelog = document.createElement('div');
scorelog.innerHTML = "Score Logger: 0";
document.getElementsByClassName('hud-top-center')[0].appendChild(scorelog);
let oldScore= Game.currentGame.ui.playerTick.score,
newScore = 0;
Game.currentGame.network.addRpcHandler("DayCycle", () => {
if (Game.currentGame.ui.components.DayNightTicker.tickData.isDay == 0) {
newScore = Game.currentGame.ui.playerTick.score;
scorelog.innerHTML = `Score Logger:${(newScore - oldScore).toLocaleString("en")}`;
oldScore = Game.currentGame.ui.playerTick.score;
}
})