// ==UserScript== // @name pennergame bottle bot 2022 // @namespace http://tampermonkey.net/ // @version 11.2022.3 // @description menu bottles // @author NullPointer // @license MIT // @match https://*/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest // @grant GM_addStyle // @downloadURL none // ==/UserScript== (function() { 'use strict'; var link = ""; var url = document.location.href; if (url.indexOf("http://www.pennergame") >= 0) {link = "http://www.pennergame.de"} if (url.indexOf("http://pennergame") >= 0) {link = "http://pennergame.de"} if (url.indexOf("berlin.pennergame.de") >= 0) {link = "http://berlin.pennergame.de"} if (url.indexOf("www.berlin.pennergame.de") >= 0) {link = "http://www.berlin.pennergame.de"} if (url.indexOf("muenchen.pennergame.de") >= 0) {link = "http://muenchen.pennergame.de"} if (url.indexOf("www.muenchen.pennergame.de")>=0) {link = "http://www.muenchen.pennergame.de"} if (url.indexOf("koeln.pennergame.de")>=0) {link = "http://koeln.pennergame.de"} if (url.indexOf("www.koeln.pennergame.de")>=0) {link = "http://www.koeln.pennergame.de"} if (url.indexOf("reloaded.pennergame.de")>=0) {link = "http://reloaded.pennergame.de"} if (url.indexOf("www.reloaded.pennergame.de")>=0) {link = "http://www.reloaded.pennergame.de"} if (url.indexOf("sylt.pennergame.de")>=0) {link = "http://sylt.pennergame.de"} if (url.indexOf("www.sylt.pennergame.de")>=0) {link = "http://www.sylt.pennergame.de"} if (url.indexOf("malle.pennergame.de")>=0) {link = "http://malle.pennergame.de"} if (url.indexOf("http://halloweeen.pennergame.de")>=0) {link = "http://halloweeen.pennergame.de"} if (url.indexOf("vatikan.pennergame.de")>=0) {link = "http://vatikan.pennergame.de"} GM_addStyle("input[type=button].formbutton {margin: 4px 8px; padding: 8px; border: 1px solid #0a0; border-radius: 5px; cursor: pointer;} input[type=button].formbutton:hover {border: 1px solid #0c0; color: #fff;}"); GM_addStyle("input[type=button].formbutton:disabled {color: #888; cursor: default;} input[type=button].formbutton:disabled:hover {border: 1px solid #0a0;}"); var menu = document.createElement("div"); menu.setAttribute("style", "position: absolute; top: "+(document.getElementById("header").offsetHeight*1-5)+"px; left: "+(document.getElementById("my-profile-new").getBoundingClientRect().left*1-260)+"px; z-index: 100; display: block; min-width: 240px; font-size: 10pt; padding: 10px; background-color: rgb(100, 100, 100, 0.75); border: 1px solid #555; border-radius: 10px;"); menu.setAttribute("align", "left"); menu.innerHTML += '
'+ ''+ '
'+ '
 Loading...
'+ '
 
'+ '
 
'; document.getElementsByTagName("body")[0].appendChild(menu); var botStarted = GM_getValue("botStarted", false); if (botStarted) { document.getElementById("startBtn").value="Stop BOT"; _check(); } _bottlecheck(); document.getElementById("startBtn").addEventListener("click", function() { GM_setValue("botStarted", !botStarted); location.reload(); }); function _check() { log("_check"); if (!botStarted) { _status("Stopped!"); return; } GM.xmlHttpRequest({ method: 'GET', url: link+'/activities/', onload: function(responseDetails) { var content = responseDetails.responseText; try { var xx = content.split('720">12 Stunden')[1].split('
')[1].split('')[0].split('value="Sammeln gehen"')[1].split('type')[0]; _status("Starting search..."); window.setTimeout(function() { _buscar(); }, 2000); } catch(e) { var s = content.search("gerade einen Angriff durch"); if (s != -1) { window.setTimeout(function() { _status("Fighting " + document.getElementById("counter1").innerHTML); }, 1000);// 1s window.setTimeout(function() { _check(); }, 600000);// 10min } } } } } }); } function _r(min, max) { return Math.floor(Math.random() * max) + min; } function _status(s) { document.getElementById("botStatus").innerHTML=s; } function _out(a,b){ document.getElementById("out").innerHTML='
Bottles  '+a+'
Sell  '+b+'€
'; } function _pet(s){ document.getElementById("petInfo").innerHTML=s; } function _bottlecheck() { log("_bottlecheck"); GM.xmlHttpRequest({ method: 'GET', url: link+'/stock/bottle/', onload: function(responseDetails) { var content = responseDetails.responseText; var flaschen = content.split('')[1].split('Preis:')[0].split('')[1].split(' Pfandflaschen')[0].replace(/\s/g, ""); var cent = content.split('zum akuellen Kurs:')[1].split('')[0].split('euro;')[1].split(' ')[0].replace(/\,/g, "."); var preis = Math.round(flaschen*cent)*1/1; _out(flaschen,preis); } }); GM.xmlHttpRequest({ method: 'GET', url: link+'/pet/', onload: function(responseDetails) { var zuruecktry = responseDetails.responseText.split('id="pet_roam_time">')[1]; if(zuruecktry){ var zuruecktry1 = zuruecktry.split('')[0].split('(')[1].split(',')[0]; document.getElementById("petInfo").innerHTML = 'Pet until ' + (new Date(new Date().getTime() + zuruecktry1 * 1000)).toLocaleTimeString(); } } }); } function _vaciar() { log("_vaciar"); var x = document.createElement("div"); x.innerHTML = '
'; document.getElementsByTagName("body")[0].appendChild(x); document.myform.submit(); } function _buscar() { log("_buscar"); var x = document.createElement("div"); x.innerHTML = '
'+ ''+ ''+ '' '
'; document.getElementsByTagName("body")[0].appendChild(x); document.myform.submit(); } function log(m) { console.log((new Date()).toLocaleString()+" - "+m); } })();