Greasy Fork is available in English.

Ultra Menu✨

Actualizado :D

Autor
AleSml 2312
Dziennych instalacji
9
Wszystkich instalacji
1 182
Oceny
1 0 0
Wersja
Utworzono
22-06-2020
Zaktualizowano
22-06-2020
Licencja
Brak licencji
Dotyczy
// ==UserScript==
// @name Ultra Menu✨
// @namespace http://tampermonkey.net/
// @version
// @description
// @author Alejandro
// @match zombs.io
// @grant none
// ==/UserScript==

(function() {
let styles = document.createTextNode(`

.hud-menu-scripts {
display: none;
position: fixed;
top: 50%;
left: 48%;
width: 800px;
height: 590px;
margin: -300px 0 0 -320px;
padding: 20px 340px 20px 20px;
background: rgba(0, 0, 0, 0.6);
color: #eee;
border-radius: 4px;
z-index: 15;
}
.hud-menu-icons .hud-menu-icon[data-type=Scripts]::before {
background-image: url('https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/160/facebook/230/white-medium-star_2b50.png');
`);

let css = document.createElement("style");
css.type = "text/css";
css.appendChild(styles);
document.body.appendChild(css);
let menu_html = "

Ultra Menu

"
document.body.insertAdjacentHTML("afterbegin", menu_html);
let menu_scripts = document.getElementsByClassName('hud-menu-scripts')[0];
var allItems = document.getElementsByClassName("myCustomIcon");
var menus = document.getElementsByClassName("hud-menu");

var newMenuItem = document.createElement("div");
newMenuItem.classList.add("hud-menu-icon");
newMenuItem.classList.add("myCustomIcon");
newMenuItem.setAttribute("data-type", "Scripts");
newMenuItem.innerHTML = "Scripts";
document.getElementById("hud-menu-icons").appendChild(newMenuItem);

var AllItems = document.getElementsByClassName("myCustomIcon");
for(var item = 0; item < allItems.length; item++) {
allItems[item].addEventListener("mouseenter", onMenuItemEnter, false);
allItems[item].addEventListener("mouseleave", onMenuItemLeave, false);
}

function onMenuItemEnter() {
var theTooltip = document.createElement("div");
theTooltip.classList.add("hud-tooltip");
theTooltip.classList.add("hud-tooltip-left");
theTooltip.id = "hud-tooltip";
theTooltip.innerHTML = `

Ultra Menu

`;

this.appendChild(theTooltip)

theTooltip.style.top = "-10px";
theTooltip.style.bottom = 0
theTooltip.style.left = "-96.4px";
theTooltip.style.right = 0;
theTooltip.style.width = "78.5px";
theTooltip.style.fontSize = "16.7px";
theTooltip.style.fontWeight = "bold";
theTooltip.style.position = "relative";
theTooltip.style.textIndent = 0;
}

function onMenuItemLeave() {
this.removeChild(document.getElementById("hud-tooltip"));
}

document.getElementsByClassName('hud-menu-icon')[3].addEventListener("click", function(e) {
if(menu_scripts.style.display == "none") {
menu_scripts.style.display = "block";
for(var i = 0; i < menus.length; i++) {
menus[i].style.display = "none";
}
} else {
menu_scripts.style.display = "none";
}
});
let icons = document.getElementsByClassName("hud-menu-icon");
let menu_icons = [
icons[0],
icons[1],
icons[2]
]
menu_icons.forEach(function(elem) {
elem.addEventListener("click", function(e) {
if(menu_scripts.style.display == "block") {
menu_scripts.style.display = "none";
}
})
})
window.addEventListener('mouseup', function(event) {
if(event.target !== menu_scripts && event.target.parentNode !== menu_scripts) {
menu_scripts.style.display = 'none';
}
})
})();

window.UpgradeWalls = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "Wall") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeDoors = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "Door") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeSlowTraps = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "SlowTrap") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeArrows = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "ArrowTower") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeCannons = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "CannonTower") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeBombs = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "BombTower") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeMages = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "MagicTower") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeMelees = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "MeleeTower") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeGoldMines = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "GoldMine") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.UpgradeHarvesters = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "Harvester") {
Game.currentGame.network.sendRpc({
name: "UpgradeBuilding",
uid: obj.fromTick.uid
})
}
}
}


window.SellWalls = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "Wall") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellDoors = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "Door") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellSlowTraps = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "SlowTrap") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellArrows = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "ArrowTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellCannons = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "CannonTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellBombs = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "BombTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellMages = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "MagicTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellMelees = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "MeleeTower") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellGoldMines = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "GoldMine") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}
window.SellHarvesters = function() {
var entities = Game.currentGame.world.entities;
for (var uid in entities) {
if (!entities.hasOwnProperty(uid)) continue;

var obj = entities[uid];
if (obj.fromTick.model == "Harvester") {
Game.currentGame.network.sendRpc({
name: "DeleteBuilding",
uid: obj.fromTick.uid
})
}
}
}

var scr = '';
scr += "

Upgrade✨

";
scr += 'Upgrade Walls';
scr += 'Upgrade Doors';
scr += 'UpgradeSlowTraps';
scr += 'Upgrade Arrows';
scr += 'Upgrade Cannons';
scr += 'Upgrade Melees';
scr += 'Upgrade Bombs';
scr += 'Upgrade Mages';
scr += 'UpgradeGoldMines';
scr += 'Upgrade Harvesters';
scr += "

Sell✨

";
scr += 'Sell Walls';
scr += 'Sell Doors';
scr += 'Sell Slow Traps';
scr += 'Sell Arrows';
scr += 'Sell Cannons';
scr += 'Sell Melees';
scr += 'Sell Bombs';
scr += 'Sell Mages';
scr += 'Sell Gold Mines';
scr += 'Sell Harvesters';
scr += "

Created By: Ale

";
document.getElementsByClassName("hud-menu-scripts")[0].innerHTML = scr