// ==UserScript== // @name Base Saver // @namespace http://tampermonkey.net/ // @version 1.2 // @author Havy // @description Record Base // @match zombs.io // @grant none // @downloadURL none // ==/UserScript== let css2 = ` .hud-menu-zipp4 { display: none; position: fixed; top: 50%; left: 50%; width: 370px; height: 220px; margin: -200px 0 0 -182px; background: rgba(0, 0, 0, 0.6); color: #eee; z-index: 5; } .hud-spell-icons .hud-spell-icon[data-type="Zippity4"]::before { background-image: url("https://cdn-icons-png.flaticon.com/512/599/599063.png"); } .hud-menu-zipp4 .hud-the-tab:hover { background: rgba(0, 0, 0, 0.2); color: #eee; } `; let styles = document.createElement("style"); styles.appendChild(document.createTextNode(css2)); document.head.appendChild(styles); styles.type = "text/css"; let spell = document.createElement("div"); spell.classList.add("hud-spell-icon"); spell.setAttribute("data-type", "Zippity4"); spell.classList.add("hud-zipp4-icon"); document.getElementsByClassName("hud-spell-icons")[0].appendChild(spell); let modHTML = `
`; document.body.insertAdjacentHTML("afterbegin", modHTML); let zipz123 = document.getElementsByClassName("hud-menu-zipp4")[0]; document.getElementsByClassName("hud-zipp4-icon")[0].addEventListener("click", function () { if (zipz123.style.display == "none" || zipz123.style.display == "") { document.getElementById("hud-menu-shop") .style.display = "none"; document.getElementById("hud-menu-party") .style.display = "none"; document.getElementById("hud-menu-settings") .style.display = "none"; zipz123.style.display = "block"; } else { zipz123.style.display = "none"; }; }); let allIcon = [ document.getElementsByClassName("hud-menu-icon")[0], document.getElementsByClassName("hud-menu-icon")[1], document.getElementsByClassName("hud-menu-icon")[2], document.getElementsByClassName("hud-spell-icon")[0], document.getElementsByClassName("hud-spell-icon")[1] ]; allIcon.forEach(function (elem) { elem.addEventListener("click", function () { if (zipz123.style.display == "block") { zipz123.style.display = "none"; }; }); }); document.getElementsByClassName("hud-zipp-grid4")[0].innerHTML = `

`; function GetGoldStash() { for (let i in game.ui.buildings) { if (game.ui.buildings[i].type == "GoldStash") { return game.ui.buildings[i]; } } } window.PlaceBuilding = function(x, y, building, yaw) { Game.currentGame.network.sendRpc({ name: "MakeBuilding", x: x, y: y, type: building, yaw: yaw }) } //Base 1 window.RecordBase = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase1 = base }) } window.buildRecordedBase = function() { let waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase1 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase1 = null; }) } //Base 2 window.RecordBase2 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase2 = base }) } window.buildRecordedBase2 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase2 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase2 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase2 = null; }) } //Base 3 window.RecordBase3 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase3 = base }) } window.buildRecordedBase3 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase3 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase3 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase3 = null; }) } //Base 4 window.RecordBase4 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase4 = base }) } window.buildRecordedBase4 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase4 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase4 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase4 = null; }) } //Base 5 window.RecordBase5 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase5 = base }) } window.buildRecordedBase5 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase5 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase5 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase5 = null; }) } //Base 6 window.RecordBase6 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase6 = base }) } window.buildRecordedBase6 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase6 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase6 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase6 = null; }) } //Base 7 window.RecordBase7 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase7 = base }) } window.buildRecordedBase7 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase7 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase7 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase7 = null; }) } //Base 8 window.RecordBase8 = function(baseName) { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded!"); let buildings = Game.currentGame.ui.buildings; let base = ""; let stash = GetGoldStash(); if (stash == undefined) { return } let stashPosition = { x: stash.x, y: stash.y } for (var uid in buildings) { if (!buildings.hasOwnProperty(uid)) { continue } let obj = buildings[uid] let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y let building = Game.currentGame.ui.buildings[obj.uid].type let yaw = 180; base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");" } localStorage.RecordedBase8 = base }) } window.buildRecordedBase8 = function() { var waitForGoldStash = setInterval(function() { if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") { stash = GetGoldStash(); if (stash == undefined) return stashPosition = { x: stash.x, y: stash.y } clearInterval(waitForGoldStash) game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!"); var basecode = localStorage.RecordedBase8 basecode = new Function(basecode) return basecode() } }, 275) } window.DeleteRecordedbase8 = function() { Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() { game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!"); localStorage.RecordedBase8 = null; }) }