// ==UserScript== // @name Gladiatus Tools // @namespace https://greasyfork.org/users/904482 // @version 0.0.3 // @description Set of tools and aids for the game Gladiatus // @author lpachecob // @grant none // @match *.gladiatus.gameforge.com/game/index.php* // @icon https://lobby.gladiatus.gameforge.com/favicon.ico // @license MIT // @downloadURL none // ==/UserScript== if ( window.location.search.split("&")[0] == "?mod=guildMarket" && window.location.search.split("&")[1] != "submod=control" ) { MarketHelps(); } else if ( window.location.search.split("&")[0] == "?mod=guildMarket" && window.location.search.split("&")[1] == "submod=control" ) { //comming soon } else if (window.location.search.split("&")[0] == "?mod=auction") { AcutionHouseTools(); } else if ( window.location.search.split("&")[0] == "?mod=forge" && window.location.search.split("&")[1] == "submod=smeltery" ) { SmelteryTimeSaverExtension(); } /** * Adds quick sale buttons to the alliance marketplace */ function MarketHelps() { /* Getting the element with the id "sellForm" from the page. */ let panelVenta = document.getElementById("sellForm"); /* Getting the element with the id "preis" from the page. */ let inputPrecio = document.getElementById("preis"); let inputDuracion = document.getElementById("dauer"); /* Getting the element with the name "anbieten" from the page. */ let botonVender = document.getElementsByName("anbieten")[0]; /* Getting the element with the id "market_inventory" from the page. */ let marketInventory = document.getElementById("market_inventory"); /* Getting the element with the id "sstat_gold_val" from the page and getting the text content of the element. Then it is converting the text content to a number. */ let oro = parseFloat(document.getElementById("sstat_gold_val").textContent); let cajaVenta = document.getElementsByClassName("ui-droppable")[0]; /* Adding HTML to the page. */ panelVenta.insertAdjacentHTML( "beforebegin", `
Coloca un item y elige el precio para vender.
` ); ventaRapidaMenu.insertAdjacentHTML( "beforeend", ` ` ); ventaRapidaMenu.insertAdjacentHTML( "beforeend", ` ` ); ventaRapidaMenu.insertAdjacentHTML( "beforeend", ` ` ); ventaRapidaMenu.insertAdjacentHTML( "beforeend", ` ` ); ventaRapidaMenu.insertAdjacentHTML( "beforeend", ` ` ); ventaRapidaMenu.insertAdjacentHTML( "beforeend", `Elegir duración
Puedes comprar los siguientes rotativos
" ); calcularRotativos.insertAdjacentHTML( "beforeend", `50k: " + Math.floor(oro / 50.0) + "
"; col1.insertAdjacentHTML("beforeend", text50k); /* Creating a variable called text100k and setting it to a string. Then it is inserting the string into the element with the id "col1". */ let text100k = "100k: " + Math.floor(oro / 100.0) + "
"; col1.insertAdjacentHTML("beforeend", text100k); /* Creating a variable called text200k and setting it to a string. Then it is inserting the string into the element with the id "col1". */ let text200k = "200k: " + Math.floor(oro / 200.0) + "
"; col1.insertAdjacentHTML("beforeend", text200k); /* Creating a variable called text500k and setting it to a string. Then it is inserting the string into the element with the id "col2". */ let text500k = "500k: " + Math.floor(oro / 500.0) + "
"; col2.insertAdjacentHTML("beforeend", text500k); /* Creating a variable called text1kk and setting it to a string. Then it is inserting the string into the element with the id "col2". */ let text1kk = "1kk: " + Math.floor(oro / 1000.0) + "
"; col2.insertAdjacentHTML("beforeend", text1kk); /* Adding an event listener to the element with the id "CalcularRotativosTitle". When the user clicks on the element, the function will be executed. The function will check if the element with the id "CalcularRotativos" is visible or not. If it is visible, it will hide it. If it is hidden, it will show it. */ let calcularRotativosTitle = document.getElementById( "CalcularRotativosTitle" ); calcularRotativosTitle.addEventListener("click", () => { if (calcularRotativos.style.display == "none") { calcularRotativos.style.display = "block"; } else { calcularRotativos.style.display = "none"; } }); document.addEventListener("mouseup", () => { if (cajaVenta.children.length > 0) { add50k.disabled = false; add100k.disabled = false; add200k.disabled = false; add500k.disabled = false; add1kk.disabled = false; } }); //Auto Compra/Venta // hace doble click a un objeto de los paquetes, 3 children indica el contenedor del item // document.getElementById("packages_wrapper").children[0].children[1].children[2].children[0].dispatchEvent(new MouseEvent("dblclick")) // function Find(textContent) { // let elements = document.getElementById("market_table").children[0].children[0].children; // let elementsArray = [].slice.call(elements); // for (let index = 0; index < elementsArray.length; index++) { // let element = elementsArray[index]; // if (element.tagName === "TR" && // element.children[0].tagName === "TD") { // console.log(element) // } // } // } } /** * It adds a button to the auction house that buys all the food you can afford */ function AcutionHouseTools() { let items = document.getElementsByClassName("auction_bid_div"); let oro = parseFloat(document.getElementById("sstat_gold_val").textContent); let menu = document.getElementsByClassName("section-header")[1]; menu.insertAdjacentHTML( "beforebegin", `Indica un precio máximo para comprar o compra todo lo que te alcance.
No se sobrepujará a los compañeros de alianza.
`); */ SectionMenuCompra.insertAdjacentHTML( "beforeend", `Se comprará todo lo que alcance con el oro que tienes.
No se sobrepujará a los compañeros de alianza.
` ); SectionMenuCompra.insertAdjacentHTML( "beforeend", ` ` ); SectionMenuCompra.insertAdjacentHTML( "beforeend", ` ` ); let oroMaximo = document.getElementById("OroMaximo"); let botonComprar = document.getElementById("BotonComprar"); oroMaximo.addEventListener("input", () => { if (oroMaximo.value.length > 0) { botonComprar.title = "Se comprara la comida que alcance con: " + oroMaximo.value + " 🥇"; botonComprar.innerHTML = "\n Comprar \n"; } else if (oroMaximo.value.length == 0) { botonComprar.title = "Se comprará toda la comida que alcance con el oro que tengas"; botonComprar.innerHTML = "\n Comprar todo\n"; } }); botonComprar.addEventListener("click", () => { if (oroMaximo.value.length > 0) { //Proximamente } else if (oroMaximo.value.length == 0) { for (let i = 0; i < items.length; i++) { let costo = parseFloat(items[i].children[2].value); if (costo > oro) { let PujaDeAlguien; if ( items[i].children[0].innerText.split("\n")[0] == "No hay pujas." || items[i].children[0].innerText.split("\n")[0] == "Ya hay pujas existentes." ) { items[i].children[3].click(); } } } } }); let menuCompraTitle = document.getElementById("MenuCompraTitle"); menuCompraTitle.addEventListener("click", () => { if (SectionMenuCompra.style.display == "none") { SectionMenuCompra.style.display = "block"; } else { SectionMenuCompra.style.display = "none"; } }); } /** * Adds a button that merges all objects in your selected inventory */ function SmelteryTimeSaverExtension() { window.addEventListener("load", () => { if (document.getElementsByClassName("smelter-actions")[0] != undefined) { let inventario = document.getElementsByClassName("smelter-actions")[0]; function FindBtn(textContent) { let elements = document.getElementsByClassName("awesome-button"); let elementsArray = [].slice.call(elements); for (let index = 0; index < elementsArray.length; index++) { let element = elementsArray[index]; if (element.textContent === textContent) { return element; } } } let btnFundicion = FindBtn("Iniciar función"); let items = document.getElementsByClassName("ui-draggable"); inventario.insertAdjacentHTML( "beforeend", ` ` ); let selectInventario = document.getElementById("SelectInventario"); if (localStorage.InventarioFundicion == undefined) { localStorage.SelectHora = "â… "; selectInventario.value = "â… "; } else { selectInventario.value = localStorage.InventarioFundicion; } selectInventario.addEventListener("change", (event) => { localStorage.InventarioFundicion = selectInventario.value; }); let inventoryTabs = document.getElementsByClassName("awesome-tabs"); let inventorySelected; for (let index = 0; index < inventoryTabs.length; index++) { if (inventoryTabs[index].text == "â…£") { inventorySelected = inventoryTabs[index]; } } let btnFundirTodo = document.getElementById("FundirTodo"); btnFundirTodo.addEventListener("click", () => { inventorySelected.click(); btnFundicion.click(); for (let index = 9; index < items.length; index++) { items[index].click(); } }); } else { console.log("time saver extension not installed"); } }); }