您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
basic skid by Yurio but cant do good mod me sad ;(
// ==UserScript== // @name CHICKEN MOD V4 // @version mod // @author yurio suck at code jkjkjkk (LorZ) // @description basic skid by Yurio but cant do good mod me sad ;( // @match *://moomoo.io/* // @match *://*.moomoo.io/* // @icon data:image/jpeg;base64,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 // @grant none // @namespace https://greasyfork.org/users/1271917 // ==/UserScript== // This is actually chickenv4's menu XDDDD no copy pls me worked hard on this // Me minifiy to fuck up code so noobs won't steal // Don't be too alarmed with the names of variables and shit var styleItem = document.createElement("style"); styleItem.type = "text/css"; styleItem.appendChild(document.createTextNode(` #suggestBox { width: 355px; border-radius: 3px; background-color: rgba(0,0,0,0.5); margin: auto; text-align: left; z-index: 49; pointer-events: auto; position: relative; bottom: 3.5px; overflow-y: auto; } #suggestBox div { background-color: rgba(255,255,255,0); color: rgba(255,255,255,1); transition: background-color 0.3s, color 0.3s; } #suggestBox div:hover { background-color: rgba(255,255,255,0.2); color: rgba(0,0,0,1); } .suggestBoxHard { color: rgba(255,255,255,1); font-size: 18px; } .suggestBoxLight { color: rgba(255,255,255,0.7); font-size: 18px; } `)); document.head.appendChild(styleItem); function getEl(id) { return document.getElementById(id); } !function(run) { let min = document.createElement("script"); min.src = "https://rawgit.com/kawanet/msgpack-lite/master/dist/msgpack.min.js"; document.body.append(min); window.oncontextmenu = function() { return false; }; let config = window.config; // CLIENT: config.clientSendRate = 9; // Aim Packet Send Rate config.serverUpdateRate = 9; // UI: config.deathFadeout = 0; config.playerCapacity = 9999; // CHECK IN SANDBOX: config.isSandbox = window.location.hostname == "sandbox.moomoo.io"; // CUSTOMIZATION: config.weaponVariants = [{ id: 0, src: "", xp: 0, val: 1, }, { id: 1, src: "_g", xp: 3000, val: 1.1, }, { id: 2, src: "_d", xp: 7000, val: 1.18, }, { id: 3, src: "_r", poison: true, xp: 12000, val: 1.18, }, { id: 4, src: "_e", poison: true, heal: true, xp: 24000, val: 1.18, }]; // VISUAL: config.anotherVisual = true; config.useWebGl = true; config.resetRender = true; function waitTime(timeout) { return new Promise((done) => { setTimeout(() => { done(); }, timeout); }); } let botSkts = []; // STORAGE: let canStore; if (typeof(Storage) !== "undefined") { canStore = true; } function saveVal(name, val) { if (canStore) localStorage.setItem(name, val); } function deleteVal(name) { if (canStore) localStorage.removeItem(name); } function getSavedVal(name) { if (canStore) return localStorage.getItem(name); return null; } // CONFIGS: let gC = function(a, b) { try { let res = JSON.parse(getSavedVal(a)); if (typeof res === "object") { return b; } else { return res; } } catch (e) { alert("dieskid"); return b; } }; function setCommands() { return { "help": { desc: "Show Commands", action: function(message) { for (let cmds in commands) { addMenuChText("/" + cmds, commands[cmds].desc, "lime", 1); } } }, "clear": { desc: "Clear Chats", action: function(message) { resetMenuChText(); } }, "debug": { desc: "Debug Mod For Development", action: function(message) { addDeadPlayer(player); addMenuChText("Debug", "Done", "#99ee99", 1); } }, "play": { desc: "Play Music ( /play [link] )", action: function(message) { let link = message.split(" "); if (link[1]) { let audio = new Audio(link[1]); audio.play(); } else { addMenuChText("Warn", "Enter Link ( /play [link] )", "#99ee99", 1); } } }, "bye": { desc: "Leave Game", action: function(message) { window.leave(); } }, }; } function setConfigs() { return { killChat: true, alwaysRev: true, autoBuy: true, autoBuyEquip: true, autoPush: false, revTick: true, spikeTick: true, predictTick: true, autoPlace: false, autoReplace: true, autoPrePlace: true, antiTrap: true, slowOT: false, attackDir: false, showDir: true, noDir: true, autoRespawn: true }; }; let commands = setCommands(); let configs = setConfigs(); window.removeConfigs = function() { for (let cF in configs) { deleteVal(cF, configs[cF]); } }; for (let cF in configs) { configs[cF] = gC(cF, configs[cF]); } // MENU FUNCTIONS: window.changeMenu = function() {}; window.debug = function() {}; window.wasdMode = function() {}; // PAGE 1: window.startGrind = function() {}; // PAGE 3: window.connectFillBots = function() {}; window.destroyFillBots = function() {}; window.tryConnectBots = function() {}; window.destroyBots = function() {}; window.resBuild = function() {}; window.toggleBotsCircle = function() {}; window.toggleVisual = function() {}; // SOME FUNCTIONS: window.prepareUI = function() {}; window.leave = function() {}; // nah hahahahahhh why good ping window.ping = 0; class deadfuturechickenmodrevival { constructor(flarez, lore) { this.inGame = false; this.lover = flarez + lore; this.baby = "ae86"; this.isBlack = 0; this.webSocket = undefined; this.checkBaby = function() { this.baby !== "ae86" ? this.isBlack++ : this.isBlack--; if (this.isBlack >= 1) return "bl4cky"; return "noting for you"; }; this.x2 = 0; this.y2 = 0; this.chat = "Imagine playing this badass game XDDDDD"; this.summon = function(tmpObj) { this.x2 = tmpObj.x; this.y2 = tmpObj.y; this.chat = tmpObj.name + " ur so bad XDDDD"; }; this.commands = function(cmd) { cmd == "rv3link" && window.open("https://florr.io/"); cmd == "woah" && window.open("https://www.youtube.com/watch?v=MO0AGukzj6M"); return cmd; }; this.dayte = "11yearold"; this.memeganoob = "69yearold"; this.startDayteSpawn = function(tmpObj) { let ratio = setInterval(() => { this.x2 = tmpObj.x + 20; this.y2 = tmpObj.y - 20; this.chat = "UR SO BAD LOL"; if (tmpObj.name == "ae86") { this.chat = "omg ae86 go run"; setTimeout(() => { this.inGame = false; clearInterval(ratio); }, 1000); } }, 1234); }; this.AntiChickenModV69420 = function(tmpObj) { return "!c!dc user " + tmpObj.name; }; } }; class HtmlAction { constructor(element) { this.element = element; }; add(code) { if (!this.element) return undefined; this.element.innerHTML += code; }; newLine(amount) { let result = `<br>`; if (amount > 0) { result = ``; for (let i = 0; i < amount; i++) { result += `<br>`; } } this.add(result); }; checkBox(setting) { let newCheck = `<input type = "checkbox"`; setting.id && (newCheck += ` id = ${setting.id}`); setting.style && (newCheck += ` style = ${setting.style.replaceAll(" ", "")}`); setting.class && (newCheck += ` class = ${setting.class}`); setting.checked && (newCheck += ` checked`); setting.onclick && (newCheck += ` onclick = ${setting.onclick}`); newCheck += `>`; this.add(newCheck); }; text(setting) { let newText = `<input type = "text"`; setting.id && (newText += ` id = ${setting.id}`); setting.style && (newText += ` style = ${setting.style.replaceAll(" ", "")}`); setting.class && (newText += ` class = ${setting.class}`); setting.size && (newText += ` size = ${setting.size}`); setting.maxLength && (newText += ` maxLength = ${setting.maxLength}`); setting.value && (newText += ` value = ${setting.value}`); setting.placeHolder && (newText += ` placeHolder = ${setting.placeHolder.replaceAll(" ", " ")}`); newText += `>`; this.add(newText); }; select(setting) { let newSelect = `<select`; setting.id && (newSelect += ` id = ${setting.id}`); setting.style && (newSelect += ` style = ${setting.style.replaceAll(" ", "")}`); setting.class && (newSelect += ` class = ${setting.class}`); newSelect += `>`; for (let options in setting.option) { newSelect += `<option value = ${setting.option[options].id}` setting.option[options].selected && (newSelect += ` selected`); newSelect += `>${options}</option>`; } newSelect += `</select>`; this.add(newSelect); }; button(setting) { let newButton = `<button`; setting.id && (newButton += ` id = ${setting.id}`); setting.style && (newButton += ` style = ${setting.style.replaceAll(" ", "")}`); setting.class && (newButton += ` class = ${setting.class}`); setting.onclick && (newButton += ` onclick = ${setting.onclick}`); newButton += `>`; setting.innerHTML && (newButton += setting.innerHTML); newButton += `</button>`; this.add(newButton); }; selectMenu(setting) { let newSelect = `<select`; if (!setting.id) { alert("please put id skid"); return; } window[setting.id + "Func"] = function() {}; setting.id && (newSelect += ` id = ${setting.id}`); setting.style && (newSelect += ` style = ${setting.style.replaceAll(" ", "")}`); setting.class && (newSelect += ` class = ${setting.class}`); newSelect += ` onchange = window.${setting.id + "Func"}()`; newSelect += `>`; let last; let i = 0; for (let options in setting.menu) { newSelect += `<option value = ${"option_" + options} id = ${"O_" + options}`; setting.menu[options] && (newSelect += ` checked`); newSelect += ` style = "color: ${setting.menu[options] ? "#000" : "#fff"}; background: ${setting.menu[options] ? "#8ecc51" : "#cc5151"};">${options}</option>`; i++; } newSelect += `</select>`; this.add(newSelect); i = 0; for (let options in setting.menu) { window[options + "Func"] = function() { setting.menu[options] = getEl("check_" + options).checked ? true : false; saveVal(options, setting.menu[options]); getEl("O_" + options).style.color = setting.menu[options] ? "#000" : "#fff"; getEl("O_" + options).style.background = setting.menu[options] ? "#8ecc51" : "#cc5151"; //getEl(setting.id).style.color = setting.menu[options] ? "#8ecc51" : "#cc5151"; }; this.checkBox({ id: "check_" + options, style: `display: ${i == 0 ? "inline-block" : "none"};`, class: "checkB", onclick: `window.${options + "Func"}()`, checked: setting.menu[options] }); i++; } last = "check_" + getEl(setting.id).value.split("_")[1]; window[setting.id + "Func"] = function() { getEl(last).style.display = "none"; last = "check_" + getEl(setting.id).value.split("_")[1]; getEl(last).style.display = "inline-block"; //getEl(setting.id).style.color = setting.menu[last.split("_")[1]] ? "#8ecc51" : "#fff"; }; }; }; class Html { constructor() { this.element = null; this.action = null; this.divElement = null; this.startDiv = function(setting, func) { let newDiv = document.createElement("div"); setting.id && (newDiv.id = setting.id); setting.style && (newDiv.style = setting.style); setting.class && (newDiv.className = setting.class); this.element.appendChild(newDiv); this.divElement = newDiv; let addRes = new HtmlAction(newDiv); typeof func == "function" && func(addRes); }; this.addDiv = function(setting, func) { let newDiv = document.createElement("div"); setting.id && (newDiv.id = setting.id); setting.style && (newDiv.style = setting.style); setting.class && (newDiv.className = setting.class); setting.appendID && getEl(setting.appendID).appendChild(newDiv); this.divElement = newDiv; let addRes = new HtmlAction(newDiv); typeof func == "function" && func(addRes); }; }; set(id) { this.element = getEl(id); this.action = new HtmlAction(this.element); }; resetHTML(text) { if (text) { this.element.innerHTML = ``; } else { this.element.innerHTML = ``; } }; setStyle(style) { this.element.style = style; }; setCSS(style) { this.action.add(`<style>` + style + `</style>`); }; }; let HTML = new Html(); let menuDiv = document.createElement("div"); menuDiv.id = "menuDiv"; menuDiv.draggable = true; menuDiv.addEventListener("dragstart", function(e) { e.dataTransfer.setData("text/plain", ""); }); document.addEventListener("dragover", function(e) { menuDiv.style.left = e.clientX - menuDiv.offsetWidth / 2 + "px"; menuDiv.style.top = e.clientY - menuDiv.offsetHeight / 2 + "px"; }); document.body.appendChild(menuDiv); HTML.set("menuDiv"); HTML.setStyle(` position: absolute; left: 20px; top: 20px; display: none; `); HTML.resetHTML(); HTML.setCSS(` .menuClass{ color: #fff; font-size: 31px; text-align: left; padding: 10px; padding-top: 7px; padding-bottom: 5px; width: 300px; background-color: rgba(0, 0, 0, 0.25); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .menuC { display: none; font-family: "Hammersmith One"; font-size: 12px; max-height: 180px; overflow-y: scroll; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .menuB { text-align: center; background-color: rgb(25, 25, 25); color: #fff; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; border: 2px solid #000; cursor: pointer; } .menuB:hover { border: 2px solid #fff; } .menuB:active { color: rgb(25, 25, 25); background-color: rgb(200, 200, 200); } .customText { color: #000; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; border: 2px solid #000; } .customText:focus { background-color: yellow; } .checkB { position: relative; top: 2px; accent-color: #888; cursor: pointer; } .Cselect { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; background-color: rgb(75, 75, 75); color: #fff; border: 1px solid #000; } #menuChanger { position: absolute; right: 10px; top: 10px; background-color: rgba(0, 0, 0, 0); color: #fff; border: none; cursor: pointer; } #menuChanger:hover { color: #000; } ::-webkit-scrollbar { width: 10px; } ::-webkit-scrollbar-track { opacity: 0; } ::-webkit-scrollbar-thumb { background-color: rgb(25, 25, 25); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } ::-webkit-scrollbar-thumb:active { background-color: rgb(230, 230, 230); } `); HTML.startDiv({ id: "menuHeadLine", class: "menuClass" }, (html) => { html.add(`你的母亲 v4`); html.button({ id: "menuChanger", class: "material-icons", innerHTML: `sync`, onclick: "window.changeMenu()" }); HTML.addDiv({ id: "menuButtons", style: "display: block; overflow-y: visible;", class: "menuC", appendID: "menuHeadLine" }, (html) => { html.button({ class: "menuB", innerHTML: "Debug", onclick: "window.debug()" }); }); HTML.addDiv({ id: "menuMain", style: "display: block", class: "menuC", appendID: "menuHeadLine" }, (html) => { html.button({ class: "menuB", innerHTML: "Nothing", onclick: "window.wasdMode()" }); html.newLine(); html.add(`Grind`); html.checkBox({ id: "weaponGrind", class: "checkB", onclick: "window.startGrind()" }); html.newLine(2); HTML.addDiv({ style: "font-size: 20px; color: #87C9E2;", appendID: "menuMain" }, (html) => { html.add(`Settings:`); }); html.add(`AntiPush`); html.checkBox({ id: "antipush", class: "checkB", checked: true }); html.newLine(); html.add(`Ae86 Heal`); html.checkBox({ id: "healingBeta", class: "checkB", checked: true }); html.newLine(); html.add(`insta syncing`) html.checkBox({ id: "gowogSync", class:"checkB", checked: "false" }) html.newLine(); }); HTML.addDiv({ id: "menuConfig", class: "menuC", appendID: "menuHeadLine" }, (html) => { html.add(`Placer `); html.text({ id: "autoPlaceTick", class: "customText", value: "2", size: "2em", maxLength: "1" }); html.newLine(); html.add(`Options: `); html.selectMenu({ id: "configsChanger", class: "Cselect", menu: configs }); html.newLine(); html.add(`Antigay(useless)`); html.select({ id: "antiBullType", class: "Cselect", option: { "Disable": { id: "noab", selected: true, }, "When Reloaded": { id: "abreload", }, "Always": { id: "abalway", } } }); }); HTML.addDiv({ id: "menuOther", class: "menuC", appendID: "menuHeadLine" }, (html) => { html.button({ class: "menuB", innerHTML: "CBOT", onclick: "window.tryConnectBots()" }); html.button({ class: "menuB", innerHTML: "DBOT", onclick: "window.destroyBots()" }); html.newLine(); html.add(`DESTROYE object `); html.text({ id: "breakRange", class: "customText", value: "700", size: "3em", maxLength: "4" }); html.newLine(); html.add(`Render MOOV`); html.select({ id: "predictType", class: "Cselect", option: { "Disable Render": { id: "disableRender", selected: true }, "X/Y and 2": { id: "pre2", }, "X/Y and 3": { id: "pre3" } } }); html.newLine(); html.add(`Render PLACEMENT `); html.checkBox({ id: "placeVis", class: "checkB", }); html.newLine(); html.add(`Bot Mode: `); html.select({ id: "mode", class: "Cselect", option: { "Clear Building": { id: "clear", selected: true }, "Sync": { id: "zync", }, "Search": { id: "zearch" }, "Clear Everything": { id: "fuckemup" }, "Flex": { id: "flex" } } }); html.newLine(); html.add(`Not Working`); html.select({ id: "setup", class: "Cselect", option: { "Dagger Musket": { id: "dm", selected: true }, "Katana Hammer": { id: "kh", }, "Dagger Repeater-Crossbow": { id: "dr" }, "Sword Muzket": { id: "zd" } } }); html.newLine(); html.button({ class: "menuB", innerHTML: "Toggle Another Visual", onclick: "window.toggleVisual()" }); html.newLine(); }); }); function toFancyTimeFormat(time) { let minutes = ~~((time % 3600) / 60); let seconds = ~~time % 60; if (seconds <= 9) seconds = `0${seconds}`; return `${minutes}:${seconds}`; } const songchat1 = new Audio("https://cdn.discordapp.com/attachments/1175772907931176991/1227645695796969492/Benzz_-_Je_Mappelle_Music_Video_GRM_Daily.mp3?ex=662fc0a6&is=662e6f26&hm=0b1c67270ba28a0298c01b1a3435bcc5e4aac496053bc3e9a73689cef70870bf&"); let isPlaying = false; let currentPart = ''; function toggleSong() { if (!isPlaying) { songchat1.play(); songchat1.ontimeupdate = function(time) { let part = song[toFancyTimeFormat(Math.round(this.currentTime | 0))]; if (part && part !== currentPart) { currentPart = part; io.send("6", part); } }; songchat1.onended = function() { if (isPlaying) { songchat1.play(); } }; isPlaying = true; } else { songchat1.pause(); isPlaying = false; } } document.addEventListener("keypress", function(e) { if (e.key === "C") { toggleSong(); } }); let menuChatDiv = document.createElement("div"); menuChatDiv.id = "menuChatDiv"; document.body.appendChild(menuChatDiv); HTML.set("menuChatDiv"); HTML.setStyle(` position: absolute; display: none; left: 0px; top: 25px; // box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.65); `); HTML.resetHTML(); HTML.setCSS(` .chDiv { color: #fff; padding: 10px; width: 357px; height: 217px; background-color: rgba(0, 0, 0, 0.2); font-family: "HammerSmith One", monospace; // border-radius: 15px; // box-shadow: black 1px 2px 19px; //backdrop-filter: blur(3px); } .chMainDiv { font-family: "Ubuntu"; font-size: 16px; max-height: 215px; overflow-y: scroll; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.1); -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; overflow-x: hidden; } .chMainDiv::-webkit-scrollbar { width: 8px; } .chMainDiv::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.5); } .chMainDiv::-webkit-scrollbar-thumb:hover { background-color: rgba(0, 0, 0, 0.7); } .chMainBox { display:none; position: absolute; left: 10px; bottom: 10px; width: 380px; height: 25px; background-color: rgba(255, 255, 255, 0.1); border-radius: 5px; color: rgba(255, 255, 255, 0.75); font-family: "HammerSmith One"; font-size: 12px; } `); HTML.startDiv({ id: "mChDiv", class: "chDiv" }, (html) => { HTML.addDiv({ id: "mChMain", class: "chMainDiv", appendID: "mChDiv" }, (html) => {}); html.text({ id: "mChBox", class: "chMainBox", // placeHolder: `Not today` }); }); let menuChats = getEl("mChMain"); let menuChatBox = getEl("mChBox"); let menuCBFocus = false; let menuChCounts = 0; menuChatBox.value = ""; menuChatBox.addEventListener("focus", () => { menuCBFocus = true; }); menuChatBox.addEventListener("blur", () => { menuCBFocus = false; }); function addMenuChText(name, message, color, noTimer) { HTML.set("menuChatDiv"); color = color || "white"; let time = new Date(); let min = time.getMinutes(); let hour = time.getHours(); let text = ``; if (!noTimer) text += `${(hour < 10 ? '0' : '') + hour}:${(min < 10 ? '0' : '') + min}`; if (name) text += `${(!noTimer ? " - " : "") + name}`; if (message) text += `${(name ? ": " : !noTimer ? " - " : "") + message}\n`; HTML.addDiv({ id: "menuChDisp", style: `color: ${color}`, appendID: "mChMain" }, (html) => { html.add(text); }); menuChats.scrollTop = menuChats.scrollHeight; menuChCounts++; } function chch(name, message, color, noTimer) { HTML.set("menuChatDiv"); color = color || "white"; let time = new Date(); let text = ``; // if (name) text += `${(!noTimer ? " - " : "") + name}`; if (message) text += `${(name ? ": " : !noTimer ? "" : "") + message}\n`; HTML.addDiv({ id: "menuChDisp", style: `color: ${color}`, appendID: "mChMain" }, (html) => { html.add(text); }); menuChats.scrollTop = menuChats.scrollHeight; menuChCounts++; } function resetMenuChText() { menuChats.innerHTML = ``; menuChCounts = 0; addMenuChText(null, "Chat '/help' for a list of chat commands.", "white", 1) } resetMenuChText(); let menuIndex = 0; let menus = ["menuMain", "menuConfig", "menuOther"]; window.changeMenu = function() { getEl(menus[menuIndex % menus.length]).style.display = "none"; menuIndex++; getEl(menus[menuIndex % menus.length]).style.display = "block"; }; let mStatus = document.createElement("div"); mStatus.id = "status"; getEl("gameUI").appendChild(mStatus); HTML.set("status"); HTML.setStyle(` display: block; position: absolute; color: #ddd; font: 15px Hammersmith One; bottom: 215px; left: 20px; `); HTML.resetHTML(); HTML.setCSS(` .sizing { font-size: 15px; } .mod { font-size: 15px; display: inline-block; } `); let openMenu = false; let WS = undefined; let socketID = undefined; //Ong u ass omg let spikeB = { info: undefined, can: false, aim: undefined, dist: undefined, x: undefined, y: undefined, } let useWasd = false; let secPacket = 0; let secMax = 500; let secTime = 1000; let minPacket = 0; let minMax = 150; let minTime = 60000; let firstSend = { sec: false, min: false }; let game = { tick: 0, tickQueue: [], tickBase: function(set, tick) { if (this.tickQueue[this.tick + tick]) { this.tickQueue[this.tick + tick].push(set); } else { this.tickQueue[this.tick + tick] = [set]; } }, tickRate: (1000 / config.serverUpdateRate), tickSpeed: 0, lastTick: performance.now() }; let modConsole = []; let dontSend = false; let fpsTimer = { last: 0, time: 0, ltime: 0 }; let lastMoveDir = undefined; let lastsp = ["cc", 1, "__proto__"]; WebSocket.prototype.nsend = WebSocket.prototype.send; WebSocket.prototype.send = function(message) { if (!WS) { WS = this; WS.addEventListener("message", function(msg) { getMessage(msg); }); WS.addEventListener("close", (event) => { if (event.code == 4001) { window.location.reload(); } }); } if (WS == this) { dontSend = false; // EXTRACT DATA ARRAY: let data = new Uint8Array(message); let parsed = window.msgpack.decode(data); let type = parsed[0]; data = parsed[1]; // SEND MESSAGE: if (type == "6") { if (data[0]) { // ANTI PROFANITY: let profanity = ["cunt", "whore", "fuck", "shit", "faggot", "nigger", "nigga", "dick", "vagina", "minge", "cock", "rape", "cum", "sex", "tits", "penis", "clit", "pussy", "meatcurtain", "jizz", "prune", "douche", "wanker", "damn", "bitch", "dick", "fag", "bastard", ]; let tmpString; profanity.forEach((profany) => { if (data[0].indexOf(profany) > -1) { tmpString = ""; for (let i = 0; i < profany.length; ++i) { if (i == 1) { tmpString += String.fromCharCode(0); } tmpString += profany[i]; } let re = new RegExp(profany, "g"); data[0] = data[0].replace(re, tmpString); } }); // FIX CHAT: data[0] = data[0].slice(0, 30); } } else if (type == "L") { // MAKE SAME CLAN: data[0] = data[0] + (String.fromCharCode(0).repeat(7)); data[0] = data[0].slice(0, 7); } else if (type == "M") { // APPLY CYAN COLOR: data[0].name = data[0].name == "" ? "?" : data[0].name; data[0].moofoll = true; data[0].skin = data[0].skin == 10 ? "__proto__" : data[0].skin; lastsp = [data[0].name, data[0].moofoll, data[0].skin]; } else if (type == "D") { if ((my.lastDir == data[0]) || [null, undefined].includes(data[0])) { dontSend = true; } else { my.lastDir = data[0]; } } else if (type == "d") { if (!data[2]) { dontSend = true; } else { if (![null, undefined].includes(data[1])) { my.lastDir = data[1]; } } } else if (type == "K") { if (!data[1]) { dontSend = true; } } else if (type == "S") { instaC.wait = !instaC.wait; dontSend = true; } else if (type == "f") { if (data[1]) { if (player.moveDir == data[0]) { dontSend = true; } player.moveDir = data[0]; } else { dontSend = true; } } if (!dontSend) { let binary = window.msgpack.encode([type, data]); this.nsend(binary); // START SECOND COUNT: if (!firstSend.sec) { firstSend.sec = true; setTimeout(() => { firstSend.sec = false; secPacket = 0; }, secTime); } secPacket++; // START MINUTE COUNT: if (!firstSend.min) { firstSend.min = true; setTimeout(() => { firstSend.min = false; minPacket = 0; }, minTime); } if (minPacket >= minMax) { minPacket = 0; } minPacket++; } } else { this.nsend(message); } } function packet(type) { // EXTRACT DATA ARRAY: let data = Array.prototype.slice.call(arguments, 1); // SEND MESSAGE: let binary = window.msgpack.encode([type, data]); WS.send(binary); } function origPacket(type) { // EXTRACT DATA ARRAY: let data = Array.prototype.slice.call(arguments, 1); // SEND MESSAGE: let binary = window.msgpack.encode([type, data]); WS.nsend(binary); } window.leave = function() { origPacket("kys", { "frvr is so bad": true, "sidney is too good": true, "dev are too weak": true, }); }; //...lol let io = { send: packet }; function getMessage(message) { let data = new Uint8Array(message.data); let parsed = window.msgpack.decode(data); let type = parsed[0]; data = parsed[1]; let events = { A: setInitData, // id: setInitData, //B: disconnect, C: setupGame, // 1: setupGame, D: addPlayer, // 2: addPlayer, E: removePlayer, // 4: removePlayer, a: updatePlayers, // 33: updatePlayers, G: updateLeaderboard, // 5: updateLeaderboard,here H: loadGameObject, // 6: loadGameObject, I: loadAI, // a: loadAI, J: animateAI, // aa: animateAI, K: gatherAnimation, // 7: gatherAnimation, L: wiggleGameObject, // 8: wiggleGameObject, M: shootTurret, // sp: shootTurret, N: updatePlayerValue, // 9: updatePlayerValue, O: updateHealth, // h: updateHealth,//here P: killPlayer, // 11: killPlayer, Q: killObject, // 12: killObject, R: killObjects, // 13: killObjects, S: updateItemCounts, // 14: updateItemCounts, T: updateAge, // 15: updateAge, U: updateUpgrades, // 16: updateUpgrades, V: updateItems, // 17: updateItems, X: addProjectile, // 18: addProjectile, Y: remProjectile, // 19: remProjectile, //Z: serverShutdownNotice, //0: addAlliance, //1: deleteAlliance, 2: allianceNotification, // an: allianceNotification, 3: setPlayerTeam, // st: setPlayerTeam, 4: setAlliancePlayers, // sa: setAlliancePlayers, 5: updateStoreItems, // us: updateStoreItems, 6: receiveChat, // ch: receiveChat, 7: updateMinimap, // mm: updateMinimap, 8: showText, // t: showText, 9: pingMap, // p: pingMap, 0: pingSocketResponse, }; if (type == "io-init") { socketID = data[0]; } else { if (events[type]) { events[type].apply(undefined, data); } } } // MATHS: Math.lerpAngle = function(value1, value2, amount) { let difference = Math.abs(value2 - value1); if (difference > Math.PI) { if (value1 > value2) { value2 += Math.PI * 2; } else { value1 += Math.PI * 2; } } let value = value2 + ((value1 - value2) * amount); if (value >= 0 && value <= Math.PI * 2) return value; return value % (Math.PI * 2); }; // REOUNDED RECTANGLE: CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) { if (w < 2 * r) r = w / 2; if (h < 2 * r) r = h / 2; if (r < 0) r = 0; this.beginPath(); this.moveTo(x + r, y); this.arcTo(x + w, y, x + w, y + h, r); this.arcTo(x + w, y + h, x, y + h, r); this.arcTo(x, y + h, x, y, r); this.arcTo(x, y, x + w, y, r); this.closePath(); return this; }; // GLOBAL VALUES: function resetMoveDir() { keys = {}; io.send("e"); } let allChats = []; let ticks = { tick: 0, delay: 0, time: [], manage: [], }; let ais = []; let players = []; let alliances = []; let alliancePlayers = []; let allianceNotifications = []; let gameObjects = []; let liztobj = []; let projectiles = []; let deadPlayers = []; let breakObjects = []; let player; let playerSID; let tmpObj; let enemy = []; let nears = []; let near = []; let my = { reloaded: false, waitHit: 0, autoAim: false, revAim: false, ageInsta: true, reSync: false, bullTick: 0, anti0Tick: 0, antiSync: false, safePrimary: function(tmpObj) { return [0, 8].includes(tmpObj.primaryIndex); }, safeSecondary: function(tmpObj) { return [10, 11, 14].includes(tmpObj.secondaryIndex); }, lastDir: 0, autoPush: false, pushData: {} } // FIND OBJECTS BY ID/SID: function findID(tmpObj, tmp) { return tmpObj.find((THIS) => THIS.id == tmp); } function findSID(tmpObj, tmp) { return tmpObj.find((THIS) => THIS.sid == tmp); } function findPlayerByID(id) { return findID(players, id); } function findPlayerBySID(sid) { return findSID(players, sid); } function findAIBySID(sid) { return findSID(ais, sid); } function findObjectBySid(sid) { return findSID(gameObjects, sid); } function findProjectileBySid(sid) { return findSID(gameObjects, sid); } let gameName = getEl("gameName"); gameName.innerText = "Chicken"; let adCard = getEl("adCard"); adCard.remove(); let promoImageHolder = getEl("promoImgHolder"); promoImageHolder.remove(); let chatButton = getEl("chatButton"); chatButton.remove(); let gameCanvas = getEl("gameCanvas"); let mainContext = gameCanvas.getContext("2d"); let mapDisplay = getEl("mapDisplay"); let mapContext = mapDisplay.getContext("2d"); mapDisplay.width = 300; mapDisplay.height = 300; let storeMenu = getEl("storeMenu"); let storeHolder = getEl("storeHolder"); let upgradeHolder = getEl("upgradeHolder"); let upgradeCounter = getEl("upgradeCounter"); let chatBox = getEl("chatBox"); chatBox.autocomplete = "off"; chatBox.style.textAlign = "center"; chatBox.style.width = "18em"; let chatHolder = getEl("chatHolder"); let actionBar = getEl("actionBar"); let leaderboardData = getEl("leaderboardData"); let itemInfoHolder = getEl("itemInfoHolder"); let menuCardHolder = getEl("menuCardHolder"); let mainMenu = getEl("mainMenu"); getEl("mainMenu").style.backgroundImage = "url('https://c1.wallpaperflare.com/preview/747/358/397/你的母亲-hart-night-view-thumbnail.jpg')"; let diedText = getEl("diedText"); let screenWidth; let screenHeight; let maxScreenWidth = config.maxScreenWidth; let maxScreenHeight = config.maxScreenHeight; let pixelDensity = 1; let delta; let now; let lastUpdate = performance.now(); let camX; let camY; let tmpDir; let mouseX = 0; let mouseY = 0; let allianceMenu = getEl("allianceMenu"); let waterMult = 1; let waterPlus = 0; let outlineColor = "#525252"; let darkOutlineColor = "#3d3f42"; let outlineWidth = 5.5; let firstSetup = true; let keys = {}; let moveKeys = { }; let attackState = 0; let inGame = false; let macro = {}; let mills = { place: 0, placeSpawnPads: 0 }; let lastDir; let lastLeaderboardData = []; // ON LOAD: let inWindow = true; window.onblur = function() { inWindow = false; }; window.onfocus = function() { inWindow = true; if (player && player.alive) { // resetMoveDir(); } }; let ms = { avg: 0, max: 0, min: 0, delay: 0 } function pingSocketResponse() { let pingTime = window.pingTime; const pingDisplay = document.getElementById("pingDisplay") pingDisplay.innerText = "Ping: " + pingTime + " ms | FPS: " + Math.round(fpsTimer.ltime); if (pingTime > ms.max || isNaN(ms.max)) { ms.max = pingTime; } if (pingTime < ms.min || isNaN(ms.min)) { ms.min = pingTime; } // if (pingTime >= 90) { // doAutoQ = true; // } else { // doAutoQ = false; // } } let placeVisible = []; /** CLASS CODES */ class Utils { constructor() { // MATH UTILS: let mathABS = Math.abs, mathCOS = Math.cos, mathSIN = Math.sin, mathPOW = Math.pow, mathSQRT = Math.sqrt, mathATAN2 = Math.atan2, mathPI = Math.PI; let _this = this; // GLOBAL UTILS: this.round = function(n, v) { return Math.round(n * v) / v; }; this.toRad = function(angle) { return angle * (mathPI / 180); }; this.toAng = function(radian) { return radian / (mathPI / 180); }; this.randInt = function(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }; this.randFloat = function(min, max) { return Math.random() * (max - min + 1) + min; }; this.lerp = function(value1, value2, amount) { return value1 + (value2 - value1) * amount; }; this.decel = function(val, cel) { if (val > 0) val = Math.max(0, val - cel); else if (val < 0) val = Math.min(0, val + cel); return val; }; this.getDistance = function(x1, y1, x2, y2) { return mathSQRT((x2 -= x1) * x2 + (y2 -= y1) * y2); }; this.getDist = function(tmp1, tmp2, type1, type2) { let tmpXY1 = { x: type1 == 0 ? tmp1.x : type1 == 1 ? tmp1.x1 : type1 == 2 ? tmp1.x2 : type1 == 3 && tmp1.x3, y: type1 == 0 ? tmp1.y : type1 == 1 ? tmp1.y1 : type1 == 2 ? tmp1.y2 : type1 == 3 && tmp1.y3, }; let tmpXY2 = { x: type2 == 0 ? tmp2.x : type2 == 1 ? tmp2.x1 : type2 == 2 ? tmp2.x2 : type2 == 3 && tmp2.x3, y: type2 == 0 ? tmp2.y : type2 == 1 ? tmp2.y1 : type2 == 2 ? tmp2.y2 : type2 == 3 && tmp2.y3, }; return mathSQRT((tmpXY2.x -= tmpXY1.x) * tmpXY2.x + (tmpXY2.y -= tmpXY1.y) * tmpXY2.y); }; this.getDirection = function(x1, y1, x2, y2) { return mathATAN2(y1 - y2, x1 - x2); }; this.getDirect = function(tmp1, tmp2, type1, type2) { let tmpXY1 = { x: type1 == 0 ? tmp1.x : type1 == 1 ? tmp1.x1 : type1 == 2 ? tmp1.x2 : type1 == 3 && tmp1.x3, y: type1 == 0 ? tmp1.y : type1 == 1 ? tmp1.y1 : type1 == 2 ? tmp1.y2 : type1 == 3 && tmp1.y3, }; let tmpXY2 = { x: type2 == 0 ? tmp2.x : type2 == 1 ? tmp2.x1 : type2 == 2 ? tmp2.x2 : type2 == 3 && tmp2.x3, y: type2 == 0 ? tmp2.y : type2 == 1 ? tmp2.y1 : type2 == 2 ? tmp2.y2 : type2 == 3 && tmp2.y3, }; return mathATAN2(tmpXY1.y - tmpXY2.y, tmpXY1.x - tmpXY2.x); }; this.getAngleDist = function(a, b) { let p = mathABS(b - a) % (mathPI * 2); return (p > mathPI ? (mathPI * 2) - p : p); }; this.isNumber = function(n) { return (typeof n == "number" && !isNaN(n) && isFinite(n)); }; this.isString = function(s) { return (s && typeof s == "string"); }; this.kFormat = function(num) { return num > 999 ? (num / 1000).toFixed(1) + "k" : num; }; this.sFormat = function(num) { let fixs = [{ num: 1e3, string: "k" }, { num: 1e6, string: "m" }, { num: 1e9, string: "b" }, { num: 1e12, string: "q" } ].reverse(); let sp = fixs.find(v => num >= v.num); if (!sp) return num; return (num / sp.num).toFixed(1) + sp.string; }; this.capitalizeFirst = function(string) { return string.charAt(0).toUpperCase() + string.slice(1); }; this.fixTo = function(n, v) { return parseFloat(n.toFixed(v)); }; this.sortByPoints = function(a, b) { return parseFloat(b.points) - parseFloat(a.points); }; this.lineInRect = function(recX, recY, recX2, recY2, x1, y1, x2, y2) { let minX = x1; let maxX = x2; if (x1 > x2) { minX = x2; maxX = x1; } if (maxX > recX2) maxX = recX2; if (minX < recX) minX = recX; if (minX > maxX) return false; let minY = y1; let maxY = y2; let dx = x2 - x1; if (Math.abs(dx) > 0.0000001) { let a = (y2 - y1) / dx; let b = y1 - a * x1; minY = a * minX + b; maxY = a * maxX + b; } if (minY > maxY) { let tmp = maxY; maxY = minY; minY = tmp; } if (maxY > recY2) maxY = recY2; if (minY < recY) minY = recY; if (minY > maxY) return false; return true; }; this.containsPoint = function(element, x, y) { let bounds = element.getBoundingClientRect(); let left = bounds.left + window.scrollX; let top = bounds.top + window.scrollY; let width = bounds.width; let height = bounds.height; let insideHorizontal = x > left && x < left + width; let insideVertical = y > top && y < top + height; return insideHorizontal && insideVertical; }; this.mousifyTouchEvent = function(event) { let touch = event.changedTouches[0]; event.screenX = touch.screenX; event.screenY = touch.screenY; event.clientX = touch.clientX; event.clientY = touch.clientY; event.pageX = touch.pageX; event.pageY = touch.pageY; }; this.hookTouchEvents = function(element, skipPrevent) { let preventDefault = !skipPrevent; let isHovering = false; // let passive = window.Modernizr.passiveeventlisteners ? {passive: true} : false; let passive = false; element.addEventListener("touchstart", this.checkTrusted(touchStart), passive); element.addEventListener("touchmove", this.checkTrusted(touchMove), passive); element.addEventListener("touchend", this.checkTrusted(touchEnd), passive); element.addEventListener("touchcancel", this.checkTrusted(touchEnd), passive); element.addEventListener("touchleave", this.checkTrusted(touchEnd), passive); function touchStart(e) { _this.mousifyTouchEvent(e); window.setUsingTouch(true); if (preventDefault) { e.preventDefault(); e.stopPropagation(); } if (element.onmouseover) element.onmouseover(e); isHovering = true; } function touchMove(e) { _this.mousifyTouchEvent(e); window.setUsingTouch(true); if (preventDefault) { e.preventDefault(); e.stopPropagation(); } if (_this.containsPoint(element, e.pageX, e.pageY)) { if (!isHovering) { if (element.onmouseover) element.onmouseover(e); isHovering = true; } } else { if (isHovering) { if (element.onmouseout) element.onmouseout(e); isHovering = false; } } } function touchEnd(e) { _this.mousifyTouchEvent(e); window.setUsingTouch(true); if (preventDefault) { e.preventDefault(); e.stopPropagation(); } if (isHovering) { if (element.onclick) element.onclick(e); if (element.onmouseout) element.onmouseout(e); isHovering = false; } } }; this.removeAllChildren = function(element) { while (element.hasChildNodes()) { element.removeChild(element.lastChild); } }; this.generateElement = function(config) { let element = document.createElement(config.tag || "div"); function bind(configValue, elementValue) { if (config[configValue]) element[elementValue] = config[configValue]; } bind("text", "textContent"); bind("html", "innerHTML"); bind("class", "className"); for (let key in config) { switch (key) { case "tag": case "text": case "html": case "class": case "style": case "hookTouch": case "parent": case "children": continue; default: break; } element[key] = config[key]; } if (element.onclick) element.onclick = this.checkTrusted(element.onclick); if (element.onmouseover) element.onmouseover = this.checkTrusted(element.onmouseover); if (element.onmouseout) element.onmouseout = this.checkTrusted(element.onmouseout); if (config.style) { element.style.cssText = config.style; } if (config.hookTouch) { this.hookTouchEvents(element); } if (config.parent) { config.parent.appendChild(element); } if (config.children) { for (let i = 0; i < config.children.length; i++) { element.appendChild(config.children[i]); } } return element; }; this.checkTrusted = function(callback) { return function(ev) { if (ev && ev instanceof Event && (ev && typeof ev.isTrusted == "boolean" ? ev.isTrusted : true)) { callback(ev); } else { //console.error("Event is not trusted.", ev); } }; }; this.randomString = function(length) { let text = ""; let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (let i = 0; i < length; i++) { text += possible.charAt(Math.floor(Math.random() * possible.length)); } return text; }; this.countInArray = function(array, val) { let count = 0; for (let i = 0; i < array.length; i++) { if (array[i] === val) count++; } return count; }; this.hexToRgb = function(hex) { return hex.slice(1).match(/.{1,2}/g).map(g => parseInt(g, 16)); }; this.getRgb = function(r, g, b) { return [r / 255, g / 255, b / 255].join(", "); }; } }; class Animtext { // ANIMATED TEXT: constructor() { // INIT: this.init = function(x, y, scale, speed, life, text, color) { (this.x = x), (this.y = y), (this.color = color), (this.scale = scale*3.5), (this.weight = 50); (this.startScale = this.scale * 1.2), (this.maxScale = 1.5 * scale), (this.minScale = 0.5 * scale), (this.scaleSpeed = 0.7), (this.speed = speed), (this.speedMax = speed), (this.life = life), (this.maxLife = life), (this.text = text), this.movSpeed = speed; }; // UPDATE: this.update = function(delta) { if(this.life){ this.life -= delta; if(this.scaleSpeed != -0.35){ this.y -= this.speed * delta; // (this.x += this.speed * delta); } else { this.y -= this.speed * delta; } this.scale -= .8; // this.scale > 0.35 && (this.scale = Math.max(this.scale, this.startScale)); // this.speed < this.speedMax && (this.speed -= this.speedMax * .0075); if(this.scale >= this.maxScale){ this.scale = this.maxScale; this.scaleSpeed *= -.5; this.speed = this.speed * .75; }; this.life <= 0 && (this.life = 0) }; }; // RENDER: this.render = function(ctxt, xOff, yOff) { ctxt.lineWidth = 10; ctxt.strokeStyle = darkOutlineColor; //"black"; ctxt.fillStyle = this.color; ctxt.globalAlpha = 1; ctxt.font = this.scale + "px HammerSmith One"; ctxt.strokeText(this.text, this.x - xOff, this.y - yOff); ctxt.fillText(this.text, this.x - xOff, this.y - yOff); ctxt.globalAlpha = 1; }; } }; class Textmanager { // TEXT MANAGER: constructor() { this.texts = []; this.stack = []; // UPDATE: this.update = function(delta, ctxt, xOff, yOff) { ctxt.textBaseline = "middle"; ctxt.textAlign = "center"; for (let i = this.texts.length - 1; i >= 0; --i) { if (this.texts[i].life > 0) { this.texts[i].update(delta); this.texts[i].render(ctxt, xOff, yOff); } else { this.texts.splice(i, 1); } } }; // SHOW TEXT: this.showText = function(x, y, scale, speed, life, text, color) { let tmpText; for (let i = 0; i < this.texts.length; ++i) { if (!this.texts[i].life) { tmpText = this.texts[i]; break; } } if (!tmpText) { tmpText = new Animtext(); this.texts.push(tmpText); } tmpText.init(x, y, scale, speed, life, text, color); }; } } class Items { constructor() { // ITEM GROUPS: this.groups = [{ id: 0, name: "food", layer: 0 }, { id: 1, name: "walls", place: true, limit: 30, layer: 0 }, { id: 2, name: "spikes", place: true, limit: 15, layer: 0 }, { id: 3, name: "mill", place: true, limit: 7, layer: 1 }, { id: 4, name: "mine", place: true, limit: 1, layer: 0 }, { id: 5, name: "trap", place: true, limit: 6, layer: -1 }, { id: 6, name: "booster", place: true, limit: 12, layer: -1 }, { id: 7, name: "turret", place: true, limit: 2, layer: 1 }, { id: 8, name: "watchtower", place: true, limit: 12, layer: 1 }, { id: 9, name: "buff", place: true, limit: 4, layer: -1 }, { id: 10, name: "spawn", place: true, limit: 1, layer: -1 }, { id: 11, name: "sapling", place: true, limit: 2, layer: 0 }, { id: 12, name: "blocker", place: true, limit: 3, layer: -1 }, { id: 13, name: "teleporter", place: true, limit: 2, layer: -1 }]; // PROJECTILES: this.projectiles = [{ indx: 0, layer: 0, src: "arrow_1", dmg: 25, speed: 1.6, scale: 103, range: 1000 }, { indx: 1, layer: 1, dmg: 25, scale: 20 }, { indx: 0, layer: 0, src: "arrow_1", dmg: 35, speed: 2.5, scale: 103, range: 1200 }, { indx: 0, layer: 0, src: "arrow_1", dmg: 30, speed: 2, scale: 103, range: 1200 }, { indx: 1, layer: 1, dmg: 16, scale: 20 }, { indx: 0, layer: 0, src: "bullet_1", dmg: 50, speed: 3.6, scale: 160, range: 1400 }]; // WEAPONS: this.weapons = [{ id: 0, type: 0, name: "tool hammer", desc: "tool for gathering all resources", src: "hammer_1", length: 140, width: 140, xOff: -3, yOff: 18, dmg: 25, range: 65, gather: 1, speed: 300 }, { id: 1, type: 0, age: 2, name: "hand axe", desc: "gathers resources at a higher rate", src: "axe_1", length: 140, width: 140, xOff: 3, yOff: 24, dmg: 30, spdMult: 1, range: 70, gather: 2, speed: 400 }, { id: 2, type: 0, age: 8, pre: 1, name: "great axe", desc: "deal more damage and gather more resources", src: "great_axe_1", length: 140, width: 140, xOff: -8, yOff: 25, dmg: 35, spdMult: 1, range: 75, gather: 4, speed: 400 }, { id: 3, type: 0, age: 2, name: "short sword", desc: "increased attack power but slower move speed", src: "sword_1", iPad: 1.3, length: 130, width: 210, xOff: -8, yOff: 46, dmg: 35, spdMult: 0.85, range: 110, gather: 1, speed: 300 }, { id: 4, type: 0, age: 8, pre: 3, name: "katana", desc: "greater range and damage", src: "samurai_1", iPad: 1.3, length: 130, width: 210, xOff: -8, yOff: 59, dmg: 40, spdMult: 0.8, range: 118, gather: 1, speed: 300 }, { id: 5, type: 0, age: 2, name: "polearm", desc: "long range melee weapon", src: "spear_1", iPad: 1.3, length: 130, width: 210, xOff: -8, yOff: 53, dmg: 45, knock: 0.2, spdMult: 0.82, range: 142, gather: 1, speed: 700 }, { id: 6, type: 0, age: 2, name: "bat", desc: "fast long range melee weapon", src: "bat_1", iPad: 1.3, length: 110, width: 180, xOff: -8, yOff: 53, dmg: 20, knock: 0.7, range: 110, gather: 1, speed: 300 }, { id: 7, type: 0, age: 2, name: "daggers", desc: "really fast short range weapon", src: "dagger_1", iPad: 0.8, length: 110, width: 110, xOff: 18, yOff: 0, dmg: 20, knock: 0.1, range: 65, gather: 1, hitSlow: 0.1, spdMult: 1.13, speed: 100 }, { id: 8, type: 0, age: 2, name: "stick", desc: "great for gathering but very weak", src: "stick_1", length: 140, width: 140, xOff: 3, yOff: 24, dmg: 1, spdMult: 1, range: 70, gather: 7, speed: 400 }, { id: 9, type: 1, age: 6, name: "hunting bow", desc: "bow used for ranged combat and hunting", src: "bow_1", req: ["wood", 4], length: 120, width: 120, xOff: -6, yOff: 0, Pdmg: 25, projectile: 0, spdMult: 0.75, speed: 600 }, { id: 10, type: 1, age: 6, name: "great hammer", desc: "hammer used for destroying structures", src: "great_hammer_1", length: 140, width: 140, xOff: -9, yOff: 25, dmg: 10, Pdmg: 10, spdMult: 0.88, range: 75, sDmg: 7.5, gather: 1, speed: 400 }, { id: 11, type: 1, age: 6, name: "wooden shield", desc: "blocks projectiles and reduces melee damage", src: "shield_1", length: 120, width: 120, shield: 0.2, xOff: 6, yOff: 0, Pdmg: 0, spdMult: 0.7 }, { id: 12, type: 1, age: 8, pre: 9, name: "crossbow", desc: "deals more damage and has greater range", src: "crossbow_1", req: ["wood", 5], aboveHand: true, armS: 0.75, length: 120, width: 120, xOff: -4, yOff: 0, Pdmg: 35, projectile: 2, spdMult: 0.7, speed: 700 }, { id: 13, type: 1, age: 9, pre: 12, name: "repeater crossbow", desc: "high firerate crossbow with reduced damage", src: "crossbow_2", req: ["wood", 10], aboveHand: true, armS: 0.75, length: 120, width: 120, xOff: -4, yOff: 0, Pdmg: 30, projectile: 3, spdMult: 0.7, speed: 230 }, { id: 14, type: 1, age: 6, name: "mc grabby", desc: "steals resources from enemies", src: "grab_1", length: 130, width: 210, xOff: -8, yOff: 53, dmg: 0, Pdmg: 0, steal: 250, knock: 0.2, spdMult: 1.05, range: 125, gather: 0, speed: 700 }, { id: 15, type: 1, age: 9, pre: 12, name: "musket", desc: "slow firerate but high damage and range", src: "musket_1", req: ["stone", 10], aboveHand: true, rec: 0.35, armS: 0.6, hndS: 0.3, hndD: 1.6, length: 205, width: 205, xOff: 25, yOff: 0, Pdmg: 50, projectile: 5, hideProjectile: true, spdMult: 0.6, speed: 1500 }]; // ITEMS: this.list = [{ group: this.groups[0], name: "apple", desc: "restores 20 health when consumed", req: ["food", 10], consume: function(doer) { return doer.changeHealth(20, doer); }, scale: 22, holdOffset: 15, healing: 20, itemID: 0, itemAID: 16, }, { age: 3, group: this.groups[0], name: "cookie", desc: "restores 40 health when consumed", req: ["food", 15], consume: function(doer) { return doer.changeHealth(40, doer); }, scale: 27, holdOffset: 15, healing: 40, itemID: 1, itemAID: 17, }, { age: 7, group: this.groups[0], name: "cheese", desc: "restores 30 health and another 50 over 5 seconds", req: ["food", 25], consume: function(doer) { if (doer.changeHealth(30, doer) || doer.health < 100) { doer.dmgOverTime.dmg = -10; doer.dmgOverTime.doer = doer; doer.dmgOverTime.time = 5; return true; } return false; }, scale: 27, holdOffset: 15, healing: 30, itemID: 2, itemAID: 18, }, { group: this.groups[1], name: "wood wall", desc: "provides protection for your village", req: ["wood", 10], projDmg: true, health: 380, scale: 50, holdOffset: 20, placeOffset: -5, itemID: 3, itemAID: 19, }, { age: 3, group: this.groups[1], name: "stone wall", desc: "provides improved protection for your village", req: ["stone", 25], health: 900, scale: 50, holdOffset: 20, placeOffset: -5, itemID: 4, itemAID: 20, }, { age: 7, group: this.groups[1], name: "castle wall", desc: "provides powerful protection for your village", req: ["stone", 35], health: 1500, scale: 52, holdOffset: 20, placeOffset: -5, itemID: 5, itemAID: 21, }, { group: this.groups[2], name: "spikes", desc: "damages enemies when they touch them", req: ["wood", 20, "stone", 5], health: 400, dmg: 20, scale: 49, spritePadding: -23, holdOffset: 8, placeOffset: -5, itemID: 6, itemAID: 22, shadow: { offsetX: 5, // Adjust the shadow's X offset as needed offsetY: 5, // Adjust the shadow's Y offset as needed blur: 20, // Adjust the shadow's blur as needed color: "rgba(0, 0, 0, 0.5)" // Adjust the shadow's color and transparency as needed } }, { age: 5, group: this.groups[2], name: "greater spikes", desc: "damages enemies when they touch them", req: ["wood", 30, "stone", 10], health: 500, dmg: 35, scale: 52, spritePadding: -23, holdOffset: 8, placeOffset: -5, itemID: 7, itemAID: 23, }, { age: 9, group: this.groups[2], name: "poison spikes", desc: "poisons enemies when they touch them", req: ["wood", 35, "stone", 15], health: 600, dmg: 30, pDmg: 5, scale: 52, spritePadding: -23, holdOffset: 8, placeOffset: -5, itemID: 8, itemAID: 24, }, { age: 9, group: this.groups[2], name: "spinning spikes", desc: "damages enemies when they touch them", req: ["wood", 30, "stone", 20], health: 500, dmg: 45, turnSpeed: 0.003, scale: 52, spritePadding: -23, holdOffset: 8, placeOffset: -5, itemID: 9, itemAID: 25, }, { group: this.groups[3], name: "windmill", desc: "generates gold over time", req: ["wood", 50, "stone", 10], health: 400, pps: 1, turnSpeed: 0.0016, spritePadding: 25, iconLineMult: 12, scale: 45, holdOffset: 20, placeOffset: 5, itemID: 10, itemAID: 26, }, { age: 5, group: this.groups[3], name: "faster windmill", desc: "generates more gold over time", req: ["wood", 60, "stone", 20], health: 500, pps: 1.5, turnSpeed: 0.0025, spritePadding: 25, iconLineMult: 12, scale: 47, holdOffset: 20, placeOffset: 5, itemID: 11, itemAID: 27, }, { age: 8, group: this.groups[3], name: "power mill", desc: "generates more gold over time", req: ["wood", 100, "stone", 50], health: 800, pps: 2, turnSpeed: 0.005, spritePadding: 25, iconLineMult: 12, scale: 47, holdOffset: 20, placeOffset: 5, itemID: 12, itemAID: 28, }, { age: 5, group: this.groups[4], type: 2, name: "mine", desc: "allows you to mine stone", req: ["wood", 20, "stone", 100], iconLineMult: 12, scale: 65, holdOffset: 20, placeOffset: 0, itemID: 13, itemAID: 29, }, { age: 5, group: this.groups[11], type: 0, name: "sapling", desc: "allows you to farm wood", req: ["wood", 150], iconLineMult: 12, colDiv: 0.5, scale: 110, holdOffset: 50, placeOffset: -15, itemID: 14, itemAID: 30, }, { age: 4, group: this.groups[5], name: "pit trap", desc: "pit that traps enemies if they walk over it", req: ["wood", 30, "stone", 30], trap: true, ignoreCollision: true, hideFromEnemy: true, health: 500, colDiv: 0.2, scale: 50, holdOffset: 20, placeOffset: -5, alpha: 0.6, itemID: 15, itemAID: 31, }, { age: 4, group: this.groups[6], name: "boost pad", desc: "provides boost when stepped on", req: ["stone", 20, "wood", 5], ignoreCollision: true, boostSpeed: 1.5, health: 150, colDiv: 0.7, scale: 45, holdOffset: 20, placeOffset: -5, itemID: 16, itemAID: 32, }, { age: 7, group: this.groups[7], doUpdate: true, name: "turret", desc: "defensive structure that shoots at enemies", req: ["wood", 200, "stone", 150], health: 800, projectile: 1, shootRange: 700, shootRate: 2200, scale: 43, holdOffset: 20, placeOffset: -5, itemID: 17, itemAID: 33, }, { age: 7, group: this.groups[8], name: "platform", desc: "platform to shoot over walls and cross over water", req: ["wood", 20], ignoreCollision: true, zIndex: 1, health: 300, scale: 43, holdOffset: 20, placeOffset: -5, itemID: 18, itemAID: 34, }, { age: 7, group: this.groups[9], name: "healing pad", desc: "standing on it will slowly heal you", req: ["wood", 30, "food", 10], ignoreCollision: true, healCol: 15, health: 400, colDiv: 0.7, scale: 45, holdOffset: 20, placeOffset: -5, itemID: 19, itemAID: 35, }, { age: 9, group: this.groups[10], name: "spawn pad", desc: "you will spawn here when you die but it will dissapear", req: ["wood", 100, "stone", 100], health: 400, ignoreCollision: true, spawnPoint: true, scale: 45, holdOffset: 20, placeOffset: -5, itemID: 20, itemAID: 36, }, { age: 7, group: this.groups[12], name: "blocker", desc: "blocks building in radius", req: ["wood", 30, "stone", 25], ignoreCollision: true, blocker: 300, health: 400, colDiv: 0.7, scale: 45, holdOffset: 20, placeOffset: -5, itemID: 21, itemAID: 37, }, { age: 7, group: this.groups[13], name: "teleporter", desc: "teleports you to a random point on the map", req: ["wood", 60, "stone", 60], ignoreCollision: true, teleport: true, health: 200, colDiv: 0.7, scale: 45, holdOffset: 20, placeOffset: -5, itemID: 22, itemAID: 38 }]; // CHECK ITEM ID: this.checkItem = { index: function(id, myItems) { return [0, 1, 2].includes(id) ? 0 : [3, 4, 5].includes(id) ? 1 : [6, 7, 8, 9].includes(id) ? 2 : [10, 11, 12].includes(id) ? 3 : [13, 14].includes(id) ? 5 : [15, 16].includes(id) ? 4 : [17, 18, 19, 21, 22].includes(id) ? [13, 14].includes(myItems) ? 6 : 5 : id == 20 ? [13, 14].includes(myItems) ? 7 : 6 : undefined; } } // ASSIGN IDS: for (let i = 0; i < this.list.length; ++i) { this.list[i].id = i; if (this.list[i].pre) this.list[i].pre = i - this.list[i].pre; } // TROLOLOLOL: if (typeof window !== "undefined") { function shuffle(a) { for (let i = a.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } return a; } //shuffle(this.list); } } } class GameObject { constructor(sid) { this.sid = sid; this.init = function(x, y, dir, scale, type, data, owner) { data = data || {}; this.sentTo = {}; this.gridLocations = []; this.active = true; this.alive = true; this.doUpdate = data.doUpdate; this.x = x; this.y = y; if (config.anotherVisual) { this.dir = dir + Math.PI; } else { this.dir = dir; } this.lastDir = dir; this.xWiggle = 0; this.yWiggle = 0; this.visScale = scale; this.scale = scale; this.type = type; this.id = data.id; this.owner = owner; this.name = data.name; this.isItem = (this.id != undefined); this.group = data.group; this.maxHealth = data.health; this.health = this.maxHealth; this.healthMov = 100; this.layer = 2; if (this.group != undefined) { this.layer = this.group.layer; } else if (this.type == 0) { this.layer = 3; } else if (this.type == 2) { this.layer = 0; } else if (this.type == 4) { this.layer = -1; } this.colDiv = data.colDiv || 1; this.blocker = data.blocker; this.ignoreCollision = data.ignoreCollision; this.dontGather = data.dontGather; this.hideFromEnemy = data.hideFromEnemy; this.friction = data.friction; this.projDmg = data.projDmg; this.dmg = data.dmg; this.pDmg = data.pDmg; this.pps = data.pps; this.zIndex = data.zIndex || 0; this.turnSpeed = data.turnSpeed; this.req = data.req; this.trap = data.trap; this.healCol = data.healCol; this.teleport = data.teleport; this.boostSpeed = data.boostSpeed; this.projectile = data.projectile; this.shootRange = data.shootRange; this.shootRate = data.shootRate; this.shootCount = this.shootRate; this.spawnPoint = data.spawnPoint; this.onNear = 0; this.breakObj = false; this.alpha = data.alpha || 1; this.maxAlpha = data.alpha || 1; this.damaged = 0; }; this.changeHealth = function(amount, doer) { this.health += amount; return (this.health <= 0); }; this.getScale = function(sM, ig) { sM = sM || 1; return this.scale * ((this.isItem || this.type == 2 || this.type == 3 || this.type == 4) ? 1 : (0.6 * sM)) * (ig ? 1 : this.colDiv); }; this.visibleToPlayer = function(player) { return !(this.hideFromEnemy) || (this.owner && (this.owner == player || (this.owner.team && player.team == this.owner.team))); }; this.update = function(delta) { if (this.health != this.healthMov) { this.health < this.healthMov ? (this.healthMov -= 1.9) : (this.healthMov += 1.9); if (Math.abs(this.health - this.healthMov) < 1.9) this.healthMov = this.health; }; if (this.active) { if (this.xWiggle) { this.xWiggle *= Math.pow(0.99, delta); } if (this.yWiggle) { this.yWiggle *= Math.pow(0.99, delta); } if (!this.dmg) { let d2 = UTILS.getAngleDist(this.lastDir, this.dir); if (d2 > 0.01) { this.dir += d2 / 5; } else { this.dir = this.lastDir; } } else { if (this.turnSpeed && this.dmg) { this.dir += this.turnSpeed * delta; } } } else { if (this.alive) { this.alpha -= delta / (200 / this.maxAlpha); this.visScale += delta / (this.scale / 2.5); if (this.alpha <= 0) { this.alpha = 0; this.alive = false; } } } }; this.isTeamObject = function(tmpObj) { return this.owner == null ? true : (this.owner && tmpObj.sid == this.owner.sid || tmpObj.findAllianceBySid(this.owner.sid)); }; } } class Objectmanager { constructor(GameObject, gameObjects, UTILS, config, players, server) { let mathFloor = Math.floor, mathABS = Math.abs, mathCOS = Math.cos, mathSIN = Math.sin, mathPOW = Math.pow, mathSQRT = Math.sqrt; this.ignoreAdd = false; this.hitObj = []; this.disableObj = function(obj) { obj.active = false; }; let tmpObj; this.add = function(sid, x, y, dir, s, type, data, setSID, owner) { tmpObj = findObjectBySid(sid); if (!tmpObj) { tmpObj = gameObjects.find((tmp) => !tmp.active); if (!tmpObj) { tmpObj = new GameObject(sid); gameObjects.push(tmpObj); } } if (setSID) { tmpObj.sid = sid; } tmpObj.init(x, y, dir, s, type, data, owner); }; this.disableBySid = function(sid) { let find = findObjectBySid(sid); if (find) { this.disableObj(find); } }; this.removeAllItems = function(sid, server) { gameObjects.filter((tmp) => tmp.active && tmp.owner && tmp.owner.sid == sid).forEach((tmp) => this.disableObj(tmp)); }; this.checkItemLocation = function(x, y, s, sM, indx, ignoreWater, placer) { let cantPlace = gameObjects.find((tmp) => tmp.active && UTILS.getDistance(x, y, tmp.x, tmp.y) < s + (tmp.blocker ? tmp.blocker : tmp.getScale(sM, tmp.isItem))); if (cantPlace) return false; if (!ignoreWater && indx != 18 && y >= config.mapScale / 2 - config.riverWidth / 2 && y <= config.mapScale / 2 + config.riverWidth / 2) return false; return true; }; } } class Projectile { constructor(players, ais, objectManager, items, config, UTILS, server) { // INIT: this.init = function(indx, x, y, dir, spd, dmg, rng, scl, owner) { this.active = true; this.tickActive = true; this.indx = indx; this.x = x; this.y = y; this.x2 = x; this.y2 = y; this.dir = dir; this.skipMov = true; this.speed = spd; this.dmg = dmg; this.scale = scl; this.range = rng; this.r2 = rng; this.owner = owner; }; // UPDATE: this.update = function(delta) { if (this.active) { let tmpSpeed = this.speed * delta; if (!this.skipMov) { this.x += tmpSpeed * Math.cos(this.dir); this.y += tmpSpeed * Math.sin(this.dir); this.range -= tmpSpeed; if (this.range <= 0) { this.x += this.range * Math.cos(this.dir); this.y += this.range * Math.sin(this.dir); tmpSpeed = 1; this.range = 0; this.active = false; } } else { this.skipMov = false; } } }; this.tickUpdate = function(delta) { if (this.tickActive) { let tmpSpeed = this.speed * delta; if (!this.skipMov) { this.x2 += tmpSpeed * Math.cos(this.dir); this.y2 += tmpSpeed * Math.sin(this.dir); this.r2 -= tmpSpeed; if (this.r2 <= 0) { this.x2 += this.r2 * Math.cos(this.dir); this.y2 += this.r2 * Math.sin(this.dir); tmpSpeed = 1; this.r2 = 0; this.tickActive = false; } } else { this.skipMov = false; } } }; } }; class Store { constructor() { // STORE HATS: this.hats = [{ id: 45, name: "Shame!", dontSell: true, price: 0, scale: 120, desc: "hacks are for winners" }, { id: 51, name: "Moo Cap", price: 0, scale: 120, desc: "coolest mooer around" }, { id: 50, name: "Apple Cap", price: 0, scale: 120, desc: "apple farms remembers" }, { id: 28, name: "Moo Head", price: 0, scale: 120, desc: "no effect" }, { id: 29, name: "Pig Head", price: 0, scale: 120, desc: "no effect" }, { id: 30, name: "Fluff Head", price: 0, scale: 120, desc: "no effect" }, { id: 36, name: "Pandou Head", price: 0, scale: 120, desc: "no effect" }, { id: 37, name: "Bear Head", price: 0, scale: 120, desc: "no effect" }, { id: 38, name: "Monkey Head", price: 0, scale: 120, desc: "no effect" }, { id: 44, name: "Polar Head", price: 0, scale: 120, desc: "no effect" }, { id: 35, name: "Fez Hat", price: 0, scale: 120, desc: "no effect" }, { id: 42, name: "Enigma Hat", price: 0, scale: 120, desc: "join the enigma army" }, { id: 43, name: "Blitz Hat", price: 0, scale: 120, desc: "hey everybody i'm blitz" }, { id: 49, name: "Bob XIII Hat", price: 0, scale: 120, desc: "like and subscribe" }, { id: 57, name: "Pumpkin", price: 50, scale: 120, desc: "Spooooky" }, { id: 8, name: "Bummle Hat", price: 100, scale: 120, desc: "no effect" }, { id: 2, name: "Straw Hat", price: 500, scale: 120, desc: "no effect" }, { id: 15, name: "Winter Cap", price: 600, scale: 120, desc: "allows you to move at normal speed in snow", coldM: 1 }, { id: 5, name: "Cowboy Hat", price: 1000, scale: 120, desc: "no effect" }, { id: 4, name: "Ranger Hat", price: 2000, scale: 120, desc: "no effect" }, { id: 18, name: "Explorer Hat", price: 2000, scale: 120, desc: "no effect" }, { id: 31, name: "Flipper Hat", price: 2500, scale: 120, desc: "have more control while in water", watrImm: true }, { id: 1, name: "Marksman Cap", price: 3000, scale: 120, desc: "increases arrow speed and range", aMlt: 1.3 }, { id: 10, name: "Bush Gear", price: 3000, scale: 160, desc: "allows you to disguise yourself as a bush" }, { id: 48, name: "Halo", price: 3000, scale: 120, desc: "no effect" }, { id: 6, name: "Soldier Helmet", price: 4000, scale: 120, desc: "reduces damage taken but slows movement", spdMult: 0.94, dmgMult: 0.75 }, { id: 23, name: "Anti Venom Gear", price: 4000, scale: 120, desc: "makes you immune to poison", poisonRes: 1 }, { id: 13, name: "Medic Gear", price: 5000, scale: 110, desc: "slowly regenerates health over time", healthRegen: 3 }, { id: 9, name: "Miners Helmet", price: 5000, scale: 120, desc: "earn 1 extra gold per resource", extraGold: 1 }, { id: 32, name: "Musketeer Hat", price: 5000, scale: 120, desc: "reduces cost of projectiles", projCost: 0.5 }, { id: 7, name: "Bull Helmet", price: 6000, scale: 120, desc: "increases damage done but drains health", healthRegen: -5, dmgMultO: 1.5, spdMult: 0.96 }, { id: 22, name: "Emp Helmet", price: 6000, scale: 120, desc: "turrets won't attack but you move slower", antiTurret: 1, spdMult: 0.7 }, { id: 12, name: "Booster Hat", price: 6000, scale: 120, desc: "increases your movement speed", spdMult: 1.16 }, { id: 26, name: "Barbarian Armor", price: 8000, scale: 120, desc: "knocks back enemies that attack you", dmgK: 0.6 }, { id: 21, name: "Plague Mask", price: 10000, scale: 120, desc: "melee attacks deal poison damage", poisonDmg: 5, poisonTime: 6 }, { id: 46, name: "Bull Mask", price: 10000, scale: 120, desc: "bulls won't target you unless you attack them", bullRepel: 1 }, { id: 14, name: "Windmill Hat", topSprite: true, price: 10000, scale: 120, desc: "generates points while worn", pps: 1.5 }, { id: 11, name: "Spike Gear", topSprite: true, price: 10000, scale: 120, desc: "deal damage to players that damage you", dmg: 0.45 }, { id: 53, name: "Turret Gear", topSprite: true, price: 10000, scale: 120, desc: "you become a walking turret", turret: { proj: 1, range: 700, rate: 2500 }, spdMult: 0.7 }, { id: 20, name: "Samurai Armor", price: 12000, scale: 120, desc: "increased attack speed and fire rate", atkSpd: 0.78 }, { id: 58, name: "Dark Knight", price: 12000, scale: 120, desc: "restores health when you deal damage", healD: 0.4 }, { id: 27, name: "Scavenger Gear", price: 15000, scale: 120, desc: "earn double points for each kill", kScrM: 2 }, { id: 40, name: "Tank Gear", price: 15000, scale: 120, desc: "increased damage to buildings but slower movement", spdMult: 0.3, bDmg: 3.3 }, { id: 52, name: "Thief Gear", price: 15000, scale: 120, desc: "steal half of a players gold when you kill them", goldSteal: 0.5 }, { id: 55, name: "Bloodthirster", price: 20000, scale: 120, desc: "Restore Health when dealing damage. And increased damage", healD: 0.25, dmgMultO: 1.2, }, { id: 56, name: "Assassin Gear", price: 20000, scale: 120, desc: "Go invisible when not moving. Can't eat. Increased speed", noEat: true, spdMult: 1.1, invisTimer: 1000 }]; // STORE ACCESSORIES: this.accessories = [{ id: 12, name: "Snowball", price: 1000, scale: 105, xOff: 18, desc: "no effect" }, { id: 9, name: "Tree Cape", price: 1000, scale: 90, desc: "no effect" }, { id: 10, name: "Stone Cape", price: 1000, scale: 90, desc: "no effect" }, { id: 3, name: "Cookie Cape", price: 1500, scale: 90, desc: "no effect" }, { id: 8, name: "Cow Cape", price: 2000, scale: 90, desc: "no effect" }, { id: 11, name: "Monkey Tail", price: 2000, scale: 97, xOff: 25, desc: "Super speed but reduced damage", spdMult: 1.35, dmgMultO: 0.2 }, { id: 17, name: "Apple Basket", price: 3000, scale: 80, xOff: 12, desc: "slowly regenerates health over time", healthRegen: 1 }, { id: 6, name: "Winter Cape", price: 3000, scale: 90, desc: "no effect" }, { id: 4, name: "Skull Cape", price: 4000, scale: 90, desc: "no effect" }, { id: 5, name: "Dash Cape", price: 5000, scale: 90, desc: "no effect" }, { id: 2, name: "Dragon Cape", price: 6000, scale: 90, desc: "no effect" }, { id: 1, name: "Super Cape", price: 8000, scale: 90, desc: "no effect" }, { id: 7, name: "Troll Cape", price: 8000, scale: 90, desc: "no effect" }, { id: 14, name: "Thorns", price: 10000, scale: 115, xOff: 20, desc: "no effect" }, { id: 15, name: "Blockades", price: 10000, scale: 95, xOff: 15, desc: "no effect" }, { id: 20, name: "Devils Tail", price: 10000, scale: 95, xOff: 20, desc: "no effect" }, { id: 16, name: "Sawblade", price: 12000, scale: 90, spin: true, xOff: 0, desc: "deal damage to players that damage you", dmg: 0.15 }, { id: 13, name: "Angel Wings", price: 15000, scale: 138, xOff: 22, desc: "slowly regenerates health over time", healthRegen: 3 }, { id: 19, name: "Shadow Wings", price: 15000, scale: 138, xOff: 22, desc: "increased movement speed", spdMult: 1.1 }, { id: 18, name: "Blood Wings", price: 20000, scale: 178, xOff: 26, desc: "restores health when you deal damage", healD: 0.2 }, { id: 21, name: "Corrupt X Wings", price: 20000, scale: 178, xOff: 26, desc: "deal damage to players that damage you", dmg: 0.25 }]; } }; class ProjectileManager { constructor(Projectile, projectiles, players, ais, objectManager, items, config, UTILS, server) { this.addProjectile = function(x, y, dir, range, speed, indx, owner, ignoreObj, layer, inWindow) { let tmpData = items.projectiles[indx]; let tmpProj; for (let i = 0; i < projectiles.length; ++i) { if (!projectiles[i].active) { tmpProj = projectiles[i]; break; } } if (!tmpProj) { tmpProj = new Projectile(players, ais, objectManager, items, config, UTILS, server); tmpProj.sid = projectiles.length; projectiles.push(tmpProj); } tmpProj.init(indx, x, y, dir, speed, tmpData.dmg, range, tmpData.scale, owner); tmpProj.ignoreObj = ignoreObj; tmpProj.layer = layer || tmpData.layer; tmpProj.inWindow = inWindow; tmpProj.src = tmpData.src; return tmpProj; }; } }; class AiManager { // AI MANAGER: constructor(ais, AI, players, items, objectManager, config, UTILS, scoreCallback, server) { // AI TYPES: this.aiTypes = [{ id: 0, src: "cow_1", killScore: 150, health: 500, weightM: 0.8, speed: 0.00095, turnSpeed: 0.001, scale: 72, drop: ["food", 50] }, { id: 1, src: "pig_1", killScore: 200, health: 800, weightM: 0.6, speed: 0.00085, turnSpeed: 0.001, scale: 72, drop: ["food", 80] }, { id: 2, name: "Bull", src: "bull_2", hostile: true, dmg: 20, killScore: 1000, health: 1800, weightM: 0.5, speed: 0.00094, turnSpeed: 0.00074, scale: 78, viewRange: 800, chargePlayer: true, drop: ["food", 100] }, { id: 3, name: "Bully", src: "bull_1", hostile: true, dmg: 20, killScore: 2000, health: 2800, weightM: 0.45, speed: 0.001, turnSpeed: 0.0008, scale: 90, viewRange: 900, chargePlayer: true, drop: ["food", 400] }, { id: 4, name: "Wolf", src: "wolf_1", hostile: true, dmg: 8, killScore: 500, health: 300, weightM: 0.45, speed: 0.001, turnSpeed: 0.002, scale: 84, viewRange: 800, chargePlayer: true, drop: ["food", 200] }, { id: 5, name: "Quack", src: "chicken_1", dmg: 8, killScore: 2000, noTrap: true, health: 300, weightM: 0.2, speed: 0.0018, turnSpeed: 0.006, scale: 70, drop: ["food", 100] }, { id: 6, name: "MOOSTAFA", nameScale: 50, src: "enemy", hostile: true, dontRun: true, fixedSpawn: true, spawnDelay: 60000, noTrap: true, colDmg: 100, dmg: 40, killScore: 8000, health: 18000, weightM: 0.4, speed: 0.0007, turnSpeed: 0.01, scale: 80, spriteMlt: 1.8, leapForce: 0.9, viewRange: 1000, hitRange: 210, hitDelay: 1000, chargePlayer: true, drop: ["food", 100] }, { id: 7, name: "Treasure", hostile: true, nameScale: 35, src: "crate_1", fixedSpawn: true, spawnDelay: 120000, colDmg: 200, killScore: 5000, health: 20000, weightM: 0.1, speed: 0.0, turnSpeed: 0.0, scale: 70, spriteMlt: 1.0 }, { id: 8, name: "MOOFIE", src: "wolf_2", hostile: true, fixedSpawn: true, dontRun: true, hitScare: 4, spawnDelay: 30000, noTrap: true, nameScale: 35, dmg: 10, colDmg: 100, killScore: 3000, health: 7000, weightM: 0.45, speed: 0.0015, turnSpeed: 0.002, scale: 90, viewRange: 800, chargePlayer: true, drop: ["food", 1000] }]; // SPAWN AI: this.spawn = function(x, y, dir, index) { let tmpObj = ais.find((tmp) => !tmp.active); if (!tmpObj) { tmpObj = new AI(ais.length, objectManager, players, items, UTILS, config, scoreCallback, server); ais.push(tmpObj); } tmpObj.init(x, y, dir, index, this.aiTypes[index]); return tmpObj; }; } }; class AI { constructor(sid, objectManager, players, items, UTILS, config, scoreCallback, server) { this.sid = sid; this.isAI = true; this.nameIndex = UTILS.randInt(0, config.cowNames.length - 1); // INIT: this.init = function(x, y, dir, index, data) { this.x = x; this.y = y; this.startX = data.fixedSpawn ? x : null; this.startY = data.fixedSpawn ? y : null; this.xVel = 0; this.yVel = 0; this.zIndex = 0; this.dir = dir; this.dirPlus = 0; this.showName = 'aaa'; this.index = index; this.src = data.src; if (data.name) this.name = data.name; this.weightM = data.weightM; this.speed = data.speed; this.killScore = data.killScore; this.turnSpeed = data.turnSpeed; this.scale = data.scale; this.maxHealth = data.health; this.leapForce = data.leapForce; this.health = this.maxHealth; this.chargePlayer = data.chargePlayer; this.viewRange = data.viewRange; this.drop = data.drop; this.dmg = data.dmg; this.hostile = data.hostile; this.dontRun = data.dontRun; this.hitRange = data.hitRange; this.hitDelay = data.hitDelay; this.hitScare = data.hitScare; this.spriteMlt = data.spriteMlt; this.nameScale = data.nameScale; this.colDmg = data.colDmg; this.noTrap = data.noTrap; this.spawnDelay = data.spawnDelay; this.hitWait = 0; this.waitCount = 1000; this.moveCount = 0; this.targetDir = 0; this.active = true; this.alive = true; this.runFrom = null; this.chargeTarget = null; this.dmgOverTime = {}; }; let tmpRatio = 0; let animIndex = 0; this.animate = function(delta) { if (this.animTime > 0) { this.animTime -= delta; if (this.animTime <= 0) { this.animTime = 0; this.dirPlus = 0; tmpRatio = 0; animIndex = 0; } else { if (animIndex == 0) { tmpRatio += delta / (this.animSpeed * config.hitReturnRatio); this.dirPlus = UTILS.lerp(0, this.targetAngle, Math.min(1, tmpRatio)); if (tmpRatio >= 1) { tmpRatio = 1; animIndex = 1; } } else { tmpRatio -= delta / (this.animSpeed * (1 - config.hitReturnRatio)); this.dirPlus = UTILS.lerp(0, this.targetAngle, Math.max(0, tmpRatio)); } } } }; // ANIMATION: this.startAnim = function() { this.animTime = this.animSpeed = 600; this.targetAngle = Math.PI * 0.8; tmpRatio = 0; animIndex = 0; }; }; }; class addCh { constructor(x, y, chat, tmpObj) { this.x = x; this.y = y; this.alpha = 0; this.active = true; this.alive = false; this.chat = chat; this.owner = tmpObj; }; }; class DeadPlayer { constructor(x, y, dir, buildIndex, weaponIndex, weaponVariant, skinColor, scale, name) { this.x = x; this.y = y; this.lastDir = dir; this.dir = dir + Math.PI; this.buildIndex = buildIndex; this.weaponIndex = weaponIndex; this.weaponVariant = weaponVariant; this.skinColor = skinColor; this.scale = scale; this.visScale = 0; this.name = name; this.alpha = 1; this.active = true; this.animate = function(delta) { let d2 = UTILS.getAngleDist(this.lastDir, this.dir); if (d2 > 0.01) { this.dir += d2 / 20; } else { this.dir = this.lastDir; } if (this.visScale < this.scale) { this.visScale += delta / (this.scale / 2); if (this.visScale >= this.scale) { this.visScale = this.scale; } } this.alpha -= delta / 30000; if (this.alpha <= 0) { this.alpha = 0; this.active = false; } } } }; class Player { constructor(id, sid, config, UTILS, projectileManager, objectManager, players, ais, items, hats, accessories, server, scoreCallback, iconCallback) { this.id = id; this.sid = sid; this.tmpScore = 0; this.team = null; this.latestSkin = 0; this.oldSkinIndex = 0; this.skinIndex = 0; this.latestTail = 0; this.oldTailIndex = 0; this.tailIndex = 0; this.hitTime = 0; this.lastHit = 0; this.showName = 'NOOO'; this.tails = {}; for (let i = 0; i < accessories.length; ++i) { if (accessories[i].price <= 0) this.tails[accessories[i].id] = 1; } this.skins = {}; for (let i = 0; i < hats.length; ++i) { if (hats[i].price <= 0) this.skins[hats[i].id] = 1; } this.points = 0; this.dt = 0; this.hidden = false; this.itemCounts = {}; this.isPlayer = true; this.pps = 0; this.moveDir = undefined; this.skinRot = 0; this.lastPing = 0; this.iconIndex = 0; this.skinColor = 0; this.dist2 = 0; this.aim2 = 0; this.maxSpeed = 1; this.chat = { message: null, count: 0 }; this.circle = false; this.cAngle = 0; // SPAWN: this.spawn = function(moofoll) { this.attacked = false; this.timeDamaged = 0; this.timeHealed = 0; this.pinge = 0; this.millPlace = 'NOOO'; this.lastshamecount = 0; this.death = false; this.spinDir = 0; this.sync = false; this.antiBull = 0; this.bullTimer = 0; this.poisonTimer = 0; this.active = true; this.alive = true; this.lockMove = false; this.lockDir = false; this.minimapCounter = 0; this.chatCountdown = 0; this.shameCount = 0; this.shameTimer = 0; this.sentTo = {}; this.gathering = 0; this.gatherIndex = 0; this.shooting = {}; this.shootIndex = 9; this.autoGather = 0; this.animTime = 0; this.animSpeed = 0; this.mouseState = 0; this.buildIndex = -1; this.weaponIndex = 0; this.weaponCode = 0; this.weaponVariant = 0; this.primaryIndex = undefined; this.secondaryIndex = undefined; this.dmgOverTime = {}; this.noMovTimer = 0; this.maxXP = 300; this.XP = 0; this.age = 1; this.kills = 0; this.upgrAge = 2; this.upgradePoints = 0; this.x = 0; this.y = 0; this.oldXY = { x: 0, y: 0 }; this.zIndex = 0; this.xVel = 0; this.yVel = 0; this.slowMult = 1; this.dir = 0; this.dirPlus = 0; this.targetDir = 0; this.targetAngle = 0; this.maxHealth = 100; this.health = this.maxHealth; this.oldHealth = this.maxHealth; this.damaged = 0; this.scale = config.playerScale; this.speed = config.playerSpeed; this.resetMoveDir(); this.resetResources(moofoll); this.items = [0, 3, 6, 10]; this.weapons = [0]; this.shootCount = 0; this.weaponXP = []; this.reloads = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 53: 0, }; this.bowThreat = { 9: 0, 12: 0, 13: 0, 15: 0, }; this.damageThreat = 0; this.inTrap = false; this.canEmpAnti = false; this.empAnti = false; this.soldierAnti = false; this.poisonTick = 0; this.bullTick = 0; this.setPoisonTick = false; this.setBullTick = false; this.antiTimer = 2; }; // RESET MOVE DIR: this.resetMoveDir = function() { this.moveDir = undefined; }; // RESET RESOURCES: this.resetResources = function(moofoll) { for (let i = 0; i < config.resourceTypes.length; ++i) { this[config.resourceTypes[i]] = moofoll ? 100 : 0; } }; // ADD ITEM: this.getItemType = function(id) { let findindx = this.items.findIndex((ids) => ids == id); if (findindx != -1) { return findindx; } else { return items.checkItem.index(id, this.items); } }; // SET DATA: this.setData = function(data) { this.id = data[0]; this.sid = data[1]; this.name = data[2]; this.x = data[3]; this.y = data[4]; this.dir = data[5]; this.health = data[6]; this.maxHealth = data[7]; this.scale = data[8]; this.skinColor = data[9]; }; // UPDATE POISON TICK: this.updateTimer = function() { this.bullTimer -= 1; if (this.bullTimer <= 0) { this.setBullTick = false; this.bullTick = game.tick - 1; this.bullTimer = config.serverUpdateRate; } this.poisonTimer -= 1; if (this.poisonTimer <= 0) { this.setPoisonTick = false; this.poisonTick = game.tick - 1; this.poisonTimer = config.serverUpdateRate; } }; this.update = function(delta) { if (this.active) { // MOVE: let gear = { skin: findID(hats, this.skinIndex), tail: findID(accessories, this.tailIndex) } let spdMult = ((this.buildIndex >= 0) ? 0.5 : 1) * (items.weapons[this.weaponIndex].spdMult || 1) * (gear.skin ? (gear.skin.spdMult || 1) : 1) * (gear.tail ? (gear.tail.spdMult || 1) : 1) * (this.y <= config.snowBiomeTop ? ((gear.skin && gear.skin.coldM) ? 1 : config.snowSpeed) : 1) * this.slowMult; this.maxSpeed = spdMult; } }; let tmpRatio = 0; let animIndex = 0; this.animate = function(delta) { if (this.animTime > 0) { this.animTime -= delta; if (this.animTime <= 0) { this.animTime = 0; this.dirPlus = 0; tmpRatio = 0; animIndex = 0; } else { if (animIndex == 0) { tmpRatio += delta / (this.animSpeed * config.hitReturnRatio); this.dirPlus = UTILS.lerp(0, this.targetAngle, Math.min(1, tmpRatio)); if (tmpRatio >= 1) { tmpRatio = 1; animIndex = 1; } } else { tmpRatio -= delta / (this.animSpeed * (1 - config.hitReturnRatio)); this.dirPlus = UTILS.lerp(0, this.targetAngle, Math.max(0, tmpRatio)); } } } }; // GATHER ANIMATION: this.startAnim = function(didHit, index) { this.animTime = this.animSpeed = items.weapons[index].speed; this.targetAngle = (didHit ? -config.hitAngle : -Math.PI); tmpRatio = 0; animIndex = 0; }; // CAN SEE: this.canSee = function(other) { if (!other) return false; let dx = Math.abs(other.x - this.x) - other.scale; let dy = Math.abs(other.y - this.y) - other.scale; return dx <= (config.maxScreenWidth / 2) * 1.3 && dy <= (config.maxScreenHeight / 2) * 1.3; }; // SHAME SYSTEM: this.judgeShame = function() { if (this.oldHealth < this.health) { if (this.hitTime) { let timeSinceHit = game.tick - this.hitTime; this.lastHit = game.tick; this.hitTime = 0; if (timeSinceHit < 2) { this.shameCount++; } else { this.shameCount = Math.max(0, this.shameCount - 2); } } } else if (this.oldHealth > this.health) { this.hitTime = game.tick; } }; this.addShameTimer = function() { this.shameCount = 0; this.shameTimer = 30; let interval = setInterval(() => { this.shameTimer--; if (this.shameTimer <= 0) { clearInterval(interval); } }, 1000); }; // CHECK TEAM: this.isTeam = function(tmpObj) { return (this == tmpObj || (this.team && this.team == tmpObj.team)); }; // FOR THE PLAYER: this.findAllianceBySid = function(sid) { return this.team ? alliancePlayers.find((THIS) => THIS === sid) : null; }; //scriptMenu.toggles let pingHeal = function() { return Math.max(0, 180 - window.pingTime); }; let normalMS = 70; let goodMS = 90; if (true) { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } let backupAnti = []; let hittedTime = Date.now(); function autoHealer(tmpObj, value) { let pingHeal = function() { return Math.max(0, 180 - window.pingTime); }; let normalMS = 70; let goodMS = 90; let antiInsta = false; let findAttacker = undefined; if (true) { if (near.dist2 <= 300) { if (value >= 20 && (Date.now() - hittedTime >= 180 || Date.now() - hittedTime <= 60)) { if (tmpObj.shameCount < tmpObj.dangerShame) { for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } } else { if (traps.in) { healIntrap(tmpObj, value); } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } } if (player.skinIndex == 11) { if (value >= 30) { instaC.isCounter = true; } } if (value >= 20) { hittedTime = Date.now(); judgeAtNextTick = true; } } else { if (traps.in) { healIntrap(tmpObj, value); } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } } } } function simpleAutoHealer(tmpObj, value) { let pingHeal = function() { return Math.max(0, 170 - window.pingTime); }; let normalMS = 70; let goodMS = 90; let antiInsta = false; if (true) { if (nears.length) { if (value >= 20) { judgeAtNextTick = true; } for (let i = 0; i < nears.length; i++) { let nearEnemy = nears[i]; let findAttacker = []; let checkAnti = value >= (tmpObj.skinIndex == 6 ? 25 : 10) && (nearEnemy.secondaryIndex == undefined || nearEnemy.primaryIndex == undefined ? true : nearEnemy.reloads[nearEnemy.primaryIndex] == 0); if (checkAnti) { antiInsta = true; } } if (antiInsta) { if (tmpObj.shameCount < tmpObj.dangerShame) { for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } if (player.skinIndex == 11) { if (value >= 30) { instaC.isCounter = true; } } } else { (scriptMenu.toggles["tickheal"] ? setTickout : setTimeout)(()=>{ for (let i = 0; i < applCxC(value); i++) { place(0, getAttackDir()); } }, scriptMenu.toggles["tickheal"] ? 2 : pingHeal()); } } } this.checkCanInsta = function(nobull) { let totally = 0; if (this.alive && inGame) { let primary = { weapon: this.weapons[0], variant: this.primaryVariant, dmg: this.weapons[0] == undefined ? 0 : items.weapons[this.weapons[0]].dmg, }; let secondary = { weapon: this.weapons[1], variant: this.secondaryVariant, dmg: this.weapons[1] == undefined ? 0 : items.weapons[this.weapons[1]].Pdmg, }; let bull = this.skins[7] && !nobull ? 1.5 : 1; let pV = primary.variant != undefined ? config.weaponVariants[primary.variant].val : 1; if (primary.weapon != undefined && this.reloads[primary.weapon] == 0) { totally += primary.dmg * pV * bull; } if (secondary.weapon != undefined && this.reloads[secondary.weapon] == 0) { totally += secondary.dmg; } if (this.skins[53] && this.reloads[53] <= (player.weapons[1] == 10 ? 0 : game.tickRate) && near.skinIndex != 22) { totally += 25; } totally *= near.skinIndex == 6 ? 0.75 : 1; return totally; } return 0; }; // UPDATE WEAPON RELOAD: this.manageReload = function() { if (this.shooting[53]) { this.shooting[53] = 0; this.reloads[53] = (2500 - game.tickRate); } else { if (this.reloads[53] > 0) { this.reloads[53] = Math.max(0, this.reloads[53] - game.tickRate); } } if (this.gathering || this.shooting[1]) { if (this.gathering) { this.gathering = 0; this.reloads[this.gatherIndex] = (items.weapons[this.gatherIndex].speed * (this.skinIndex == 20 ? 0.78 : 1)); this.attacked = true; } if (this.shooting[1]) { this.shooting[1] = 0; this.reloads[this.shootIndex] = (items.weapons[this.shootIndex].speed * (this.skinIndex == 20 ? 0.78 : 1)); this.attacked = true; } } else { this.attacked = false; if (this.buildIndex < 0) { if (this.reloads[this.weaponIndex] > 0) { // Math.max(0, this.reloads[this.weaponIndex] - game.tickRate) this.reloads[this.weaponIndex] = Math.max(0, this.reloads[this.weaponIndex] - 110); if (this == player) { if (getEl("weaponGrind").checked || scriptMenu.toggles["autoGrind"]) { for (let i = 0; i < Math.PI * 2; i += Math.PI / 2) { checkPlace(player.getItemType(22), i); } } } if (this.reloads[this.primaryIndex] == 0 && this.reloads[this.weaponIndex] == 0) { this.antiBull++; game.tickBase(() => { this.antiBull = 0; }, 1); } } } } }; // FOR ANTI INSTA: this.addDamageThreat = function(tmpObj) { let primary = { weapon: this.primaryIndex, variant: this.primaryVariant }; primary.dmg = primary.weapon == undefined ? 45 : items.weapons[primary.weapon].dmg; let secondary = { weapon: this.secondaryIndex, variant: this.secondaryVariant }; secondary.dmg = secondary.weapon == undefined ? 75 : items.weapons[secondary.weapon].Pdmg; let bull = 1.5; let pV = primary.variant != undefined ? config.weaponVariants[primary.variant].val : 1.18; let sV = secondary.variant != undefined ? [9, 12, 13, 15].includes(secondary.weapon) ? 1 : config.weaponVariants[secondary.variant].val : 1.18; if (primary.weapon == undefined ? true : this.reloads[primary.weapon] == 0) { this.damageThreat += primary.dmg * pV * bull; } if (secondary.weapon == undefined ? true : this.reloads[secondary.weapon] == 0) { this.damageThreat += secondary.dmg * sV; } if (this.reloads[53] <= game.tickRate) { this.damageThreat += 25; } this.damageThreat *= tmpObj.skinIndex == 6 ? 0.75 : 1; if (!this.isTeam(tmpObj)) { if (this.dist2 <= 300) { tmpObj.damageThreat += this.damageThreat; } } }; } }; // SOME CODES: function sendUpgrade(index) { player.reloads[index] = 0; packet("H", index); } function storeEquip(id, index) { packet("c", 0, id, index); } function storeBuy(id, index) { packet("c", 1, id, index); } function buyEquip(id, index) { let nID = player.skins[6] ? 6 : 0; if (player.alive && inGame) { if (index == 0) { if (player.skins[id]) { if (player.latestSkin != id) { packet("c", 0, id, 0); } } else { if (configs.autoBuyEquip) { let find = findID(hats, id); if (find) { if (player.points >= find.price) { packet("c", 1, id, 0); packet("c", 0, id, 0); } else { if (player.latestSkin != nID) { packet("c", 0, nID, 0); } } } else { if (player.latestSkin != nID) { packet("c", 0, nID, 0); } } } else { if (player.latestSkin != nID) { packet("c", 0, nID, 0); } } } } else if (index == 1) { if (useWasd && (id != 11 && id != 0)) { if (player.latestTail != 0) { packet("c", 0, 0, 1); } return; } if (player.tails[id]) { if (player.latestTail != id) { packet("c", 0, id, 1); } } else { if (configs.autoBuyEquip) { let find = findID(accessories, id); if (find) { if (player.points >= find.price) { packet("c", 1, id, 1); packet("c", 0, id, 1); } else { if (player.latestTail != 0) { packet("c", 0, 0, 1); } } } else { if (player.latestTail != 0) { packet("c", 0, 0, 1); } } } else { if (player.latestTail != 0) { packet("c", 0, 0, 1); } } } } } } function selectToBuild(index, wpn) { packet("z", index, wpn); } function selectWeapon(index, isPlace) { if (!isPlace) { player.weaponCode = index; } packet("z", index, 1); } function sendAutoGather() { packet("K", 1, 1); } function sendAtck(id, angle) { packet("F", id, angle, 1); } // PLACER: function place(id, rad, rmd) { try { if (id == undefined) return; let item = items.list[player.items[id]]; let tmpS = player.scale + item.scale + (item.placeOffset || 0); let tmpX = player.x2 + tmpS * Math.cos(rad); let tmpY = player.y2 + tmpS * Math.sin(rad); if ((player.alive && inGame && player.itemCounts[item.group.id] == undefined ? true : player.itemCounts[item.group.id] < (config.isSandbox ? 299 : item.group.limit ? item.group.limit : 99))) { selectToBuild(player.items[id]); sendAtck(1, rad); selectWeapon(player.weaponCode, 1); if (rmd && getEl("placeVis").checked) { placeVisible.push({ x: tmpX, y: tmpY, name: item.name, scale: item.scale, dir: rad }); game.tickBase(() => { placeVisible.shift(); }, 1) } } } catch (e) { console.log(e)} } function checkPlace(id, rad) { try { if (id == undefined) return; let item = items.list[player.items[id]]; let tmpS = player.scale + item.scale + (item.placeOffset || 0); let tmpX = player.x2 + tmpS * Math.cos(rad); let tmpY = player.y2 + tmpS * Math.sin(rad); if (objectManager.checkItemLocation(tmpX, tmpY, item.scale, 0.6, item.id, false, player)) { place(id, rad); } } catch (e) {} } function Aplace(id, first = -(Math.PI / 2), repeat = (Math.PI / 2), plus = (Math.PI / 18), radian) { try { let item = items.list[player.items[id]]; let tmpS = player.scale + item.scale + (item.placeOffset || 0); let counts = { attempts: 0, placed: 0 }; let tmpObjects = []; gameObjects.forEach((p) => { tmpObjects.push({ x: p.x, y: p.y, active: p.active, blocker: p.blocker, scale: p.scale, isItem: p.isItem, type: p.type, colDiv: p.colDiv, getScale: function(sM, ig) { sM = sM || 1; return this.scale * ((this.isItem || this.type == 2 || this.type == 3 || this.type == 4) ? 1 : (0.6 * sM)) * (ig ? 1 : this.colDiv); }, }); }); for (let i = first; i < repeat; i += plus) { counts.attempts++; let relAim = radian + i; let tmpX = player.x2 + tmpS * Math.cos(relAim); let tmpY = player.y2 + tmpS * Math.sin(relAim); let cantPlace = tmpObjects.find((tmp) => tmp.active && UTILS.getDistance(tmpX, tmpY, tmp.x, tmp.y) < item.scale + (tmp.blocker ? tmp.blocker : tmp.getScale(0.6, tmp.isItem))); if (cantPlace) continue; if (item.id != 19 && tmpY >= config.mapScale / 2 - config.riverWidth / 2 && tmpY <= config.mapScale / 2 + config.riverWidth / 2) continue; place(id, relAim, 1); tmpObjects.push({ x: tmpX, y: tmpY, active: true, blocker: item.blocker, scale: item.scale, isItem: true, type: null, colDiv: item.colDiv, getScale: function() { return this.scale; }, }); } } catch (err) {} } function cplace(id, rad) { // for preplacer indi if (id == undefined) return; let item = items.list[player.items[id]]; let tmpS = player.scale + item.scale + (item.placeOffset || 0); let tmpX = player.x2 + tmpS * Math.cos(rad); let tmpY = player.y2 + tmpS * Math.sin(rad); preIndi.push({ x: tmpX, y: tmpY, name: item.name, scale: item.scale, dir: rad }); game.tickBase(() => { preIndi.shift(); }, 1); if (id === 0 || (player.alive && inGame)) { selectToBuild(player.items[id]); sendAtck(1, rad); selectWeapon(player.weaponCode, 1); } } // HEALING: function soldierMult() { return player.latestSkin == 6 ? 0.75 : 1; } function healthBased() { if (player.health == 100) return 0; if ((player.skinIndex != 45 && player.skinIndex != 56)) { return Math.ceil((100 - player.health) / items.list[player.items[0]].healing); } return 0; } function getAttacker(damaged) { let attackers = enemy.filter(tmp => { //let damages = new Damages(items); //let dmg = damages.weapons[tmp.weaponIndex]; //let by = tmp.weaponIndex < 9 ? [dmg[0], dmg[1], dmg[2], dmg[3]] : [dmg[0], dmg[1]]; let rule = { //one: tmp.dist2 <= 300, //two: by.includes(damaged), three: tmp.attacked } return /*rule.one && rule.two && */ rule.three; }); return attackers; } function healer() { for (let i = 0; i < healthBased(); i++) { place(0, getAttackDir()); } } function antiSyncHealing(timearg) { my.antiSync = true; let healAnti = setInterval(() => { if (player.shameCount < 5) { place(0, getAttackDir()); } }, 75); setTimeout(() => { clearInterval(healAnti); setTimeout(() => { my.antiSync = false; }, game.tickRate); }, game.tickRate); } function applCxC(value) { if (player.health == 100) return 0; if (player.skinIndex != 45 && player.skinIndex != 56) { return Math.ceil(value / items.list[player.items[0]].healing); } return 0; } function calcDmg(value) { return value * player.skinIndex == 6 ? 0.75 : 1; } function biomeGear(mover, returns) { if (player.y2 >= config.mapScale / 2 - config.riverWidth / 2 && player.y2 <= config.mapScale / 2 + config.riverWidth / 2) { if (returns) return 31; buyEquip(31, 0); } else { if (player.y2 <= config.snowBiomeTop) { if (returns) return mover && player.moveDir == undefined ? 6 : 15; buyEquip(mover && player.moveDir == undefined ? 6 : 15, 0); } else { if (returns) return mover && player.moveDir == undefined ? 6 : 6; buyEquip(mover && player.moveDir == undefined ? 6 : 12, 0); } } if (returns) return 0; } let advHeal = []; let preIndi = []; class Traps { constructor(UTILS, items) { this.dist = 0; this.aim = 0; this.inTrap = false; this.replaced = false; this.antiTrapped = false; this.info = {}; this.notFast = function() { return player.weapons[1] == 10 && ((this.info.health > items.weapons[player.weapons[0]].dmg) || player.weapons[0] == 5); } this.testCanPlace = function(id, first = -(Math.PI / 2), repeat = (Math.PI / 2), plus = (Math.PI / 18), radian, replacer, yaboi) { try { let item = items.list[player.items[id]]; let tmpS = player.scale + item.scale + (item.placeOffset || 0); let counts = { attempts: 0, placed: 0 }; let tmpObjects = []; gameObjects.forEach((p) => { tmpObjects.push({ x: p.x, y: p.y, active: p.active, blocker: p.blocker, scale: p.scale, isItem: p.isItem, type: p.type, colDiv: p.colDiv, getScale: function(sM, ig) { sM = sM || 1; return this.scale * ((this.isItem || this.type == 2 || this.type == 3 || this.type == 4) ? 1 : (0.6 * sM)) * (ig ? 1 : this.colDiv); }, }); }); for (let i = first; i < repeat; i += plus) { counts.attempts++; let relAim = radian + i; let tmpX = player.x2 + tmpS * Math.cos(relAim); let tmpY = player.y2 + tmpS * Math.sin(relAim); let cantPlace = tmpObjects.find((tmp) => tmp.active && UTILS.getDistance(tmpX, tmpY, tmp.x, tmp.y) < item.scale + (tmp.blocker ? tmp.blocker : tmp.getScale(0.6, tmp.isItem))); if (cantPlace) continue; if (item.id != 19 && tmpY >= config.mapScale / 2 - config.riverWidth / 2 && tmpY <= config.mapScale / 2 + config.riverWidth / 2) continue; checkPlace(id, relAim, 1); tmpObjects.push({ x: tmpX, y: tmpY, active: true, blocker: item.blocker, scale: item.scale, isItem: true, type: null, colDiv: item.colDiv, getScale: function() { return this.scale; }, }); if (UTILS.getAngleDist(near.aim2, relAim) <= 1) { counts.placed++; } } if (counts.placed > 0 && replacer && item.dmg) { if (near.dist2 <= items.weapons[player.weapons[0]].range + (player.scale * 1.8) && scriptMenu.toggles["spiketick"]) { instaC.canSpikeTick = true; } } } catch (err) { } }; this.checkSpikeTick = function() { try { if (![3, 4, 5].includes(near.primaryIndex)) return false; if ((getEl("safeAntiSpikeTick").checked || my.autoPush) ? false : near.primaryIndex == undefined ? true : (near.reloads[near.primaryIndex] > game.tickRate)) return false; // more range for safe. also testing near.primaryIndex || 5 if (near.dist2 <= items.weapons[near.primaryIndex || 5].range + (near.scale * 1.8)) { let item = items.list[9]; let tmpS = near.scale + item.scale + (item.placeOffset || 0); let danger = 0; let counts = { attempts: 0, block: `unblocked` }; for (let i = -1; i <= 1; i += 1 / 10) { counts.attempts++; let relAim = UTILS.getDirect(player, near, 2, 2) + i; let tmpX = near.x2 + tmpS * Math.cos(relAim); let tmpY = near.y2 + tmpS * Math.sin(relAim); let cantPlace = gameObjects.find((tmp) => tmp.active && UTILS.getDistance(tmpX, tmpY, tmp.x, tmp.y) < item.scale + (tmp.blocker ? tmp.blocker : tmp.getScale(0.6, tmp.isItem))); if (cantPlace) continue; if (tmpY >= config.mapScale / 2 - config.riverWidth / 2 && tmpY <= config.mapScale / 2 + config.riverWidth / 2) continue; danger++; counts.block = `blocked`; break; } if (danger) { my.anti0Tick = 1; return true; } } } catch (err) { return null; } return false; } this.protect = function(aim) { if (!configs.antiTrap || near.dist2 > 500 || !enemy.length) return; if (player.items[4]) { this.testCanPlace(4, -(Math.PI / 2), (Math.PI / 2), (Math.PI / 18), aim + Math.PI); this.antiTrapped = true; } }; this.autoPlace = function() { if (enemy.length && scriptMenu.toggles["autoplace"] && !instaC.ticking) { if (game.tick % (Math.max(1, parseInt(scriptMenu.toggles["placementThrottle"])) || 1) === 0) { if (gameObjects.length) { let near2 = { inTrap: true, }; let nearTrap = gameObjects.filter(e => e.trap && e.active && e.isTeamObject(player) && UTILS.getDist(e, near, 0, 2) <= (near.scale + e.getScale() + 5)).sort(function (a, b) { return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0, 2); })[0]; if ((near.dist2 <= 600)) { if (near.dist2 <= 220 && nearTrap) { this.testCanPlace(2, 0, (Math.PI * 2), (Math.PI / 24), near.aim2); } else { if ([4, 5].includes(player.weaponIndex) && near.dist2 <= items.weapons[player.primaryIndex || 5].range + (player.scale * 1.8)) { this.testCanPlace(2, 0, (Math.PI * 2), (Math.PI / 24), near.aim2); } else { player.items[4] == 15 && this.testCanPlace(4, 0, (Math.PI * 2), (Math.PI / 24), near.aim2); } } } } } }//scriptMenu.toggles["autoGrind"]) }; this.replacer = function (findObj) { if (!findObj || !configs.autoReplace) return; if (!inGame) return; if (this.antiTrapped) return; game.tickBase(() => { let objAim = UTILS.getDirect(findObj, player, 0, 2); let objDst = UTILS.getDist(findObj, player, 0, 2); if (getEl("weaponGrind").checked|| scriptMenu.toggles["autoGrind"] && objDst <= items.weapons[player.weaponIndex].range + player.scale) return; if (objDst <= 500 && near.dist2 <= 500) { let danger = this.checkSpikeTick(); if (my.autoPush) { this.testCanPlace(4, 0, (Math.PI * 2), (Math.PI / 24), objDst, 1); } else if (!danger && near.dist2 <= items.weapons[near.primaryIndex || 5].range + (near.scale * 1.8)) { this.testCanPlace(2, 0, (Math.PI * 2), (Math.PI / 24), objAim, 1); } else { player.items[4] == 15 && this.testCanPlace(4, 0, (Math.PI * 2), (Math.PI / 24), objAim, 1); } this.replaced = true; } }, 1); }; } }; class Instakill { constructor() { this.wait = false; this.can = false; this.isTrue = false; this.nobull = false; this.ticking = false; this.canSpikeTick = false; this.startTick = false; this.readyTick = false; this.canCounter = false; this.revTick = false; this.syncHit = false; this.changeType = function(type) { this.wait = false; this.isTrue = true; my.autoAim = true; let instaLog = [type]; if (type == "rev") { selectWeapon(player.weapons[1]); buyEquip(53, 0); sendAutoGather(); setTimeout(() => { selectWeapon(player.weapons[0]); buyEquip(7, 0); setTimeout(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 111); }, 100); } else if (type == "nobull") { selectWeapon(player.weapons[0]); buyEquip(7, 0); sendAutoGather(); setTimeout(() => { selectWeapon(player.weapons[1]); buyEquip(player.reloads[53] == 0 ? 53 : 6, 0); setTimeout(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 80); }, 105); } else if (type == "normal") { selectWeapon(player.weapons[0]); buyEquip(7, 0); sendAutoGather(); setTimeout(() => { selectWeapon(player.weapons[1]); buyEquip(player.reloads[53] == 0 ? 53 : 6, 0); setTimeout(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 80); }, 100); } else { setTimeout(() => { this.isTrue = false; my.autoAim = false; }, 50); } }; this.spikeTickType = function() { this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[0]); buyEquip(7, 0); sendAutoGather(); game.tickBase(() => { //if (player.reloads[53] == 0 && getEl("turretCombat").checked) { buyEquip(53, 0); selectWeapon(player.weapons[0]); buyEquip(53, 0); //buyEquip(21, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; buyEquip(6, 0); buyEquip(21, 1); }, 3); }, 1); }; this.bowInsta = function(type) {//bow insta from four mod this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[0]); game.tickBase(() => { selectWeapon(player.weapons[1]); sendAutoGather(); sendUpgrade(38); buyEquip(53, 0); buyEquip(19, 1); game.tickBase(() => { sendUpgrade(12); selectWeapon(player.weapons[1]); buyEquip(1, 0); buyEquip(19, 1); game.tickBase(() => { sendUpgrade(15); selectWeapon(player.weapons[1]); buyEquip(1, 0); buyEquip(19, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 1); }, 1); }, 1); }, 1); } /* this.spikeTickType = function() { this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(21, 1); sendAutoGather(); game.tickBase(() => { if (player.reloads[53] == 0 && getEl("turretCombat").checked) { selectWeapon(player.weapons[0]); buyEquip(53, 0); buyEquip(21, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 1); } else { sendAutoGather(); this.isTrue = false; my.autoAim = false; } }, 1); };*/ this.counterType = function() { this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(21, 1); sendAutoGather(); game.tickBase(() => { if (player.reloads[53] == 0 && getEl("turretCombat").checked) { selectWeapon(player.weapons[0]); buyEquip(53, 0); buyEquip(21, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 1); } else { sendAutoGather(); this.isTrue = false; my.autoAim = false; } }, 1); }; this.antiCounterType = function() { my.autoAim = true; this.isTrue = true; inantiantibull = true; selectWeapon(player.weapons[0]); buyEquip(6, 0); buyEquip(21, 1); io.send("D", near.aim2); sendAutoGather(); game.tickBase(() => { buyEquip(player.reloads[53] == 0 ? player.skins[53] ? 53 : 6 : 6, 0); buyEquip(21, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; inantiantibull = false; }, 1); }, 1) }; this.rangeType = function(type) { this.isTrue = true; my.autoAim = true; if (type == "ageInsta") { my.ageInsta = false; if (player.items[5] == 18) { place(5, near.aim2); } packet("f", undefined, 1); buyEquip(22, 0); buyEquip(21, 1); game.tickBase(() => { selectWeapon(player.weapons[1]); buyEquip(53, 0); buyEquip(21, 1); sendAutoGather(); game.tickBase(() => { sendUpgrade(12); selectWeapon(player.weapons[1]); buyEquip(53, 0); buyEquip(21, 1); game.tickBase(() => { sendUpgrade(15); selectWeapon(player.weapons[1]); buyEquip(53, 0); buyEquip(21, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 1); }, 1); }, 1); }, 1); } else { selectWeapon(player.weapons[1]); if (player.reloads[53] == 0 && near.dist2 <= 700 && near.skinIndex != 22) { buyEquip(53, 0); } else { buyEquip(20, 0); } buyEquip(11, 1); sendAutoGather(); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 1); } }; this.oneTickType = function() { this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[1]); buyEquip(53, 0); buyEquip(19, 1); packet("f", near.aim2, 1); if (player.weapons[1] == 15) { my.revAim = true; sendAutoGather(); } game.tickBase(() => { my.revAim = false; selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(19, 1); packet("f", near.aim2, 1); if (player.weapons[1] != 15) { sendAutoGather(); } game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; packet("f", undefined, 1); }, 1); }, 1); }; this.threeOneTickType = function() { this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); biomeGear(); buyEquip(19, 1); packet("f", near.aim2, 1); game.tickBase(() => { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); buyEquip(53, 0); buyEquip(19, 1); packet("f", near.aim2, 1); game.tickBase(() => { selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(19, 1); sendAutoGather(); packet("f", near.aim2, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; packet("f", undefined, 1); }, 1); }, 1); }, 1); }; this.kmTickType = function() { this.isTrue = true; my.autoAim = true; my.revAim = true; selectWeapon(player.weapons[1]); buyEquip(53, 0); buyEquip(19, 1); sendAutoGather(); packet("f", near.aim2, 1); game.tickBase(() => { my.revAim = false; selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(19, 1); packet("f", near.aim2, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; packet("f", undefined, 1); }, 1); }, 1); }; this.boostTickType = function() { /*this.isTrue = true; my.autoAim = true; selectWeapon(player.weapons[0]); buyEquip(53, 0); buyEquip(19, 1); packet("f", near.aim2); game.tickBase(() => { place(4, near.aim2); selectWeapon(player.weapons[1]); biomeGear(); buyEquip(19, 1); sendAutoGather(); packet("f", near.aim2); game.tickBase(() => { selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(19, 1); packet("f", near.aim2); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; packet("f", undefined); }, 1); }, 1); }, 1);*/ this.isTrue = true; my.autoAim = true; biomeGear(); buyEquip(19, 1); packet("f", near.aim2, 1); game.tickBase(() => { if (player.weapons[1] == 15) { my.revAim = true; } selectWeapon(player.weapons[[9, 12, 13, 15].includes(player.weapons[1]) ? 1 : 0]); buyEquip(53, 0); buyEquip(19, 1); if ([9, 12, 13, 15].includes(player.weapons[1])) { sendAutoGather(); } packet("f", near.aim2, 1); place(4, near.aim2); game.tickBase(() => { my.revAim = false; selectWeapon(player.weapons[0]); buyEquip(7, 0); buyEquip(19, 1); if (![9, 12, 13, 15].includes(player.weapons[1])) { sendAutoGather(); } packet("f", near.aim2, 1); game.tickBase(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; packet("f", undefined, 1); }, 1); }, 1); }, 1); }; this.gotoGoal = function(goto, OT) { let slowDists = (weeeee) => weeeee * config.playerScale; let goal = { a: goto - OT, b: goto + OT, c: goto - slowDists(1), d: goto + slowDists(1), e: goto - slowDists(2), f: goto + slowDists(2), g: goto - slowDists(4), h: goto + slowDists(4) }; let bQ = function(wwww, awwww) { if (player.y2 >= config.mapScale / 2 - config.riverWidth / 2 && player.y2 <= config.mapScale / 2 + config.riverWidth / 2 && awwww == 0) { buyEquip(31, 0); } else { buyEquip(wwww, awwww); } } if (enemy.length) { let dst = near.dist2; this.ticking = true; if (dst >= goal.a && dst <= goal.b) { bQ(22, 0); bQ(19, 1); if (player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0] || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } return { dir: undefined, action: 1 }; } else { if (dst < goal.a) { if (dst >= goal.g) { if (dst >= goal.e) { if (dst >= goal.c) { bQ(40, 0); bQ(19, 1); if (configs.none) { player.buildIndex != player.items[1] && selectToBuild(player.items[1]); } else { if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } } else { bQ(22, 0); bQ(19, 1); if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } } else { bQ(6, 0); bQ(19, 1); if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } } else { biomeGear(); bQ(11, 1); if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } return { dir: near.aim2 + Math.PI, action: 0 }; } else if (dst > goal.b) { if (dst <= goal.h) { if (dst <= goal.f) { if (dst <= goal.d) { bQ(40, 0); bQ(19, 1); if (configs.none) { player.buildIndex != player.items[1] && selectToBuild(player.items[1]); } else { if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } } else { bQ(22, 0); bQ(19, 1); if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } } else { bQ(6, 0); bQ(19, 1); if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } } else { biomeGear(); bQ(11, 1); if ((player.weaponIndex != player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]) || player.buildIndex > -1) { selectWeapon(player.weapons[[10, 14].includes(player.weapons[1]) ? 1 : 0]); } } return { dir: near.aim2, action: 0 }; } return { dir: undefined, action: 0 }; } } else { this.ticking = false; return { dir: undefined, action: 0 }; } } /** wait 1 tick for better quality */ this.bowMovement = function() { let moveMent = this.gotoGoal(685, 3); if (moveMent.action) { if (player.reloads[53] == 0 && !this.isTrue) { this.rangeType("ageInsta"); } else { packet("f", moveMent.dir, 1); } } else { packet("f", moveMent.dir, 1); } }, this.tickMovement = function() { let dist = player.weapons[1] == 9 ? 240 : 240; let actionDist = player.weapons[1] == 9 ? 2 : player.weapons[1] == 12 ? 1.5 : player.weapons[1] == 13 ? 1 : player.weapons[1] == 15 ? 2 : 3; let moveMent = this.gotoGoal(238, 3); if (moveMent.action) { if (player.reloads[53] == 0 && !this.isTrue) { this.boostTickType(); } else { packet("f", moveMent.dir, 1); } } else { packet("f", moveMent.dir, 1); } }, this.kmTickMovement = function() { let moveMent = this.gotoGoal(240, 3); if (moveMent.action) { if (near.skinIndex != 22 && player.reloads[53] == 0 && !this.isTrue && ((game.tick - near.poisonTick) % config.serverUpdateRate == 8)) { this.kmTickType(); } else { packet("f", moveMent.dir, 1); } } else { packet("f", moveMent.dir, 1); } }, this.boostTickMovement = function() { let dist = player.weapons[1] == 9 ? 365 : player.weapons[1] == 12 ? 380 : player.weapons[1] == 13 ? 365 : player.weapons[1] == 15 ? 365 : 370; let actionDist = player.weapons[1] == 9 ? 2 : player.weapons[1] == 12 ? 1.5 : player.weapons[1] == 13 ? 1 : player.weapons[1] == 15 ? 2 : 3; let moveMent = this.gotoGoal(372, 3); if (moveMent.action) { if (player.reloads[53] == 0 && !this.isTrue) { this.boostTickType(); } else { packet("f", moveMent.dir, 1); } } else { packet("f", moveMent.dir, 1); } } /** wait 1 tick for better quality */ this.perfCheck = function(pl, nr) { if (nr.weaponIndex == 11 && UTILS.getAngleDist(nr.aim2 + Math.PI, nr.d2) <= config.shieldAngle) return false; if (![9, 12, 13, 15].includes(player.weapons[1])) return true; let pjs = { x: nr.x2 + (65 * Math.cos(nr.aim2 + Math.PI)), y: nr.y2 + (65 * Math.sin(nr.aim2 + Math.PI)) }; if (UTILS.lineInRect(pl.x2 - pl.scale, pl.y2 - pl.scale, pl.x2 + pl.scale, pl.y2 + pl.scale, pjs.x, pjs.y, pjs.x, pjs.y)) { return true; } let finds = ais.filter(tmp => tmp.visible).find((tmp) => { if (UTILS.lineInRect(tmp.x2 - tmp.scale, tmp.y2 - tmp.scale, tmp.x2 + tmp.scale, tmp.y2 + tmp.scale, pjs.x, pjs.y, pjs.x, pjs.y)) { return true; } }); if (finds) return false; finds = liztobj.filter(tmp => tmp.active).find((tmp) => { let tmpScale = tmp.getScale(); if (!tmp.ignoreCollision && UTILS.lineInRect(tmp.x - tmpScale, tmp.y - tmpScale, tmp.x + tmpScale, tmp.y + tmpScale, pjs.x, pjs.y, pjs.x, pjs.y)) { return true; } }); if (finds) return false; return true; } } }; class Autobuy { constructor(buyHat, buyAcc) { this.hat = function() { buyHat.forEach((id) => { let find = findID(hats, id); if (find && !player.skins[id] && player.points >= find.price) packet("c", 1, id, 0); }); }; this.acc = function() { buyAcc.forEach((id) => { let find = findID(accessories, id); if (find && !player.tails[id] && player.points >= find.price) packet("c", 1, id, 1); }); }; } }; class Autoupgrade { constructor() { this.sb = function(upg) { upg(3); upg(17); upg(31); upg(23); upg(9); upg(38); }; this.kh = function(upg) { upg(3); upg(17); upg(31); upg(23); upg(10); upg(38); upg(4); upg(25); }; this.pb = function(upg) { upg(5); upg(17); upg(32); upg(23); upg(9); upg(38); }; this.ph = function(upg) { upg(5); upg(17); upg(32); upg(23); upg(10); upg(38); upg(28); upg(25); }; this.db = function(upg) { upg(7); upg(17); upg(31); upg(23); upg(9); upg(34); }; }; }; class Damages { constructor(items) { // 0.75 1 1.125 1.5 this.calcDmg = function(dmg, val) { return dmg * val; }; this.getAllDamage = function(dmg) { return [this.calcDmg(dmg, 0.75), dmg, this.calcDmg(dmg, 1.125), this.calcDmg(dmg, 1.5)]; }; this.weapons = []; for (let i = 0; i < items.weapons.length; i++) { let wp = items.weapons[i]; let name = wp.name.split(" ").length <= 1 ? wp.name : (wp.name.split(" ")[0] + "_" + wp.name.split(" ")[1]); this.weapons.push(this.getAllDamage(i > 8 ? wp.Pdmg : wp.dmg)); this[name] = this.weapons[i]; } } } /** CLASS CODES */ // jumpscare code warn let tmpList = []; var bianosTick = false; // LOADING: let UTILS = new Utils(); let items = new Items(); let objectManager = new Objectmanager(GameObject, gameObjects, UTILS, config); let store = new Store(); let hats = store.hats; let accessories = store.accessories; let projectileManager = new ProjectileManager(Projectile, projectiles, players, ais, objectManager, items, config, UTILS); let aiManager = new AiManager(ais, AI, players, items, null, config, UTILS); let textManager = new Textmanager(); let traps = new Traps(UTILS, items); let instaC = new Instakill(); let autoBuy = new Autobuy([6,7, 22, 12, 53, 40], [11 , 13, 18]); let autoUpgrade = new Autoupgrade(); let lastDeath; let minimapData; let mapMarker = {}; let mapPings = []; let tmpPing; let breakTrackers = []; let pathFindTest = 0; let grid = []; let pathFind = { active: false, grid: 40, scale: 1440, x: 14400, y: 14400, chaseNear: false, array: [], lastX: this.grid / 2, lastY: this.grid / 2 }; function sendChat(message) { packet("6", message.slice(0, 30)); } let runAtNextTick = []; function checkProjectileHolder(x, y, dir, range, speed, indx, layer, sid) { let weaponIndx = indx == 0 ? 9 : indx == 2 ? 12 : indx == 3 ? 13 : indx == 5 && 15; let projOffset = config.playerScale * 2; let projXY = { x: indx == 1 ? x : x - projOffset * Math.cos(dir), y: indx == 1 ? y : y - projOffset * Math.sin(dir), }; let nearPlayer = players.filter((e) => e.visible && UTILS.getDist(projXY, e, 0, 2) <= e.scale).sort(function(a, b) { return UTILS.getDist(projXY, a, 0, 2) - UTILS.getDist(projXY, b, 0, 2); })[0]; if (nearPlayer) { if (indx == 1) { nearPlayer.shooting[53] = 1; } else { nearPlayer.shootIndex = weaponIndx; nearPlayer.shooting[1] = 1; antiProj(nearPlayer, dir, range, speed, indx, weaponIndx); } } } let projectileCount = 0; function antiProj(tmpObj, dir, range, speed, index, weaponIndex) { if (!tmpObj.isTeam(player)) { tmpDir = UTILS.getDirect(player, tmpObj, 2, 2); if (UTILS.getAngleDist(tmpDir, dir) <= 0.2) { tmpObj.bowThreat[weaponIndex]++; if (index == 5) { projectileCount++; } setTimeout(() => { tmpObj.bowThreat[weaponIndex]--; if (index == 5) { projectileCount--; } }, range / speed); if (tmpObj.bowThreat[9] >= 1 && (tmpObj.bowThreat[12] >= 1 || tmpObj.bowThreat[15] >= 1)) { place(1, tmpObj.aim2); my.anti0Tick = 4; if (!my.antiSync) { antiSyncHealing(4); } } else { if (projectileCount >= 2) { place(1, tmpObj.aim2); my.anti0Tick = 4; if (!my.antiSync) { antiSyncHealing(4); } } } } } } // SHOW ITEM INFO: function showItemInfo(item, isWeapon, isStoreItem) { if (player && item) { UTILS.removeAllChildren(itemInfoHolder); itemInfoHolder.classList.add("visible"); UTILS.generateElement({ id: "itemInfoName", text: UTILS.capitalizeFirst(item.name), parent: itemInfoHolder }); UTILS.generateElement({ id: "itemInfoDesc", text: item.desc, parent: itemInfoHolder }); if (isStoreItem) { } else if (isWeapon) { UTILS.generateElement({ class: "itemInfoReq", text: !item.type ? "primary" : "secondary", parent: itemInfoHolder }); } else { for (let i = 0; i < item.req.length; i += 2) { UTILS.generateElement({ class: "itemInfoReq", html: item.req[i] + "<span class='itemInfoReqVal'> x" + item.req[i + 1] + "</span>", parent: itemInfoHolder }); } if (item.group.limit) { UTILS.generateElement({ class: "itemInfoLmt", text: (player.itemCounts[item.group.id] || 0) + "/" + (config.isSandbox ? 99 : item.group.limit), parent: itemInfoHolder }); } } } else { itemInfoHolder.classList.remove("visible"); } } // RESIZE: window.addEventListener("resize", UTILS.checkTrusted(resize)); function resize() { screenWidth = window.innerWidth; screenHeight = window.innerHeight; let scaleFillNative = Math.max(screenWidth / maxScreenWidth, screenHeight / maxScreenHeight) * pixelDensity; gameCanvas.width = screenWidth * pixelDensity; gameCanvas.height = screenHeight * pixelDensity; gameCanvas.style.width = screenWidth + "px"; gameCanvas.style.height = screenHeight + "px"; mainContext.setTransform( scaleFillNative, 0, 0, scaleFillNative, (screenWidth * pixelDensity - (maxScreenWidth * scaleFillNative)) / 2, (screenHeight * pixelDensity - (maxScreenHeight * scaleFillNative)) / 2 ); } resize(); // MOUSE INPUT: var usingTouch; const mals = document.getElementById('touch-controls-fullscreen'); mals.style.display = 'block'; mals.addEventListener("mousemove", gameInput, false); function gameInput(e) { mouseX = e.clientX; mouseY = e.clientY; } let clicks = { left: false, middle: false, right: false, }; let clicked = { g: false } mals.addEventListener("mousedown", mouseDown, false); function mouseDown(e) { if (attackState != 1) { attackState = 1; if (e.button == 0) { clicks.left = true; } else if (e.button == 2) { clicks.right = true; } } } mals.addEventListener("mouseup", UTILS.checkTrusted(mouseUp)); function mouseUp(e) { if (attackState != 0) { attackState = 0; if (e.button == 0) { clicks.left = false; } else if (e.button == 1) { clicks.middle = false; } else if (e.button == 2) { clicks.right = false; } } } mals.addEventListener("wheel", wheel, false); let wbe = 1; let mWbe = 1; let smothAnim = null; function wheel(e, t = [null, 0]) { if (e.deltaY > 0) { //if (maxScreenWidth < 2100) { mWbe = Math.min(mWbe + 0.35, 10); //} } else { if (maxScreenWidth > 800) { mWbe = Math.max(mWbe - 0.35, 0.1); } } if (smothAnim) clearInterval(smothAnim); smothAnim = setInterval(() => { wbe += (mWbe - wbe) * 0.1; maxScreenWidth = config.maxScreenWidth * wbe; maxScreenHeight = config.maxScreenHeight * wbe; resize(); if (Math.abs(mWbe - wbe) < 0.01) { clearInterval(smothAnim); } }, 15); } function findAllianceBySid(sid) { return player.team ? alliancePlayers.find((THIS) => THIS === sid) : null; } // INPUT UTILS: function getMoveDir() { let dx = 0; let dy = 0; for (let key in moveKeys) { let tmpDir = moveKeys[key]; dx += !!keys[key] * tmpDir[0]; dy += !!keys[key] * tmpDir[1]; } return dx == 0 && dy == 0 ? undefined : Math.atan2(dy, dx); } function getSafeDir() { if (!player) return 0; if (!player.lockDir) { lastDir = Math.atan2(mouseY - (screenHeight / 2), mouseX - (screenWidth / 2)); } return lastDir || 0; } let plusDir = 0; let lastSpin = Date.now(); function getAttackDir(debug) { if (debug) { if (!player) return "0"; if (my.autoAim || ((clicks.left || (useWasd && near.dist2 <= items.weapons[player.weapons[0]].range + near.scale * 1.8 && !traps.inTrap)) && player.reloads[player.weapons[0]] == 0)) lastDir = (getEl("weaponGrind").checked || scriptMenu.toggles["autoGrind"]) ? getSafeDir() : enemy.length ? near.aim2 : getSafeDir(); else if (clicks.right && player.reloads[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0) lastDir = "getSafeDir()"; else if (traps.inTrap && player.reloads[traps.notFast(objectCheck) ? player.weapons[1] : player.weapons[0]] == 0) lastDir = "traps.aim"; else if (spikeB.can) { lastDir = 'spikeB.aim'; } else if (!player.lockDir) { if (configs.noDir) return "undefined"; lastDir = "getSafeDir()"; } return lastDir; } else { if (!player) return 0; if (my.autoAim || ((clicks.left || (useWasd && near.dist2 <= items.weapons[player.weapons[0]].range + near.scale * 1.8 && !traps.inTrap)) && player.reloads[player.weapons[0]] == 0)) lastDir = getEl("weaponGrind").checked ? getSafeDir() : enemy.length ? my.revAim ? (near.aim2 + Math.PI) : near.aim2 : getSafeDir(); else if (clicks.right && player.reloads[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0) lastDir = getSafeDir(); else if (traps.inTrap && player.reloads[traps.notFast() ? player.weapons[1] : player.weapons[0]] == 0) { lastDir = traps.aim; } else if (spikeB.can) { lastDir = spikeB.aim; } else if (!player.lockDir) { if (configs.noDir) return undefined; lastDir = getSafeDir(); } return lastDir || 0; } } function getVisualDir() { if (!player) return 0; lastDir = getSafeDir(); return lastDir || 0; } // KEYS: function keysActive() { return (allianceMenu.style.display != "block" && chatHolder.style.display != "block" && !menuCBFocus); } function toggleMenuChat() { if (menuChatDiv.style.display != "none") { // chatHolder.style.display = "none"; // if (menuChatBox.value != "") { //commands[command.slice(1)] let cmd = function(command) { return { found: command.startsWith("/") && commands[command.slice(1).split(" ")[0]], fv: commands[command.slice(1).split(" ")[0]] } } let command = cmd(menuChatBox.value); if (command.found) { if (typeof command.fv.action === "function") { command.fv.action(menuChatBox.value); } } else { sendChat(menuChatBox.value); } menuChatBox.value = ""; menuChatBox.blur(); } else { if (menuCBFocus) { menuChatBox.blur(); } else { menuChatBox.focus(); } } } function instaSync () { var instaSync = getEl("gowogSync") if ( instaSync && instaSync.checked) { this.isTrue = true my.autoAim = true selectWeapon(player.weapons[1]); buyEquip(53, 0); sendAutoGather(); setTimeout(() => { selectWeapon(player.weapons[0]); buyEquip(7, 0); setTimeout(() => { sendAutoGather(); this.isTrue = false; my.autoAim = false; }, 225); }, 100); } } function keyDown(event) { let keyNum = event.which || event.keyCode || 0; if (player && player.alive && keysActive()) { if (!keys[keyNum]) { keys[keyNum] = 1; macro[event.key] = 1; if (keyNum == 27) { openMenu = false; document.getElementById("menuDiv").style.display = "none"; document.getElementById("menuChatDiv").style.display = "none"; scriptMenu.toggleMenu(); } else if (keyNum == 69) { sendAutoGather(); } else if (keyNum == 67) { updateMapMarker(); } else if (player.weapons[keyNum - 49] != undefined) { player.weaponCode = player.weapons[keyNum - 49]; } else if (moveKeys[keyNum]) { sendMoveDir(); } else if (event.key == "m") { mills.placeSpawnPads = !mills.placeSpawnPads; } else if (event.key == "z") { mills.place = !mills.place; } else if (event.key == "Z") { typeof window.debug == "function" && window.debug(); } else if (keyNum == 32) { packet("d", 1, getSafeDir(), 1); packet("d", 0, getSafeDir(), 1); } else if (event.key == "") { io.send("6", '') project.send(JSON.stringify(["", ""])); for (let i = 0; i < botz.length; i++) { botz[i][0].zync(near); console.log(botz[i][0]) } } } } } addEventListener("keydown", UTILS.checkTrusted(keyDown)); function keyUp(event) { if (player && player.alive) { let keyNum = event.which || event.keyCode || 0; if (keyNum == 13) { toggleMenuChat(); } else if (keysActive()) { if (keys[keyNum]) { keys[keyNum] = 0; macro[event.key] = 0; if (moveKeys[keyNum]) { sendMoveDir(); } } } } } window.addEventListener("keyup", UTILS.checkTrusted(keyUp)); function sendMoveDir() { let newMoveDir = getMoveDir(); if (lastMoveDir == undefined || newMoveDir == undefined || Math.abs(newMoveDir - lastMoveDir) > 0.3) { if (!my.autoPush) { packet("f", newMoveDir, 1); } lastMoveDir = newMoveDir; } } // BUTTON EVENTS: function bindEvents() {} bindEvents(); /** PATHFIND TEST */ function chechPathColl(tmp) { return ((player.scale + tmp.getScale()) / (player.maxSpeed * items.weapons[player.weaponIndex].spdMult)) + (tmp.dmg && !tmp.isTeamObject(player) ? 35 : 0); return tmp.colDiv == 0.5 ? (tmp.scale * tmp.colDiv) : !tmp.isTeamObject(player) && tmp.dmg ? (tmp.scale + player.scale) : tmp.isTeamObject(player) && tmp.trap ? 0 : tmp.scale; } function checkObject() { let checkColl = gameObjects.filter(tmp => player.canSee(tmp) && tmp.active); for (let y = 0; y < pathFind.grid; y++) { grid[y] = []; for (let x = 0; x < pathFind.grid; x++) { let tmpXY = { x: (player.x2 - (pathFind.scale / 2)) + ((pathFind.scale / pathFind.grid) * x), y: (player.y2 - (pathFind.scale / 2)) + ((pathFind.scale / pathFind.grid) * y) } if (UTILS.getDist(pathFind.chaseNear ? near : pathFind, tmpXY, pathFind.chaseNear ? 2 : 0, 0) <= (pathFind.chaseNear ? 35 : 60)) { pathFind.lastX = x; pathFind.lastY = y; grid[y][x] = 0; continue; } let find = checkColl.find(tmp => UTILS.getDist(tmp, tmpXY, 0, 0) <= chechPathColl(tmp)); if (find) { if (find.trap) { grid[y][x] = 0; continue; } grid[y][x] = 1; } else { grid[y][x] = 0; } } } } function createPath() { grid = []; checkObject(); } function Pathfinder() { pathFind.scale = (config.maxScreenWidth / 2) * 1.3; if (!traps.inTrap && (pathFind.chaseNear ? enemy.length : true)) { if (near.dist2 <= items.weapons[player.weapons[0]].range) { packet("f", undefined, 1); } else { createPath(); easystar.setGrid(grid); easystar.setAcceptableTiles([0]); easystar.enableDiagonals(); easystar.findPath((grid[0].length / 2), (grid.length / 2), pathFind.lastX, pathFind.lastY, function (path) { if (path === null) { pathFind.array = []; if (near.dist2 <= items.weapons[player.weapons[0]].range) { packet("f", undefined, 1); } else { packet("f", near.aim2, 1); } } else { pathFind.array = path; if (pathFind.array.length > 1) { let tmpXY = { x: (player.x2 - (pathFind.scale / 2)) + ((pathFind.scale / pathFind.grid) * path[1].x), y: (player.y2 - (pathFind.scale / 2)) + ((pathFind.scale / pathFind.grid) * path[1].y) } packet("f", UTILS.getDirect(tmpXY, player, 0, 2), 1); } } }); easystar.calculate(); } } } /** PATHFIND TEST */ // ITEM COUNT DISPLAY: let isItemSetted = []; function updateItemCountDisplay(index = undefined) { for (let i = 3; i < items.list.length; ++i) { let id = items.list[i].group.id; let tmpI = items.weapons.length + i; if (!isItemSetted[tmpI]) { isItemSetted[tmpI] = document.createElement("div"); isItemSetted[tmpI].id = "itemCount" + tmpI; getEl("actionBarItem" + tmpI).appendChild(isItemSetted[tmpI]); isItemSetted[tmpI].style = ` display: block; position: absolute; padding-left: 5px; font-size: 2em; color: #fff; `; isItemSetted[tmpI].innerHTML = player.itemCounts[id] || 0; } else { if (index == id) isItemSetted[tmpI].innerHTML = player.itemCounts[index] || 0; } } } // AUTOPUSH: function autoPush() { let nearTrap = gameObjects.filter(tmp => tmp.trap && tmp.active && tmp.isTeamObject(player) && UTILS.getDist(tmp, near, 0, 2) <= (near.scale + tmp.getScale() + 15)).sort(function(a, b) { return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0, 2); })[0]; if (nearTrap) { let enemyboob = gameObjects.some(tmp => tmp.dmg && tmp.active && !tmp.isTeamObject(player) && UTILS.getDist(tmp, nearTrap, 0, 0) <= (near.scale + nearTrap.scale + tmp.scale + 5)); if (enemyboob) { my.autoPush = false; pathFind.active = false; pathFind.chaseNear = false; return; } let spike = gameObjects.filter(tmp => tmp.dmg && tmp.active && tmp.isTeamObject(player) && UTILS.getDist(tmp, nearTrap, 0, 0) <= (near.scale + nearTrap.scale + tmp.scale + 5)).sort(function(a, b) { return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0, 2); })[0]; if (spike && UTILS.getDist(spike, nearTrap, 0, 0)) { let pos = { x: spike.x + (250 * Math.cos(UTILS.getDirect(near, spike, 2, 0))), y: spike.y + (250 * Math.sin(UTILS.getDirect(near, spike, 2, 0))), x2: spike.x + ((UTILS.getDist(near, spike, 2, 0) + player.scale) * Math.cos(UTILS.getDirect(near, spike, 2, 0))), y2: spike.y + ((UTILS.getDist(near, spike, 2, 0) + player.scale) * Math.sin(UTILS.getDirect(near, spike, 2, 0))) }; let finds = gameObjects.filter(tmp => tmp.active).find((tmp) => { let tmpScale = tmp.getScale(); if (!tmp.ignoreCollision && UTILS.lineInRect(tmp.x - tmpScale, tmp.y - tmpScale, tmp.x + tmpScale, tmp.y + tmpScale, player.x2, player.y2, pos.x2, pos.y2)) { return true; } }); if (near.dist2 >= 110) { my.autoPush = false; pathFind.active = true; pathFind.chaseNear = true; } else if (near.dist2 <= 100) { pathFind.active = false; pathFind.chaseNear = false; my.autoPush = true; my.pushData = { x: spike.x + Math.cos(30), y: spike.y + Math.sin(30), x2: pos.x2 + Math.cos(60), y2: pos.y2 + Math.sin(60) }; let angle = Math.atan2(near.y2 - spike.y, near.x2 - spike.x); let point = { x: near.x2 + Math.cos(angle) * 53, y: near.y2 + Math.sin(angle) * 53, }; let num = UTILS.getDist(near, spike, 2, 0); let text = num.toString(10); let scale = (player.scale / 10); if (UTILS.getDist(near, spike, 2, 0) >= 105) { if (UTILS.lineInRect(player.x2 - scale, player.y2 - scale, player.x2 + scale, player.y2 + scale, near.x2, near.y2, pos.x, pos.y)) { io.send("f", near.aim2, 1); } else { io.send("f", UTILS.getDirect(pos, player, 2, 2), 1); } } else { let isEnemyTouchingSpike = gameObjects.some(tmp => tmp.dmg && tmp.active && !tmp.isTeamObject(player) && UTILS.getDist(tmp, spike, 0, 0) <= (tmp.scale + spike.scale + 5)); if (isEnemyTouchingSpike) { let enemyPos = { x: enemy.x, y: enemy.y }; let angleToEnemy = Math.atan2(enemyPos.y - spike.y, enemyPos.x - spike.x); let angleDifference = Math.abs(UTILS.getDirect(near, spike, 2, 0) - angleToEnemy); if (angleDifference > Math.PI / 2) { let antiOverPush = angleToEnemy + Math.PI / 2; io.send("f", antiOverPush, 1); } else { io.send("f", UTILS.getDirect(near, spike, 2, 0), 1); } } else { io.send("f", Math.atan2(point.y - player.y2, point.x - player.x2), 1); } } } } else { if (my.autoPush) { io.send("f", undefined, 1); my.autoPush = false; } pathFind.active = false; pathFind.chaseNear = false; } } else { if (my.autoPush) { io.send("f", undefined, 1); my.autoPush = false; } pathFind.active = false; pathFind.chaseNear = false; } } // ADD DEAD PLAYER: function addDeadPlayer(tmpObj) { deadPlayers.push(new DeadPlayer(tmpObj.x, tmpObj.y, tmpObj.dir, tmpObj.buildIndex, tmpObj.weaponIndex, tmpObj.weaponVariant, tmpObj.skinColor, tmpObj.scale, tmpObj.name)); } /** APPLY SOCKET CODES */ // SET INIT DATA: function setInitData(data) { alliances = data.teams; } // SETUP GAME: function setupGame(yourSID) { keys = {}; macro = {}; playerSID = yourSID; attackState = 0; inGame = true; packet("F", 0, getAttackDir(), 1); my.ageInsta = true; if (firstSetup) { firstSetup = false; gameObjects.length = 0; liztobj.length = 0; } } // ADD NEW PLAYER: function addPlayer(data, isYou) { let tmpPlayer = findPlayerByID(data[0]); if (!tmpPlayer) { tmpPlayer = new Player(data[0], data[1], config, UTILS, projectileManager, objectManager, players, ais, items, hats, accessories); players.push(tmpPlayer); if (data[1] != playerSID) { addMenuChText(null, `Found ${data[2]} {${data[1]}}`, "lime"); } } else { if (data[1] != playerSID) { addMenuChText(null, `Found ${data[2]} {${data[1]}}`, "lime"); } } tmpPlayer.spawn(isYou ? true : null); tmpPlayer.visible = false; tmpPlayer.oldPos = { x2: undefined, y2: undefined }; tmpPlayer.x2 = undefined; tmpPlayer.y2 = undefined; tmpPlayer.x3 = undefined; tmpPlayer.y3 = undefined; tmpPlayer.setData(data); if (isYou) { if (!player) { window.prepareUI(tmpPlayer); } player = tmpPlayer; camX = player.x; camY = player.y; my.lastDir = 0; updateItems(); updateAge(); updateItemCountDisplay(); if (player.skins[7]) { my.reSync = true; } } } // REMOVE PLAYER: function removePlayer(id) { for (let i = 0; i < players.length; i++) { if (players[i].id == id) { addMenuChText("Game", players[i].name + "[" + players[i].sid + "] left the game", "red"); players.splice(i, 1); break; } } } // UPDATE HEALTH: function updateHealth(sid, value) { tmpObj = findPlayerBySID(sid); if (tmpObj) { tmpObj.oldHealth = tmpObj.health; tmpObj.health = value; tmpObj.judgeShame(); if (tmpObj.oldHealth > tmpObj.health) { tmpObj.damaged = tmpObj.oldHealth - tmpObj.health; advHeal.push([sid, value, tmpObj.damaged]); } } } // KILL PLAYER: function killPlayer() { inGame = false; lastDeath = { x: player.x, y: player.y, }; if (configs.autoRespawn) { getEl("diedText").style.display = "none"; packet("M", { name: lastsp[0], moofoll: lastsp[1], skin: lastsp[2] }); } } // UPDATE PLAYER ITEM VALUES: function updateItemCounts(index, value) { if (player) { player.itemCounts[index] = value; updateItemCountDisplay(index); } } // UPDATE AGE: function updateAge(xp, mxp, age) { if (xp != undefined) player.XP = xp; if (mxp != undefined) player.maxXP = mxp; if (age != undefined) player.age = age; } // UPDATE UPGRADES: function updateUpgrades(points, age) { player.upgradePoints = points; player.upgrAge = age; if (points > 0) { tmpList.length = 0; UTILS.removeAllChildren(upgradeHolder); for (let i = 0; i < items.weapons.length; ++i) { if (items.weapons[i].age == age && (items.weapons[i].pre == undefined || player.weapons.indexOf(items.weapons[i].pre) >= 0)) { let e = UTILS.generateElement({ id: "upgradeItem" + i, class: "actionBarItem", onmouseout: function() { showItemInfo(); }, parent: upgradeHolder }); e.style.backgroundImage = getEl("actionBarItem" + i).style.backgroundImage; tmpList.push(i); } } for (let i = 0; i < items.list.length; ++i) { if (items.list[i].age == age && (items.list[i].pre == undefined || player.items.indexOf(items.list[i].pre) >= 0)) { let tmpI = (items.weapons.length + i); let e = UTILS.generateElement({ id: "upgradeItem" + tmpI, class: "actionBarItem", onmouseout: function() { showItemInfo(); }, parent: upgradeHolder }); e.style.backgroundImage = getEl("actionBarItem" + tmpI).style.backgroundImage; tmpList.push(tmpI); } } for (let i = 0; i < tmpList.length; i++) { (function(i) { let tmpItem = getEl('upgradeItem' + i); tmpItem.onclick = UTILS.checkTrusted(function() { packet("H", i); }); UTILS.hookTouchEvents(tmpItem); })(tmpList[i]); } for (let i = 0; i < tmpList.length; i++) { (function(i) { let tmpItem = getEl('upgradeItem' + i); tmpItem.onclick = UTILS.checkTrusted(function() { packet("H", i); }); UTILS.hookTouchEvents(tmpItem); if (scriptMenu.toggles["autoUpgrade"]) { let parsedInt = parseInt(scriptMenu.toggles["autoUpgrade_sub_value"]); if (tmpList.length == 1) { packet("H", i); } else if (["17", "31", "23", parsedInt].find(e => tmpItem.id.includes(e))) { packet("H", i); } } })(tmpList[i]); } if (tmpList.length) { upgradeHolder.style.display = "block"; upgradeCounter.style.display = "block"; upgradeCounter.innerHTML = "SELECT ITEMS (" + points + ")"; } else { upgradeHolder.style.display = "none"; upgradeCounter.style.display = "none"; showItemInfo(); } } else { upgradeHolder.style.display = "none"; upgradeCounter.style.display = "none"; showItemInfo(); } } // KILL OBJECT: function killObject(sid) { let findObj = findObjectBySid(sid); objectManager.disableBySid(sid); if (player) { for (let i = 0; i < breakObjects.length; i++) { if (breakObjects[i].sid == sid) { breakObjects.splice(i, 1); break; } } if (!player.canSee(findObj)) { breakTrackers.push({ x: findObj.x, y: findObj.y }); } if (breakTrackers.length > 8) { breakTrackers.shift(); } traps.replacer(findObj); } } // KILL ALL OBJECTS BY A PLAYER: function killObjects(sid) { if (player) objectManager.removeAllItems(sid); } function setTickout(doo, timeout) { if (!ticks.manage[ticks.tick + timeout]) { ticks.manage[ticks.tick + timeout] = [doo]; } else { ticks.manage[ticks.tick + timeout].push(doo); } } function caf(e, t) { try { return Math.atan2((t.y2 || t.y) - (e.y2 || e.y), (t.x2 || t.x) - (e.x2 || e.x)); } catch (e) { return 0; } } let found = false; let autoQ = false; let autos = { insta: { todo: false, wait: false, count: 4, shame: 5 }, bull: false, antibull: 0, reloaded: false, stopspin: true } let omgS = { spike: { active: false, x: 0, y: 0, scale: 0, }, moveDir: undefined, lastPos: { x: 0, y: 0, } } function fgdo(a, b) { return Math.sqrt(Math.pow((b.y - a.y), 2) + Math.pow((b.x - a.x), 2)); } let whereverifybutton = document.querySelector("#altcha_checkbox") function clicktheverify() { if (whereverifybutton) { whereverifybutton.click() } } setInterval(clicktheverify, 50); // Initialisation des variables let lastTime = performance.now(); let frameCount = 120; window.fps = 120; // Fonction de mise à jour (appelée à chaque frame) function update() { // Calculer le temps écoulé depuis la dernière image const currentTime = performance.now(); const deltaTime = currentTime - lastTime; lastTime = currentTime; // Incrémenter le compteur de frames frameCount++; // Calculer les FPS chaque seconde (1000 ms) if (deltaTime >= 100) { window.fps = frameCount; // Mettre à jour la valeur des FPS frameCount = 120; // Réinitialiser le compteur de frames } requestAnimationFrame(update);}update(); // UPDATE PLAYER DATA: function updatePlayers(data) { // High Ping Notif if (window.pingTime > 150) { textManager.showText(player.x2, player.y2, 20, 0.15, 1850, "Warning High Ping: " + window.pingTime, "red", 2); } // High Ping Notif if (window.fps < 3) { textManager.showText(player.x2, player.y2, 20, 0.1, 1850, "xaxa fps suck?!?" + window.fps, "blue", 2); } // Safe walk: let dir = lastMoveDir; let newPos = { x: player.x2 + (player.x2 - omgS.lastPos.x) * 1.3 + (Math.cos(dir) * 50), y: player.y2 + (player.y2 - omgS.lastPos.y) * 1.3 + (Math.sin(dir) * 50), }; let nearSpike = gameObjects .filter(e => (e.name === "spikes" || e.name === "greater spikes" || e.name === "spinning spikes" || e.name === "poison spikes") && e.active && UTILS.getDist(e, tmpObj, 0, 2) <= 200 && !e.isTeamObject(player)) .sort((a, b) => UTILS.getDist(a, tmpObj, 0, 2) - UTILS.getDist(b, tmpObj, 0, 2))[0]; let found = false; let buildings = gameObjects.sort((a, b) => Math.hypot(player.y2 - a.y, player.x2 - a.x) - Math.hypot(player.y2 - b.y, player.x2 - b.x)); let spikes = buildings.filter(obj => obj.dmg && fgdo(player, obj) < 230 && !obj.isTeamObject(player) && obj.active); // Safe walk logic: Check for collision with spikes for (let i = 0; i < spikes.length; i++) { if (fgdo(spikes[i], newPos) < spikes[i].scale + player.scale + 4.5) { found = Math.atan2(player.y2 - spikes[i].y, player.x2 - spikes[i].x); omgS.spike.active = true; omgS.spike.x = spikes[i].x; omgS.spike.y = spikes[i].y; omgS.spike.scale = spikes[i].scale; } } if (found !== false && !my.inTrap) { packet("f", undefined, 1); textManager.showText(player.x2, player.y2, 20, 0.15, 1850, "block", "#fff", 2); } else if (!instaC.isTrue) { omgS.spike.active = false; } else { omgS.spike.active = false; } omgS.lastPos.x = player.x2; omgS.lastPos.y = player.y2; // AutoBreakSpike: if (!spikeB.info || !spikeB.info.active || !spikes.includes(spikeB.info) && !traps.inTrap) { buildings = gameObjects.sort((a, b) => Math.hypot(player.y2 - a.y, player.x2 - a.x) - Math.hypot(player.y2 - b.y, player.x2 - b.x)); spikes = buildings.filter(obj => (obj.name === 'spikes' || obj.name === 'greater spikes' || obj.name === 'spinning spikes' || obj.name === 'poison spikes') && !(player.sid === obj.owner.sid || findAllianceBySid(obj.owner.sid)) && fgdo(player, obj) < (player.items[1] === 10 ? 145 : 200) && obj.active); let nearestSpike = spikes.length > 0 ? spikes[0] : null; if (spikes.length > 1) { nearestSpike = spikes.reduce((closest, current) => { return Math.hypot(player.y2 - current.y, player.x2 - current.x) < Math.hypot(player.y2 - closest.y, player.x2 - closest.x) ? current : closest; }); } if (nearestSpike) { spikeB.info = nearestSpike; } else { spikeB.info = null; } } if (spikeB.info) { let weaponRange = items.weapons[player.weapons[1] === 10 ? player.weapons[1] : player.weapons[0]].range + player.scale * 1.8; let spikeDistance = Math.hypot(player.y2 - spikeB.info.y, player.x2 - spikeB.info.x); if (spikeDistance <= weaponRange) { spikeB.dist = spikeDistance; spikeB.x = spikeB.info.x; spikeB.y = spikeB.info.y; spikeB.can = true; spikeB.aim = UTILS.getDirect(spikeB.info, player, 0, 2); } else { spikeB.can = false; } } else { spikeB.can = false; } if (spikeB.can) { if (!clicks.right || !clicks.left || !instaC.isTrue) { game.tickBase(() => { if (player.reloads[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0 && !my.waitHit) { selectWeapon(player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]); sendAutoGather(); my.waitHit = 1; game.tickBase(() => { sendAutoGather(); my.waitHit = 0; }, 1); } }, 1); } } game.tick++; enemy = []; nears = []; near = []; game.tickSpeed = performance.now() - game.lastTick; game.lastTick = performance.now(); players.forEach((tmp) => { tmp.forcePos = !tmp.visible; tmp.visible = false; if((tmp.timeHealed - tmp.timeDamaged)>0 && tmp.lastshamecount<tmp.shameCount) tmp.pinge = (tmp.timeHealed - tmp.timeDamaged); }); for (let i = 0; i < data.length;) { tmpObj = findPlayerBySID(data[i]); if (tmpObj) { tmpObj.t1 = (tmpObj.t2 === undefined) ? game.lastTick : tmpObj.t2; tmpObj.t2 = game.lastTick; tmpObj.oldPos.x2 = tmpObj.x2; tmpObj.oldPos.y2 = tmpObj.y2; tmpObj.x1 = tmpObj.x; tmpObj.y1 = tmpObj.y; tmpObj.x2 = data[i + 1]; tmpObj.y2 = data[i + 2]; tmpObj.x3 = tmpObj.x2 + (tmpObj.x2 - tmpObj.oldPos.x2); tmpObj.y3 = tmpObj.y2 + (tmpObj.y2 - tmpObj.oldPos.y2); tmpObj.d1 = (tmpObj.d2 === undefined) ? data[i + 3] : tmpObj.d2; tmpObj.d2 = data[i + 3]; tmpObj.dt = 0; tmpObj.buildIndex = data[i + 4]; tmpObj.weaponIndex = data[i + 5]; tmpObj.weaponVariant = data[i + 6]; tmpObj.team = data[i + 7]; tmpObj.isLeader = data[i + 8]; tmpObj.oldSkinIndex = tmpObj.skinIndex; tmpObj.oldTailIndex = tmpObj.tailIndex; tmpObj.skinIndex = data[i + 9]; tmpObj.tailIndex = data[i + 10]; tmpObj.iconIndex = data[i + 11]; tmpObj.zIndex = data[i + 12]; tmpObj.visible = true; tmpObj.update(game.tickSpeed); tmpObj.dist2 = UTILS.getDist(tmpObj, player, 2, 2); tmpObj.aim2 = UTILS.getDirect(tmpObj, player, 2, 2); tmpObj.dist3 = UTILS.getDist(tmpObj, player, 3, 3); tmpObj.aim3 = UTILS.getDirect(tmpObj, player, 3, 3); tmpObj.damageThreat = 0; if (tmpObj.skinIndex == 45 && tmpObj.shameTimer <= 0) { tmpObj.addShameTimer(); } if (tmpObj.oldSkinIndex == 45 && tmpObj.skinIndex != 45) { tmpObj.shameTimer = 0; tmpObj.shameCount = 0; if (tmpObj == player) { healer(); } } botSkts.forEach((bot) => { bot.showName = 'YEAHHH' }) for(let i = 0; i < players.length; i++) { for(let aa = 0; aa < botSkts.length; aa++) { if(player.id === aa.id) aa.showName = 'YEAHHHHHH' } } if (player.shameCount < 4 && near.dist3 <= 300 && near.reloads[near.primaryIndex] <= game.tickRate * (window.pingTime >= 200 ? 2 : 1)) { autoQ = true; healer(); } else { if (autoQ) { healer(); } autoQ = false; } if (tmpObj == player) { if (liztobj.length) { liztobj.forEach((tmp) => { tmp.onNear = false; if (tmp.active) { if (!tmp.onNear && UTILS.getDist(tmp, tmpObj, 0, 2) <= tmp.scale + items.weapons[tmpObj.weapons[0]].range) { tmp.onNear = true; } if (tmp.isItem && tmp.owner) { if (!tmp.pps && tmpObj.sid == tmp.owner.sid && UTILS.getDist(tmp, tmpObj, 0, 2) > (parseInt(getEl("breakRange").value) || 0) && !tmp.breakObj && ![13, 14, 20].includes(tmp.id)) { tmp.breakObj = true; breakObjects.push({ x: tmp.x, y: tmp.y, sid: tmp.sid }); } } } }); let nearTrap = liztobj.filter(e => e.trap && e.active && UTILS.getDist(e, tmpObj, 0, 2) <= (tmpObj.scale + e.getScale() + 25) && !e.isTeamObject(tmpObj)).sort(function(a, b) { return UTILS.getDist(a, tmpObj, 0, 2) - UTILS.getDist(b, tmpObj, 0, 2); })[0]; if (nearTrap) { let spike = gameObjects.filter(obj => obj.dmg && cdf(tmpObj, obj) <= tmpObj.scale + nearTrap.scale/2 && !obj.isTeamObject(tmpObj) && obj.active)[0] traps.dist = UTILS.getDist(nearTrap, tmpObj, 0, 2); traps.aim = UTILS.getDirect(nearTrap, tmpObj, 0, 2); traps.protect(caf(nearTrap, tmpObj) - Math.PI); traps.inTrap = true; traps.info = nearTrap; } else { traps.inTrap = false; traps.info = {}; } } else { traps.inTrap = false; } } if (tmpObj.weaponIndex < 9) { tmpObj.primaryIndex = tmpObj.weaponIndex; tmpObj.primaryVariant = tmpObj.weaponVariant; } else if (tmpObj.weaponIndex > 8) { tmpObj.secondaryIndex = tmpObj.weaponIndex; tmpObj.secondaryVariant = tmpObj.weaponVariant; } } i += 13; } if (textManager.stack.length) { let stacks = []; let notstacks = []; let num = 0; let num2 = 0; let pos = { x: null, y: null }; let pos2 = { x: null, y: null } textManager.stack.forEach((text) => { if (text.value >= 0) { if (num == 0) pos = { x: text.x, y: text.y }; num += Math.abs(text.value); } else { if (num2 == 0) pos2 = { x: text.x, y: text.y }; num2 += Math.abs(text.value); } }); if (num2 > 0) { textManager.showText(pos2.x, pos2.y, Math.max(45, Math.min(50, num2)), 0.18, 500, num2, "#8ecc51"); } if (num > 0) { textManager.showText(pos.x, pos.y, Math.max(45, Math.min(50, num)), 0.18, 500, num, "#fff"); } textManager.stack = []; } if (runAtNextTick.length) { runAtNextTick.forEach((tmp) => { checkProjectileHolder(...tmp); }); runAtNextTick = []; } for (let i = 0; i < data.length;) { tmpObj = findPlayerBySID(data[i]); if (tmpObj) { if (!tmpObj.isTeam(player)) { enemy.push(tmpObj); if (tmpObj.dist2 <= items.weapons[tmpObj.primaryIndex == undefined ? 5 : tmpObj.primaryIndex].range + (player.scale * 2)) { nears.push(tmpObj); } } tmpObj.manageReload(); if (tmpObj != player) { tmpObj.addDamageThreat(player); } } i += 13; } /*projectiles.forEach((proj) => { tmpObj = proj; if (tmpObj.active) { tmpObj.tickUpdate(game.tickSpeed); } });*/ if (player && player.alive) { if (enemy.length) { near = enemy.sort(function(tmp1, tmp2) { return tmp1.dist2 - tmp2.dist2; })[0]; } else { // console.log("no enemy"); } if (game.tickQueue[game.tick]) { game.tickQueue[game.tick].forEach((action) => { action(); }); game.tickQueue[game.tick] = null; } if (advHeal.length) { advHeal.forEach((updHealth) => { if (window.pingTime < 150) { let sid = updHealth[0]; let value = updHealth[1]; let totalDamage = 100 - value let damaged = updHealth[2]; tmpObj = findPlayerBySID(sid); let bullTicked = false; if (tmpObj == player) { if (tmpObj.skinIndex == 7 && (damaged == 5 || (tmpObj.latestTail == 13 && damaged == 2))) { if (my.reSync) { my.reSync = false; tmpObj.setBullTick = true; } bullTicked = true; } if (inGame) { let attackers = getAttacker(damaged); let gearDmgs = [0.25, 0.45].map((val) => val * items.weapons[player.weapons[0]].dmg * soldierMult()); let includeSpikeDmgs = enemy.length ? !bullTicked && (gearDmgs.includes(damaged) && near.skinIndex == 11) : false; let healTimeout = 140 - window.pingTime; let dmg = 100 - player.health; let slowHeal = function (timer, tickBase) { if (!tickBase) { setTimeout(() => { healer(); }, timer); } else { game.tickBase(() => { healer() }, 2) } } if (getEl("healingBeta").checked) { if (enemy.length) { if ([0, 7, 8].includes(near.primaryIndex)) { if (damaged < 75) { slowHeal(healTimeout) } else { healer() } } if ([1, 2, 6].includes(near.primaryIndex)) { if (damaged >= 25 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 5) { healer() } else { slowHeal(healTimeout) } } if (near.primaryIndex == 3) { if (near.secondaryIndex == 15) { if (near.primaryVariant < 2) { if (damaged >= 35 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 5 && game.tick - player.antiTimer > 1) { tmpObj.canEmpAnti = true tmpObj.antiTimer = game.tick healer() } else { slowHeal(healTimeout) } } else { if (damaged > 35 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 5 && game.tick - player.antiTimer > 1) { tmpObj.canEmpAnti = true tmpObj.antiTimer = game.tick healer() } else { slowHeal(healTimeout) } } } else { if (damaged >= 25 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 4) { healer() } else { slowHeal(healTimeout) } } } if (near.primaryIndex == 4) { if (near.primaryVariant >= 1) { if (damaged >= 10 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 4) { healer() } else { slowHeal(healTimeout) } } else { if (damaged >= 35 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 3) { healer() } else { slowHeal(healTimeout) } } } if ([undefined, 5].includes(near.primaryIndex)) { if (near.secondaryIndex == 10) { if (dmg >= (includeSpikeDmgs ? 10 : 20) && tmpObj.damageThreat + dmg >= 80 && tmpObj.shameCount < 6) { healer() } else { slowHeal(healTimeout) } } else if (near.primaryVariant >= 2 || near.primaryVariant == undefined) { if (dmg >= (includeSpikeDmgs ? 15 : 20) && tmpObj.damageThreat + dmg >= 50 && tmpObj.shameCount < 6) { healer() } else { slowHeal(healTimeout) } } else if ([undefined || 15].includes(near.secondaryIndex)) { if (damaged > (includeSpikeDmgs ? 8 : 20) && player.damageThreat >= 25 && (game.tick - player.antiTimer) > 1) { if (tmpObj.shameCount < 5) { healer() } else { slowHeal(healTimeout) } } else { slowHeal(healTimeout) } } else if ([9, 12, 13].includes(near.secondaryIndex)) { if (dmg >= 25 && player.damageThreat + dmg >= 70 && tmpObj.shameCount < 6) { healer() } else { slowHeal(healTimeout) } } else { if (damaged > 25 && player.damageThreat + dmg >= 95) { healer() } else { slowHeal(healTimeout) } } } if (near.primaryIndex == 6) { if (near.secondaryIndex == 15) { if (damaged >= 25 && tmpObj.damageThreat + dmg >= 95 && tmpObj.shameCount < 4) { healer() } else { slowHeal(healTimeout) } } else { if (damaged >= 70 && tmpObj.shameCount < 4) { healer() } else { slowHeal(healTimeout) } } } if (damaged >= 30 && near.reloads[near.secondaryIndex] == 0 && near.dist2 <= 150 && player.skinIndex == 11 && player.tailIndex == 21) instaC.canCounter = true } else { if (damaged >= 70) { healer() } else { slowHeal(healTimeout) } } } else { if (damaged >= (includeSpikeDmgs ? 8 : 25) && dmg + player.damageThreat >= 80 && (game.tick - player.antiTimer) > 1) { if (tmpObj.reloads[53] == 0 && tmpObj.reloads[tmpObj.weapons[1]] == 0) { tmpObj.canEmpAnti = true; } else { player.soldierAnti = true; } tmpObj.antiTimer = game.tick; let shame = [0, 4, 6, 7, 8].includes(near.primaryIndex) ? 2 : 5; if (tmpObj.shameCount < shame) { healer(); } else { if (near.primaryIndex == 7 || (player.weapons[0] == 7 && (near.skinIndex == 11 || near.tailIndex == 21))) { slowHeal(healTimeout) } else { slowHeal(healTimeout, 1) } } } else { if (near.primaryIndex == 7 || (player.weapons[0] == 7 && (near.skinIndex == 11 || near.tailIndex == 21))) { slowHeal(healTimeout) } else { slowHeal(healTimeout, 1) } } if (damaged >= 25 && near.dist2 <= 140 && player.skinIndex == 11 && player.tailIndex == 21) instaC.canCounter = true } } else { if (!tmpObj.setPoisonTick && (tmpObj.damaged == 5 || (tmpObj.latestTail == 13 && tmpObj.damaged == 2))) { tmpObj.setPoisonTick = true; } } } } else { let [sid, value, damaged] = updHealth; let totalDamage = 100 - value; let tmpObj = findPlayerBySID(sid); let bullTicked = false; if (tmpObj == player) { if (tmpObj.skinIndex == 7 && (damaged == 5 || (tmpObj.latestTail == 13 && damaged == 2))) { if (my.reSync) { my.reSync = false; tmpObj.setBullTick = true; bullTicked = true; } } if (inGame) { let attackers = getAttacker(damaged); let gearDmgs = [0.25, 0.45].map((val) => val * items.weapons[player.weapons[0]].dmg * soldierMult()); let includeSpikeDmgs = enemy.length ? !bullTicked && (gearDmgs.includes(damaged) && near.skinIndex == 11) : false; let healTimeout = 60; let dmg = 100 - player.health; let shameCountThreshold = [2, 5][[0, 4, 6, 7, 8].includes(near.primaryIndex) ? 0 : 1]; let slowHeal = function (timer, tickBase) { if (!tickBase) setTimeout(() => healer(), timer); else game.tickBase(() => healer(), 2); }; if (getEl("healingBeta").checked) { let canHealFast = [0, 7, 8].includes(near.primaryIndex) ? damaged < 75 : [1, 2, 6].includes(near.primaryIndex) ? damaged >= 25 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 5 : [undefined, 5].includes(near.primaryIndex) ? dmg >= (includeSpikeDmgs ? 15 : 20) && tmpObj.damageThreat + dmg >= 50 && tmpObj.shameCount < 6 : near.primaryIndex == 3 && near.secondaryIndex == 15 ? damaged >= 35 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 5 && game.tick - player.antiTimer > 1 : near.primaryIndex == 4 ? near.primaryVariant >= 1 ? damaged >= 10 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 4 : damaged >= 35 && player.damageThreat + dmg >= 95 && tmpObj.shameCount < 3 : near.primaryIndex == 6 && near.secondaryIndex == 15 ? damaged >= 25 && tmpObj.damageThreat + dmg >= 95 && tmpObj.shameCount < 4 : damaged >= 25 && player.damageThreat + dmg >= 95; canHealFast ? healer() : slowHeal(healTimeout); } else { let canHealFast = damaged >= (includeSpikeDmgs ? 8 : 25) && dmg + player.damageThreat >= 80 && (game.tick - player.antiTimer) > 1; if (canHealFast) { if (tmpObj.reloads[53] == 0 && tmpObj.reloads[tmpObj.weapons[1]] == 0) tmpObj.canEmpAnti = true; else player.soldierAnti = true; tmpObj.antiTimer = game.tick; if (tmpObj.shameCount < shameCountThreshold) healer(); else slowHeal(healTimeout, near.primaryIndex == 7 || (player.weapons[0] == 7 && (near.skinIndex == 11 || near.tailIndex == 21)) ? 0 : 1); } else { slowHeal(healTimeout, near.primaryIndex == 7 || (player.weapons[0] == 7 && (near.skinIndex == 11 || near.tailIndex == 21)) ? 0 : 1); } } } else { if (!tmpObj.setPoisonTick && (tmpObj.damaged == 5 || (tmpObj.latestTail == 13 && tmpObj.damaged == 2))) { tmpObj.setPoisonTick = true; } } } } }); advHeal = []; } if (near.dist2 <= 310) { if ([3, 4, 5].includes(near.primaryIndex) && [10, 9, 12, 13, 15].includes(near.secondaryIndex)) { if (near.skinIndex == 7 && near.reloads[near.primaryIndex]) { buyEquip(6, 0); if (near.skinIndex == 53 || near.reloads[53] == 1) { buyEquip(6, 0); } } } } players.forEach((tmp) => { if (!tmp.visible && player != tmp) { tmp.reloads = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 53: 0, }; } if (tmp.setBullTick) { tmp.bullTimer = 0; } if (tmp.setPoisonTick) { tmp.poisonTimer = 0; } tmp.updateTimer(); }); if (inGame) { if (enemy.length) { if (player.canEmpAnti) { player.canEmpAnti = false; if (near.dist2 <= 300 && !my.safePrimary(near) && !my.safeSecondary(near)) { if (near.reloads[53] == 0) { player.empAnti = true; player.soldierAnti = false; //modLog("EmpAnti"); } else { player.empAnti = false; player.soldierAnti = true; //modLog("SoldierAnti"); } } } let prehit = liztobj.filter(tmp => tmp.dmg && tmp.active && tmp.isTeamObject(player) && UTILS.getDist(tmp, near, 0, 3) <= (tmp.scale + near.scale)).sort(function(a, b) { return UTILS.getDist(a, near, 0, 2) - UTILS.getDist(b, near, 0, 2); })[0]; if (prehit) { if (near.dist3 <= items.weapons[player.weapons[0]].range + player.scale * 1.8 && configs.predictTick) { instaC.canSpikeTick = true; instaC.syncHit = true; if (configs.revTick && player.weapons[1] == 15 && player.reloads[53] == 0 && instaC.perfCheck(player, near)) { instaC.revTick = true; } } } let antiSpikeTick = gameObjects.filter(tmp => tmp.dmg && tmp.active && !tmp.isTeamObject(player) && UTILS.getDist(tmp, player, 0, 3) < (tmp.scale + player.scale)).sort(function(a, b) { return UTILS.getDist(a, player, 0, 2) - UTILS.getDist(b, player, 0, 2); })[0]; if (antiSpikeTick && !traps.inTrap) { if (near.dist2 <= items.weapons[5].range + near.scale * 1.8) { my.anti0Tick = 1; } } } if ((useWasd ? true : ((player.checkCanInsta(true) >= 220 ? player.checkCanInsta(true) : player.checkCanInsta(false)) >= (player.weapons[1] == 10 ? 95 : 100))) && near.dist2 <= items.weapons[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]].range + near.scale * 1.8 && (instaC.wait || (useWasd && Math.floor(Math.random() * 5) == 0)) && !instaC.isTrue && !my.waitHit && player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] == 0 && (useWasd ? true : (player.reloads[53] <= (player.weapons[1] == 10 ? 0 : game.tickRate))) && instaC.perfCheck(player, near)) { if (player.checkCanInsta(true) >= 220) { instaC.nobull = useWasd ? false : instaC.canSpikeTick ? false : true; } else { instaC.nobull = false; } instaC.can = true; } else { instaC.can = false; } macro.q && place(0, getAttackDir()); macro.f && place(4, getSafeDir()); macro.v && place(2, getSafeDir()); macro.y && place(5, getSafeDir()); macro.h && place(player.getItemType(22), getSafeDir()); macro.n && place(3, getSafeDir()); if (game.tick % 3 == 0) { if (mills.place) { let plcAng = 1.25; for (let i = -plcAng; i <= plcAng; i += plcAng) { checkPlace(3, UTILS.getDirect(player.oldPos, player, 2, 2) + i); } } else { if (mills.placeSpawnPads) { for (let i = 0; i < Math.PI * 2; i += Math.PI / 2) { checkPlace(player.getItemType(20), UTILS.getDirect(player.oldPos, player, 2, 2) + i); } } } } if (instaC.can) { instaC.changeType(configs.alwaysRev ? "rev" : "normal"); } if (instaC.canCounter) { instaC.canCounter = false; if (player.reloads[player.weapons[0]] == 0 && !instaC.isTrue) { instaC.counterType(); } } if (instaC.canSpikeTick) { instaC.canSpikeTick = false; if (instaC.revTick) { instaC.revTick = false; if ([1, 2, 3, 4, 5, 6].includes(player.weapons[0]) && player.reloads[player.weapons[1]] == 0 && !instaC.isTrue) { instaC.changeType("rev"); chch(null, "[RevSyncHit]", "yellow"); } } else { if ([1, 2, 3, 4, 5, 6].includes(player.weapons[0]) && player.reloads[player.weapons[0]] == 0 && !instaC.isTrue) { instaC.spikeTickType(); if (instaC.syncHit) { chch(null, "[SyncHit]", "yellow"); } } } } if (!clicks.middle && (clicks.left || clicks.right) && !instaC.isTrue) { if ((player.weaponIndex != (clicks.right && player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0])) || player.buildIndex > -1) { selectWeapon(clicks.right && player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]); } if (player.reloads[clicks.right && player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0 && !my.waitHit) { sendAutoGather(); my.waitHit = 1; game.tickBase(() => { sendAutoGather(); my.waitHit = 0; }, 1); } } if (useWasd && !clicks.left && !clicks.right && !instaC.isTrue && near.dist2 <= (items.weapons[player.weapons[0]].range + near.scale * 1.8) && !traps.inTrap) { if ((player.weaponIndex != player.weapons[0]) || player.buildIndex > -1) { selectWeapon(player.weapons[0]); } if (player.reloads[player.weapons[0]] == 0 && !my.waitHit) { sendAutoGather(); my.waitHit = 1; game.tickBase(() => { sendAutoGather(); my.waitHit = 0; }, 1); } } if (traps.inTrap) { if (!clicks.left && !clicks.right && !instaC.isTrue) { if (player.weaponIndex != (traps.notFast() ? player.weapons[1] : player.weapons[0]) || player.buildIndex > -1) { selectWeapon(traps.notFast() ? player.weapons[1] : player.weapons[0]); } if (player.reloads[traps.notFast() ? player.weapons[1] : player.weapons[0]] == 0 && !my.waitHit) { sendAutoGather(); my.waitHit = 1; game.tickBase(() => { sendAutoGather(); my.waitHit = 0; }, 1); } } } if (clicked.g && !traps.inTrap) { if (!instaC.isTrue && player.reloads[player.weapons[1]] == 0) { if (my.ageInsta && player.weapons[0] != 4 && player.weapons[1] == 9 && player.age >= 9 && enemy.length) { instaC.bowMovement(); } else { instaC.rangeType(); } } } if (macro.t && !traps.inTrap) { if (!instaC.isTrue && player.reloads[player.weapons[0]] == 0 && (player.weapons[1] == 15 ? (player.reloads[player.weapons[1]] == 0) : true) && (player.weapons[0] == 5 || (player.weapons[0] == 4 && player.weapons[1] == 15))) { instaC[(player.weapons[0] == 4 && player.weapons[1] == 15) ? "kmTickMovement" : "tickMovement"](); } } if (macro["."] && !traps.inTrap) { if (!instaC.isTrue && player.reloads[player.weapons[0]] == 0 && ([9, 12, 13, 15].includes(player.weapons[1]) ? (player.reloads[player.weapons[1]] == 0) : true)) { instaC.boostTickMovement(); } } if (player.weapons[1] && !clicks.left && !clicks.right && !spikeB.can && !traps.inTrap && !instaC.isTrue && !(useWasd && near.dist2 <= items.weapons[player.weapons[0]].range + near.scale * 1.8)) { if (player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] == 0) { if (!my.reloaded) { my.reloaded = true; let fastSpeed = items.weapons[player.weapons[0]].spdMult < items.weapons[player.weapons[1]].spdMult ? 1 : 0; if (player.weaponIndex != player.weapons[fastSpeed] || player.buildIndex > -1) { selectWeapon(player.weapons[fastSpeed]); } } } else { my.reloaded = false; if(useWasd) { autos.stopspin = false; } if (player.reloads[player.weapons[0]] > 0) { if (player.weaponIndex != player.weapons[0] || player.buildIndex > -1) { selectWeapon(player.weapons[0]); } } else if (player.reloads[player.weapons[0]] == 0 && player.reloads[player.weapons[1]] > 0) { if (player.weaponIndex != player.weapons[1] || player.buildIndex > -1) { selectWeapon(player.weapons[1]); } if(useWasd) { if (!autos.stopspin) { setTimeout(()=>{ autos.stopspin = true; }, 750); } } } } } if (!instaC.isTrue && !traps.inTrap && !traps.replaced) { traps.autoPlace(); } if (!macro.q && !macro.f && !macro.v && !macro.h && !macro.n) { packet("D", getAttackDir()); } let hatChanger = function() { if (my.anti0Tick > 0) { buyEquip(6, 0); } else { if (clicks.left || clicks.right) { if (((!enemy.length || near.dist2 >= 260) && player.shameCount > 0 && player.skinIndex != 45) || my.reSync) { buyEquip(7, 0); } else { if (clicks.left) { buyEquip(player.reloads[player.weapons[0]] == 0 ? 7 : player.empAnti ? 22 : player.soldierAnti ? 6 : near.dist2 <= 300 ? 6 : 6, 0); } else if (clicks.right) { buyEquip(player.reloads[clicks.right && player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0 ? 40 : player.empAnti ? 22 : player.soldierAnti ? 6 : near.dist2 <= 300 ? 6 : 6, 0); } } } else if (traps.inTrap || spikeB.can) { if (traps.inTrap ? traps.info.health <= items.weapons[player.weaponIndex].dmg ? false : (player.reloads[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0): spikeB.info.health <= items.weapons[player.weaponIndex].dmg ? false : (player.reloads[player.weapons[1] == 10 ? player.weapons[1] : player.weapons[0]] == 0)) { buyEquip(40, 0); buyEquip(6, 0); } else { buyEquip(6, 0); } } else { if (player.empAnti || player.soldierAnti) { buyEquip(6, 0); } else { if (((!enemy.length || near.dist2 >= 260) && player.shameCount > 0 && player.skinIndex != 45) || my.reSync) { buyEquip(7, 0); } else { if (near.dist2 <= 480) { buyEquip(6, 0); } else { if (player.y2 >= config.mapScale / 2 - config.riverWidth / 2 && player.y2 <= config.mapScale / 2 + config.riverWidth / 2) { buyEquip(31, 0); } else if (player.y2 <= config.snowBiomeTop) { buyEquip(15, 0); } else { buyEquip(12, 0); } } } } } } } let accChangerSwordaaa = function () { if (player.weaponIndex == 3) { if (clicks.right || (my.autoPush && near.dist2 <= 270)) { buyEquip(11, 1); } else if (clicks.left) { buyEquip(18, 1); } else { buyEquip(11, 1); } } else { if (near.dist2 <= 270) { if (clicks.right) { buyEquip(19, 1); } else if (clicks.left) { buyEquip(19, 1); } else { buyEquip(19, 1); } } else { buyEquip(11, 1); } } } let accChanger = function () { if (player.weaponIndex == 7) { if (clicks.right || my.autoPush){ buyEquip(19, 1); } else if (clicks.left) { buyEquip(18,1); buyEquip(11, 1); buyEquip(6, 0); } else { buyEquip(11, 1); } } else { if (near.dist2 <= 270) { if (clicks.right){ buyEquip(19, 1); } else if (clicks.left) { buyEquip(19,1); } else { buyEquip(19, 1); } } else { buyEquip(11, 1); } } } if (storeMenu.style.display != "block" && !instaC.isTrue && !instaC.ticking) { hatChanger(); accChanger(); } if (scriptMenu.toggles["autoPush"] && enemy.length && !traps.inTrap && !instaC.ticking) { autoPush(); } else { if (my.autoPush) { my.autoPush = false; packet("f", lastMoveDir || undefined, 1); } } if (instaC.ticking) { instaC.ticking = false; } if (instaC.syncHit) { instaC.syncHit = false; } if (player.empAnti) { player.empAnti = false; } if (player.soldierAnti) { player.soldierAnti = false; } if (my.anti0Tick > 0) { my.anti0Tick--; } if (traps.replaced) { traps.replaced = false; } if (traps.antiTrapped) { traps.antiTrapped = false; } } } if (botSkts.length) { botSkts.forEach((bots) => { if (true) { bots[0].showName = 'YEAHHH'; } }); } } for(var i1 = 0; i1 < liztobj.length; i1++) { if (liztobj[i1].active && liztobj[i1].health > 0 && UTILS.getDist(liztobj[i1], player, 0, 2) < 150 && getEl("antipush").checked) { // || liztobj[i1].buildHealth <= items.weapons[nearEnemy.weaponIndex].dmg) if(liztobj[i1].name.includes("spike") && liztobj[i1]){ if(liztobj[i1].owner.sid != player.sid && clicks.left == false && tmpObj.reloads[tmpObj.secondaryIndex] == 0){ selectWeapon(player.weapons[1]) buyEquip(40, 0); packet("D", UTILS.getDirect(liztobj[i1], player, 0, 2)) setTickout( () => { buyEquip(6, 0) }, 1); } } } } function ez(context, x, y) { context.fillStyle = "rgba(0, 255, 255, 0.2)"; context.beginPath(); context.fill(); context.closePath(); context.globalAlpha = 1; } // UPDATE LEADERBOARD: function updateLeaderboard(data) { lastLeaderboardData = data; return; UTILS.removeAllChildren(leaderboardData); let tmpC = 1; for (let i = 0; i < data.length; i += 3) { (function(i) { UTILS.generateElement({ class: "leaderHolder", parent: leaderboardData, children: [ UTILS.generateElement({ class: "leaderboardItem", style: "color:" + ((data[i] == playerSID) ? "#fff" : "rgba(255,255,255,0.6)"), text: tmpC + ". " + (data[i + 1] != "" ? data[i + 1] : "unknown") }), UTILS.generateElement({ class: "leaderScore", text: UTILS.sFormat(data[i + 2]) || "0" }) ] }); })(i); tmpC++; } } // LOAD GAME OBJECT: function loadGameObject(data) { for (let i = 0; i < data.length;) { objectManager.add(data[i], data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], items.list[data[i + 6]], true, (data[i + 7] >= 0 ? { sid: data[i + 7] } : null)); i += 8; } } // ADD AI: function loadAI(data) { for (let i = 0; i < ais.length; ++i) { ais[i].forcePos = !ais[i].visible; ais[i].visible = false; } if (data) { let tmpTime = performance.now(); for (let i = 0; i < data.length;) { tmpObj = findAIBySID(data[i]); if (tmpObj) { tmpObj.index = data[i + 1]; tmpObj.t1 = (tmpObj.t2 === undefined) ? tmpTime : tmpObj.t2; tmpObj.t2 = tmpTime; tmpObj.x1 = tmpObj.x; tmpObj.y1 = tmpObj.y; tmpObj.x2 = data[i + 2]; tmpObj.y2 = data[i + 3]; tmpObj.d1 = (tmpObj.d2 === undefined) ? data[i + 4] : tmpObj.d2; tmpObj.d2 = data[i + 4]; tmpObj.health = data[i + 5]; tmpObj.dt = 0; tmpObj.visible = true; } else { tmpObj = aiManager.spawn(data[i + 2], data[i + 3], data[i + 4], data[i + 1]); tmpObj.x2 = tmpObj.x; tmpObj.y2 = tmpObj.y; tmpObj.d2 = tmpObj.dir; tmpObj.health = data[i + 5]; if (!aiManager.aiTypes[data[i + 1]].name) tmpObj.name = config.cowNames[data[i + 6]]; tmpObj.forcePos = true; tmpObj.sid = data[i]; tmpObj.visible = true; } i += 7; } } } // ANIMATE AI: function animateAI(sid) { tmpObj = findAIBySID(sid); if (tmpObj) tmpObj.startAnim(); } // GATHER ANIMATION: function gatherAnimation(sid, didHit, index) { tmpObj = findPlayerBySID(sid); if (tmpObj) { tmpObj.startAnim(didHit, index); tmpObj.gatherIndex = index; tmpObj.gathering = 1; if (didHit) { let tmpObjects = objectManager.hitObj; objectManager.hitObj = []; game.tickBase(() => { // refind tmpObj = findPlayerBySID(sid); let val = items.weapons[index].dmg * (config.weaponVariants[tmpObj[(index < 9 ? "prima" : "seconda") + "ryVariant"]].val) * (items.weapons[index].sDmg || 1) * (tmpObj.skinIndex == 40 ? 3.3 : 1); tmpObjects.forEach((healthy) => { healthy.health -= val; textManager.showText(healthy.x, healthy.y, 20, 0, 500, Math.abs(val.toString().includes(".") ? UTILS.fixTo(val, 3) : val), "#f00", true); }); }, 1); } } } // WIGGLE GAME OBJECT: function wiggleGameObject(dir, sid) { tmpObj = findObjectBySid(sid); if (tmpObj) { tmpObj.xWiggle += config.gatherWiggle * Math.cos(dir); tmpObj.yWiggle += config.gatherWiggle * Math.sin(dir); if (tmpObj.health) { objectManager.hitObj.push(tmpObj); } } } // SHOOT TURRET: function shootTurret(sid, dir) { tmpObj = findObjectBySid(sid); if (tmpObj) { if (config.anotherVisual) { tmpObj.lastDir = dir; } else { tmpObj.dir = dir; } tmpObj.xWiggle += config.gatherWiggle * Math.cos(dir + Math.PI); tmpObj.yWiggle += config.gatherWiggle * Math.sin(dir + Math.PI); } } // UPDATE PLAYER VALUE: function updatePlayerValue(index, value, updateView) { if (player) { player[index] = value; if (index == "points") { if (scriptMenu.toggles["autobuy"]) { autoBuy.hat(); autoBuy.acc(); } } else if (index == "kills") { // Woah Credits To Zod324Myers https://www.youtube.com/@Zod324myers if (configs.killChat || scriptMenu.toggles["killChat"]) { sendChat("Dumbasses down: " + value); setTimeout(() => { sendChat("I'm Super Pro"); }, 600); } } } } // ACTION BAR: function updateItems(data, wpn) { if (data) { if (wpn) { player.weapons = data; player.primaryIndex = player.weapons[0]; player.secondaryIndex = player.weapons[1]; if (!instaC.isTrue) { selectWeapon(player.weapons[0]); } } else { player.items = data; } } for (let i = 0; i < items.list.length; i++) { let tmpI = items.weapons.length + i; let actionBarItem = getEl("actionBarItem" + tmpI); actionBarItem.style.display = player.items.indexOf(items.list[i].id) >= 0 ? "inline-block" : "none"; } for (let i = 0; i < items.weapons.length; i++) { let actionBarItem = getEl("actionBarItem" + i); actionBarItem.style.display = player.weapons[items.weapons[i].type] == items.weapons[i].id ? "inline-block" : "none"; } let kms = player.weapons[0] == 3 && player.weapons[1] == 15; if (kms) { getEl("actionBarItem3").style.display = "none"; getEl("actionBarItem4").style.display = "inline-block"; } } // ADD PROJECTILE: function addProjectile(x, y, dir, range, speed, indx, layer, sid) { projectileManager.addProjectile(x, y, dir, range, speed, indx, null, null, layer, inWindow).sid = sid; runAtNextTick.push(Array.prototype.slice.call(arguments)); } // REMOVE PROJECTILE: function remProjectile(sid, range) { for (let i = 0; i < projectiles.length; ++i) { if (projectiles[i].sid == sid) { projectiles[i].range = range; let tmpObjects = objectManager.hitObj; objectManager.hitObj = []; game.tickBase(() => { let val = projectiles[i].dmg; tmpObjects.forEach((healthy) => { if (healthy.projDmg) { healthy.health -= val; } }); }, 1); } } } // lol this useless,,, fr let noob = false; let serverReady = true; var isProd = location.hostname !== "127.0.0.1" && !location.hostname.startsWith("192.168."); let wssws = isProd ? "wss" : "ws"; let project = new WebSocket(`${wssws}://beautiful-sapphire-toad.glitch.me`); let withSync = false; project.binaryType = "arraybuffer"; project.onmessage = function(msg) { let data = msg.data; if (data == "isready") { serverReady = true; } if (data == "fine") { noob = false; } if (data == "tezt") { addMenuChText(`${player.name}[${player.sid}]`, 'EEEEEEEEEEE', "white"); } if (data == "yeswearesyncer") { // let delay = Date.now() - wsDelay; withSync = true; if (player) { textManager.showText(player.x, player.y, 35, 0.1, 500, "Sync: " + window.pingTime + "ms", "#fff"); console.log("synced!!!!!!!! also delay: " + window.pingTime + "ms"); } } }; project.onopen = function() { var gameTitle = getEl("gameName"); gameTitle.innerText = "Moo Moo"; }; // SHOW ALLIANCE MENU: function allianceNotification(sid, name) { let findBotSID = findSID(bots, sid); if (findBotSID) {} } function setPlayerTeam(team, isOwner) { if (player) { player.team = team; player.isOwner = isOwner; if (team == null) alliancePlayers = []; } } function setAlliancePlayers(data) { alliancePlayers = data; } // STORE MENU: function updateStoreItems(type, id, index) { if (index) { if (!type) player.tails[id] = 1; else { player.latestTail = id; } } else { if (!type) player.skins[id] = 1, id == 7 && (my.reSync = true); // testing perfect bulltick... else { player.latestSkin = id; } } } // SEND MESSAGE: function receiveChat(sid, message) { if (/img/i.test(message)) return; // Anti img kick gowog if (/iframe/i.test(message)) return; let kawaii = false; let tmpPlayer = findPlayerBySID(sid); if (tmpPlayer) { allChats.push(new addCh(tmpPlayer.x, tmpPlayer.y, message, tmpPlayer)); } tmpPlayer.chatMessage = message; tmpPlayer.chatCountdown = config.chatCountdown; } // MINIMAP: function updateMinimap(data) { minimapData = data; } // SHOW ANIM TEXT: function showText(x, y, value, type) { // if (config.anotherVisual) { textManager.stack.push({ x: x, y: y, value: value }); // } else { // textManager.showText(x, y, 50, 0.18, useWasd ? 500 : 1500, Math.abs(value), (value >= 0) ? "#fff" : "#8ecc51"); // } } /** APPLY SOCKET CODES */ // BOT: let bots = []; let ranLocation = { x: UTILS.randInt(35, 14365), y: UTILS.randInt(35, 14365) }; setInterval(() => { ranLocation = { x: UTILS.randInt(35, 14365), y: UTILS.randInt(35, 14365) }; }, 60000); class Bot { constructor(id, sid, hats, accessories) { this.millPlace = true; this.id = id; this.sid = sid; this.team = null; this.skinIndex = 0; this.tailIndex = 0; this.hitTime = 0; this.iconIndex = 0; this.enemy = []; this.near = []; this.dist2 = 0; this.aim2 = 0; this.tick = 0; this.itemCounts = {}; this.latestSkin = 0; this.latestTail = 0; this.points = 0; this.tails = {}; for (let i = 0; i < accessories.length; ++i) { if (accessories[i].price <= 0) this.tails[accessories[i].id] = 1; } this.skins = {}; for (let i = 0; i < hats.length; ++i) { if (hats[i].price <= 0) this.skins[hats[i].id] = 1; } this.spawn = function(moofoll) { this.upgraded = 0; this.enemy = []; this.near = []; this.active = true; this.alive = true; this.lockMove = false; this.lockDir = false; this.minimapCounter = 0; this.chatCountdown = 0; this.shameCount = 0; this.shameTimer = 0; this.sentTo = {}; this.gathering = 0; this.autoGather = 0; this.animTime = 0; this.animSpeed = 0; this.mouseState = 0; this.buildIndex = -1; this.weaponIndex = 0; this.dmgOverTime = {}; this.noMovTimer = 0; this.maxXP = 300; this.XP = 0; this.age = 1; this.kills = 0; this.upgrAge = 2; this.upgradePoints = 0; this.x = 0; this.y = 0; this.zIndex = 0; this.xVel = 0; this.yVel = 0; this.slowMult = 1; this.dir = 0; this.nDir = 0; this.dirPlus = 0; this.targetDir = 0; this.targetAngle = 0; this.maxHealth = 100; this.health = this.maxHealth; this.oldHealth = this.maxHealth; this.scale = config.playerScale; this.speed = config.playerSpeed; this.resetMoveDir(); this.resetResources(moofoll); this.items = [0, 3, 6, 10]; this.weapons = [0]; this.shootCount = 0; this.weaponXP = []; this.isBot = false; this.reloads = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 53: 0, }; this.timeZinceZpawn = 0; this.whyDie = ""; this.clearRadius = false; this.circlee = 0; }; // RESET MOVE DIR: this.resetMoveDir = function() { this.moveDir = undefined; }; // RESET RESOURCES: this.resetResources = function(moofoll) { for (let i = 0; i < config.resourceTypes.length; ++i) { this[config.resourceTypes[i]] = moofoll ? 100 : 0; } }; // SET DATA: this.setData = function(data) { this.id = data[0]; this.sid = data[1]; this.name = data[2]; this.x = data[3]; this.y = data[4]; this.dir = data[5]; this.health = data[6]; this.maxHealth = data[7]; this.scale = data[8]; this.skinColor = data[9]; }; // SHAME SYSTEM: this.judgeShame = function() { if (this.oldHealth < this.health) { if (this.hitTime) { let timeSinceHit = this.tick - this.hitTime; this.hitTime = 0; if (timeSinceHit < 2) { this.lastshamecount = this.shameCount; this.shameCount++; } else { this.lastshamecount = this.shameCount; this.shameCount = Math.max(0, this.shameCount - 2); } } } else if (this.oldHealth > this.health) { this.hitTime = this.tick; } }; // CHECK TEAM this.isTeam = function (tmpObj) { return (this == tmpObj || (this.team && this.team == tmpObj.team)); }; // UPDATE WEAPON RELOAD: this.manageReloadaa = function() { if (this.shooting[53]) { this.shooting[53] = 0; this.reloads[53] = (2500 - 1000/9); } else { if (this.reloads[53] > 0) { this.reloads[53] = Math.max(0, this.reloads[53] - 1000/9); } } if (this.gathering || this.shooting[1]) { if (this.gathering) { this.gathering = 0; this.reloads[this.gatherIndex] = (items.weapons[this.gatherIndex].speed * (this.skinIndex == 20 ? 0.78 : 1)); this.attacked = true; } if (this.shooting[1]) { this.shooting[1] = 0; this.reloads[this.shootIndex] = (items.weapons[this.shootIndex].speed * (this.skinIndex == 20 ? 0.78 : 1)); this.attacked = true; } } else { this.attacked = false; if (this.buildIndex < 0) { if (this.reloads[this.weaponIndex] > 0) { this.reloads[this.weaponIndex] = Math.max(0, this.reloads[this.weaponIndex] - game.tickRate); } } } }; this.closeSockets = function(websc) { websc.close(); }; this.whyDieChat = function(websc, whydie) { websc.sendWS("6", whydie + " Get Raped LoLoLoL"); }; } }; class BotObject { constructor(sid) { this.sid = sid; // INIT: this.init = function(x, y, dir, scale, type, data, owner) { data = data || {}; this.active = true; this.x = x; this.y = y; this.scale = scale; this.owner = owner; this.id = data.id; this.dmg = data.dmg; this.trap = data.trap; this.teleport = data.teleport; this.isItem = this.id != undefined; }; } }; class BotObjManager { constructor(botObj, fOS) { // DISABLE OBJ: this.disableObj = function(obj) { obj.active = false; if (config.anotherVisual) {} else { obj.alive = false; } }; // ADD NEW: let tmpObj; this.add = function(sid, x, y, dir, s, type, data, setSID, owner) { tmpObj = fOS(sid); if (!tmpObj) { tmpObj = botObj.find((tmp) => !tmp.active); if (!tmpObj) { tmpObj = new BotObject(sid); botObj.push(tmpObj); } } if (setSID) { tmpObj.sid = sid; } tmpObj.init(x, y, dir, s, type, data, owner); }; // DISABLE BY SID: this.disableBySid = function(sid) { let find = fOS(sid); if (find) { this.disableObj(find); } }; // REMOVE ALL FROM PLAYER: this.removeAllItems = function(sid, server) { botObj.filter((tmp) => tmp.active && tmp.owner && tmp.owner.sid == sid).forEach((tmp) => this.disableObj(tmp)); }; } }; let botz = []; function botSpawn(id) { let bot; console.log(WS); let t = WS.url.split("wss://")[1].split("?")[0]; bot = id && new WebSocket("wss://" + t + "?token=re:" + encodeURIComponent(id)); let botPlayer = new Map(); botSkts.push([botPlayer]); botz.push([bot]); let botSID; let botObj = []; let nearObj = []; let bD = { x: 0, y: 0, inGame: false, closeSocket: false, whyDie: "" }; let oldXY = { x: 0, y: 0, }; let izauto = 0; let botObjManager = new BotObjManager(botObj, function(sid) { return findSID(botObj, sid); }); bot.binaryType = "arraybuffer"; bot.first = true; bot.sendWS = function(type) { // EXTRACT DATA ARRAY: let data = Array.prototype.slice.call(arguments, 1); // SEND MESSAGE: let binary = window.msgpack.encode([type, data]); bot.send(binary); }; bot.spawn = function() { bot.sendWS("M", { name: "Trash Slave", moofoll: 1, skin: "__proto__" }); }; bot.sendUpgrade = function(index) { bot.sendWS("H", index); }; bot.place = function(id, a) { try { let item = items.list[botPlayer.items[id]]; if (botPlayer.itemCounts[item.group.id] == undefined ? true : botPlayer.itemCounts[item.group.id] < (config.isSandbox ? 296 : item.group.limit ? item.group.limit : 296)) { bot.sendWS("G", botPlayer.items[id]); bot.sendWS("d", 1, a); bot.sendWS("G", botPlayer.weaponIndex, true); } } catch (e) { } }; bot.buye = function(id, index) { let nID = 0; if (botPlayer.alive && botPlayer.inGame) { if (index == 0) { if (botPlayer.skins[id]) { if (botPlayer.latestSkin != id) { bot.sendWS("c", 0, id, 0); } } else { let find = findID(hats, id); if (find) { if (botPlayer.points >= find.price) { bot.sendWS("c", 1, id, 0); bot.sendWS("c", 0, id, 0); } else { if (botPlayer.latestSkin != nID) { bot.sendWS("c", 0, nID, 0); } } } else { if (botPlayer.latestSkin != nID) { bot.sendWS("c", 0, nID, 0); } } } } else if (index == 1) { if (botPlayer.tails[id]) { if (botPlayer.latestTail != id) { bot.sendWS("c", 0, id, 1); } } else { let find = findID(accessories, id); if (find) { if (botPlayer.points >= find.price) { bot.sendWS("c", 1, id, 1); bot.sendWS("c", 0, id, 1); } else { if (botPlayer.latestTail != 0) { bot.sendWS("c", 0, 0, 1); } } } else { if (botPlayer.latestTail != 0) { bot.sendWS("c", 0, 0, 1); } } } } } }; bot.fastGear = function() { if (botPlayer.y2 >= config.mapScale / 2 - config.riverWidth / 2 && botPlayer.y2 <= config.mapScale / 2 + config.riverWidth / 2) { bot.buye(31, 0); } else { if (botPlayer.y2 <= config.snowBiomeTop) { bot.buye(15, 0); } else { bot.buye(12, 0); } } }; bot.selectWeapon = function(a) { packet("z", a, 1); } function caf(e, t) { try { return Math.atan2((t.y2 || t.y) - (e.y2 || e.y), (t.x2 || t.x) - (e.x2 || e.x)); } catch (e) { return 0; } } bot.heal = function() { if (botPlayer.health < 100) { bot.place(0, 0) } } function cdf (e, t){ try { return Math.hypot((t.y2||t.y)-(e.y2||e.y), (t.x2||t.x)-(e.x2||e.x)); } catch(e){ return Infinity; } } let zoon = 'no'; bot.zync = function(a) { if (!botPlayer.millPlace) { zoon = 'yeah'; bot.place(5, caf(botPlayer, a)); let NextTickLocation = { x: botPlayer.x + Math.cos(caf(a, botPlayer) - Math.PI) * 80, y: botPlayer.y + Math.sin(caf(a, botPlayer) - Math.PI) * 80, x2: botPlayer.x + Math.cos(caf(a, botPlayer) - Math.PI) * 80, y2: botPlayer.y + Math.sin(caf(a, botPlayer) - Math.PI) * 80, }; function calculateDistance(x1, y1, x2, y2) { let distance = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2)); return distance; } function dotherezt() { bot.sendWS("6", calculateDistance(NextTickLocation.x, NextTickLocation.y, botPlayer.x, botPlayer.y)+''); bot.sendWS("D", caf(a, botPlayer) - Math.PI); } let aa = setInterval(() => { bot.sendWS("G", botPlayer.weapons[1], true); if (izauto == 0) { bot.sendWS("K", 1); izauto = 1; } setTimeout(() => { bot.sendWS("G", botPlayer.weapons[0], true); }, 2000); bot.buye(53, 0); if (calculateDistance(NextTickLocation.x, NextTickLocation.y, botPlayer.x, botPlayer.y) > 5) { bot.sendWS("f", caf(botPlayer, NextTickLocation)); } else { bot.sendWS("6", calculateDistance(NextTickLocation.x, NextTickLocation.y, botPlayer.x, botPlayer.y)+''); zoon = 'no'; bot.sendWS("f", undefined); dotherezt(); clearInterval(aa); } }, 150); setTimeout(() => { zoon = 'no'; clearInterval(aa); }, 500); } }; bot.onmessage = function(message) { let data = new Uint8Array(message.data); let parsed = window.msgpack.decode(data); let type = parsed[0]; data = parsed[1]; if (type == "io-init") { bot.spawn(); } if (type == "1") { botSID = data[0]; console.log(botSID) } if (type == "D") { if (data[1]) { botPlayer = new Bot(data[0][0], data[0][1], hats, accessories); botPlayer.setData(data[0]); botPlayer.inGame = true; botPlayer.alive = true; botPlayer.x2 = undefined; botPlayer.y2 = undefined; botPlayer.spawn(1); botPlayer.oldHealth = 100; botPlayer.health = 100; botPlayer.showName = 'YEAHHH'; oldXY = { x: data[0][3], y: data[0][4] } bD.inGame = true; if (bot.first) { bot.first = false; bots.push(bD); } } } if (type == "P") { bot.spawn(); botPlayer.inGame = false; bD.inGame = false; } if (type == "f") { let tmpData = data[0]; botPlayer.tick++; botPlayer.enemy = []; botPlayer.near = []; bot.showName = 'YEAHHH'; nearObj = []; for (let i = 0; i < tmpData.length;) { if (tmpData[i] == botPlayer.sid) { botPlayer.x2 = tmpData[i + 1]; botPlayer.y2 = tmpData[i + 2]; botPlayer.d2 = tmpData[i + 3]; botPlayer.buildIndex = tmpData[i + 4]; botPlayer.weaponIndex = tmpData[i + 5]; botPlayer.weaponVariant = tmpData[i + 6]; botPlayer.team = tmpData[i + 7]; botPlayer.isLeader = tmpData[i + 8]; botPlayer.skinIndex = tmpData[i + 9]; botPlayer.tailIndex = tmpData[i + 10]; botPlayer.iconIndex = tmpData[i + 11]; botPlayer.zIndex = tmpData[i + 12]; botPlayer.visible = true; bD.x2 = botPlayer.x2; bD.y2 = botPlayer.y2; } i += 13; } for (let i = 0; i < tmpData.length;) { tmpObj = findPlayerBySID(tmpData[i]); if (tmpObj) { if (!tmpObj.isTeam(botPlayer)) { enemy.push(tmpObj); if (tmpObj.dist2 <= items.weapons[tmpObj.primaryIndex == undefined ? 5 : tmpObj.primaryIndex].range + (botPlayer.scale * 2)) { nears.push(tmpObj); } } } i += 13; } if (enemy.length) { //console.log(enemy) botPlayer.near = enemy.sort(function(tmp1, tmp2) { return tmp1.dist2 - tmp2.dist2; })[0]; } if (izauto == 1) { bot.sendWS("K", 1); izauto = 0; } if (bD.closeSocket) { botPlayer.closeSockets(bot); } if (bD.whyDie != "") { botPlayer.whyDieChat(bot, bD.whyDie); bD.whyDie = ""; } if (botPlayer.alive) { if (player.team) { if (botPlayer.team != player.team && (botPlayer.tick % 9 === 0)) { botPlayer.team && (bot.sendWS("N")); bot.sendWS("b", player.team); } } let item = items.list[botPlayer.items[3]]; let a = botPlayer.itemCounts[item.group.id] if ((a != undefined ? a : 0) < 201 && botPlayer.millPlace) { if (botPlayer.inGame) { bot.sendWS("D", botPlayer.moveDir); if (izauto == 0) { bot.sendWS("K", 1); izauto = 1; } if (UTILS.getDist(oldXY, botPlayer, 0, 2) > 90) { let aim = UTILS.getDirect(oldXY, botPlayer, 0, 2); bot.place(3, aim + 7.7); bot.place(3, aim - 7.7); bot.place(3, aim); oldXY = { x: botPlayer.x2, y: botPlayer.y2 }; } if (botPlayer.tick % 90 === 0) { let rand = Math.random() * Math.PI * 2; botPlayer.moveDir = rand; bot.sendWS("f", botPlayer.moveDir); } } bot.fastGear(); } else if((a != undefined ? a : 0) > 296 && botPlayer.millPlace) { botPlayer.millPlace = false; // bot.sendWS("K", 1); bot.fastGear(); } else { if (botPlayer.inGame) { if (botObj.length > 0) { let buldingtoawdoin = botObj.filter((e) => e.active && e.isItem && UTILS.getDist(e, player, 0, 2) <= (600)); if (getEl("mode").value == 'fuckemup') { // if (getEl("mode").value == "clear") { bot.selectWeapon(botPlayer.weapons[1]); let gotoDist = UTILS.getDist(buldingtoawdoin[0], botPlayer, 0, 2); let gotoAim = UTILS.getDirect(buldingtoawdoin[0], botPlayer, 0, 2); nearObj = botObj.filter((e) => e.active && (findSID(buldingtoawdoin, e.sid) ? true : !(e.trap && (player.sid == e.owner.sid || player.findAllianceBySid(e.owner.sid)))) && e.isItem && UTILS.getDist(e, botPlayer, 0, 2) <= (items.weapons[botPlayer.weaponIndex].range + e.scale + 10)).sort(function(a, b) { return UTILS.getDist(a, botPlayer, 0, 2) - UTILS.getDist(b, botPlayer, 0, 2); })[0]; if (nearObj) { let isPassed = UTILS.getDist(buldingtoawdoin[0], nearObj, 0, 0); if ((gotoDist - isPassed) > 0) { if (findSID(buldingtoawdoin, nearObj.sid) ? true : (nearObj.dmg || nearObj.trap)) { if (botPlayer.moveDir != undefined) { botPlayer.moveDir = undefined; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); } } else { botPlayer.moveDir = gotoAim; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); } if (botPlayer.nDir != UTILS.getDirect(nearObj, botPlayer, 0, 2)) { botPlayer.nDir = UTILS.getDirect(nearObj, botPlayer, 0, 2); bot.sendWS("D", botPlayer.nDir); } if (izauto == 0) { bot.sendWS("K", 1); izauto = 1; } bot.buye(40, 0); } else { botPlayer.moveDir = gotoAim; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); bot.fastGear(); } } else { botPlayer.moveDir = gotoAim; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); bot.fastGear(); } } } if (botObj.length > 0) { if (getEl("mode").value == 'flex') { const dir = botPlayer.sid * ((Math.PI * 2) / botPlayer.sid); const x = Math.cos(Date.now() * 0.01) * 300 + player.x; const y = Math.sin(Date.now() * 0.01) * 300 + player.x; bot.sendWS("f", Math.atan2(y - botPlayer.y, x - botPlayer.x)); const dist = Math.hypot(x - botPlayer.x, y - botPlayer.y); if (dist > 22) // 22 is player speed without booster hat return; } } if (botObj.length > 0) { nearObj = botObj.filter((e) => e.active && e.isItem && UTILS.getDist(e, botPlayer, 0, 2) <= (items.weapons[botPlayer.weaponIndex].range)).sort(function(a, b) { return UTILS.getDist(a, botPlayer, 0, 2) - UTILS.getDist(b, botPlayer, 0, 2); })[0]; if (nearObj) { if (izauto == 0) { bot.sendWS("K", 1); izauto = 1; } if (botPlayer.nDir != UTILS.getDirect(nearObj, botPlayer, 0, 2)) { botPlayer.nDir = UTILS.getDirect(nearObj, botPlayer, 0, 2); bot.sendWS("D", botPlayer.nDir); } bot.buye(40, 0); bot.buye(11, 1); } else { bot.fastGear(); bot.buye(11, 1); } bot.buye(11, 1); if (breakObjects.length > 0 && getEl("mode").value == 'clear') { // if (getEl("mode").value == "clear") { bot.selectWeapon(botPlayer.weapons[1]); let gotoDist = UTILS.getDist(breakObjects[0], botPlayer, 0, 2); let gotoAim = UTILS.getDirect(breakObjects[0], botPlayer, 0, 2); nearObj = botObj.filter((e) => e.active && (findSID(breakObjects, e.sid) ? true : !(e.trap && (player.sid == e.owner.sid || player.findAllianceBySid(e.owner.sid)))) && e.isItem && UTILS.getDist(e, botPlayer, 0, 2) <= (items.weapons[botPlayer.weaponIndex].range + e.scale)).sort(function(a, b) { return UTILS.getDist(a, botPlayer, 0, 2) - UTILS.getDist(b, botPlayer, 0, 2); })[0]; if (nearObj) { let isPassed = UTILS.getDist(breakObjects[0], nearObj, 0, 0); if ((gotoDist - isPassed) > 0) { if (findSID(breakObjects, nearObj.sid) ? true : (nearObj.dmg || nearObj.trap)) { if (botPlayer.moveDir != undefined) { botPlayer.moveDir = undefined; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); } } else { botPlayer.moveDir = gotoAim; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); } if (botPlayer.nDir != UTILS.getDirect(nearObj, botPlayer, 0, 2)) { botPlayer.nDir = UTILS.getDirect(nearObj, botPlayer, 0, 2); bot.sendWS("D", botPlayer.nDir); } if (izauto == 0) { bot.sendWS("K", 1); izauto = 1; } bot.buye(40, 0); bot.fastGear(); } else { botPlayer.moveDir = gotoAim; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); bot.fastGear(); } } else { botPlayer.moveDir = gotoAim; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); bot.fastGear(); } if (gotoDist > 300) { if (UTILS.getDist(oldXY, botPlayer, 0, 2) > 90) { let aim = UTILS.getDirect(oldXY, botPlayer, 0, 2); bot.place(3, aim + 7.7); bot.place(3, aim - 7.7); bot.place(3, aim); oldXY = { x: botPlayer.x2, y: botPlayer.y2 }; } } } } if (botObj.length > 0 && getEl("mode").value == 'zync') { let wdaawdwad = botObj.filter((e) => e.active && e.isItem && UTILS.getDist(e, player, 0, 2) <= (items.weapons[botPlayer.weaponIndex].range + e.scale)); if(!wdaawdwad.length) { if(zoon == 'no') bot.sendWS("D", UTILS.getDirect(player, botPlayer, 0, 2)); bot.sendWS("f", caf(player, botPlayer) + Math.PI); } if(wdaawdwad.length) { let gotoDist = UTILS.getDist(wdaawdwad[0], botPlayer, 0, 2); let gotoAim = UTILS.getDirect(wdaawdwad[0], botPlayer, 0, 2); nearObj = botObj.filter((e) => e.active && (findSID(wdaawdwad, e.sid) ? true : !(e.trap && (player.sid == e.owner.sid || player.findAllianceBySid(e.owner.sid)))) && e.isItem && UTILS.getDist(e, botPlayer, 0, 2) <= (items.weapons[botPlayer.weaponIndex].range + e.scale)).sort(function(a, b) { return UTILS.getDist(a, botPlayer, 0, 2) - UTILS.getDist(b, botPlayer, 0, 2); })[0]; if (nearObj) { let isPassed = UTILS.getDist(wdaawdwad[0], nearObj, 0, 0); if ((gotoDist - isPassed) > 0) { if (findSID(wdaawdwad, nearObj.sid) ? true : (nearObj.dmg || nearObj.trap)) { if (botPlayer.moveDir != undefined) { botPlayer.moveDir = undefined; bot.sendWS("f", botPlayer.moveDir); bot.sendWS("D", botPlayer.nDir); } } else { bot.sendWS("D", botPlayer.nDir); } if (botPlayer.nDir != UTILS.getDirect(nearObj, botPlayer, 0, 2)) { botPlayer.nDir = UTILS.getDirect(nearObj, botPlayer, 0, 2); bot.sendWS("D", botPlayer.nDir); } if (izauto == 0) { bot.sendWS("K", 1); izauto = 1; } bot.buye(40, 0); bot.fastGear(); } else { if(zoon == 'no') bot.sendWS("D", UTILS.getDirect(nearObj, botPlayer, 0, 2)); if(cdf(player, botPlayer) <= 110) bot.sendWS("f", undefined); else bot.sendWS("f", caf(player, botPlayer) + Math.PI); } } else { if(wdaawdwad.length) { if(zoon == 'no') bot.sendWS("D", UTILS.getDirect(wdaawdwad[0], botPlayer, 0, 2)); if(cdf(player, botPlayer) <= 110) bot.sendWS("f", undefined); else bot.sendWS("f", caf(player, botPlayer) + Math.PI); } else { if(zoon == 'no') bot.sendWS("D", UTILS.getDirect(player, botPlayer, 0, 2)); if(cdf(player, botPlayer) <= 110) bot.sendWS("f", undefined); else bot.sendWS("f", caf(player, botPlayer) + Math.PI); } } } } } } } } if (type == "H") { let tmpData = data[0]; for (let i = 0; i < tmpData.length;) { botObjManager.add(tmpData[i], tmpData[i + 1], tmpData[i + 2], tmpData[i + 3], tmpData[i + 4], tmpData[i + 5], items.list[tmpData[i + 6]], true, (tmpData[i + 7] >= 0 ? { sid: tmpData[i + 7] } : null)); i += 8; } } if (type == "N") { let index = data[0]; let value = data[1]; if (botPlayer) { botPlayer[index] = value; } } if (type == "O") { if (data[0] == botPlayer.sid) { botPlayer.oldHealth = botPlayer.health; botPlayer.health = data[1]; botPlayer.judgeShame(); if (botPlayer.oldHealth > botPlayer.health) { if (botPlayer.shameCount < 5) { for (let i = 0; i < 2; i++) { bot.place(0, botPlayer.nDir); } } else { setTimeout(() => { for (let i = 0; i < 2; i++) { bot.place(0, botPlayer.nDir); } }, 95); } } } } if (type == "Q") { let sid = data[0]; botObjManager.disableBySid(sid); } if (type == "R") { let sid = data[0]; if (botPlayer.alive) botObjManager.removeAllItems(sid); } if (type == "S") { let index = data[0]; let value = data[1]; if (botPlayer) { botPlayer.itemCounts[index] = value; } } if (type == "U") { if (data[0] > 0) { if(getEl("setup").value == 'dm') { if (botPlayer.upgraded == 0) { bot.sendUpgrade(7); } else if (botPlayer.upgraded == 1) { bot.sendUpgrade(17); } else if (botPlayer.upgraded == 2) { bot.sendUpgrade(31); } else if (botPlayer.upgraded == 3) { bot.sendUpgrade(23); } else if (botPlayer.upgraded == 4) { bot.sendUpgrade(9); } else if (botPlayer.upgraded == 5) { bot.sendUpgrade(34); } else if (botPlayer.upgraded == 6) { bot.sendUpgrade(12); } else if (botPlayer.upgraded == 7) { bot.sendUpgrade(15); } } else if(getEl("setup").value == 'dr') { if (botPlayer.upgraded == 0) { bot.sendUpgrade(7); } else if (botPlayer.upgraded == 1) { bot.sendUpgrade(17); } else if (botPlayer.upgraded == 2) { bot.sendUpgrade(31); } else if (botPlayer.upgraded == 3) { bot.sendUpgrade(23); } else if (botPlayer.upgraded == 4) { bot.sendUpgrade(9); } else if (botPlayer.upgraded == 5) { bot.sendUpgrade(34); } else if (botPlayer.upgraded == 6) { bot.sendUpgrade(12); } else if (botPlayer.upgraded == 7) { bot.sendUpgrade(13); } } else if(getEl("setup").value == 'kh') { if (botPlayer.upgraded == 0) { bot.sendUpgrade(3); } else if (botPlayer.upgraded == 1) { bot.sendUpgrade(17); } else if (botPlayer.upgraded == 2) { bot.sendUpgrade(31); } else if (botPlayer.upgraded == 3) { bot.sendUpgrade(27); } else if (botPlayer.upgraded == 4) { bot.sendUpgrade(10); } else if (botPlayer.upgraded == 5) { bot.sendUpgrade(34); } else if (botPlayer.upgraded == 6) { bot.sendUpgrade(4); } else if (botPlayer.upgraded == 7) { bot.sendUpgrade(25); } } else if(getEl("setup").value == 'zd') { if (botPlayer.upgraded == 0) { bot.sendUpgrade(3); } else if (botPlayer.upgraded == 1) { bot.sendUpgrade(17); } else if (botPlayer.upgraded == 2) { bot.sendUpgrade(31); } else if (botPlayer.upgraded == 3) { bot.sendUpgrade(27); } else if (botPlayer.upgraded == 4) { bot.sendUpgrade(9); } else if (botPlayer.upgraded == 5) { bot.sendUpgrade(34); } else if (botPlayer.upgraded == 6) { bot.sendUpgrade(12); } else if (botPlayer.upgraded == 7) { bot.sendUpgrade(15); } } botPlayer.upgraded++; } } if (type == "V") { let tmpData = data[0]; let wpn = data[1]; if (tmpData) { if (wpn) botPlayer.weapons = tmpData; else botPlayer.items = tmpData; } } if (type == "5") { let type = data[0]; let id = data[1]; let index = data[2]; if (index) { if (!type) botPlayer.tails[id] = 1; else botPlayer.latestTail = id; } else { if (!type) botPlayer.skins[id] = 1; else botPlayer.latestSkin = id; } } if (type == "6") { let id = data[0]; let mzg = data[1]+''; if(id == player.sid && mzg.includes("Sync")) { bot.zync(botPlayer.near); } } }; bot.onclose = function() { botPlayer.inGame = false; bD.inGame = false; }; } // RENDER LEAF: function renderLeaf(x, y, l, r, ctxt) { let endX = x + (l * Math.cos(r)); let endY = y + (l * Math.sin(r)); let width = l * 0.4; ctxt.moveTo(x, y); ctxt.beginPath(); ctxt.quadraticCurveTo(((x + endX) / 2) + (width * Math.cos(r + Math.PI / 2)), ((y + endY) / 2) + (width * Math.sin(r + Math.PI / 2)), endX, endY); ctxt.quadraticCurveTo(((x + endX) / 2) - (width * Math.cos(r + Math.PI / 2)), ((y + endY) / 2) - (width * Math.sin(r + Math.PI / 2)), x, y); ctxt.closePath(); ctxt.fill(); ctxt.stroke(); } // RENDER CIRCLE: function renderCircle(x, y, scale, tmpContext, dontStroke, dontFill) { tmpContext = tmpContext || mainContext; tmpContext.beginPath(); tmpContext.arc(x, y, scale, 0, 2 * Math.PI); if (!dontFill) tmpContext.fill(); if (!dontStroke) tmpContext.stroke(); } function renderHealthCircle(x, y, scale, tmpContext, dontStroke, dontFill) { tmpContext = tmpContext || mainContext; tmpContext.beginPath(); tmpContext.arc(x, y, scale, 0, 2 * Math.PI); if (!dontFill) tmpContext.fill(); if (!dontStroke) tmpContext.stroke(); } // RENDER STAR SHAPE: function renderStar(ctxt, spikes, outer, inner) { let rot = Math.PI / 2 * 3; let x, y; let step = Math.PI / spikes; ctxt.beginPath(); ctxt.moveTo(0, -outer); for (let i = 0; i < spikes; i++) { x = Math.cos(rot) * outer; y = Math.sin(rot) * outer; ctxt.lineTo(x, y); rot += step; x = Math.cos(rot) * inner; y = Math.sin(rot) * inner; ctxt.lineTo(x, y); rot += step; } ctxt.lineTo(0, -outer); ctxt.closePath(); } function renderHealthStar(ctxt, spikes, outer, inner) { let rot = Math.PI / 2 * 3; let x, y; let step = Math.PI / spikes; ctxt.beginPath(); ctxt.moveTo(0, -outer); for (let i = 0; i < spikes; i++) { x = Math.cos(rot) * outer; y = Math.sin(rot) * outer; ctxt.lineTo(x, y); rot += step; x = Math.cos(rot) * inner; y = Math.sin(rot) * inner; ctxt.lineTo(x, y); rot += step; } ctxt.lineTo(0, -outer); ctxt.closePath(); } // RENDER RECTANGLE: function renderRect(x, y, w, h, ctxt, dontStroke, dontFill) { if (!dontFill) ctxt.fillRect(x - (w / 2), y - (h / 2), w, h); if (!dontStroke) ctxt.strokeRect(x - (w / 2), y - (h / 2), w, h); } function renderHealthRect(x, y, w, h, ctxt, dontStroke, dontFill) { if (!dontFill) ctxt.fillRect(x - (w / 2), y - (h / 2), w, h); if (!dontStroke) ctxt.strokeRect(x - (w / 2), y - (h / 2), w, h); } // RENDER RECTCIRCLE: function renderRectCircle(x, y, s, sw, seg, ctxt, dontStroke, dontFill) { ctxt.save(); ctxt.translate(x, y); seg = Math.ceil(seg / 2); for (let i = 0; i < seg; i++) { renderRect(0, 0, s * 2, sw, ctxt, dontStroke, dontFill); ctxt.rotate(Math.PI / seg); } ctxt.restore(); } // RENDER BLOB: function renderBlob(ctxt, spikes, outer, inner) { let rot = Math.PI / 2 * 3; let x, y; let step = Math.PI / spikes; let tmpOuter; ctxt.beginPath(); ctxt.moveTo(0, -inner); for (let i = 0; i < spikes; i++) { tmpOuter = UTILS.randInt(outer + 0.9, outer * 1.2); ctxt.quadraticCurveTo(Math.cos(rot + step) * tmpOuter, Math.sin(rot + step) * tmpOuter, Math.cos(rot + (step * 2)) * inner, Math.sin(rot + (step * 2)) * inner); rot += step * 2; } ctxt.lineTo(0, -inner); ctxt.closePath(); } // RENDER TRIANGLE: function renderTriangle(s, ctx) { ctx = ctx || mainContext; let h = s * (Math.sqrt(3) / 2); ctx.beginPath(); ctx.moveTo(0, -h / 2); ctx.lineTo(-s / 2, h / 2); ctx.lineTo(s / 2, h / 2); ctx.lineTo(0, -h / 2); ctx.fill(); ctx.closePath(); } // PREPARE MENU BACKGROUND: function prepareMenuBackground() { let tmpMid = config.mapScale / 2; let attempts = 0; for (let i = 0; i < items.list.length * 3;) { if (attempts >= 1000) break; attempts++; let type = items.list[UTILS.randInt(0, items.list.length - 1)]; let data = { x: tmpMid + UTILS.randFloat(-1000, 1000), y: tmpMid + UTILS.randFloat(-600, 600), dir: UTILS.fixTo(Math.random() * (Math.PI * 2), 2) }; if (objectManager.checkItemLocation(data.x, data.y, type.scale, 0.6, type.id, true)) { objectManager.add(i, data.x, data.y, data.dir, type.scale, type.id, type); } else { continue; } i++; } } const speed = 35; // RENDER PLAYERS: function renderDeadPlayers(xOffset, yOffset) { mainContext.fillStyle = "#91b2db"; const currentTime = Date.now(); deadPlayers.filter(dead => dead.active).forEach((dead) => { if (!dead.startTime) { dead.startTime = currentTime; dead.angle = 0; dead.radius = 0.1; } const timeElapsed = currentTime - dead.startTime; const maxAlpha = 1; dead.alpha = Math.max(0, maxAlpha - (timeElapsed / 3000)); dead.animate(delta); mainContext.globalAlpha = dead.alpha; mainContext.strokeStyle = outlineColor; mainContext.save(); mainContext.translate(dead.x - xOffset, dead.y - yOffset); dead.radius -= 0.001; dead.angle += 0.0174533; const moveSpeed = 1; const x = dead.radius * Math.cos(dead.angle); const y = dead.radius * Math.sin(dead.angle); dead.x += x * moveSpeed; dead.y += y * moveSpeed; mainContext.rotate(dead.angle); renderDeadPlayer(dead, mainContext); mainContext.restore(); mainContext.fillStyle = "#91b2db"; if (timeElapsed >= 3000) { dead.active = false; dead.startTime = null; } }); } // RENDER PLAYERS: function renderPlayers(xOffset, yOffset, zIndex) { mainContext.globalAlpha = 1; mainContext.fillStyle = "#91b2db"; for (var i = 0; i < players.length; ++i) { tmpObj = players[i]; if (tmpObj.zIndex == zIndex) { tmpObj.animate(delta); if (tmpObj.visible) { tmpObj.skinRot += (0.002 * delta); tmpDir = (!configs.showDir && !useWasd && tmpObj == player) ? configs.attackDir ? getVisualDir() : getSafeDir() : (tmpObj.dir||0); mainContext.save(); mainContext.translate(tmpObj.x - xOffset, tmpObj.y - yOffset); // RENDER PLAYER: mainContext.rotate(tmpDir + tmpObj.dirPlus); renderPlayer(tmpObj, mainContext); mainContext.restore(); } } } } // RENDER DEAD PLAYER: function renderDeadPlayer(obj, ctxt) { ctxt = ctxt || mainContext; ctxt.lineWidth = outlineWidth; ctxt.lineJoin = "miter"; let handAngle = (Math.PI / 4) * (items.weapons[obj.weaponIndex].armS||1); let oHandAngle = (obj.buildIndex < 0)?(items.weapons[obj.weaponIndex].hndS||1):1; let oHandDist = (obj.buildIndex < 0)?(items.weapons[obj.weaponIndex].hndD||1):1; // TAIL/CAPE: renderTail2(13, ctxt, obj); // WEAPON BELLOW HANDS: if (obj.buildIndex < 0 && !items.weapons[obj.weaponIndex].aboveHand) { renderTool(items.weapons[obj.weaponIndex], config.weaponVariants[obj.weaponVariant || 0].src || "", obj.scale, 0, ctxt); if (items.weapons[obj.weaponIndex].projectile != undefined && !items.weapons[obj.weaponIndex].hideProjectile) { renderProjectile(obj.scale, 0, items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext); } } // HANDS: ctxt.fillStyle = "#ececec"; renderCircle(obj.scale * Math.cos(handAngle), (obj.scale * Math.sin(handAngle)), 14); renderCircle((obj.scale * oHandDist) * Math.cos(-handAngle * oHandAngle), (obj.scale * oHandDist) * Math.sin(-handAngle * oHandAngle), 14); // WEAPON ABOVE HANDS: if (obj.buildIndex < 0 && items.weapons[obj.weaponIndex].aboveHand) { renderTool(items.weapons[obj.weaponIndex], config.weaponVariants[obj.weaponVariant || 0].src || "", obj.scale, 0, ctxt); if (items.weapons[obj.weaponIndex].projectile != undefined && !items.weapons[obj.weaponIndex].hideProjectile) { renderProjectile(obj.scale, 0, items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext); } } // BUILD ITEM: if (obj.buildIndex >= 0) { var tmpSprite = getItemSprite(items.list[obj.buildIndex]); ctxt.drawImage(tmpSprite, obj.scale - items.list[obj.buildIndex].holdOffset, -tmpSprite.width / 2); } // BODY: renderCircle(0, 0, obj.scale, ctxt); // SKIN renderSkin2(48, ctxt, null, obj) } // RENDER PLAYER: function renderPlayer(obj, ctxt) { ctxt = ctxt || mainContext; ctxt.lineWidth = outlineWidth; ctxt.lineJoin = "miter"; let handAngle = (Math.PI / 4) * (items.weapons[obj.weaponIndex].armS || 1); let oHandAngle = (obj.buildIndex < 0) ? (items.weapons[obj.weaponIndex].hndS || 1) : 1; let oHandDist = (obj.buildIndex < 0) ? (items.weapons[obj.weaponIndex].hndD || 1) : 1; let katanaMusket = (obj == player && obj.weapons[0] == 3 && obj.weapons[1] == 15); // TAIL/CAPE: if (obj.tailIndex > 0) { renderTailTextureImage(obj.tailIndex, ctxt, obj); } // WEAPON BELLOW HANDS: if (obj.buildIndex < 0 && !items.weapons[obj.weaponIndex].aboveHand) { renderTool(items.weapons[katanaMusket ? 4 : obj.weaponIndex], config.weaponVariants[obj.weaponVariant].src, obj.scale, 0, ctxt); if (items.weapons[obj.weaponIndex].projectile != undefined && !items.weapons[obj.weaponIndex].hideProjectile) { renderProjectile(obj.scale, 0, items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext); } } // HANDS: ctxt.fillStyle = config.skinColors[obj.skinColor]; renderCircle(obj.scale * Math.cos(handAngle), (obj.scale * Math.sin(handAngle)), 14); renderCircle((obj.scale * oHandDist) * Math.cos(-handAngle * oHandAngle), (obj.scale * oHandDist) * Math.sin(-handAngle * oHandAngle), 14); // WEAPON ABOVE HANDS: if (obj.buildIndex < 0 && items.weapons[obj.weaponIndex].aboveHand) { renderTool(items.weapons[obj.weaponIndex], config.weaponVariants[obj.weaponVariant].src, obj.scale, 0, ctxt); if (items.weapons[obj.weaponIndex].projectile != undefined && !items.weapons[obj.weaponIndex].hideProjectile) { renderProjectile(obj.scale, 0, items.projectiles[items.weapons[obj.weaponIndex].projectile], mainContext); } } // BUILD ITEM: if (obj.buildIndex >= 0) { var tmpSprite = getItemSprite(items.list[obj.buildIndex]); ctxt.drawImage(tmpSprite, obj.scale - items.list[obj.buildIndex].holdOffset, -tmpSprite.width / 2); } // BODY: renderCircle(0, 0, obj.scale, ctxt); // SKIN: if (obj.skinIndex > 0) { ctxt.rotate(Math.PI / 2); renderTextureSkin(obj.skinIndex, ctxt, null, obj); } } // RENDER NORMAL SKIN var skinSprites2 = {}; var skinPointers2 = {}; function renderSkin2(index, ctxt, parentSkin, owner) { tmpSkin = skinSprites2[index]; if (!tmpSkin) { var tmpImage = new Image(); tmpImage.onload = function() { this.isLoaded = true; this.onload = null; }; //tmpImage.src = "https://moomoo.io/img/hats/hat_" + index + ".png"; tmpImage.src = "https://moomoo.io/img/hats/hat_" + index + ".png"; skinSprites2[index] = tmpImage; tmpSkin = tmpImage; } var tmpObj = parentSkin||skinPointers2[index]; if (!tmpObj) { for (var i = 0; i < hats.length; ++i) { if (hats[i].id == index) { tmpObj = hats[i]; break; } } skinPointers2[index] = tmpObj; } if (tmpSkin.isLoaded) ctxt.drawImage(tmpSkin, -tmpObj.scale/2, -tmpObj.scale/2, tmpObj.scale, tmpObj.scale); if (!parentSkin && tmpObj.topSprite) { ctxt.save(); ctxt.rotate(owner.skinRot); renderSkin2(index + "_top", ctxt, tmpObj, owner); ctxt.restore(); } } // RENDER SKIN: function renderTextureSkin(index, ctxt, parentSkin, owner) { if (!(tmpSkin = skinSprites[index + (txt ? "lol" : 0)])) { var tmpImage = new Image(); tmpImage.onload = function() { this.isLoaded = true, this.onload = null } , tmpImage.src = setSkinTextureImage(index, "hat", index), skinSprites[index + (txt ? "lol" : 0)] = tmpImage, tmpSkin = tmpImage } var tmpObj = parentSkin||skinPointers[index]; if (!tmpObj) { for (var i = 0; i < hats.length; ++i) { if (hats[i].id == index) { tmpObj = hats[i]; break; } } skinPointers[index] = tmpObj; } if (tmpSkin.isLoaded) ctxt.drawImage(tmpSkin, -tmpObj.scale/2, -tmpObj.scale/2, tmpObj.scale, tmpObj.scale); if (!parentSkin && tmpObj.topSprite) { ctxt.save(); ctxt.rotate(owner.skinRot); renderSkin(index + "_top", ctxt, tmpObj, owner); ctxt.restore(); } } var FlareZHat = { 7: "https://i.imgur.com/vAOzlyY.png", 15: "https://i.imgur.com/YRQ8Ybq.png", 40: "https://i.imgur.com/Xzmg27N.png", 26: "https://i.imgur.com/I0xGtyZ.png", 55: "https://i.imgur.com/uYgDtcZ.png", 20: "https://i.imgur.com/f5uhWCk.png", }; function setSkinTextureImage(id, type, id2) { if (true) { if(FlareZHat[id] && type == "hat") { return FlareZHat[id]; } else { if(type == "acc") { return ".././img/accessories/access_" + id + ".png"; } else if(type == "hat") { return ".././img/hats/hat_" + id + ".png"; } else { return ".././img/weapons/" + id + ".png"; } } } else { if(type == "acc") { return ".././img/accessories/access_" + id + ".png"; } else if(type == "hat") { return ".././img/hats/hat_" + id + ".png"; } else { return ".././img/weapons/" + id + ".png"; } } } // RENDER SKINS: let skinSprites = {}; let skinPointers = {}; let tmpSkin; function renderSkin(index, ctxt, parentSkin, owner) { tmpSkin = skinSprites[index]; if (!tmpSkin) { let tmpImage = new Image(); tmpImage.onload = function() { this.isLoaded = true; this.onload = null; }; tmpImage.src = "https://moomoo.io/img/hats/hat_" + index + ".png"; skinSprites[index] = tmpImage; tmpSkin = tmpImage; } let tmpObj = parentSkin || skinPointers[index]; if (!tmpObj) { for (let i = 0; i < hats.length; ++i) { if (hats[i].id == index) { tmpObj = hats[i]; break; } } skinPointers[index] = tmpObj; } if (tmpSkin.isLoaded) ctxt.drawImage(tmpSkin, -tmpObj.scale / 2, -tmpObj.scale / 2, tmpObj.scale, tmpObj.scale); if (!parentSkin && tmpObj.topSprite) { ctxt.save(); ctxt.rotate(owner.skinRot); renderSkin(index + "_top", ctxt, tmpObj, owner); ctxt.restore(); } } // RENDER TAIL: var FlareZAcc = { 21: "https://i.imgur.com/4ddZert.png", 19: "https://i.imgur.com/sULkUZT.png", }; function setTailTextureImage(id, type, id2) { if (true) { if(FlareZAcc[id] && type == "acc") { return FlareZAcc[id]; } else { if(type == "acc") { return ".././img/accessories/access_" + id + ".png"; } else if(type == "hat") { return ".././img/hats/hat_" + id + ".png"; } else { return ".././img/weapons/" + id + ".png"; } } } else { if(type == "acc") { return ".././img/accessories/access_" + id + ".png"; } else if(type == "hat") { return ".././img/hats/hat_" + id + ".png"; } else { return ".././img/weapons/" + id + ".png"; } } } function renderTailTextureImage(index, ctxt, owner) { if (!(tmpSkin = accessSprites[index + (txt ? "lol" : 0)])) { var tmpImage = new Image(); tmpImage.onload = function() { this.isLoaded = true, this.onload = null } , tmpImage.src = setTailTextureImage(index, "acc"),//".././img/accessories/access_" + index + ".png"; accessSprites[index + (txt ? "lol" : 0)] = tmpImage, tmpSkin = tmpImage; } var tmpObj = accessPointers[index]; if (!tmpObj) { for (var i = 0; i < accessories.length; ++i) { if (accessories[i].id == index) { tmpObj = accessories[i]; break; } } accessPointers[index] = tmpObj; } if (tmpSkin.isLoaded) { ctxt.save(); ctxt.translate(-20 - (tmpObj.xOff||0), 0); if (tmpObj.spin) ctxt.rotate(owner.skinRot); ctxt.drawImage(tmpSkin, -(tmpObj.scale/2), -(tmpObj.scale/2), tmpObj.scale, tmpObj.scale); ctxt.restore(); } } let accessSprites = {}; let accessPointers = {}; var txt = true; function renderTail(index, ctxt, owner) { tmpSkin = accessSprites[index]; if (!tmpSkin) { let tmpImage = new Image(); tmpImage.onload = function() { this.isLoaded = true; this.onload = null; }; tmpImage.src = "https://moomoo.io/img/accessories/access_" + index + ".png"; accessSprites[index] = tmpImage; tmpSkin = tmpImage; } let tmpObj = accessPointers[index]; if (!tmpObj) { for (let i = 0; i < accessories.length; ++i) { if (accessories[i].id == index) { tmpObj = accessories[i]; break; } } accessPointers[index] = tmpObj; } if (tmpSkin.isLoaded) { ctxt.save(); ctxt.translate(-20 - (tmpObj.xOff || 0), 0); if (tmpObj.spin) ctxt.rotate(owner.skinRot); ctxt.drawImage(tmpSkin, -(tmpObj.scale / 2), -(tmpObj.scale / 2), tmpObj.scale, tmpObj.scale); ctxt.restore(); } } var accessSprites2 = {}; var accessPointers2 = {}; function renderTail2(index, ctxt, owner) { tmpSkin = accessSprites2[index]; if (!tmpSkin) { var tmpImage = new Image(); tmpImage.onload = function() { this.isLoaded = true; this.onload = null; }; tmpImage.src = "https://moomoo.io/img/accessories/access_" + index + ".png"; accessSprites2[index] = tmpImage; tmpSkin = tmpImage; } var tmpObj = accessPointers2[index]; if (!tmpObj) { for (var i = 0; i < accessories.length; ++i) { if (accessories[i].id == index) { tmpObj = accessories[i]; break; } } accessPointers2[index] = tmpObj; } if (tmpSkin.isLoaded) { ctxt.save(); ctxt.translate(-20 - (tmpObj.xOff||0), 0); if (tmpObj.spin) ctxt.rotate(owner.skinRot); ctxt.drawImage(tmpSkin, -(tmpObj.scale/2), -(tmpObj.scale/2), tmpObj.scale, tmpObj.scale); ctxt.restore(); } } // RENDER TOOL: let toolSprites = {}; function renderTool(obj, variant, x, y, ctxt) { let tmpSrc = obj.src + (variant || ""); let tmpSprite = toolSprites[tmpSrc]; if (!tmpSprite) { tmpSprite = new Image(); tmpSprite.onload = function() { this.isLoaded = true; } tmpSprite.src = "https://moomoo.io/img/weapons/" + tmpSrc + ".png"; toolSprites[tmpSrc] = tmpSprite; } if (tmpSprite.isLoaded) ctxt.drawImage(tmpSprite, x + obj.xOff - (obj.length / 2), y + obj.yOff - (obj.width / 2), obj.length, obj.width); } // RENDER PROJECTILES: function renderProjectiles(layer, xOffset, yOffset) { for (let i = 0; i < projectiles.length; i++) { tmpObj = projectiles[i]; if (tmpObj.active && tmpObj.layer == layer && tmpObj.inWindow) { tmpObj.update(delta); if (tmpObj.active && isOnScreen(tmpObj.x - xOffset, tmpObj.y - yOffset, tmpObj.scale)) { mainContext.save(); mainContext.translate(tmpObj.x - xOffset, tmpObj.y - yOffset); mainContext.rotate(tmpObj.dir); renderProjectile(0, 0, tmpObj, mainContext, 1); mainContext.restore(); } } }; } // RENDER PROJECTILE: let projectileSprites = {};//fz iz zexy function renderProjectile(x, y, obj, ctxt, debug) { if (obj.src) { let tmpSrc = items.projectiles[obj.indx].src; let tmpSprite = projectileSprites[tmpSrc]; if (!tmpSprite) { tmpSprite = new Image(); tmpSprite.onload = function() { this.isLoaded = true; } tmpSprite.src = "https://moomoo.io/img/weapons/" + tmpSrc + ".png"; projectileSprites[tmpSrc] = tmpSprite; } if (tmpSprite.isLoaded) ctxt.drawImage(tmpSprite, x - (obj.scale / 2), y - (obj.scale / 2), obj.scale, obj.scale); } else if (obj.indx == 1) { ctxt.fillStyle = "#939393"; renderCircle(x, y, obj.scale, ctxt); } } // RENDER AI: let aiSprites = {}; function renderAI(obj, ctxt) { let tmpIndx = obj.index; let tmpSprite = aiSprites[tmpIndx]; if (!tmpSprite) { let tmpImg = new Image(); tmpImg.onload = function() { this.isLoaded = true; this.onload = null; }; tmpImg.src = "https://moomoo.io/img/animals/" + obj.src + ".png"; tmpSprite = tmpImg; aiSprites[tmpIndx] = tmpSprite; } if (tmpSprite.isLoaded) { let tmpScale = obj.scale * 1.2 * (obj.spriteMlt || 1); ctxt.drawImage(tmpSprite, -tmpScale, -tmpScale, tmpScale * 2, tmpScale * 2); } } // RENDER WATER BODIES: function renderWaterBodies(xOffset, yOffset, ctxt, padding) { // MIDDLE RIVER: let tmpW = config.riverWidth + padding; let tmpY = (config.mapScale / 2) - yOffset - (tmpW / 2); if (tmpY < maxScreenHeight && tmpY + tmpW > 0) { ctxt.fillRect(0, tmpY, maxScreenWidth, tmpW); } } chatHolder.style.alignItems = "20px left";/* position: absolute; left: 20px; top: 20px; display: none; */ chatHolder.style.justifyContent = "20px top"; chatHolder.style.flexDirection = "column"; var scriptMenu = new class { addTab(e, t, o, l) { let i = this, s = document.createElement("div"), n = i.tabs.length; if (s.id = "scriptMenuTab" + e + n, s.style = ` position: absolute; color: #fff; top: ${45*n}px; left: 10px; width: 130px; height: 35px; background-color: rgb(255, 255, 255, .1); border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .4s; `, s.innerHTML = ` <div style="position: absolute; top: 7.5px; left: 7.5px; width: 20px; height: 20px; background-size: 20px 20px; background-image: url('${t}');"></div> <div style="margin-left: 5px;">${e}</div> `, l) { let a = document.createElement("div"); a.style = ` position: absolute; top: ${45*n+45}px; left: 10px; width: 130px; height: 4px; pointer-events: none; opacity: 0; background: transparent; `, i.scriptMenuTabs.appendChild(a) } s.onmouseover = () => { let e = this.themeColors[this.themeIndx]; s.style.backgroundColor = e.selectedTabs }, s.onmouseout = () => { let e = this.themeColors[this.themeIndx]; s.clicked || (s.style.backgroundColor = e.unselectedTabs) }, s.onclick = () => { let e = this.themeColors[this.themeIndx]; s.clicked = !0, s.style.backgroundColor = e.selectedTabs, i.resetOtherTabs(s), i.tabClicked(s.id) }, i.tabs.push(s), i.scriptMenuTabs.appendChild(s), 0 == n && s.click(); let r = document.createElement("div"); r.id = s.id + "_Display", r.style = ` position: absolute; top: ${0==n?0:425}px; left: 0px; width: 100%; height: 100%; transition: .5s; overflow-y: scroll; `, o && (r.innerHTML = o), i.scriptMenuDisplay.appendChild(r), i.displays.push(r) } tabClicked(e) { for (let t = 0; t < this.displays.length; t++) { let o = this.displays[t]; e + "_Display" == o.id ? o.style.top = "0px" : o.style.top = "425px" } } resetOtherTabs(e) { let t = this.themeColors[this.themeIndx]; for (let o = 0; o < this.tabs.length; o++) { let l = this.tabs[o]; l.id != e.id && (l.style.backgroundColor = t.unselectedTabs, l.clicked = !1) } } addToggle(e, { disabled: t, logic: o, id: l, placerholder: i, key: s, enlargedLooks: n, label: a, width: r, height: d, marginBottom: g, checked: h, tag: c = "", options: p, value: b, min: m, max: u }, $) { let y = this.displays[e]; this.displayToggles[e] ? this.displayToggles[e]++ : this.displayToggles[e] = 1; let f = this.displayToggles[e], x = 25; f % 2 == 0 && (x = 265); let k = 20; f % 2 == 0 ? k += (Math.floor(f / 2) - 1) * 80 + (this.addedTogglesHeight[e] || 0) : k += 80 * Math.floor(f / 2) + (this.addedTogglesHeight[e] || 0), d && (this.addedTogglesHeight[e] || (this.addedTogglesHeight[e] = 0), this.addedTogglesHeight[e] += d - 60), n && this.displayToggles[e]++; let v = document.createElement("div"); if (this.toggles[l] = h, v.id = `holderElement_${l}`, v.style = ` position: absolute; top: ${k}px; left: ${x}px; width: ${r||210}px; height: ${d||60}px; background-color: #fff; border-radius: 12px; background-color: rgb(255, 255, 255, .15); ${t?"":"keybind"==$||"checkList"==$||"text/notes"==$||"button"==$?"":"cursor: pointer;"} user-select: none; transition: .4s; ${t?"pointer-events: none;":""} `, t && (v.style.pointerEvents = "none"), "text display" == $ && (v.style.pointerEvents = "none"), g) { let T = document.createElement("div"); T.id = `${l}_spacer`, T.style = ` pointer-events: none; position: absolute; top: ${k+60}px; left: 0px; width: 100%; height: ${g}px; background: transparent; `, y.appendChild(T) } if (v.innerHTML = ` <div style="position: absolute; color: #fff; top: 7.5px; width: 100%; text-align: ${"text/notes"==$?"left":"center"}; left: 0px;"> <div style="${"text/notes"==$?"margin-left: 5px;":""}">${a||""}</div> </div> <div id="${l}_tag" style="display: ${c?"block":"none"}; position: absolute; color: #000; font-size: 12px; top: 7.5px; text-align: center; top: -6px; right: -5px; background-color: #fff; padding-right: 5px; padding-left: 5px; border-radius: 4px;"> ${c||""} </div> `, "toggle" == $) { let _ = document.createElement("div"); _.style = ` text-align: center; width: 100%; position: absolute; bottom: 7.5px; `; let w = document.createElement("button"); w.style = ` font-size: 12px; font-family: Hammersmith One; border-radius: 4px; border: none; background-color: rgb(0, 0, 0, 0); cursor: pointer; pointer-events: none; `, this.toggles[l] ? (v.clicked = !0, w.style.color = "#000", w.innerHTML = "Enabled", v.style.backgroundColor = "rgb(255, 255, 255, .6)") : (w.style.color = "rgb(255, 255, 255, .6)", w.innerHTML = "Disabled"), v.onclick = () => { let e = this.themeColors[this.themeIndx]; this.toggles[l] = !this.toggles[l], v.clicked = this.toggles[l], this.toggles[l] ? (w.innerHTML = "Enabled", w.style.color = e.toggledButtonColor, v.style.backgroundColor = e.selectedToggle) : (v.style.backgroundColor = e.unselectedToggle, w.innerHTML = "Disabled", w.style.color = e.toggleButtonColor), "darkMode" == l && (scriptMenu.toggles.megaSuperFzDeadRevialLureAe86Visuals ? this.darkModeElement.style.backgroundColor = "rgb(255, 255, 255, .25)" : this.darkModeElement.style.backgroundColor = "rgb(0, 0, 70, .25)", this.darkModeElement.style.opacity = this.toggles[l] ? 1 : 0) }, _.appendChild(w), v.appendChild(_) } else if ("dropdown" == $) { let C = document.createElement("div"); C.style = ` text-align: center; width: 100%; position: absolute; bottom: 5px; `; let B = document.createElement("select"); B.id = `${l}_dropdown`; let E = p.find(e => e.selected); E ? this.toggles[l] = E.value : this.toggles[l] = p[0]?.value; for (let M = 0; M < p.length; M++) { let L = p[M]; "string" == typeof L ? B.innerHTML += ` <option value="${M}">${L}</option> ` : B.innerHTML += ` <option value="${L.value}" ${L.selected?"selected":""}>${L.label}</option> ` } B.style = ` font-family: Hammersmith One; text-align: center; color: #000; width: 150px; height: 25px; cursor: pointer; border-radius: 4px; background-color: rgb(255, 255, 255, .6); border: none; `, B.onchange = () => { this.toggles[l] = B.value, B.blur() }, C.appendChild(B), v.appendChild(C) } else if ("text" == $ || "number" == $) { let H = document.createElement("div"); H.style = ` text-align: center; width: 100%; position: absolute; bottom: 5px; `; let I = document.createElement("input"); I.type = $, I.id = `${$}_input_${l}`, I.value = this.toggles[l] = b, "number" == $ && (I.min = m || 0, I.max = u), i && (I.placerholder = i), I.style = ` font-family: Hammersmith One; text-align: center; color: #fff; width: 150px; height: 25px; cursor: text; border-radius: 4px; background-color: rgb(255, 255, 255, .4); border: none; `, I.onchange = () => { this.toggles[l] = I.value, I.blur() }, H.appendChild(I), v.appendChild(H) } else if ("button" == $) { let S = document.createElement("div"); S.style = ` text-align: center; width: 100%; position: absolute; bottom: 5px; `; let A = document.createElement("button"); A.style = ` font-family: Hammersmith One; text-align: center; color: #fff; width: 150px; height: 25px; cursor: pointer; border-radius: 4px; background-color: rgb(255, 255, 255, .2); transition: .4s; border: none; `, A.onclick = () => { o(), A.blur() }, A.innerHTML = "Execute", A.onmouseover = () => { A.style.backgroundColor = "rgb(255, 255, 255, .4)" }, A.onmouseout = () => { A.style.backgroundColor = "rgb(255, 255, 255, .2)" }, S.appendChild(A), v.appendChild(S) } else if ("slider" == $) { let D = document.createElement("input"), P = document.createElement("div"); P.innerHTML = `(${b}px)`, P.style = ` position: absolute; font-size: 10px; bottom: 25px; color: white; width: 100%; text-align: center; `, D.min = m, D.max = u, D.style = ` position: absolute; bottom: 15px; left: 50%; width: 150px; height: 5px; transform: translateX(-50%); `, D.type = "range", this.toggles[l] = D.value = b, D.onchange = () => { this.toggles[l] = D.value, P.innerHTML = `(${D.value}px)` }, v.appendChild(P), v.appendChild(D) } else if ("text display" == $) { let N = document.createElement("div"); N.id = `textDisplay_${l}`, N.style = ` display: flex; align-items: enter; justify-content: center; color: white; width: 100%; position: absolute; bottom: 10px; font-size: 12px; `, N.innerHTML = "0", v.appendChild(N) } else if ("themes" == $) { let z = document.createElement("div"); z.style = ` position: absolute; display: flex; align-items: center; justify-content: center; width: 100%; bottom: 20px; height: 60px; gap: 10px; `; for (let R = 0; R < p.length; R++) { let O = p[R], j = document.createElement("div"); j.style = ` width: 45px; height: 45px; background-color: ${O.color}; border: solid; border-color: ${O.selected?"yellow":"white"}; border-radius: 12px; border-width: 2px; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; `, j.title = `${O.styleName} Theme`, j.tabIndex = 0, j.onmouseover = () => { j.style.transform = "scale(1.1)", j.style.boxShadow = "0 4px 8px rgba(0, 0, 0, 0.2)" }, j.onmouseout = () => { j.style.transform = "scale(1)", j.style.boxShadow = "none" }, j.onclick = () => { let e = z.children; for (let t = 0; t < e.length; t++) e[t].style.borderColor = "white"; j.style.borderColor = "yellow", this.changeTheme(R) }, z.appendChild(j) } v.appendChild(z) } else if ("custom" == $) { let F = document.createElement("div"); F.style = ` text-align: center; width: 100%; position: absolute; bottom: 7.5px; `; let U = document.createElement("button"); U.style = ` font-size: 12px; font-family: Hammersmith One; border-radius: 8px; border: none; background-color: rgb(255, 255, 255, 0); padding: 7px; padding-left: 20px; padding-right: 20px; cursor: pointer; pointer-events: none; `, this.toggles[l] ? (v.clicked = !0, U.style.color = "#000", U.innerHTML = "Enabled", v.style.backgroundColor = "rgb(255, 255, 255, .6)") : (U.style.color = "rgb(255, 255, 255, .6)", U.innerHTML = "Disabled"), v.onclick = () => { let e = this.themeColors[this.themeIndx]; this.toggles[l] = !this.toggles[l], v.clicked = this.toggles[l], this.toggles[l] ? (U.innerHTML = "Enabled", U.style.color = e.toggledButtonColor, v.style.backgroundColor = e.selectedToggle) : (v.style.backgroundColor = e.unselectedToggle, U.innerHTML = "Disabled", U.style.color = e.toggleButtonColor) }, F.appendChild(U), v.appendChild(F); let K = document.createElement("div"); K.style = ` position: absolute; display: flex; align-items: center; justify-content: center; width: 100%; bottom: 32.5px; height: 60px; gap: 10px; `; for (let W = 0; W < p.length; W++) { let V = p[W], G = document.createElement("div"); G.style = ` width: 45px; height: 45px; border: solid; border-color: ${V.selected?"yellow":"white"}; border-radius: 12px; border-width: 2px; cursor: pointer; background-size: 45px 45px; background-image: url('${V.icon}'); transition: transform 0.2s ease, box-shadow 0.2s ease; `, G.tabIndex = 0, V.selected && (this.toggles[l + "_sub_value"] = V.id), G.onmouseover = () => { G.style.transform = "scale(1.1)", G.style.boxShadow = "0 4px 8px rgba(0, 0, 0, 0.2)" }, G.onmouseout = () => { G.style.transform = "scale(1)", G.style.boxShadow = "none" }, G.onclick = e => { let t = K.children; for (let o = 0; o < t.length; o++) t[o].style.borderColor = "white"; G.style.borderColor = "yellow", this.toggles[l + "_sub_value"] = V.id, e.stopPropagation() }, K.appendChild(G) } v.appendChild(K) } else if ("checkList" == $) { void 0 === this.toggles[l] && (this.toggles[l] = []); let Z = document.createElement("input"); Z.type, Z.style = ` position: absolute; top: 30px; left: 15px; width: calc(100% - 30px); height: 20px; border: none; border-radius: 6px; `, Z.placeholder = "Enter items separated by commas. Click outside to add them to the list.", Z.onchange = e => { let t = e.target.value.split(",").map(e => e.trim()), o = [...new Set(t)]; for (let i = 0; i < o.length; i++) { this.toggles[l].find(e => e == o[i]) || this.toggles[l].push(o[i]); let s = document.createElement("div"); s.style = ` position: relative; color: white; width: calc(100% - 20px); margin-left: 7.5px; margin-top: 7.5px; padding-left: 5px; height: 30px; background-color: rgb(255, 255, 255, .4); display: flex; align-items: center; justify-content: space-between; border-radius: 4px; `, s.innerText = o[i]; let n = document.createElement("button"); n.innerHTML = '<i class="material-icons">close</i>', n.style = ` position: absolute; top: 1.5px; right: -3px; border: none; background: none; color: red; cursor: pointer; font-size: 16px; `, n.onclick = () => { let e = this.toggles[l].findIndex(e => e == o[i]); e >= 0 && this.toggles[l].splice(e, 1), q.removeChild(s) }, s.appendChild(n), q.appendChild(s) } e.target.value = "" }; let q = document.createElement("div"); q.style = ` position: absolute; top: 65px; left: 15px; width: calc(100% - 30px); height: 105px; border-radius: 6px; background-color: rgb(0, 0, 0, .4); overflow-y: scroll; `, v.appendChild(q), v.appendChild(Z); let J = ["Tamer", "Damper", "Vajra", "Punisher", "Spark", "Razdor", "Molot", "Ecu", "Gust", "Magnum", "Halo", "Jaw", "Claw", "Talon", "Atomizer", "Thunder", "Brisant", "Reaper", "Evora", "Veyron", "Glory", "Subduer", "Talon", "Punisher", "Lance", "Fengbao", "Leiming"], X = ["Luchador", "Ochokochi", "Fenrir", "Fafnir", "Curie", "Indra", "Rook", "Ravana", "Hover", "Bulwark", "Lynx", "Ares", "Ao Jun", "Ophion", "Revenant", "Aether", "Nether", "Shenlou", "Pathfinder"], Y = []; for (let Q = 0; Q < 20; Q++) { let ee, et = `${J[Math.floor(Math.random()*J.length)]}${X[Math.floor(Math.random()*X.length)]}`; Y.push(et.slice(0, 15)) } Z.value = Y.join(","), Z.onchange({ target: { value: Z.value } }), Z.value = "" } else if ("keybind" == $) { let eo = document.createElement("div"); eo.style = ` text-align: center; width: 100%; position: absolute; bottom: 5px; `; let el = document.createElement("button"); el.style = ` font-family: Hammersmith One; text-align: center; color: #fff; width: 150px; height: 25px; cursor: pointer; border-radius: 4px; background-color: rgb(255, 255, 255, .2); transition: .4s; border: none; `, this.keyBinds[l] = s || "N/A", this.keyBindActions[l] = o; let ei = !1; el.onclick = () => { if (!ei) { ei = !0, el.innerHTML = "Enter a key..."; let e = t => { "Escape" != t.key && "Shift" != t.key && "Alt" != t.key && "Meta" != t.key ? (this.keyBinds[l] = t.key, el.innerHTML = t.key, el.blur(), ei = !1, document.removeEventListener("keydown", e)) : "Escape" == t.key && (this.keyBinds[l] = "N/A", el.innerHTML = "N/A"), t.preventDefault() }; document.addEventListener("keydown", e) } }, el.innerHTML = s || "N/A", el.onmouseover = () => { el.style.backgroundColor = "rgb(255, 255, 255, .6)" }, el.onmouseout = () => { el.style.backgroundColor = "rgb(255, 255, 255, .2)" }, eo.appendChild(el), v.appendChild(eo) } v.onmouseout = () => { let e = this.themeColors[this.themeIndx]; v.clicked || (v.style.backgroundColor = e.unselectedToggle) }, v.onmouseover = () => { let e = this.themeColors[this.themeIndx]; v.clicked || "keybind" == $ || (v.style.backgroundColor = e.selectedToggle) }, y.appendChild(v) } doKeyBindActions(e) { for (let t in this.keyBindActions) { let o = this.keyBindActions[t]; for (let l in this.keyBinds) if (l == t) { let i; this.keyBinds[l] == e.key && o(); break } } } setToggles() { this.addToggle(0, { label: "Socket Ping", id: "thePingYouAreAtForTheSocketOfThePro", width: 450, enlargedLooks: !0 }, "text display"), this.addToggle(0, { label: "Menu Themes", id: "scriptThemes_toggles", width: 450, height: 120, enlargedLooks: !0, options: [{ styleName: "Gray", color: "#808080", selected: !0 }, { styleName: "Violet", color: "rgb(143, 0, 255)" }, { styleName: "Orange", color: "rgb(255, 180, 0)" }] }, "themes"), this.addToggle(0, { label: "Auto Upgrade", id: "autoUpgrade", width: 450, height: 120, enlargedLooks: !0, checked: !0, options: [{ name: "teleport", selected: !0, icon: "https://i.imgur.com/E8X8olc.png", id: 38 }, { name: "turret", icon: "https://i.imgur.com/3dzAxBL.png", id: 33 }, { name: "healing pad", icon: "https://i.imgur.com/A3UivC2.png", id: 35 }, { name: "blocker", icon: "https://i.imgur.com/Hlc1TZZ.png", id: 37 }, { name: "platform", icon: "https://i.imgur.com/0AgDWC8.png", id: 34 }] }, "custom"), this.addToggle(5, { label: "Total Bots", id: "amountOfBotsYouHaveInServer", width: 450, enlargedLooks: !0 }, "text display"), this.addToggle(5, { label: "Bot Names", id: "botNames", width: 450, height: 180, enlargedLooks: !0 }, "checkList"), this.addToggle(1, { id: "autoplace", label: "Autoplace", tag: "Recommended" }, "toggle"), this.addToggle(1, { id: "autoPush", label: "Autopush", checked: !0, tag: "Recommended" }, "toggle"), this.addToggle(2, { id: "Autonetick", label: "AutoOnetick", checked: !1, tag: "In Development" }, "toggle"), this.addToggle(2, { id: "MPS", label: "Map Ping Sync", checked: !1, tag: "In Development" }, "toggle"), this.addToggle(2, { id: "Debug", label: "Debug Hack", checked: !0, tag: "*use if the mod bug*" }, "toggle"), this.addToggle(2, { id: "autoreplace", label: "Autoreplace", checked: !0, tag: "Recommended" }, "toggle"), this.addToggle(3, {// safeAntiSpikeTick id: "reloadBars", label: "Reloading Bars", tag: "Recommended", checked: !0 }, "toggle"), this.addToggle(3, { id: "treeFade", label: "Tree Fade", tag: "Recommended", checked: !0 }, "toggle"), this.addToggle(3, { id: "safeAntiSpikeTick", label: "Anti spike tick", tag: "Recommended", checked: !0 }, "toggle"), this.addToggle(1, { id: "spiketick", label: "Spiketick", tag: "Rec. Diamond PH", checked: !0 }, "toggle"), this.addToggle(2, { id: "autobuy", label: "Autobuy", checked: !0 }, "toggle"), this.addToggle(3, { id: "buildingHealthBars", label: "Building HP Bars", tag: "Recommended", checked: !0 }, "toggle"), this.addToggle(0, { id: "killChat", label: "Kill Chat" }, "toggle"), this.addToggle(5, { id: "botModule", label: "Module", options: [{ value: 0, label: "Musket Sync" }, { value: 1, label: "Bow Spam" }, { value: 2, label: "Object Breaker (Owner)" }, { value: 3, label: "Object Breaker (All)" }] }, "dropdown"), this.addToggle(5, { id: "botMovement", label: "Movement", options: [{ value: "normal", label: "Follow Player" }, { value: "circle", label: "Circle Player" }, { value: "mouse", label: "Follow Mouse" }, { value: "stop", label: "Stop Moving" }] }, "dropdown"), this.addToggle(5, { id: "targetType", label: "Autoaim Target", options: [{ value: "player", label: "Nearest to Player" }, { value: "bot", label: "Nearest to Bot" }] }, "dropdown"), this.addToggle(3, { id: "darkMode", label: "Dark Mode" }, "toggle"), this.addToggle(0, { id: "placementThrottle", label: "Placement Throttle", value: 2, min: 0 }, "number"), this.addToggle(5, { id: "botAmount", label: "Bot Amount", value: 4, min: 1, max: 39 }, "number"), this.addToggle(5, { label: "Add Bots", logic: () => { //botManager.addBots(this.toggles.botAmount) } }, "button"), this.addToggle(5, { label: "Remove Bots", logic: () => { //botManager.removeBots(this.toggles.botAmount) } }, "button"), this.addToggle(5, { id: "circleRad", label: "Circle Radius", value: 200, min: 70, max: 7200 }, "number"), this.addToggle(5, { id: "playerDist", label: "Player Dist", value: 200, min: 0, max: 7200 }, "number"), this.addToggle(5, { id: "breakingRad", label: "Breaking Radius", value: 900, min: 0, max: 14400 }, "number"), this.addToggle(5, { id: "targetSids", label: "Target Sids", value: "", placerholder: "Enter sids" }, "text"), this.addToggle(1, { id: "preplace", label: "Preplace", tag: "Make Sure To toggle" }, "toggle"), this.addToggle(0, { id: "autoGrind", label: "Autogrind" }, "toggle"), this.addToggle(0, { id: "tickheal", label: "HEALING BY PING" }, "toggle"), this.addToggle(0, { id: "collectStats", label: "Collect User Stats", disabled: true, marginBottom: 20 }, "toggle"), this.addToggle(2, { id: "soldierEMP", label: "Soldier EMP Healing", checked: !0 }, "toggle"), this.addToggle(5, { id: "primaryBotWeapon", label: "Primary Bot Weapon", options: [{ label: "Short Sword", selected: !0, value: 3 }, { label: "Daggers", value: 7 }, { label: "Polearm", value: 5 }, { label: "Bat", value: 6 }] }, "dropdown"), this.addToggle(5, { id: "killOnSight", label: "Kill-On Sight" }, "toggle"), this.addToggle(3, { id: "renderNames", label: "Render Names", checked: !0, marginBottom: 20 }, "toggle"), this.addToggle(3, { id: "renderBuildingDmg", label: "Render Building Dmg", checked: !0, marginBottom: 20 }, "toggle"), this.addToggle(6, { id: "botMovementMouseKeybind", label: "Mouse Movement", tag: "Affects: Bots", key: "B", logic() { let e = document.getElementById("botMovement_dropdown"); e.selectedIndex = 2; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Movement"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Mouse") } }, "keybind"), this.addToggle(6, { id: "botMovementStopKeybind", label: "Stop Movement", tag: "Affects: Bots", key: "O", logic() { let e = document.getElementById("botMovement_dropdown"); e.selectedIndex = 3; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Movement"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Stop") } }, "keybind"), this.addToggle(6, { id: "botMovementPlayerKeybind", label: "Player Movement", tag: "Affects: Bots", key: "M", logic() { let e = document.getElementById("botMovement_dropdown"); e.selectedIndex = 0; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Movement"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Player") } }, "keybind"), this.addToggle(6, { id: "objBreakerAllKeybind", label: "Obj Breaker (All)", tag: "Affects: Bots", key: "b", logic() { let e = document.getElementById("botModule_dropdown"); e.selectedIndex = 3; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Module"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Obj Breaker (All)") } }, "keybind"), this.addToggle(6, { id: "objBreakerOwnerKeybind", label: "Obj Breaker (Owner)", tag: "Affects: Bots", key: "o", logic() { let e = document.getElementById("botModule_dropdown"); e.selectedIndex = 2; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Module"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Obj Breaker (Owner)") } }, "keybind"), this.addToggle(6, { id: "musketSyncKeybind", label: "Musket Sync", tag: "Affects: Bots", key: "m", logic() { let e = document.getElementById("botModule_dropdown"); e.selectedIndex = 0; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Module"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Musket Sync") } }, "keybind"), this.addToggle(6, { id: "nearestToBotTargetKeybind", label: "Nearest Bot Target", tag: "Affects: Bots", key: "T", logic() { let e = document.getElementById("targetType_dropdown"); e.selectedIndex = 1; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Target"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Bot Nearest") } }, "keybind"), this.addToggle(6, { id: "nearestToPlayerTargetKeybind", label: "Nearest Player Target", tag: "Affects: Bots", key: "G", logic() { let e = document.getElementById("targetType_dropdown"); e.selectedIndex = 0; let t = new Event("change", { bubbles: !0 }); e.dispatchEvent(t), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Target"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", "Player Nearest") } }, "keybind"), this.addToggle(5, { id: "placeQuadTrapsBot", label: "Place Traps", marginBottom: 20 }, "toggle"), this.addToggle(6, { id: "botAutoplaceToggle", label: "Autoplacer Toggle", tag: "Affects: Bots", key: "p", logic: () => { document.getElementById("holderElement_placeQuadTrapsBot").click(), textManager.showText(player, 2e3, 15, 0, "#fff", "Bot Autoplace"), textManager.showText({ x: player.x, y: player.y + 20 }, 2e3, 15, 0, "#fff", this.toggles.placeQuadTrapsBot ? "Enabled" : "Disabled") } }, "keybind"), this.addToggle(3, { label: "Render Real Dir", id: "realDir", tag: "Recommended", checked: !0, marginBottom: 20 }, "toggle") } toggleMenu() { if (!this.setingKeybind) { 0 == this.menuElement.style.opacity ? (this.menuElement.style.opacity = 1, this.menuElement.style.pointerEvents = "auto") : (this.menuElement.style.opacity = 0, this.menuElement.style.pointerEvents = "none"), this.scriptMenuTabs.blur(); for (let e = 0; e < this.displays.length; e++) this.displays[e].blur() } } init() { this.setingKeybind = !1, this.keyBinds = {}, this.keyBindActions = {}, this.menuElement = document.createElement("div"), this.menuElement.id = "scriptMenu", this.menuElement.style = ` opacity: 0; position: absolute; width: 650px; height: 425px; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: rgb(0, 0, 0, .8); border-radius: 12px; overflow: hidden; user-select: none; transition: .5s; pointer-events: none; z-index: 1000; `, this.menuElement.innerHTML = ` <style> ::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0); } ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.5); } </style> <div id="scriptMenuTabsHolder" style="position: absolute; left: 0px; top: 0px; height: 100%; width: 150px; background-color: rgb(255, 255, 255, .1);"> <div style="position: absolute; font-size: 25px; left: 29.18px; top: 20px; color: #fff;">Chicken</div> <div style="position: absolute; font-size: 15px; right: 17.5px; top: 12.5px; color: #fff; text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #00f, 0 0 70px #00f, 0 0 80px #00f, 0 0 100px #00f, 0 0 150px #00f;">V4</div> <div id="scriptMenuTabs" style="overflow-y: scroll; left: 0px; position: absolute; width: 100%; height: 365px; top: 60px;"> </div> </div> <div id="scriptMenuDisplay" style="position: absolute; width: 500px; height: 100%; left: 150px; top: 0px; overflow: hidden;"> </div> `, document.body.appendChild(this.menuElement), this.chickenAdminRedirect = "", this.scriptMenuDisplay = document.getElementById("scriptMenuDisplay"), this.scriptMenuTabs = document.getElementById("scriptMenuTabs"), this.addTab("Home", "https://i.imgur.com/Da9LKoE.png"), this.addTab("Combat", "https://i.imgur.com/sR5JnTE.png"), this.addTab("Defense", "https://i.imgur.com/0fz1qiE.png"), this.addTab("Visual", "https://i.imgur.com/cJOwD3n.png"), this.addTab("Chat Log", "https://i.imgur.com/XWv7qI9.png", ` <div id="chatLogger" style="position: absolute; top: 10px; left: 10px; width: 480px; height: 365px; background-color: rgb(255, 255, 255, .15); border-radius: 12px; overflow-y: scroll;"> </div> <div id="chickenSuggestionBox" style="display: none; left: 10px; bottom: 45px; position: absolute; background-color: rgb(0, 0, 0); width: 480px; border-radius: 6px; padding-top: 5px; padding-bottom: 5px;"></div> <input id="chickenChatBox" type="text" placeholder="To chat: click here or press 'Enter' key" style="box-shadow: none; outline: none; left: 10px; bottom: 10px; height: 30px; position: absolute; border-radius: 5px; width: 476px; background: rgb(255, 255, 255, .15); border: none; color: #fff;"> `), this.addTab("Bots", "https://i.imgur.com/g6p10wB.png"), this.addTab("Keybinds", "https://i.imgur.com/5ga93HN.png"), this.addTab("Notes", "https://i.imgur.com/9fbjRuw.png", ` <div style="color: #fff; position: absolute; top: 10px; left: 10px; width: 480px; height: 405px;"> <div style="height: 380px; overflow-y: scroll;"> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Useful stuff to know</div> <div style="margin-left: 10px;"> If the autobreak is being dumb (trying to break spike/trap when out of weapons' range or if player cannot actually damage the object), hold the "<span style="color: #9e9e9e">shift</span>" key to override the spike breaking process.<br> You can also use the same key to override autopushing.<br> If the script gets bugged or stuck, press the "<span style="color: #9e9e9e">Z</span>" key to debug the script. This may not always work depending on the bug/problem.<br> <span style="color: #9e9e9e">Melee Sync</span> toggle only works with other chicken mod users. </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Menu Import Failure</div> <div style="margin-left: 10px;"> If the menu gets incorrectly imported, click <span id="scriptMenuReimporter" style="color: #9e9e9e; cursor: pointer;">here</span>. </div> <div style="color: #9e9e9e; font-size: 16px;">Private chat display / chatbox</div> <div style="margin-left: 10px;"> Hold the "<span style="color: #9e9e9e">Alt / Option</span>" key to auto focus on the private chat box.<br> Use the command, "<span style="color: #9e9e9e">!clear</span>" to clear the display.<br> All the commands on the old chatbox can be also used for this one (example: bot playing command and the chat filter commands) </div> <div style="color: #9e9e9e; font-size: 16px;">Bots</div> <div style="margin-left: 10px;"> Use the command, "<span style="color: #9e9e9e">!play *sid*</span>" to start playing as a bot.<br> Use the command, "<span style="color: #9e9e9e">!play stop</span>" to stop playing as a bot.<br> Use the command, "<span style="color: #9e9e9e">!cbot *message*</span>" to make all bots chat a message. (Don't use the private chicken mod chat box for this command).<br> The recommended amount of bots to use is <span style="color: #9e9e9e">20</span>. </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Kill-On Sight Bot Toggle</div> <div style="margin-left: 10px;"> This toggle only works when you have at least one targeted sid.<br> This toggle makes it so that bots would auto-fire on targeted sids on sight regardless of the module they are set to.<br> <span style="color: #9e9e9e">Please note that this means that they'll auto-fire even if not enough bots are present to kill the target.</span> </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Bot Target Sids</div> <div style="margin-left: 10px;"> Put commas between SIDs. For example: <span style="color: #9e9e9e">12,32,42</span>.<br> When you put SIDs in the toggle, the bots will prioritize targeting enemies with the SIDs over any other enemy SID not listed.<br> The bot checks if there are enemies with the SID and checks if it can shoot/sync them. If all requirements are met, the bot will override the nearest enemy and fire at the target SID.<br> With multiple target SIDs, the bot will choose the closest one that fits all the requirements. </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Playing as a bot</div> <div style="margin-left: 10px;"> When playing as the bot, the main player stop becoming responsive to your inputs. The bot you control will not have the same healing/functions as the main player. This means that when playing as a bot, you won't be able to do things like: clan creation, autopushing, and pinging the ingame map. </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Chicken mod commands</div> <div style="margin-left: 10px;"> This section is for <span style="color: #9e9e9e">Chicken mod admins</span>.<br> Use the command, "<span style="color: #9e9e9e">!cinvis *boolean*</span>", on the private chatbox to hide your discord username and in-game position from other chicken mod users.<br> Use the command, "<span style="color: #9e9e9e">!cfreeze *sid* *duration=in_seconds*</span>, on public chatbox to freeze a chicken user in place. (The default duration is <span style="color: #9e9e9e">10</span> seconds).<br> Use the command, "<span style="color: #9e9e9e">!ckick *sid*</span>", on public chatbox to kick a chicken user from the game<br> Use the command, "<span style="color: #9e9e9e">!cjumpscare</span>", on private chatbox to jumpscare a all chicken users </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Chat Logger Commands</div> <div style="margin-left: 10px;"> Type <span style="color: #9e9e9e">"!clear"</span> on private message sender to clear chat logger.<br> Use the command <span style="color: #9e9e9e">"!ignore sid"</span> on private message sender to make the logger ignore player with the chosen sid. <span style="color: #9e9e9e">(ex: !ignore 6)</span><br> Use the command <span style="color: #9e9e9e">"!ignore name</span> on private message sender to make the logger ignore players with the chosen name. <span style="color: #9e9e9e">(ex: !ignore Zombie)</span><br> Use the command <span style="color: #9e9e9e">"!stop sid"</span> on private messager sender to stop ingoring player with the chosen sid. <span style="color: #9e9e9e">(ex: !stop 6)</span><br> Use the command <span style="color: #9e9e9e">"!stop name</span> on private message sender to stop ignoring players with the chosen name. <span style="color: #9e9e9e">(ex: !stop Zombie)</span><br><br> When ignoring people with the 'name' command, it will also ignore anyone with the selected text in their name. </div> <div style="margin-top: 10px; color: #9e9e9e; font-size: 16px;">Other links</div> <div style="margin-left: 10px;"> To access the <span style="color: #9e9e9e">chicken admin console thingy</span> (if you are a chicken admin), click <a style="cursor: pointer;" onclick="window.open('${this.chickenAdminRedirect}')">here</a>. </div> </div> <div style="position: absolute; color: #9e9e9e; right: 0px; bottom: 0px;"> Credits to <a style="cursor: pointer;" onclick="window.open('https://www.youtube.com/@HyperLinkBlocked')">Delphi</a> and <a style="cursor: pointer;" onclick="window.open('https://www.youtube.com/@Dayteee')">Dayte</a> for menu references </div> </div> `, !0), this.chatLogger = document.getElementById("chatLogger"), this.chatBox = document.getElementById("chickenChatBox"), this.darkModeElement = document.createElement("div"), this.darkModeElement.style = ` opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: rgb(0, 0, 70, .25); pointer-events: none; transition: 5s; `, document.body.insertBefore(this.darkModeElement, this.menuElement), this.setToggles(), document.getElementById("scriptMenuReimporter").onclick = () => { this.menuElement.remove(), this.ignored = [], this.displayToggles = {}, this.toggles = {}, this.displays = [], this.tabs = [], this.init(), scriptMenu.add("imported", {}) }; let e = document.createElement("style"); e.innerHTML = ` .chicken-chat-box { color: white; display: none; } .chicken-chat-box::placeholder { color: #ffc0cb; } `, document.body.appendChild(e), this.anotherChickenChatBox = document.createElement("input"), this.anotherChickenChatBox.type = "text", this.anotherChickenChatBox.classList.add("chicken-chat-box"), this.anotherChickenChatBox.placeholder = "Enter Message", this.anotherChickenChatBox.style = ` padding: 6px; font-size: 20px; color: #fff; background-color: rgba(0, 0, 0, 0.25); border-radius: 4px; pointer-events: all; border: 0; margin-bottom: 10px; `, window.ssadas = () => { this.anotherChickenChatBox.focus() }, chatHolder.insertBefore(this.anotherChickenChatBox, chatHolder.firstChild), this.privateLogger = document.createElement("div"), this.privateLogger.style = ` pointer-events: all; position: absolute; width: 275px; max-height: 200px; bottom: 20px; left: 160px; overflow-y: scroll; `, document.getElementById("gameUI").appendChild(this.privateLogger), this.privateLogger.onmouseover = () => { this.privateLogger.isHovered = !0 }, this.privateLogger.onmouseout = () => { this.privateLogger.isHovered = !1 } } getCurrentTime() { let e = new Date, t = e.getHours(), o = e.getMinutes(); return `${t%12==0?12:t%12}:${o<10?`0${o}`:o} ${t>=12?"PM":"AM"}` } filterMsg(e) { return ((void 0 == e || null == e) && (e = ""), e.includes("@@@@@")) ? { replace: "Spammed '@'" } : e.toString().length > 100 ? { replace: "Message Exceeded 100 Characters" } : "string" == typeof e ? e.replace(/</g, "<").replace(/>/g, ">") : e } autoScroll(e, t) { 0 == this.menuElement.style.opacity ? this.chatLogger.scrollTop = this.chatLogger.scrollHeight : "0px" != this.displays[4].style.top ? this.chatLogger.scrollTop = this.chatLogger.scrollHeight : e == player.sid && t == player.name && (this.chatLogger.scrollTop = this.chatLogger.scrollHeight), this.privateLogger.isHovered || (this.privateLogger.scrollTop = this.privateLogger.scrollHeight) } sendLoggerMsg(e) { "clear" == e || "autoclear" == e ? (this.privateLogger.innerHTML = "", this.chatLogger.innerHTML = ` <div style="font-size: 13px; margin-left: 5px; margin-top: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #ffff00">${"autoclear"==e?"Auto cleared chat logger":"Cleared chat logger"}</span> </div> `) : (this.chatLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px; margin-top: 0px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #9e9e9e">${e}</span> </div> `, this.autoScroll(player.sid, player.name)) } add(e, { msg: t, name: o, sid: l, translated: i }) { let s; if (t) { let n = this.filterMsg(t); "object" == typeof n ? (t = n.replace, s = "#9e9e9e") : t = n } return l && this.ignored.includes(l) || o && this.ignored.find(e => !!("string" == typeof e && o.includes(e))) ? "Ignored Player" : t && t.includes("WHY DIE XDDD '") ? "Ignored bot msg" : void(this.chatLogger.scrollHeight >= 3500 && this.sendLoggerMsg("autoclear"), "chat" == e ? (this.chatLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #fff">${o} {${l}}${i?'<span style="color: #f00"> (translated)</span>':""}:</span> <span style="color: ${s||"#fff"}">${t}</span> </div> `, this.autoScroll(l, o)) : "imported" == e ? this.chatLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px; margin-top: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #0f0">Successfully imported chicken mod</span> </div> ` : "private" == e ? (this.privateLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #fff">${o} {${l}}:</span> <span style="color: ${s||"#fff"}">${t}</span> </div> `, this.chatLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #fff">${o} {${l}}</span> <span style="color: #f00">(private message):</span> <span style="color: ${s||"#fff"}">${t}</span> </div> `, this.autoScroll(l, o)) : "encountered" == e ? (this.chatLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #ffff00">encountered: ${o} {${l}}</span> </div> `, this.autoScroll(l, o)) : "left" == e && (this.chatLogger.innerHTML += ` <div style="font-size: 13px; margin-left: 5px;"> <span style="color: #fff">${this.getCurrentTime()} - </span> <span style="color: #f00">${o} {${l}} has left the game</span> </div> `, this.autoScroll(l, o))) } autoFill() { let e = document.getElementById("chickenChatBox"), t = e.value; if (t && t.startsWith("!") && "chickenChatBox" == document.activeElement.id) { let o = t.split("!")[1], l = o.split(" ")[0], i; document.getElementById("chickenSuggestionBox").style.display = "block", document.getElementById("chickenSuggestionBox").innerHTML = ""; for (let s = 0; s < this.commands.length; s++) { let n = this.commands[s]; if (n[0] == l) { i = n; break } } if (i) { if (i[2]) for (let a = 0; a < i[2].length; a++) { let r = i[2][a]; r && (document.getElementById("chickenSuggestionBox").innerHTML += ` <div style="margin-left: 5px;"> <span style="color: #808080">!${i[0]} </span><span style="color: #a1a1a1">${r[0]}</span><span style="color: #fff"> - ${r[1]}</span> </div> `) } else e.value = `!${i[0]}`, e.focus(), scriptMenu.autoFill() } else { for (let d = 0; d < 10; d++) { let g = this.commands[d]; g && (g[0].startsWith(l) || "" == o) && (document.getElementById("chickenSuggestionBox").innerHTML += ` <div id="autoFillPt1_${g[0]}" style="cursor: pointer; margin-left: 5px;"> <span style="color: #808080">!${g[0]}</span><span style="color: #fff">${g[1]?` - ${g[1]}`:""}</span> </div> `) } for (let h = 0; h < 10; h++) { let c = this.commands[h]; c && (c[0].startsWith(l) || "" == o) && (document.getElementById(`autoFillPt1_${c[0]}`).onmouseover = function() { this.style.backgroundColor = "#575757" }, document.getElementById(`autoFillPt1_${c[0]}`).onmouseout = function() { this.style.backgroundColor = null }, document.getElementById(`autoFillPt1_${c[0]}`).onclick = function() { c[2], e.value = `!${c[0]}`, e.focus(), scriptMenu.autoFill() }) } } } else document.getElementById("chickenSuggestionBox").style.display = "none", document.getElementById("chickenSuggestionBox").innerHTML = "" } convertEmojis(e) { return emojione.shortnameToUnicode(e) } changeTheme(e) { let t = this.themeIndx; this.themeIndx = e; let o = this.themeColors[t], l = this.themeColors[this.themeIndx], i = [...this.menuElement.childNodes]; this.menuElement.style.backgroundColor = l.scriptMenuColor; for (let s = 0; s < i.length; s++) { let n = i[s]; if ("scriptMenuTabsHolder" == n.id) { n.style.backgroundColor = l.tabsHolderColor; [...n.childNodes].forEach(e => { "scriptMenuTabs" == e.id && [...e.childNodes].forEach(e => { "DIV" == e.tagName && (e.style.backgroundColor == o.selectedTabs ? e.style.backgroundColor = l.selectedTabs : e.style.backgroundColor = l.unselectedTabs, e.style.color = l.mainFontColor) }) }) } else "scriptMenuDisplay" == n.id && [...n.childNodes].forEach((e, t) => { t < 6 && [...e.childNodes].forEach(e => { "DIV" == e.tagName && "transparent" != e.style.background && (e.style.backgroundColor == o.selectedToggle ? e.style.backgroundColor = l.selectedToggle : e.style.backgroundColor = l.unselectedToggle); let t = [...e.childNodes]; e.childNodes[1] && "DIV" == e.childNodes[1].tagName && (e.childNodes[1].style.color = l.mainFontColor); t.find(e => "INPUT" == e.tagName && "range" == e.type) && e.childNodes[5] && (e.childNodes[5].style.color = l.mainFontColor), t.forEach(e => { e.id && e.id.includes("textDisplay") && (e.style.color = l.mainFontColor); let t = [...e.childNodes].find(e => "BUTTON" == e.tagName), i = [...e.childNodes].find(e => "INPUT" == e.tagName && ("text" == e.type || "number" == e.type)); i && (i.style.backgroundColor = l.selectedTabs, i.style.color = l.mainFontColor), t && (t.style.color == o.toggledButtonColor ? t.style.color = l.toggledButtonColor : t.style.color = l.toggleButtonColor) }) }) }) } } constructor() { this.themeIndx = 0, this.themeColors = [{ toggleHolder: "rgba(255, 255, 255, 0.15)", unselectedTabs: "rgba(255, 255, 255, 0.1)", selectedTabs: "rgba(255, 255, 255, 0.4)", mainFontColor: "rgb(255, 255, 255)", selectedToggle: "rgba(255, 255, 255, 0.6)", unselectedToggle: "rgba(255, 255, 255, 0.15)", highlightedColor: "#9e9e9e", tabsHolderColor: "rgba(255, 255, 255, 0.1)", scriptMenuColor: "rgba(0, 0, 0, 0.8)", toggledButtonColor: "rgb(0, 0, 0)", toggleButtonColor: "rgba(255, 255, 255, 0.6)" }, { toggleHolder: "rgba(255, 255, 255, 0.15)", unselectedTabs: "rgba(255, 255, 255, 0.1)", selectedTabs: "rgba(255, 255, 255, 0.4)", mainFontColor: "rgb(255, 255, 255)", selectedToggle: "rgba(98, 1, 172, 0.4)", unselectedToggle: "rgba(255, 255, 255, 0.2)", highlightedColor: "#9e9e9e", tabsHolderColor: "rgba(255, 255, 255, 0.1)", scriptMenuColor: "rgba(143, 0, 255, 0.6)", toggledButtonColor: "rgb(0, 0, 0)", toggleButtonColor: "rgba(255, 255, 255, 0.6)" }, { toggleHolder: "rgba(255, 255, 255, 0.15)", unselectedTabs: "rgba(255, 255, 255, 0.25)", selectedTabs: "rgba(255, 102, 0, 0.8)", mainFontColor: "rgb(255, 255, 255)", selectedToggle: "rgba(255, 102, 0, 0.8)", unselectedToggle: "rgba(255, 255, 255, 0.35)", highlightedColor: "#9e9e9e", tabsHolderColor: "rgba(255, 255, 255, 0.1)", scriptMenuColor: "rgba(255, 102, 0, 0.6)", toggledButtonColor: "rgb(0, 0, 0)", toggleButtonColor: "rgba(255, 255, 255, 0.6)" }], this.commands = [ ["ignore", "makes the chatlogger ignore people", [ ["*sid*", "enter the sid of the user that you want to be ignored"], ["text", "make the logger ignore anyone with the text in their name"] ]], ["stop", "stops the chatlogger from ignoring people", [ ["*sid*", "enter the sid of the user that you want to stop being ignored"], ["text", "make the logger stop ignoring anyone with the text in their name"] ]], ["clear", "clears the chatlogger"], ["play", "allows the user to play as a bot", [ ["*sid*", "enter the sid of the bot you want to play as"], ["end", "stop playing as a bot"] ]], ["cjumpscare", "jumpscares all active chicken users in your server"], ["cinvis", "stop chicken users from seeing your discord username", [ ["*boolean*", "true/false parameter"] ]] ], this.ignored = [], this.addedTogglesHeight = {}, this.displayToggles = {}, this.toggles = {}, this.displays = [], this.tabs = [], this.init(); let e = document.createElement("script"); e.src = "https://cdn.jsdelivr.net/npm/[email protected]/lib/js/emojione.min.js", document.body.appendChild(e) } }; scriptMenu.add("imported", {}); // IGMIMGIMOSADDMASMDOMSDM IPIIPIP LGOGGEDEDDEDERERE! // RENDER GAME OBJECTS: let gameObjectSprites = {}; function getResSprite(obj) { let biomeID = (obj.y >= config.mapScale - config.snowBiomeTop) ? 2 : ((obj.y <= config.snowBiomeTop) ? 1 : 0); let tmpIndex = (obj.type + "_" + obj.scale + "_" + biomeID); let tmpSprite = gameObjectSprites[tmpIndex]; if (!tmpSprite) { let blurScale = 0; let tmpCanvas = document.createElement("canvas"); tmpCanvas.width = tmpCanvas.height = (obj.scale * 2.1) + outlineWidth; let tmpContext = tmpCanvas.getContext('2d'); tmpContext.translate((tmpCanvas.width / 2), (tmpCanvas.height / 2)); tmpContext.rotate(UTILS.randFloat(0, Math.PI)); tmpContext.strokeStyle = outlineColor; tmpContext.lineWidth = outlineWidth; tmpContext.shadowBlur = 3; tmpContext.shadowColor = `rgba(0, 0, 0, ${obj.alpha})`; if (obj.type == 0) { let tmpScale; let tmpCount = UTILS.randInt(5, 6); tmpContext.globalAlpha = (cdf(obj, player) <= 250 ? 0.6 : 1); for (let i = 0; i < 2; ++i) { tmpScale = tmpObj.scale * (!i ? 1 : 0.5); renderStar(tmpContext, tmpCount, tmpScale, tmpScale * 0.7); tmpContext.fillStyle = !biomeID ? (!i ? "#9ebf57" : "#b4db62") : (!i ? "#e3f1f4" : "#fff"); tmpContext.fill(); if (!i) { tmpContext.stroke(); tmpContext.shadowBlur = null; tmpContext.shadowColor = null; tmpContext.globalAlpha = 1; } } } else if (obj.type == 1) { if (biomeID == 2) { tmpContext.fillStyle = "#606060"; renderStar(tmpContext, 6, obj.scale * 0.3, obj.scale * 0.71); tmpContext.fill(); tmpContext.stroke(); //tmpContext.shadowBlur = null; //tmpContext.shadowColor = null; tmpContext.fillStyle = "#89a54c"; renderCircle(0, 0, obj.scale * 0.55, tmpContext); tmpContext.fillStyle = "#a5c65b"; renderCircle(0, 0, obj.scale * 0.3, tmpContext, true); } else { renderBlob(tmpContext, 6, tmpObj.scale, tmpObj.scale * 0.7); tmpContext.fillStyle = biomeID ? "#e3f1f4" : "#89a54c"; tmpContext.fill(); tmpContext.stroke(); //tmpContext.shadowBlur = null; //tmpContext.shadowColor = null; tmpContext.fillStyle = biomeID ? "#6a64af" : "#c15555"; let tmpRange; let berries = 4; let rotVal = (Math.PI * 2) / berries; for (let i = 0; i < berries; ++i) { tmpRange = UTILS.randInt(tmpObj.scale / 3.5, tmpObj.scale / 2.3); renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange * Math.sin(rotVal * i), UTILS.randInt(10, 12), tmpContext); } } } else if (obj.type == 2 || obj.type == 3) { tmpContext.fillStyle = (obj.type == 2) ? (biomeID == 2 ? "#938d77" : "#939393") : "#e0c655"; renderStar(tmpContext, 3, obj.scale, obj.scale); tmpContext.fill(); tmpContext.stroke(); tmpContext.shadowBlur = null; tmpContext.shadowColor = null; tmpContext.fillStyle = (obj.type == 2) ? (biomeID == 2 ? "#b2ab90" : "#bcbcbc") : "#ebdca3"; renderStar(tmpContext, 3, obj.scale * 0.55, obj.scale * 0.65); tmpContext.fill(); } tmpSprite = tmpCanvas; gameObjectSprites[tmpIndex] = tmpSprite; } return tmpSprite; } // GET ITEM SPRITE: let itemSprites = []; function getItemSprite(obj, asIcon) { let tmpSprite = itemSprites[obj.id]; if (!tmpSprite || asIcon) { let blurScale = !asIcon ? 20 : 5; let tmpCanvas = document.createElement("canvas"); let reScale = ((!asIcon && obj.name == "windmill") ? items.list[4].scale : obj.scale); tmpCanvas.width = tmpCanvas.height = (reScale * 2.5) + outlineWidth + (items.list[obj.id].spritePadding || 0) + blurScale; let tmpContext = tmpCanvas.getContext("2d"); tmpContext.translate((tmpCanvas.width / 2), (tmpCanvas.height / 2)); tmpContext.rotate(asIcon ? 0 : (Math.PI / 2)); tmpContext.strokeStyle = outlineColor; tmpContext.lineWidth = outlineWidth * (asIcon ? (tmpCanvas.width / 81) : 1); tmpContext.shadowBlur = 2; tmpContext.shadowColor = `rgba(0, 0, 0, ${obj.alpha})`; if (obj.name == "apple") { tmpContext.fillStyle = "#c15555"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#89a54c"; let leafDir = -(Math.PI / 2); renderLeaf(obj.scale * Math.cos(leafDir), obj.scale * Math.sin(leafDir), 25, leafDir + Math.PI / 2, tmpContext); } else if (obj.name == "cookie") { tmpContext.fillStyle = "#cca861"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#937c4b"; let chips = 4; let rotVal = (Math.PI * 2) / chips; let tmpRange; for (let i = 0; i < chips; ++i) { tmpRange = UTILS.randInt(obj.scale / 2.5, obj.scale / 1.7); renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange * Math.sin(rotVal * i), UTILS.randInt(4, 5), tmpContext, true); } } else if (obj.name == "cheese") { tmpContext.fillStyle = "#f4f3ac"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#c3c28b"; let chips = 4; let rotVal = (Math.PI * 2) / chips; let tmpRange; for (let i = 0; i < chips; ++i) { tmpRange = UTILS.randInt(obj.scale / 2.5, obj.scale / 1.7); renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange * Math.sin(rotVal * i), UTILS.randInt(4, 5), tmpContext, true); } } else if (obj.name == "wood wall" || obj.name == "stone wall" || obj.name == "castle wall") { tmpContext.fillStyle = (obj.name == "castle wall") ? "#83898e" : (obj.name == "wood wall") ? "#a5974c" : "#939393"; let sides = (obj.name == "castle wall") ? 4 : 3; renderStar(tmpContext, sides, obj.scale * 1.1, obj.scale * 1.1); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = (obj.name == "castle wall") ? "#9da4aa" : (obj.name == "wood wall") ? "#c9b758" : "#bcbcbc"; renderStar(tmpContext, sides, obj.scale * 0.65, obj.scale * 0.65); tmpContext.fill(); } else if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison spikes" || obj.name == "spinning spikes") { tmpContext.fillStyle = (obj.name == "poison spikes") ? "#7b935d" : "#939393"; let tmpScale = (obj.scale * 0.6); renderStar(tmpContext, (obj.name == "spikes") ? 5 : 6, obj.scale, tmpScale); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, tmpScale, tmpContext); tmpContext.fillStyle = "#c9b758"; renderCircle(0, 0, tmpScale / 2, tmpContext, true); } else if (obj.name == "windmill" || obj.name == "faster windmill" || obj.name == "power mill") { tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, reScale, tmpContext); tmpContext.fillStyle = "#c9b758"; renderRectCircle(0, 0, reScale * 1.5, 29, 4, tmpContext); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, reScale * 0.5, tmpContext); } else if (obj.name == "mine") { tmpContext.fillStyle = "#939393"; renderStar(tmpContext, 3, obj.scale, obj.scale); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#bcbcbc"; renderStar(tmpContext, 3, obj.scale * 0.55, obj.scale * 0.65); tmpContext.fill(); } else if (obj.name == "sapling") { for (let i = 0; i < 2; ++i) { let tmpScale = obj.scale * (!i ? 1 : 0.5); renderStar(tmpContext, 7, tmpScale, tmpScale * 0.7); tmpContext.fillStyle = (!i ? "#9ebf57" : "#b4db62"); tmpContext.fill(); if (!i) tmpContext.stroke(); } } else if (obj.name == "pit trap") { tmpContext.fillStyle = "#a5974c"; renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = outlineColor; renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65); tmpContext.fill(); } else if (obj.name == "boost pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#dbd97d"; renderTriangle(obj.scale * 1, tmpContext); } else if (obj.name == "turret") { tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#939393"; let tmpLen = 50; renderRect(0, -tmpLen / 2, obj.scale * 0.9, tmpLen, tmpContext); renderCircle(0, 0, obj.scale * 0.6, tmpContext); tmpContext.fill(); tmpContext.stroke(); } else if (obj.name == "platform") { tmpContext.fillStyle = "#cebd5f"; let tmpCount = 4; let tmpS = obj.scale * 2; let tmpW = tmpS / tmpCount; let tmpX = -(obj.scale / 2); for (let i = 0; i < tmpCount; ++i) { renderRect(tmpX - (tmpW / 2), 0, tmpW, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpX += tmpS / tmpCount; } } else if (obj.name == "healing pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#db6e6e"; renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true); } else if (obj.name == "spawn pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#71aad6"; renderCircle(0, 0, obj.scale * 0.6, tmpContext); } else if (obj.name == "blocker") { tmpContext.fillStyle = "#7e7f82"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.rotate(Math.PI / 4); tmpContext.fillStyle = "#db6e6e"; renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true); } else if (obj.name == "teleporter") { tmpContext.fillStyle = "#7e7f82"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.rotate(Math.PI / 4); tmpContext.fillStyle = "#d76edb"; renderCircle(0, 0, obj.scale * 0.5, tmpContext, true); } tmpSprite = tmpCanvas; if (!asIcon) itemSprites[obj.id] = tmpSprite; } return tmpSprite; } function getItemSprite2(obj, tmpX, tmpY) { let tmpContext = mainContext; let reScale = (obj.name == "windmill" ? items.list[4].scale : obj.scale); tmpContext.save(); tmpContext.translate(tmpX, tmpY); tmpContext.rotate(obj.dir); tmpContext.strokeStyle = outlineColor; tmpContext.lineWidth = outlineWidth; if (obj.name == "apple") { tmpContext.fillStyle = "#c15555"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#89a54c"; let leafDir = -(Math.PI / 2); renderLeaf(obj.scale * Math.cos(leafDir), obj.scale * Math.sin(leafDir), 25, leafDir + Math.PI / 2, tmpContext); } else if (obj.name == "cookie") { tmpContext.fillStyle = "#cca861"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#937c4b"; let chips = 4; let rotVal = (Math.PI * 2) / chips; let tmpRange; for (let i = 0; i < chips; ++i) { tmpRange = UTILS.randInt(obj.scale / 2.5, obj.scale / 1.7); renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange * Math.sin(rotVal * i), UTILS.randInt(4, 5), tmpContext, true); } } else if (obj.name == "cheese") { tmpContext.fillStyle = "#f4f3ac"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#c3c28b"; let chips = 4; let rotVal = (Math.PI * 2) / chips; let tmpRange; for (let i = 0; i < chips; ++i) { tmpRange = UTILS.randInt(obj.scale / 2.5, obj.scale / 1.7); renderCircle(tmpRange * Math.cos(rotVal * i), tmpRange * Math.sin(rotVal * i), UTILS.randInt(4, 5), tmpContext, true); } } else if (obj.name == "wood wall" || obj.name == "stone wall" || obj.name == "castle wall") { tmpContext.fillStyle = (obj.name == "castle wall") ? "#83898e" : (obj.name == "wood wall") ? "#a5974c" : "#939393"; let sides = (obj.name == "castle wall") ? 4 : 3; renderStar(tmpContext, sides, obj.scale * 1.1, obj.scale * 1.1); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = (obj.name == "castle wall") ? "#9da4aa" : (obj.name == "wood wall") ? "#c9b758" : "#bcbcbc"; renderStar(tmpContext, sides, obj.scale * 0.65, obj.scale * 0.65); tmpContext.fill(); } else if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison spikes" || obj.name == "spinning spikes") { tmpContext.fillStyle = (obj.name == "poison spikes") ? "#7b935d" : "#939393"; let tmpScale = (obj.scale * 0.6); renderStar(tmpContext, (obj.name == "spikes") ? 5 : 6, obj.scale, tmpScale); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, tmpScale, tmpContext); tmpContext.fillStyle = "#c9b758"; renderCircle(0, 0, tmpScale / 2, tmpContext, true); } else if (obj.name == "windmill" || obj.name == "faster windmill" || obj.name == "power mill") { tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, reScale, tmpContext); tmpContext.fillStyle = "#c9b758"; renderRectCircle(0, 0, reScale * 1.5, 29, 4, tmpContext); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, reScale * 0.5, tmpContext); } else if (obj.name == "mine") { tmpContext.fillStyle = "#939393"; renderStar(tmpContext, 3, obj.scale, obj.scale); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#bcbcbc"; renderStar(tmpContext, 3, obj.scale * 0.55, obj.scale * 0.65); tmpContext.fill(); } else if (obj.name == "sapling") { for (let i = 0; i < 2; ++i) { let tmpScale = obj.scale * (!i ? 1 : 0.5); renderStar(tmpContext, 7, tmpScale, tmpScale * 0.7); tmpContext.fillStyle = (!i ? "#9ebf57" : "#b4db62"); tmpContext.fill(); if (!i) tmpContext.stroke(); } } else if (obj.name == "pit trap") { tmpContext.fillStyle = "#a5974c"; renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = outlineColor; renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65); tmpContext.fill(); } else if (obj.name == "boost pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#dbd97d"; renderTriangle(obj.scale * 1, tmpContext); } else if (obj.name == "turret") { tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#939393"; let tmpLen = 50; renderRect(0, -tmpLen / 2, obj.scale * 0.9, tmpLen, tmpContext); renderCircle(0, 0, obj.scale * 0.6, tmpContext); tmpContext.fill(); tmpContext.stroke(); } else if (obj.name == "platform") { tmpContext.fillStyle = "#cebd5f"; let tmpCount = 4; let tmpS = obj.scale * 2; let tmpW = tmpS / tmpCount; let tmpX = -(obj.scale / 2); for (let i = 0; i < tmpCount; ++i) { renderRect(tmpX - (tmpW / 2), 0, tmpW, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpX += tmpS / tmpCount; } } else if (obj.name == "healing pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#db6e6e"; renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true); } else if (obj.name == "spawn pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#71aad6"; renderCircle(0, 0, obj.scale * 0.6, tmpContext); } else if (obj.name == "blocker") { tmpContext.fillStyle = "#7e7f82"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.rotate(Math.PI / 4); tmpContext.fillStyle = "#db6e6e"; renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true); } else if (obj.name == "teleporter") { tmpContext.fillStyle = "#7e7f82"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.rotate(Math.PI / 4); tmpContext.fillStyle = "#d76edb"; renderCircle(0, 0, obj.scale * 0.5, tmpContext, true); } tmpContext.restore(); } let objSprites = []; function getObjSprite(obj) { let tmpSprite = objSprites[obj.id]; if (!tmpSprite) { // let blurScale = isNight ? 20 : 0; let tmpCanvas = document.createElement("canvas"); tmpCanvas.width = tmpCanvas.height = obj.scale * 2.5 + outlineWidth + (items.list[obj.id].spritePadding || 0) + 0; let tmpContext = tmpCanvas.getContext("2d"); tmpContext.translate(tmpCanvas.width / 2, tmpCanvas.height / 2); tmpContext.rotate(Math.PI / 2); tmpContext.strokeStyle = outlineColor; tmpContext.lineWidth = outlineWidth; tmpContext.shadowBlur = 5; tmpContext.shadowColor = `rgba(0, 0, 0, ${obj.alpha})`; if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison spikes" || obj.name == "spinning spikes") { tmpContext.fillStyle = obj.name == "poison spikes" ? "#7b935d" : "#939393"; let tmpScale = obj.scale * 0.6; renderStar(tmpContext, obj.name == "spikes" ? 5 : 6, obj.scale, tmpScale); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, tmpScale, tmpContext); tmpContext.fillStyle = "#cc5151"; renderCircle(0, 0, tmpScale / 2, tmpContext, true); } else if (obj.name == "pit trap") { tmpContext.fillStyle = "#a5974c"; renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#cc5151"; renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65); tmpContext.fill(); } tmpSprite = tmpCanvas; objSprites[obj.id] = tmpSprite; } return tmpSprite; } // GET MARK SPRITE: function getMarkSprite(obj, tmpContext, tmpX, tmpY) { let center = { x: screenWidth / 2, y: screenHeight / 2, }; tmpContext.lineWidth = outlineWidth; mainContext.globalAlpha = 0.2; tmpContext.strokeStyle = outlineColor; tmpContext.save(); tmpContext.translate(tmpX, tmpY); tmpContext.rotate(90**10); if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison spikes" || obj.name == "spinning spikes") { tmpContext.fillStyle = (obj.name == "poison spikes")?"#7b935d":"#939393"; var tmpScale = (obj.scale); renderStar(tmpContext, (obj.name == "spikes")?5:6, obj.scale, tmpScale); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, tmpScale, tmpContext); if (player && obj.owner && player.sid != obj.owner.sid && !tmpObj.findAllianceBySid(obj.owner.sid)) { tmpContext.fillStyle = "#a34040"; } else { tmpContext.fillStyle = "#c9b758"; } renderCircle(0, 0, tmpScale/2, tmpContext, true); } else if (obj.name == "turret") { renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#939393"; let tmpLen = 50; renderRect(0, -tmpLen / 2, obj.scale * 0.9, tmpLen, tmpContext); renderCircle(0, 0, obj.scale * 0.6, tmpContext); tmpContext.fill(); tmpContext.stroke(); } else if (obj.name == "teleporter") { tmpContext.fillStyle = "#7e7f82"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.rotate(Math.PI / 4); tmpContext.fillStyle = "#d76edb"; renderCircle(0, 0, obj.scale * 0.5, tmpContext, true); } else if (obj.name == "platform") { tmpContext.fillStyle = "#cebd5f"; let tmpCount = 4; let tmpS = obj.scale * 2; let tmpW = tmpS / tmpCount; let tmpX = -(obj.scale / 2); for (let i = 0; i < tmpCount; ++i) { renderRect(tmpX - (tmpW / 2), 0, tmpW, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpX += tmpS / tmpCount; } } else if (obj.name == "healing pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#db6e6e"; renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true); } else if (obj.name == "spawn pad") { tmpContext.fillStyle = "#7e7f82"; renderRect(0, 0, obj.scale * 2, obj.scale * 2, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.fillStyle = "#71aad6"; renderCircle(0, 0, obj.scale * 0.6, tmpContext); } else if (obj.name == "blocker") { tmpContext.fillStyle = "#7e7f82"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); tmpContext.rotate(Math.PI / 4); tmpContext.fillStyle = "#db6e6e"; renderRectCircle(0, 0, obj.scale * 0.65, 20, 4, tmpContext, true); } else if (obj.name == "windmill" || obj.name == "faster windmill" || obj.name == "power mill") { tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fillStyle = "#c9b758"; renderRectCircle(0, 0, obj.scale * 1.5, 29, 4, tmpContext); tmpContext.fillStyle = "#a5974c"; renderCircle(0, 0, obj.scale * 0.5, tmpContext); } else if (obj.name == "pit trap") { tmpContext.fillStyle = "#a5974c"; renderStar(tmpContext, 3, obj.scale * 1.1, obj.scale * 1.1); tmpContext.fill(); tmpContext.stroke(); if (player && obj.owner && player.sid != obj.owner.sid && !tmpObj.findAllianceBySid(obj.owner.sid)) { tmpContext.fillStyle = "#a34040"; } else { tmpContext.fillStyle = outlineColor; } renderStar(tmpContext, 3, obj.scale * 0.65, obj.scale * 0.65); tmpContext.fill(); } tmpContext.restore(); } function getMarkSprite(obj, tmpContext, tmpX, tmpY, xOffset, yOffset, outlineColor = "#ff5733") { tmpContext.lineWidth = outlineWidth; tmpContext.globalAlpha = 0.5; tmpContext.fillStyle = "#ff5733"; tmpContext.strokeStyle = outlineColor; tmpContext.save(); tmpContext.translate(tmpX, tmpY); tmpContext.rotate(obj.dir); if ( obj.name == "wood wall" || obj.name == "stone wall" || obj.name == "castle wall" || obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison spikes" || obj.name == "spinning spikes" || obj.name == "mine" || obj.name == "sapling" || obj.name == "pit trap" || obj.name == "boost pad" || obj.name == "turret" || obj.name == "platform" || obj.name == "healing pad" || obj.name == "spawn pad" || obj.name == "blocker" || obj.name == "teleporter" ) { tmpContext.beginPath(); tmpContext.arc(0, 0, obj.scale, 0, 2 * Math.PI); tmpContext.fill(); tmpContext.stroke(); } else if ( obj.name == "windmill" || obj.name == "faster windmill" || obj.name == "power mill" ) { tmpContext.beginPath(); tmpContext.arc(0, 0, obj.scale * 1.1, 0, 2 * Math.PI); tmpContext.fill(); tmpContext.stroke(); } renderCircle(tmpObj.x - xOffset, tmpObj.y - yOffset, tmpObj.getScale(0.6, true), mainContext, false, true); tmpContext.restore(); } // OBJECT ON SCREEN: function isOnScreen(x, y, s) { return (x + s >= 0 && x - s <= maxScreenWidth && y + s >= 0 && (y, s, maxScreenHeight)); } function yen(context, x, y) { context.fillStyle = "rgba(0, 255, 255, 0.2)"; context.beginPath(); context.arc(x, y, 55, 0, Math.PI * 2); // Adjust the circle size context.fill(); context.closePath(); context.globalAlpha = 1; } function markObject(tmpObj, tmpX, tmpY) { yen(mainContext, tmpX, tmpY); } // RENDER GAME OBJECTS: function renderGameObjects(layer, xOffset, yOffset) { let tmpSprite; let tmpX; let tmpY; liztobj.forEach((tmp) => { tmpObj = tmp; if (tmpObj.active && liztobj.includes(tmp) && tmpObj.render) { tmpX = tmpObj.x + tmpObj.xWiggle - xOffset; tmpY = tmpObj.y + tmpObj.yWiggle - yOffset; if (layer == 0) { tmpObj.update(delta); } mainContext.globalAlpha = tmpObj.alpha; if (tmpObj.layer == layer && isOnScreen(tmpX, tmpY, tmpObj.scale + (tmpObj.blocker || 0))) { if (tmpObj.isItem) { if ((tmpObj.dmg || tmpObj.trap) && !tmpObj.isTeamObject(player)) { tmpSprite = getObjSprite(tmpObj); } else { tmpSprite = getItemSprite(tmpObj); } mainContext.save(); mainContext.translate(tmpX, tmpY); mainContext.rotate(tmpObj.dir); if (!tmpObj.active) { mainContext.scale(tmpObj.visScale / tmpObj.scale, tmpObj.visScale / tmpObj.scale); } mainContext.drawImage(tmpSprite, -(tmpSprite.width / 2), -(tmpSprite.height / 2)); if (tmpObj.blocker) { mainContext.strokeStyle = "#db6e6e"; mainContext.globalAlpha = 0.3; mainContext.lineWidth = 6; renderCircle(0, 0, tmpObj.blocker, mainContext, false, true); } mainContext.restore(); } else { CHv4Tree(tmpObj, tmpX, tmpY); tmpSprite = getResSprite(tmpObj); mainContext.drawImage(tmpSprite, tmpX - (tmpSprite.width / 2), tmpY - (tmpSprite.height / 2)); } } if (layer == 3 && !useWasd) { if (tmpObj.health < tmpObj.maxHealth && UTILS.getDist(tmpObj, player, 0, 2) <= 400) { // HEALTH HOLDER: mainContext.fillStyle = darkOutlineColor; mainContext.roundRect(tmpX - config.healthBarWidth / 2 - config.healthBarPad, tmpY - config.healthBarPad, config.healthBarWidth + config.healthBarPad * 2, 17, 8); mainContext.fill(); let pen = tmpObj.health / tmpObj.maxHealth; let clolor; if (pen > 0.7) { clolor = "#8ecc51"; } else if (pen > 0.45) { clolor = "#e6d15a"; } else { clolor = "#cc5151"; } // HEALTH BAR: mainContext.fillStyle = clolor; mainContext.roundRect(tmpX - config.healthBarWidth / 2, tmpY, config.healthBarWidth * pen, 17 - config.healthBarPad * 2, 7); mainContext.fill(); } } } }); // PLACE VISIBLE: if (layer == 0) { if (placeVisible.length) { placeVisible.forEach((places) => { tmpX = places.x - xOffset; tmpY = places.y - yOffset; markObject(places, tmpX, tmpY); }); } if (preIndi.length) { preIndi.forEach((places) => { tmpX = places.x - xOffset; tmpY = places.y - yOffset; preplaceIndi(places, tmpX, tmpY); }); } } } function preshit(obj, tmpContext, tmpX, tmpY) { tmpContext.lineWidth = outlineWidth; tmpContext.strokeStyle = outlineColor; tmpContext.save(); tmpContext.translate(tmpX, tmpY); tmpContext.globalAlpha = 0.3 if (obj.name == "spikes" || obj.name == "greater spikes" || obj.name == "poison spikes" || obj.name == "spinning spikes") { tmpContext.fillStyle = "#ff0000"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); } else if (obj.name == "pit trap") { tmpContext.fillStyle = "#00ffff"; renderCircle(0, 0, obj.scale, tmpContext); tmpContext.fill(); tmpContext.stroke(); } tmpContext.restore(); } function preplaceIndi(tmpObj, tmpX, tmpY) { preshit(tmpObj, mainContext, tmpX, tmpY); } function CHv4Tree(y, n, r, offsets) { let trees = getResSprite(y); let easeScale = 0.03; let lowestAlpha = 0.5; let fadeStartDistance = y.scale * 1.2; let circleFadeDistance = 230; let treeFadeDistance = 170; if (player && y.type === 0) { let distanceToPlayer = Math.sqrt((y.y - player.y2) ** 2 + (y.x - player.x2) ** 2); if (distanceToPlayer <= fadeStartDistance + treeFadeDistance + player.scale) { let alphaFactor = (distanceToPlayer / (fadeStartDistance + treeFadeDistance + player.scale)) ** 2; mainContext.globalAlpha = Math.max(lowestAlpha, alphaFactor); } else { mainContext.globalAlpha = 1; } mainContext.drawImage(trees, n - trees.width / 2, r - trees.height / 2); let circleAlpha = 1 - (distanceToPlayer - y.scale) / (circleFadeDistance + player.scale * 5); if (distanceToPlayer <= y.scale + circleFadeDistance + player.scale) { mainContext.beginPath(); mainContext.arc(n, r, y.scale * 0.6, 0, 2 * Math.PI); mainContext.fillStyle = `rgba(0, 0, 0, ${circleAlpha})`; mainContext.strokeStyle = "black"; mainContext.lineWidth = 5; mainContext.fill(); mainContext.stroke(); mainContext.closePath(); } } else { mainContext.globalAlpha = 1; mainContext.drawImage(trees, n - trees.width / 2, r - trees.height / 2); } } // RENDER MINIMAP: class MapPing { constructor(color, scale) { this.init = function(x, y) { this.scale = 0; this.x = x; this.y = y; this.active = true; }; this.update = function(ctxt, delta) { if (this.active) { this.scale += 0.05 * delta; if (this.scale >= scale) { this.active = false; } else { ctxt.globalAlpha = (1 - Math.max(0, this.scale / scale)); ctxt.beginPath(); ctxt.arc((this.x / config.mapScale) * mapDisplay.width, (this.y / config.mapScale) * mapDisplay.width, this.scale, 0, 2 * Math.PI); ctxt.stroke(); } } }; this.color = color; } } function pingMap(x, y) { tmpPing = mapPings.find(pings => !pings.active); if (!tmpPing) { tmpPing = new MapPing("#fff", config.mapPingScale); mapPings.push(tmpPing); } tmpPing.init(x, y); } function updateMapMarker() { mapMarker.x = player.x; mapMarker.y = player.y; } function renderMinimap(delta) { if (player && player.alive) { mapContext.clearRect(0, 0, mapDisplay.width, mapDisplay.height); // RENDER PINGS: mapContext.lineWidth = 4; for (let i = 0; i < mapPings.length; ++i) { tmpPing = mapPings[i]; mapContext.strokeStyle = tmpPing.color; tmpPing.update(mapContext, delta); } // RENDER BREAK TRACKS: mapContext.globalAlpha = 1; mapContext.fillStyle = "#ff0000"; if (breakTrackers.length) { mapContext.fillStyle = "#abcdef"; mapContext.font = "34px HammerSmith One"; mapContext.textBaseline = "middle"; mapContext.textAlign = "center"; for (let i = 0; i < breakTrackers.length;) { mapContext.fillText("!", (breakTrackers[i].x / config.mapScale) * mapDisplay.width, (breakTrackers[i].y / config.mapScale) * mapDisplay.height); i += 2; } } // RENDER PLAYERS: mapContext.globalAlpha = 1; mapContext.fillStyle = "#fff"; renderCircle((player.x / config.mapScale) * mapDisplay.width, (player.y / config.mapScale) * mapDisplay.height, 7, mapContext, true); mapContext.fillStyle = "rgba(255,255,255,0.35)"; if (player.team && minimapData) { for (let i = 0; i < minimapData.length;) { renderCircle((minimapData[i] / config.mapScale) * mapDisplay.width, (minimapData[i + 1] / config.mapScale) * mapDisplay.height, 7, mapContext, true); i += 2; } } // RENDER BOTS: if (bots.length) { bots.forEach((tmp) => { if (tmp.inGame) { mapContext.globalAlpha = 1; mapContext.strokeStyle = "#cc5151"; renderCircle((tmp.x2 / config.mapScale) * mapDisplay.width, (tmp.y2 / config.mapScale) * mapDisplay.height, 7, mapContext, false, true); } }); } // DEATH LOCATION: if (lastDeath) { mapContext.fillStyle = "#fc5553"; mapContext.font = "34px HammerSmith One"; mapContext.textBaseline = "middle"; mapContext.textAlign = "center"; mapContext.fillText("x", (lastDeath.x / config.mapScale) * mapDisplay.width, (lastDeath.y / config.mapScale) * mapDisplay.height); } // MAP MARKER: if (mapMarker) { mapContext.fillStyle = "#fff"; mapContext.font = "34px HammerSmith One"; mapContext.textBaseline = "middle"; mapContext.textAlign = "center"; mapContext.fillText("x", (mapMarker.x / config.mapScale) * mapDisplay.width, (mapMarker.y / config.mapScale) * mapDisplay.height); } } } // ICONS: let crossHairs = ["", ""]; let crossHairSprites = {}; let iconSprites = {}; let icons = ["crown", "skull"]; function loadIcons() { for (let i = 0; i < icons.length; ++i) { let tmpSprite = new Image(); tmpSprite.onload = function() { this.isLoaded = true; }; tmpSprite.src = "./../img/icons/" + icons[i] + ".png"; iconSprites[icons[i]] = tmpSprite; } for (let i = 0; i < crossHairs.length; ++i) { let tmpSprite = new Image(); tmpSprite.onload = function() { this.isLoaded = true; }; tmpSprite.src = crossHairs[i]; crossHairSprites[i] = tmpSprite; } } loadIcons(); function cdf (e, t){ try { return Math.hypot((t.y2||t.y)-(e.y2||e.y), (t.x2||t.x)-(e.x2||e.x)); } catch(e){ return Infinity; } } function preplacer() { if (!gameObjects.length || !inGame || !enemy.length || !player) return; var Pot = function(obj, user) { let weaponIndex = user.weapons[1] === 10 && !player.reloads[user.weapons[1]] ? 1 : 0; let weapon = user.weapons[weaponIndex]; if (player.reloads[weapon]) return 0; let itemWeapon = items.weapons[weapon]; let isNear = UTILS.getDist(obj.x, obj.y, user.x2, user.y2) <= obj.scale + itemWeapon.range; return user.visible && isNear ? itemWeapon.dmg * (itemWeapon.sDmg || 1) * 3.3 : 0; }; let lowObjHealth = []; for (let i = 0; i < gameObjects.length; i++) { let obj = gameObjects[i]; if (obj.active && obj.health > 0 && UTILS.getDist(obj, player, 0, 2) <= player.scale + obj.scale * 2) { let dmg = Pot(obj, player); //players.reduce((t, p) => t + Pot(obj, p), 0); if (obj.health <= dmg) { lowObjHealth.push(obj); } } } lowObjHealth.sort((a, b) => a.health - b.health); let objectss = lowObjHealth.slice(0, Math.min(2, lowObjHealth.length)); if (objectss.length == 0) return; for (let obj of objectss) { let angles = Math.atan2(obj.y - player.y2, obj.x - player.x2); let enemyTrapped = gameObjects.filter((tmp) => tmp.trap && tmp.active && tmp.isTeamObject(player) && UTILS.getDist(tmp, obj, 0, 2) <= obj.scale + tmp.getScale() + 15).sort((a, b) => UTILS.getDist(a, obj, 0, 2) - UTILS.getDist(b, obj, 0, 2))[0]; if (near.dist2 < 600 && player.items[4] == 15) { if ([4, 5].includes(player.weaponIndex) && near.dist2 <= items.weapons[player.primaryIndex || 5].range + (player.scale * 1.8)) { cplace(2, angles, 1); } else { if (traps.inTrap && near.dist2 < 600 || my.autoPush) { cplace(4, angles); } if (enemyTrapped || enemyTrapped == obj) { cplace(2, near.aim2); } } } } } let postTickTime = 0; let frameTickRate = 1000 / 165; let timeBetweenTicks = 1000 / 9; function somePreStuff() { let currentTime = Date.now(); let newTime = currentTime - postTickTime; if (newTime + frameTickRate >= timeBetweenTicks) { postTickTime = currentTime; preplacer(); } } // UPDATE GAME: function updateGame() { if(gameObjects.length && inGame) { gameObjects.forEach((tmp) => { if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) <= 1200) { if(!liztobj.includes(tmp)) { liztobj.push(tmp); tmp.render = true; } } else { if(liztobj.includes(tmp)) { if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) >= 1200) { tmp.render = false; const index = liztobj.indexOf(tmp); if (index > -1) { // only splice array when item is found liztobj.splice(index, 1); // 2nd parameter means remove one item only } } } else if(UTILS.getDistance(tmp.x, tmp.y, player.x, player.y) >= 1200) { tmp.render = false; const index = liztobj.indexOf(tmp); if (index > -1) { // only splice array when item is found liztobj.splice(index, 1); // 2nd parameter means remove one item only } } else { tmp.render = false; const index = liztobj.indexOf(tmp); if (index > -1) { // only splice array when item is found liztobj.splice(index, 1); // 2nd parameter means remove one item only } } } }) // gameObjects = gameObjects.filter(e => UTILS.getDistance(e.x, e.y, player.x, player.y) <= 1000) } // if (config.resetRender) { mainContext.beginPath(); mainContext.clearRect(0, 0, gameCanvas.width, gameCanvas.height); // } mainContext.globalAlpha = 1; // MOVE CAMERA: if (player) { if (false) { camX = player.x; camY = player.y; } else { let tmpDist = UTILS.getDistance(camX, camY, player.x, player.y); let tmpDir = UTILS.getDirection(player.x, player.y, camX, camY); let camSpd = Math.min(tmpDist * 0.01 * delta, tmpDist); if (tmpDist > 0.05) { camX += camSpd * Math.cos(tmpDir); camY += camSpd * Math.sin(tmpDir); } else { camX = player.x; camY = player.y; } } } else { camX = config.mapScale / 2 + config.riverWidth; camY = config.mapScale / 2; } // PATHFINDER LINE if (pathFind.active) { if (pathFind.array && (pathFind.chaseNear ? enemy.length : true)) { mainContext.lineWidth = player.scale / 5; mainContext.globalAlpha = 1; mainContext.strokeStyle = "red"; mainContext.beginPath(); pathFind.array.forEach((path, i) => { let pathXY = { x: (pathFind.scale / pathFind.grid) * path.x, y: (pathFind.scale / pathFind.grid) * path.y } let render = { x: ((player.x2 - (pathFind.scale / 2)) + pathXY.x) - xOffset, y: ((player.y2 - (pathFind.scale / 2)) + pathXY.y) - yOffset } if (i == 0) { mainContext.moveTo(render.x, render.y); } else { mainContext.lineTo(render.x, render.y); } }); mainContext.stroke(); } } // INTERPOLATE PLAYERS AND AI: let lastTime = now - (1000 / config.serverUpdateRate); let tmpDiff; for (let i = 0; i < players.length + ais.length; ++i) { tmpObj = players[i] || ais[i - players.length]; if (tmpObj && tmpObj.visible) { if (tmpObj.forcePos) { tmpObj.x = tmpObj.x2; tmpObj.y = tmpObj.y2; tmpObj.dir = tmpObj.d2; } else { let total = tmpObj.t2 - tmpObj.t1; let fraction = lastTime - tmpObj.t1; let ratio = (fraction / total); let rate = 170; tmpObj.dt += delta; let tmpRate = Math.min(1.7, tmpObj.dt / rate); tmpDiff = (tmpObj.x2 - tmpObj.x1); tmpObj.x = tmpObj.x1 + (tmpDiff * tmpRate); tmpDiff = (tmpObj.y2 - tmpObj.y1); tmpObj.y = tmpObj.y1 + (tmpDiff * tmpRate); if (config.anotherVisual) { tmpObj.dir = Math.lerpAngle(tmpObj.d2, tmpObj.d1, Math.min(1.2, ratio)); } else { tmpObj.dir = Math.lerpAngle(tmpObj.d2, tmpObj.d1, Math.min(1.2, ratio)); } } } somePreStuff(); } // RENDER CORDS: let xOffset = camX - (maxScreenWidth / 2); let yOffset = camY - (maxScreenHeight / 2); // RENDER BACKGROUND: if (config.snowBiomeTop - yOffset <= 0 && config.mapScale - config.snowBiomeTop - yOffset >= maxScreenHeight) { mainContext.fillStyle = "#b6db66"; mainContext.fillRect(0, 0, maxScreenWidth, maxScreenHeight); } else if (config.mapScale - config.snowBiomeTop - yOffset <= 0) { mainContext.fillStyle = "#dbc666"; mainContext.fillRect(0, 0, maxScreenWidth, maxScreenHeight); } else if (config.snowBiomeTop - yOffset >= maxScreenHeight) { mainContext.fillStyle = "#fff"; mainContext.fillRect(0, 0, maxScreenWidth, maxScreenHeight); } else if (config.snowBiomeTop - yOffset >= 0) { mainContext.fillStyle = "#fff"; mainContext.fillRect(0, 0, maxScreenWidth, config.snowBiomeTop - yOffset); mainContext.fillStyle = "#b6db66"; mainContext.fillRect(0, config.snowBiomeTop - yOffset, maxScreenWidth, maxScreenHeight - (config.snowBiomeTop - yOffset)); } else { mainContext.fillStyle = "#b6db66"; mainContext.fillRect(0, 0, maxScreenWidth, (config.mapScale - config.snowBiomeTop - yOffset)); mainContext.fillStyle = "#dbc666"; mainContext.fillRect(0, (config.mapScale - config.snowBiomeTop - yOffset), maxScreenWidth, maxScreenHeight - (config.mapScale - config.snowBiomeTop - yOffset)); } // RENDER WATER AREAS: if (!firstSetup) { waterMult += waterPlus * config.waveSpeed * delta; if (waterMult >= config.waveMax) { waterMult = config.waveMax; waterPlus = -1; } else if (waterMult <= 1) { waterMult = waterPlus = 1; } mainContext.globalAlpha = 1; mainContext.fillStyle = "#dbc666"; renderWaterBodies(xOffset, yOffset, mainContext, config.riverPadding); mainContext.fillStyle = "#91b2db"; renderWaterBodies(xOffset, yOffset, mainContext, (waterMult - 1) * 250); } mainContext.globalAlpha = 1; mainContext.strokeStyle = outlineColor;renderDeadPlayers(xOffset, yOffset);mainContext.globalAlpha = 1;mainContext.strokeStyle = outlineColor;renderGameObjects(-1, xOffset, yOffset);mainContext.globalAlpha = 1;mainContext.lineWidth = outlineWidth;renderProjectiles(0, xOffset, yOffset);renderPlayers(xOffset, yOffset, 0); // RENDER AI: mainContext.globalAlpha = 1; for (let i = 0; i < ais.length; ++i) { tmpObj = ais[i]; if (tmpObj.active && tmpObj.visible) { tmpObj.animate(delta); mainContext.save(); mainContext.translate(tmpObj.x - xOffset, tmpObj.y - yOffset); mainContext.rotate(tmpObj.dir + tmpObj.dirPlus - (Math.PI / 2)); renderAI(tmpObj, mainContext); mainContext.restore(); } } // RENDER GAME OBJECTS (LAYERED): renderGameObjects(0, xOffset, yOffset); renderProjectiles(1, xOffset, yOffset); renderGameObjects(1, xOffset, yOffset); renderPlayers(xOffset, yOffset, 1); renderGameObjects(2, xOffset, yOffset); renderGameObjects(3, xOffset, yOffset); // MAP BOUNDARIES: mainContext.fillStyle = "#000"; mainContext.globalAlpha = 0.09; if (xOffset <= 0) { mainContext.fillRect(0, 0, -xOffset, maxScreenHeight); } if (config.mapScale - xOffset <= maxScreenWidth) { let tmpY = Math.max(0, -yOffset); mainContext.fillRect(config.mapScale - xOffset, tmpY, maxScreenWidth - (config.mapScale - xOffset), maxScreenHeight - tmpY); } if (yOffset <= 0) { mainContext.fillRect(-xOffset, 0, maxScreenWidth + xOffset, -yOffset); } if (config.mapScale - yOffset <= maxScreenHeight) { let tmpX = Math.max(0, -xOffset); let tmpMin = 0; if (config.mapScale - xOffset <= maxScreenWidth) tmpMin = maxScreenWidth - (config.mapScale - xOffset); mainContext.fillRect(tmpX, config.mapScale - yOffset, (maxScreenWidth - tmpX) - tmpMin, maxScreenHeight - (config.mapScale - yOffset)); } // RENDER DAY/NIGHT TIME: mainContext.globalAlpha = 1; mainContext.fillStyle = `rgba(0, 0, 70, ${scriptMenu.toggles["darkMode"] ? .55 : 0.35})`; mainContext.fillRect(0, 0, maxScreenWidth, maxScreenHeight); // RENDER PLAYER AND AI UI: mainContext.strokeStyle = darkOutlineColor; mainContext.globalAlpha = 1; mainContext.beginPath(); for (let i = 0; i < players.length + ais.length; ++i) { tmpObj = players[i] || ais[i - players.length]; if (tmpObj.visible) { mainContext.strokeStyle = darkOutlineColor; let tmpText = (tmpObj.team ? "[" + tmpObj.team + "] " : "") + (tmpObj.name || ""); if (!scriptMenu.toggles["renderNames"]) tmpText = ""; if (tmpText != "") { mainContext.globalAlpha = 1; mainContext.font = (tmpObj.nameScale || 30) + "px Hammersmith One"; mainContext.fillStyle = "#fff"; mainContext.textBaseline = "middle"; mainContext.textAlign = "center"; mainContext.lineWidth = (tmpObj.nameScale ? 11 : 8); mainContext.lineJoin = "round"; mainContext.strokeText(tmpText, tmpObj.x - xOffset, (tmpObj.y - yOffset - tmpObj.scale) - config.nameY); mainContext.fillText(tmpText, tmpObj.x - xOffset, (tmpObj.y - yOffset - tmpObj.scale) - config.nameY); if (tmpObj.isLeader && iconSprites["crown"].isLoaded) { let tmpS = config.crownIconScale; let tmpX = tmpObj.x - xOffset - (tmpS / 2) - (mainContext.measureText(tmpText).width / 2) - config.crownPad; mainContext.drawImage(iconSprites["crown"], tmpX, (tmpObj.y - yOffset - tmpObj.scale) - config.nameY - (tmpS / 2) - 5, tmpS, tmpS); } if (tmpObj.iconIndex == 1 && iconSprites["skull"].isLoaded) { let tmpS = config.crownIconScale; let tmpX = tmpObj.x - xOffset - (tmpS / 2) + (mainContext.measureText(tmpText).width / 2) + config.crownPad; mainContext.drawImage(iconSprites["skull"], tmpX, (tmpObj.y - yOffset - tmpObj.scale) - config.nameY - (tmpS / 2) - 5, tmpS, tmpS); } if (tmpObj.isPlayer && instaC.wait && near == tmpObj && (tmpObj.backupNobull ? crossHairSprites[1].isLoaded : crossHairSprites[0].isLoaded) && enemy.length && !useWasd) { let tmpS = tmpObj.scale * 2.2; mainContext.drawImage((tmpObj.backupNobull ? crossHairSprites[1] : crossHairSprites[0]), tmpObj.x - xOffset - tmpS / 2, tmpObj.y - yOffset - tmpS / 2, tmpS, tmpS); } } if (tmpObj.health > 0) { if(tmpObj.name != "Trash Slave") { // HEALTH HOLDER: mainContext.fillStyle = darkOutlineColor; mainContext.roundRect(tmpObj.x - xOffset - config.healthBarWidth - config.healthBarPad, (tmpObj.y - yOffset + tmpObj.scale) + config.nameY, (config.healthBarWidth * 2) + (config.healthBarPad * 2), 17, 8); mainContext.fill(); // HEALTH BAR: mainContext.fillStyle = (tmpObj == player || (tmpObj.team && tmpObj.team == player.team)) ? "#8ecc51" : "#cc5151"; mainContext.roundRect(tmpObj.x - xOffset - config.healthBarWidth, (tmpObj.y - yOffset + tmpObj.scale) + config.nameY + config.healthBarPad, ((config.healthBarWidth * 2) * (tmpObj.health / tmpObj.maxHealth)), 17 - config.healthBarPad * 2, 7); mainContext.fill(); } if (tmpObj.isPlayer) { mainContext.globalAlpha = 1; if (tmpObj == player) { mainContext.textAlign = "center"; mainContext.fillStyle = "#fff"; mainContext.lineJoin = "round"; mainContext.font = "13px Hammersmith One"; mainContext.strokeStyle = darkOutlineColor; mainContext.lineWidth = 6; mainContext.strokeText(secPacket + " " + minPacket, tmpObj.x - xOffset, tmpObj.y - yOffset); mainContext.fillText(secPacket + " " + minPacket, tmpObj.x - xOffset, tmpObj.y - yOffset); } let targetReloads = { primary: (tmpObj.primaryIndex == undefined ? 1 : ((items.weapons[tmpObj.primaryIndex].speed - tmpObj.reloads[tmpObj.primaryIndex]) / items.weapons[tmpObj.primaryIndex].speed)), secondary: (tmpObj.secondaryIndex == undefined ? 1 : ((items.weapons[tmpObj.secondaryIndex].speed - tmpObj.reloads[tmpObj.secondaryIndex]) / items.weapons[tmpObj.secondaryIndex].speed)), turret: (2500 - tmpObj.reloads[53]) / 2500 }; if (!tmpObj.currentReloads) { tmpObj.currentReloads = { // Initialize currentReloads if not already set primary: targetReloads.primary, secondary: targetReloads.secondary, turret: targetReloads.turret }; } const lerpFactor = 0.3; tmpObj.currentReloads.primary = (1 - lerpFactor) * tmpObj.currentReloads.primary + lerpFactor * targetReloads.primary; tmpObj.currentReloads.secondary = (1 - lerpFactor) * tmpObj.currentReloads.secondary + lerpFactor * targetReloads.secondary; tmpObj.currentReloads.turret = (1 - lerpFactor) * tmpObj.currentReloads.turret + lerpFactor * targetReloads.turret; if (tmpObj.currentReloads.secondary < .999) { let index = tmpObj.currentReloads.secondary; mainContext.fillStyle = darkOutlineColor; mainContext.roundRect(tmpObj.x - xOffset + 2 - config.healthBarPad, tmpObj.y - yOffset + tmpObj.scale + config.nameY - 13, 2 * 23.5 + 2 * config.healthBarPad, 17, 10); mainContext.fill(); mainContext.fillStyle = "#a5974c"; mainContext.roundRect(tmpObj.x - xOffset + 2, tmpObj.y - yOffset + tmpObj.scale + config.nameY - 13 + config.healthBarPad, 2 * 23.5 * (index), 16 - 2 * config.healthBarPad, 10); mainContext.fill(); } if (tmpObj.currentReloads.primary < .999) { let index = tmpObj.currentReloads.primary; mainContext.fillStyle = darkOutlineColor; mainContext.roundRect(tmpObj.x - xOffset - 50 - config.healthBarPad, tmpObj.y - yOffset + tmpObj.scale + config.nameY - 13, 2 * 23.5 + 2 * config.healthBarPad, 17, 10); mainContext.fill(); mainContext.fillStyle = "#a5974c"; mainContext.roundRect(tmpObj.x - xOffset - 50, tmpObj.y - yOffset + tmpObj.scale + config.nameY - 13 + config.healthBarPad, 2 * 23.5 * (index), 16 - 2 * config.healthBarPad, 10); mainContext.fill(); } // SHAME COUNT: if (tmpObj.isPlayer) { let shameX = tmpObj.x - xOffset + mainContext.measureText(tmpText).width / 2 + config.crownPad; let shameY = tmpObj.y - yOffset - tmpObj.scale - config.nameY; if (tmpObj.iconIndex == 1) { shameX = tmpObj.x - xOffset - 30 + mainContext.measureText(tmpText).width / 2 + config.crownPad * 3.5 + 5; } mainContext.font = (tmpObj.nameScale || 30) + "px Hammersmith One"; mainContext.fillStyle = "#ff0000"; mainContext.textBaseline = "middle"; // lalalalal mainContext.textAlign = "center"; mainContext.lineWidth = tmpObj.nameScale ? 11 : 8; mainContext.lineJoin = "round"; mainContext.strokeText(tmpObj.shameCount, shameX, shameY); mainContext.fillText(tmpObj.shameCount, shameX, shameY); } if (tmpObj == player) { mainContext.textAlign = "center"; mainContext.fillStyle = "#fff"; mainContext.lineJoin = "round"; mainContext.font = "20px Hammersmith One"; mainContext.strokeStyle = darkOutlineColor; mainContext.lineWidth = 6; mainContext.strokeText(instaC.wait, tmpObj.x - xOffset, tmpObj.y - yOffset + tmpObj.scale + config.nameY + 30); mainContext.fillText(instaC.wait, tmpObj.x - xOffset, tmpObj.y - yOffset + tmpObj.scale + config.nameY + 30); } // PLAYER TRACER: if (!tmpObj.isTeam(player)) { let center = { x: screenWidth / 2, y: screenHeight / 2, }; let alpha = Math.min(1, (UTILS.getDistance(0, 0, player.x - tmpObj.x, (player.y - tmpObj.y) * (16 / 9)) * 100) / (config.maxScreenHeight / 2) / center.y); let dist = center.y * alpha / 2; let tmpX = dist * Math.cos(UTILS.getDirect(tmpObj, player, 0, 0)); let tmpY = dist * Math.sin(UTILS.getDirect(tmpObj, player, 0, 0)); mainContext.save(); mainContext.translate((player.x - xOffset) + tmpX, (player.y - yOffset) + tmpY); mainContext.rotate(tmpObj.aim2 + Math.PI / 2); let by = 255 - (tmpObj.sid * 2); mainContext.fillStyle = `rgb(${by}, ${by}, ${by})`; mainContext.globalAlpha = alpha; let renderTracer = function(s, ctx) { ctx = ctx || mainContext; let h = s * (Math.sqrt(3) / 2); ctx.beginPath(); ctx.moveTo(0, -h / 1.5); ctx.lineTo(-s / 2, h / 2); ctx.lineTo(s / 2, h / 2); ctx.lineTo(0, -h / 1.5); ctx.fill(); ctx.closePath(); } renderTracer(25, mainContext); mainContext.restore(); } if (getEl("predictType").value == "pre2") { mainContext.lineWidth = 3; mainContext.strokeStyle = "#fff"; mainContext.globalAlpha = 1; mainContext.beginPath(); let render = { x: tmpObj.x2 - xOffset, y: tmpObj.y2 - yOffset }; mainContext.moveTo(tmpObj.x - xOffset, tmpObj.y - yOffset); mainContext.lineTo(render.x, render.y); mainContext.stroke(); } else if (getEl("predictType").value == "pre3") { mainContext.lineWidth = 3; mainContext.strokeStyle = "#cc5151"; mainContext.globalAlpha = 1; mainContext.beginPath(); let render = { x: tmpObj.x3 - xOffset, y: tmpObj.y3 - yOffset }; mainContext.moveTo(tmpObj.x - xOffset, tmpObj.y - yOffset); mainContext.lineTo(render.x, render.y); mainContext.stroke(); } } } } } if (player) { // AUTOPUSH LINE: if (my.autoPush && my.pushData) { mainContext.lineWidth = 5; mainContext.globalAlpha = 1; var x1 = player.x - xOffset; var y1 = player.y - yOffset; var x2 = my.pushData.x2 - xOffset; var y2 = my.pushData.y2 - yOffset; var x3 = my.pushData.x - xOffset; var y3 = my.pushData.y - yOffset; var distance = Math.hypot(x2 - x1, y2 - y1); if (distance > 150) { var ratio = 150 / distance; x2 = x1 + (x2 - x1) * ratio; y2 = y1 + (y2 - y1) * ratio; } mainContext.beginPath(); mainContext.strokeStyle = "cyan"; for (let i = 0; i <= 10; i++) { let t = i / 10; let segmentX = x1 + (x2 - x1) * t; let segmentY = y1 + (y2 - y1) * t; if (i === 0) { mainContext.moveTo(segmentX, segmentY); } else { mainContext.lineTo(segmentX, segmentY); } } mainContext.stroke(); mainContext.beginPath(); mainContext.strokeStyle = "white"; var midX = (x2 + x3) / 2; var midY = (y2 + y3) / 2; mainContext.moveTo(x2, y2); mainContext.quadraticCurveTo(midX, midY - 15, x3, y3); mainContext.stroke(); } } mainContext.globalAlpha = 1; // RENDER ANIM TEXTS: textManager.update(delta, mainContext, xOffset, yOffset); // RENDER CHAT MESSAGES: for (let i = 0; i < players.length; ++i) { tmpObj = players[i]; if (tmpObj.visible) { if (tmpObj.chatCountdown > 0) { tmpObj.chatCountdown -= delta; if (tmpObj.chatCountdown <= 0) tmpObj.chatCountdown = 0; mainContext.font = "32px HammerSmith One"; let tmpSize = mainContext.measureText(tmpObj.chatMessage); mainContext.textBaseline = "middle"; mainContext.textAlign = "center"; let tmpX = tmpObj.x - xOffset; let tmpY = tmpObj.y - tmpObj.scale - yOffset - 90; let tmpH = 47; let tmpW = tmpSize.width + 17; mainContext.fillStyle = "rgba(0,0,0,0.2)"; mainContext.roundRect(tmpX - tmpW / 2, tmpY - tmpH / 2, tmpW, tmpH, 6); mainContext.fill(); mainContext.fillStyle = "#fff"; mainContext.fillText(tmpObj.chatMessage, tmpX, tmpY); } if (tmpObj.chat.count > 0) { if (!useWasd) { tmpObj.chat.count -= delta; if (tmpObj.chat.count <= 0) tmpObj.chat.count = 0; mainContext.font = "32px HammerSmith One"; let tmpSize = mainContext.measureText(tmpObj.chat.message); mainContext.textBaseline = "middle"; mainContext.textAlign = "center"; let tmpX = tmpObj.x - xOffset; let tmpY = tmpObj.y - tmpObj.scale - yOffset + (90 * 2); let tmpH = 47; let tmpW = tmpSize.width + 17; mainContext.fillStyle = "rgba(0,0,0,0.2)"; mainContext.roundRect(tmpX - tmpW / 2, tmpY - tmpH / 2, tmpW, tmpH, 6); mainContext.fill(); mainContext.fillStyle = "#ffffff99"; mainContext.fillText(tmpObj.chat.message, tmpX, tmpY); } else { tmpObj.chat.count = 0; } } } } if (allChats.length) { const playerChatsMap = new Map(); // Organize chats by owner allChats.filter(ch => ch.active).forEach(ch => { if (!playerChatsMap.has(ch.owner)) { playerChatsMap.set(ch.owner, []); } playerChatsMap.get(ch.owner).push(ch); }); // Process each player's chats independently playerChatsMap.forEach((chats, owner) => { chats.forEach(ch => { if (!ch.alive) { if (ch.alpha <= 1) { ch.alpha += delta / 50; if (ch.alpha >= 1) { ch.alpha = 1; ch.alive = true; ch.visibleTimer = 2000; const activeChats = chats.filter(prevCh => prevCh.active && prevCh.alive); if (activeChats.length >= 4) { const oldestChat = activeChats.reduce((oldest, current) => (oldest.visibleTimer < current.visibleTimer ? oldest : current)); oldestChat.active = false; } ch.y = ch.owner.y - ch.owner.scale - yOffset - 90; activeChats.filter(prevCh => prevCh !== ch) .forEach((prevCh, index) => prevCh.y = ch.y - (index + 1) * 50); } } } else { if (ch.visibleTimer > 0) { ch.visibleTimer -= delta; } else { ch.alpha -= delta / 1000; if (ch.alpha <= 0) { ch.alpha = 0; ch.active = false; } } } if (ch.active) { ch.x = ch.owner.x - xOffset; ch.y = ch.owner.y - ch.owner.scale - yOffset - 90; const activeChats = chats.filter(prevCh => prevCh.active && prevCh.alive && prevCh !== ch); activeChats.forEach((prevCh, index) => prevCh.y = ch.y - (index + 1) * 50); } }); }); allChats.filter(ch => ch.active).forEach(ch => { mainContext.font = "32px Hammersmith One"; let tmpSize = mainContext.measureText(ch.chat); mainContext.textBaseline = "middle"; mainContext.textAlign = "center"; let tmpX = ch.x; let tmpY = ch.y; let tmpH = 47; let tmpW = tmpSize.width + 17; mainContext.globalAlpha = ch.alpha; mainContext.fillStyle = ch.owner.isTeam(player) ? "rgba(255,215,0,1)" : "#cc5151"; mainContext.strokeStyle = "rgb(25, 25, 25)"; mainContext.lineWidth = 5; mainContext.fillStyle = "rgba(0,0,0,0.2)"; mainContext.strokeStyle = "rgba(0,0,0,0.0)"; mainContext.roundRect(tmpX - tmpW / 2, tmpY - tmpH / 2, tmpW, tmpH, 6); mainContext.stroke(); mainContext.fill(); mainContext.fillStyle = "#fff"; mainContext.strokeStyle = ""; mainContext.strokeText(ch.chat, tmpX, tmpY); mainContext.fillText(ch.chat, tmpX, tmpY); }); } mainContext.globalAlpha = 1; // RENDER MINIMAP: renderMinimap(delta); } // UPDATE & ANIMATE: window.requestAnimFrame = function() { return null; } window.rAF = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000/9); }; })(); function doUpdate() { //rape modulus now = performance.now(); delta = now - lastUpdate; lastUpdate = now; let timer = performance.now(); let diff = timer - fpsTimer.last; if (diff >= 1000) { fpsTimer.ltime = fpsTimer.time * (1000 / diff); fpsTimer.last = timer; fpsTimer.time = 0; } fpsTimer.time++; updateGame(); rAF(doUpdate); ms.avg = Math.round((ms.min+ms.max)/2); } prepareMenuBackground(); doUpdate(); function toggleUseless(boolean) { getEl("instaType").disabled = boolean; getEl("antiBullType").disabled = boolean; getEl("predictType").disabled = boolean; } toggleUseless(useWasd); let changeDays = {}; window.debug = function() { my.waitHit = 0; my.autoAim = false; instaC.isTrue = false; traps.inTrap = false; itemSprites = []; objSprites = []; gameObjectSprites = []; }; window.wasdMode = function() { useWasd = !useWasd; toggleUseless(useWasd); }; window.startGrind = function() { if (getEl("weaponGrind").checked || scriptMenu.toggles["autoGrind"]) { for (let i = 0; i < Math.PI * 2; i += Math.PI / 2) { checkPlace(player.getItemType(22), i); } } }; // REMOVED!!! so they cant abuse :) let projects = [ "adorable-eight-guppy", "galvanized-bittersweet-windshield" ]; let botIDS = 0; window.connectFillBots = function() { botSkts = []; botIDS = 0; for (let i = 0; i < projects.length; i++) { let test = new WebSocket(`wss://${projects[i]}.glitch.me`); test.binaryType = "arraybuffer"; test.onopen = function() { test.ssend = function(type) { let data = Array.prototype.slice.call(arguments, 1); let binary = window.msgpack.encode([type, data]); test.send(binary); }; for (let i = 0; i < 4; i++) { window.grecaptcha.execute("6LfahtgjAAAAAF8SkpjyeYMcxMdxIaQeh-VoPATP", { action: "homepage" }).then(function(token) { let t = WS.url.split("wss://")[1].split("?")[0]; test.ssend("bots", "wss://" + t + "?token=re:" + encodeURIComponent(token), botIDS); botSkts.push([test]); botIDS++; }); } }; test.onmessage = function(message) { let data = new Uint8Array(message.data); let parsed = window.msgpack.decode(data); let type = parsed[0]; data = parsed[1]; }; } }; window.destroyFillBots = function() { botSkts.forEach((socket) => { socket[0].close(); }); botSkts = []; }; window.tryConnectBots = function() { for (let i = 0; i < (bots.length < 3 ? 3 : 4); i++) { window.grecaptcha.execute("6LfahtgjAAAAAF8SkpjyeYMcxMdxIaQeh-VoPATP", { action: "homepage" }).then(function(token) { // CONNECT SOCKET: botSpawn(token); }); } }; window.destroyBots = function() { bots.forEach((botyyyyy) => { botyyyyy.closeSocket = true; }); bots = []; }; window.resBuild = function() { if (gameObjects.length) { gameObjects.forEach((tmp) => { tmp.breakObj = false; }); breakObjects = []; } }; window.toggleBotsCircle = function() { player.circle = !player.circle; }; window.toggleVisual = function() { config.anotherVisual = !config.anotherVisual; gameObjects.forEach((tmp) => { if (tmp.active) { tmp.dir = tmp.lastDir; } }); }; window.prepareUI = function(tmpObj) { resize(); // CHAT STUFF: var chatBox = document.getElementById("chatBox"); var chatHolder = document.getElementById("chatHolder"); var suggestBox = document.createElement("div"); suggestBox.id = "suggestBox"; var prevChats = []; var prevChatsIndex = 0; function toggleChat() { if (!usingTouch) { if (chatHolder.style.display == "block") { if (chatBox.value) { sendChat(chatBox.value); } closeChat(); } else { storeMenu.style.display = "none"; allianceMenu.style.display = "none"; chatHolder.style.display = "block"; chatBox.focus(); resetMoveDir(); } } else { setTimeout(function () { var chatMessage = prompt("chat message"); if (chatMessage) { sendChat(chatMessage); } }, 1); } chatBox.value = ""; (() => { prevChatsIndex = 0; })(); } function closeChat() { chatBox.value = ""; chatHolder.style.display = "none"; } // ACTION BAR: UTILS.removeAllChildren(actionBar); for (let i = 0; i < (items.weapons.length + items.list.length); ++i) { (function (i) { UTILS.generateElement({ id: "actionBarItem" + i, class: "actionBarItem", style: "display:none; box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5)", onmouseout: function () { showItemInfo(); }, parent: actionBar }); })(i); } for (let i = 0; i < (items.list.length + items.weapons.length); ++i) { (function (i) { let tmpCanvas = document.createElement("canvas"); tmpCanvas.width = tmpCanvas.height = 66; let tmpContext = tmpCanvas.getContext("2d"); tmpContext.translate((tmpCanvas.width / 2), (tmpCanvas.height / 2)); tmpContext.imageSmoothingEnabled = false; tmpContext.webkitImageSmoothingEnabled = false; tmpContext.mozImageSmoothingEnabled = false; if (items.weapons[i]) { tmpContext.rotate((Math.PI)); let tmpSprite = new Image(); toolSprites[items.weapons[i].src] = tmpSprite; tmpSprite.onload = function () { this.isLoaded = true; let tmpPad = 1 / (this.height / this.width); let tmpMlt = (items.weapons[i].iPad || 1); tmpContext.drawImage(this, -(tmpCanvas.width * tmpMlt * config.iconPad * tmpPad) / 2, -(tmpCanvas.height * tmpMlt * config.iconPad) / 2, tmpCanvas.width * tmpMlt * tmpPad * config.iconPad, tmpCanvas.height * tmpMlt * config.iconPad); tmpContext.fillStyle = "rgba(0, 0, 70, 0.2)"; tmpContext.globalCompositeOperation = "source-atop"; tmpContext.fillRect(-tmpCanvas.width / 2, -tmpCanvas.height / 2, tmpCanvas.width, tmpCanvas.height); getEl('actionBarItem' + i).style.backgroundImage = "url(" + tmpCanvas.toDataURL() + ")"; }; tmpSprite.src = "./../img/weapons/" + items.weapons[i].src + ".png"; let tmpUnit = getEl('actionBarItem' + i); // tmpUnit.onmouseover = UTILS.checkTrusted(function () { // showItemInfo(items.weapons[i], true); // }); tmpUnit.onclick = UTILS.checkTrusted(function () { selectWeapon(tmpObj.weapons[items.weapons[i].type]); }); UTILS.hookTouchEvents(tmpUnit); } else { let tmpSprite = getItemSprite(items.list[i - items.weapons.length], true); let tmpScale = Math.min(tmpCanvas.width - config.iconPadding, tmpSprite.width); tmpContext.globalAlpha = 1; tmpContext.drawImage(tmpSprite, -tmpScale / 2, -tmpScale / 2, tmpScale, tmpScale); tmpContext.fillStyle = "rgba(0, 0, 70, 0.1)"; tmpContext.globalCompositeOperation = "source-atop"; tmpContext.fillRect(-tmpScale / 2, -tmpScale / 2, tmpScale, tmpScale); getEl('actionBarItem' + i).style.backgroundImage = "url(" + tmpCanvas.toDataURL() + ")"; let tmpUnit = getEl('actionBarItem' + i); // tmpUnit.onmouseover = UTILS.checkTrusted(function () { // showItemInfo(items.list[i - items.weapons.length]); // }); tmpUnit.onclick = UTILS.checkTrusted(function () { selectToBuild(tmpObj.items[tmpObj.getItemType(i - items.weapons.length)]); }); UTILS.hookTouchEvents(tmpUnit); } })(i); } }; window.profineTest = function(data) { if (data) { // VALIDATE NAME: let name = data + ""; name = name.slice(0, config.maxNameLength); return name; } } }(1)