// ==UserScript== // @name Pfandflaschensammler // @namespace http://userscripts.org/scripts/show/85124 // @author lmk (wieder lauffaehig gemacht und erweitert von We1hnachtsmann) // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html // @copyright (c) 2009, lmk. // @description Nach beendetem Pfandflaschensammeln wird ein Hinweis auf der zuletzt geoeffneten Seite ausgegeben und es kann zur Pfandflaschensammelseite weitergeleitet werden. // @grant GM_getValue // @grant GM_setValue // @grant GM_xmlhttpRequest // @grant GM_deleteValue // @grant GM_listValues // @include http://*.pennergame.de/* // @include http://pennergame.de/* // @include http://*.dossergame.co.uk/* // @include http://dossergame.co.uk/* // @include http://*.menelgame.pl/* // @include http://menelgame.pl/* // @include http://*.bumrise.com/* // @include http://bumrise.com/* // @include http://*.clodogame.fr/* // @include http://clodogame.fr/* // @include http://*.mendigogame.es/* // @include http://mendigogame.es/* // @include http://*.mendigogame.com/* // @include http://mendigogame.com/* // @include http://*.faveladogame.com/* // @include http://faveladogame.com/* // @include http://*.bomzhuj.ru/* // @include http://bomzhuj.ru/* // @exclude http://*board.pennergame.de/* // @exclude http://mobile.pennergame.de/* // @version 2.5.3 Erkennung des beendeten Minigames fehlerhaft; Sammelmarken einlösen // @downloadURL none // ==/UserScript== // @version 2.5.2 automatischer Aufruf der Event-Seite falls nötig // @version 2.5.1 erste Version Vatikan und neues Rentier-Spiel // @version 2.4.3 Korrekturen; Gehalt automatisch abholen // @version 2.4.2 Erweiterungen und Korrekturen für Eckfahnenspiel 2014 // @version 2.4.1 Wechsel auf greasyfork.org; Verbrechensstart erweitert // @version 2.3.34 Anpassungen für Sommergame 2014 (Zollbeamter) // @version 2.3.33 noch eine Korrektur zu Anpassungen für Ostergame 2014 // @version 2.3.32 Korrektur zu Anpassungen für Ostergame 2014 // @version 2.3.31 Anpassungen für Ostergame 2014 // @version 2.3.30 Fehler bei Anpassung an neues Karnevalgame behoben // @version 2.3.29 Anpassung an neues Karnevalgame // @version 2.3.28 kleine Korrektur: bei automatischen Verbrechen kam u.U. eine Abfrage // @version 2.3.27 2. Korrektur zu Anpassungen an Xmas-Minigame 2013 // @version 2.3.26 Korrektur zu Anpassungen an Xmas-Minigame 2013 // @version 2.3.25 Anpassungen an Xmas-Minigame 2013 // @version 2.3.24 Skript lief nicht mehr richtig // @version 2.3.23 Checkbox auf Login-Seite fehlte // @version 2.3.22 Fehler im letzten Update behoben // @version 2.3.21 Anpassung wegen anderen Aufbaus der Counter; Beseitigung von Fehlermeldungen // @version 2.3.20 Erweiterung um Minispiel Piratenschatz // @version 2.3.19 Erweiterung um Minispiel Zollkontrolle // @version 2.3.18 Erweiterung um Kofferpackspiel // @version 2.3.17 kein automatisches Wiedereinloggen, wenn explizit ausgeloggt wurde // @version 2.3.16 automatisches Wiedereinloggen // @version 2.3.15 Korrektur wegen Stadtfeind // @version 2.3.14 Testmeldung entfernt // @version 2.3.13 kleinere Erweiterungen; Reparatur nach Totalausfall // @version 2.3.12 Korrektur wegen Stadtfeind // @version 2.3.11 noch einmal Updateverfahren korrigiert // @version $Id: pfandflaschensammler.user.js 75 2014-11-26 22:10:04Z mkl $ /* Automatic click on "start collecting" | Automatischer Klick auf "Sammeln" */ var autoSubmit = true; //false; /* Alert messages */ var msgDone1 = "Das Pfandflaschensammeln wurde beendet."; // "Collecting done"; var msgDone2 = "Klicke auf OK um die Aktionsseite zu " + unescape("%F6") + "ffnen."; // "Click ok to open actions-page"; var msgAttackEnemy = "Es wurde ein Angriff auf den Stadtfeind Nr. 1 gestartet. Seite aktualisieren ?"; /* Captcha select title*/ var strTime = "Zeit: "; // "Time: "; var intervalTime = 4000; var done = " -/-"; // text after counter reached 0:00 var done0 = "00:00"; // alternative text after counter reached 0:00 var time = String(new Date().getTime()); var counter = done; var fcounter = done; var nameTime = "time"; var nameLastCollectTime = "LastCollectTime"; var checkInterval; var TOWNEXTENSION = window.location.host; var m_ownuserid; var THISSCRIPTVERSION = GM_info.script.version.split(" ")[0]; var THISSCRIPTNAME = GM_info.script.name; var THISSCRIPTINSTALL_URLGF = "https://greasyfork.org/scripts/1049-pfandflaschensammler"; var language = document.getElementsByName("language")[0].content; // Version ermitteln var oldVersion = 1; if (!document.getElementById("login")) { var host = location.toString(); var pos = host.lastIndexOf("//") + 2; host = host.substr(pos); pos = host.indexOf("/"); host = host.substr(0, pos); GM_setValue("ErrorCounter_" + host, GM_getValue("ErrorCounter_" + host, 0) + 1); oldVersion = 0; setTimeout(reload, 10000); } else doTheAction(); // ********************************************************************************** // ********************************************************************************** // Funktion extrahiert die eigene UserID // ********************************************************************************** // ********************************************************************************** function getOwnUserID() { // Eigene UserID ermitteln var ownuserid = document.getElementById('my-profile').innerHTML.split('href="/profil/id:')[1]; ownuserid = ownuserid.split('/"')[0]; return ownuserid; } // Holen einer Variablen mit User-Id function PGu_getValue(varname, deflt) { return GM_getValue(TOWNEXTENSION + varname + m_ownuserid, deflt); } // Setzen einer Variablen mit User-Id function PGu_setValue(varname, value) { GM_setValue(TOWNEXTENSION + varname + m_ownuserid, value); } // Leschen einer Variablen mit User-Id function PGu_delete(varname) { GM_deleteValue(TOWNEXTENSION + varname + m_ownuserid); } // *********************************************************************************************** // *********************************************************************************************** // formats a date into the format "YYYY-MM-DD" // *********************************************************************************************** // *********************************************************************************************** function FormatDate(DateToFormat) { var year = DateToFormat.getFullYear(); var month = DateToFormat.getMonth() + 101 + ""; var day = DateToFormat.getDate() + 100 + ""; return year + "-" + month.slice(1) + "-" + day.slice(1); } // *********************************************************************************************** // *********************************************************************************************** // removes spaces at the beginning and end of a string // *********************************************************************************************** // *********************************************************************************************** function trimString(s) { return s.replace(/^\s+|\s+$/g,''); } // ********************************************************************************** // ********************************************************************************** // returns the promille value // ********************************************************************************** // ********************************************************************************** function GetPromille(doc) { var promille = doc.getElementsByClassName("icon beer")[0].getElementsByTagName("a")[0]; promille = Number(trimString(trimString(promille.innerHTML).substr(0, 6))); return promille; } // *********************************************************************************************** // *********************************************************************************************** // check for a new script version and display a message, if there is one // *********************************************************************************************** // *********************************************************************************************** function CheckForUpdate() { // create and format actual date var today = new Date(); var tagesdatum = FormatDate(today); // if not searched for a new version of the script today if (GM_getValue("LastUpdateCheckGF","") != tagesdatum) { // ********************************************************************************** // *** GM_XMLHTTPREQUEST *** Abrufen der Skriptseite von greasyfork.org // ********************************************************************************** GM_xmlhttpRequest({method: 'GET', url: THISSCRIPTINSTALL_URLGF, headers:{ "Accept":"text/javascript; charset=UTF-8" }, overrideMimeType:"application/javascript; charset=UTF-8", onload:function(responseDetails) { // Wenn die Seite erfolgreich abgerufen werden konnte if (responseDetails.status == 200) { var content = responseDetails.responseText; // Ermitteln der Skriptversion if (content.indexOf("@version") != -1) var scriptfullversion = trimString(content.split('@version')[1]).split('\n')[0]; else var scriptfullversion = content.split('"script-show-version">').pop().split('').pop(); var scriptversion = scriptfullversion.split(' ')[0]; scriptfullversion = scriptfullversion.substr(scriptversion.length+1); // if there is a new version of the script if (scriptversion != THISSCRIPTVERSION) { // build the message var alerttext = "Es gibt eine neue Version des Skriptes '" + THISSCRIPTNAME + "':\n\n" + scriptfullversion + "\n\nDie neue Version kann Fehlerbehebungen und/oder neue Funktionen beinhalten.\nHier gibt es weitere Infos über die neue Version:\n\n" + THISSCRIPTINSTALL_URLGF + "\n\nEine Aktualisierung ist empfehlenswert und kann direkt anschließend durchgeführt werden.\n\nHinweis: Die überprüfung auf neue Versionen wird nur einmal pro Tag durchgeführt." // display the message alert(alerttext); // load the page with the new script for installation window.location.href = THISSCRIPTINSTALL_URLGF+'/code/Pfandflaschensammler.user.js'; } } } }); // memorize the new date GM_setValue("LastUpdateCheckGF", tagesdatum) } } // *********************************************************************************************** // *********************************************************************************************** // check for new minigame // *********************************************************************************************** // *********************************************************************************************** function CheckNewMinigame() { var timeout = 2000; var enemy = document.getElementById("enemy_info"); if (enemy) { var einfo = document.getElementById("wrap").innerHTML.split("#enemy_info").pop(); if (einfo.indexOf("window.location") == -1) return; var addr = einfo.split("location")[1].split('"')[1]; var today = new Date(); var tagesdatum = FormatDate(today); if (PGu_getValue("minigame_date", "xx") != tagesdatum || PGu_getValue("minigame_success", 0) == 0) if (window.location.pathname.indexOf(addr) == -1 && PGu_getValue("minigame_wait", -1) <= today.getTime()) { GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.host + addr, onload:function(responseDetails) { var content = responseDetails.responseText; var pos = content.indexOf('id="minigame_show'); if (pos == -1) PGu_setValue("minigame_date", tagesdatum); else window.location.href = window.location.protocol + '//' + window.location.host + addr; }}); return; } } if (document.getElementById("display")) if (document.getElementById("display").getElementsByClassName("cbox").length > 0) timeout = DoNewMinigame(); else if (document.getElementById("display").getElementsByClassName("modal_close").length == 0 || document.getElementById("display").style.display == "none") { var today = new Date(); var tagesdatum = FormatDate(today); if (PGu_getValue("minigame_date", "xx") != tagesdatum || PGu_getValue("minigame_success", 0) == 0) if (document.getElementById("display").innerHTML.indexOf("minigame_show") != -1) unsafeWindow.minigame_show(); else PGu_setValue("minigame_date", tagesdatum); } if (timeout > 0) window.setTimeout(CheckNewMinigame, timeout); } // *********************************************************************************************** // *********************************************************************************************** // play the new minigame // *********************************************************************************************** // *********************************************************************************************** function DoNewMinigame () { var today = new Date(); var tagesdatum = FormatDate(today); var tbl = document.getElementById("display").getElementsByClassName("cbox")[0]; if (tbl.innerHTML.indexOf("_success.png") != -1) { PGu_setValue("minigame_success", 1); PGu_setValue("minigame_date", tagesdatum); return (86400-today.getHours()*3600-today.getMinutes()*60-today.getSeconds()) * 1000; } var trs = tbl.getElementsByTagName("tr"); for (j = 0; j < trs.length; j++) if (trs[j].innerHTML.indexOf("minigame_count") != -1) break; if (j == trs.length) return 0; PGu_setValue("minigame_date", tagesdatum); if (trs[j].innerHTML.indexOf("minigame_countdown") != -1) { var span = trs[j].getElementsByTagName("span"); var seks = 0; if (span.length > 0) for (jj = 0; jj < 1; jj++) { var timer = span[jj].innerHTML; if (timer == done) { seks = 0; } else if (timer.indexOf(":") != -1) { var time = timer.split(":"); seks = (parseInt(time[0])*60 + parseInt(time[1])) * 1000; } } if (seks == 0) { unsafeWindow.minigame_show(); seks = 2000; } PGu_setValue("minigame_wait", today.getTime() + seks); return seks; } if (trs[j].style.background.indexOf("_success.png") != -1 || trs[j].style.background.indexOf("_unsuccess.png") != -1 || trs[j].style.background.indexOf("_normal.png") != -1) { var success = PGu_getValue("minigame_success", 0); if (success == 1) { if (trs[j].style.background.indexOf("_success.png") == -1) { PGu_setValue("minigame_value", -1); PGu_setValue("minigame_success", 0); success = 0; } else return (86400-today.getHours()*3600-today.getMinutes()*60-today.getSeconds()) * 1000; } if (success == 0) { if (trs[j].style.background.indexOf("_success.png") != -1) { PGu_setValue("minigame_success", 1); return (86400-today.getHours()*3600-today.getMinutes()*60-today.getSeconds()) * 1000; } else { var nextValue = PGu_getValue("minigame_value", -1) + 1; PGu_setValue("minigame_value", nextValue); document.getElementById("minigame_count").innerHTML = nextValue%10+1; var sub = trs[j].innerHTML.split("minigame_try('")[1].split("'")[0]; unsafeWindow.minigame_try(sub); } } } return 2000; } // *********************************************************************************************** // *********************************************************************************************** // check for minigame and play it // *********************************************************************************************** // *********************************************************************************************** function CheckMinigame () { if (window.location.pathname.indexOf("/activities/") == -1) return; var minigames = new Array("halloween", "summer13", "event/aug13_2"); var tbl = document.getElementsByTagName("table"); for (i = 0; i < tbl.length; i++) { for (var tk = 0; tk < minigames.length; tk++) if (tbl[i].innerHTML.indexOf("/" + minigames[tk] + "/") != -1) break; var trs = tbl[i].getElementsByTagName("tr"); for (j = 0; j < trs.length; j++) { for (var k = 0; k < minigames.length; k++) if (trs[j].innerHTML.indexOf("/" + minigames[k] + "/") != -1) break; if (tk < minigames.length || k < minigames.length) { var seks = 0; if (j + 1 < trs.length) { var span = trs[j+1].getElementsByTagName("span"); if (span.length > 0) for (jj = 0; jj < 1; jj++) { var timer = span[jj].innerHTML; if (timer == done) { seks = 0; } else if (timer.indexOf(":") != -1) { var time = timer.split(":"); seks = parseInt(time[0])*60 + parseInt(time[1]); } } } if (seks > 0) { checkInt = window.setTimeout(CheckMinigame,seks*1000); return; } else if (trs[j].style.background.indexOf("/success.jpg") != -1 || trs[j].style.background.indexOf("/fail.jpg") != -1 || trs[j].style.background.indexOf("/normal.jpg") != -1) { var success = PGu_getValue("minigame_success", 0); if (success == 1) { if (trs[j].style.background.indexOf("/success.jpg") == -1) { PGu_setValue("minigame_value", -1); PGu_setValue("minigame_success", 0); success = 0; } else checkInt = window.setTimeout(reload, 300000); } if (success == 0) { if (trs[j].style.background.indexOf("/success.jpg") != -1) { PGu_setValue("minigame_success", 1); } else { var options = trs[j].innerHTML.split(' 0) { checkInt = window.setTimeout(reload, seks*1000); return; } else { var success = PGu_getValue("XmasMini_success", 0); if (success == 1) { if (trs[j].style.background.indexOf("minigame_success") == -1) { PGu_setValue("XmasMini_value", -1); PGu_setValue("XmasMini_success", 0); success = 0; } else checkInt = window.setTimeout(reload, 600000); } if (success == 0) { if (trs[j].style.background.indexOf("minigame_success") != -1) { PGu_setValue("XmasMini_value", -1); PGu_setValue("XmasMini_success", 1); checkInt = window.setTimeout(reload, 600000); } else { var options = trs[j].innerHTML.split(' 1) name = name[1].split('"')[0]; else continue; var value = inputs[ii].split('value="'); if (value.length > 1) value = value[1].split('"')[0]; else continue; if (input != "") input += "&"; input += name + "=" + value; } if (k < minigames.length) { var seks = 0; dk = 1; if (j + 1 < trs.length) { var span = trs[j+1].getElementsByTagName("span"); if (span.length > 0) for (jj = 0; jj < 1; jj++) { var timer = span[jj].innerHTML; if (timer == done) { seks = 0; } else if (timer.indexOf(":") != -1) { var time = timer.split(":"); seks = parseInt(time[0])*60 + parseInt(time[1]); } } } if (seks > 0) { checkInt = window.setTimeout(CheckMinigame,seks*1000); return; } else if (trs[j].style.background.indexOf("success.jpg") != -1 || trs[j].style.background.indexOf("unsuccess.jpg") != -1 || trs[j].style.background.indexOf("normal.jpg") != -1) { var success = PGu_getValue("minigame_success", 0); if (success == 1) { if (trs[j].style.background.indexOf("success.jpg") == -1) { PGu_setValue("minigame_value", -1); PGu_setValue("minigame_success", 0); success = 0; } else checkInt = window.setTimeout(reload, 300000); } if (success == 0) { if (trs[j].style.background.indexOf("success.jpg") != -1) { PGu_setValue("minigame_success", 1); } else { var options = trs[j].innerHTML.split(' 0) { checkInt = window.setTimeout(reload, seks*1000); return; } else { var eventurl = PG_getValue(TOWNEXTENSION + "eventURL", ""); if (eventurl != "") window.location.href = window.location.protocol + '//' + window.location.host + eventurl; } } break; } } } } function insertCheckBox() { var newtd = document.createElement("td"); newtd.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtd.innerHTML = ' Automatisch sammeln'; document.getElementsByName("xycoords")[0].parentNode.insertBefore(newtd, document.getElementsByName("xycoords")[0]); document.getElementById("BCCheckbox").checked = PGu_getValue("AutoCollect", false); // Click-Handler hinzufügen document.getElementById("BCCheckbox").addEventListener("click", function(event) { // Klickstatus speichern PGu_setValue("AutoCollect", this.checked); if (this.checked) { var timeOptions = document.getElementsByName("time")[0]; PGu_setValue(nameLastCollectTime, timeOptions.selectedIndex); } }, false); } function insertCheckBox2() { var newtd = document.createElement("td"); newtd.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); var male = ""; if (PGu_getValue("AutoCrime", false)) male = " (noch " + PGu_getValue("AutoCrimeFkt", 0) + " Mal)"; newtd.innerHTML = ' Automatisch starten' + male + ''; var buttons = document.getElementsByTagName("button"); if (buttons.length > 0) var button = buttons[0]; else { buttons = document.getElementsByName("xycoords"); var button = buttons[buttons.length-1]; } button.parentNode.insertBefore(newtd, button); document.getElementById("SCCheckbox").checked = PGu_getValue("AutoCrime", false); // Click-Handler hinzufügen document.getElementById("SCCheckbox").addEventListener("click", function(event) { // Klickstatus speichern if (this.checked) { if (PGu_getValue("AutoCrimePic", "") == "") { if (TOWNEXTENSION == "VT") alert("Bitte erst Sünde festlegen !!"); else alert("Bitte erst Verbrechen festlegen !!"); this.checked = false; } if (PGu_getValue("AutoCrimeFkt", -1) <= 0) PGu_setValue("AutoCrimeFkt", 1); } PGu_setValue("AutoCrime", this.checked); reload(); }, false); } function insertCheckBox3(button) { var crimepic = button.parentNode.parentNode.innerHTML.split('plunder_crime/')[1].split('"')[0]; var name = 'CbButton_' + crimepic; var newtd = document.createElement("td"); newtd.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtd.innerHTML = ' diese' + (TOWNEXTENSION=="VT"?" Sünde":"s Verbrechen") + '  mal automatisch starten'; button.parentNode.appendChild(newtd, button); var crimep = PGu_getValue("AutoCrimePic", 0); if (crimep == crimepic) { document.getElementById(name).checked = true; document.getElementById(name+"Fkt").value=PGu_getValue("AutoCrimeFkt",1); } // Click-Handler hinzufügen document.getElementById(name+"Fkt").addEventListener("change", function(event) { var crimeFkt = parseInt(document.getElementById(this.id).value); if (isNaN(crimeFkt)) crimeFkt = 1; document.getElementById(this.id).value = crimeFkt; PGu_setValue("AutoCrimeFkt", crimeFkt); }, false); // Click-Handler hinzufügen document.getElementById(name).addEventListener("click", function(event) { var crimepic = this.id.split("_")[1]; crimepic = this.parentNode.parentNode.parentNode.innerHTML.split('plunder_crime/')[1].split('"')[0]; if (this.parentNode.parentNode.innerHTML.split("start_crime(").length > 1) var crimeNr = this.parentNode.parentNode.innerHTML.split("start_crime(")[1].split(")")[0]; else var crimeNr = 0; // Klickstatus speichern if (this.checked) { PGu_setValue("AutoCrime", true); PGu_setValue("AutoCrimePic", crimepic); PGu_setValue("AutoCrimeNr", crimeNr); var crimeFkt = parseInt(document.getElementById(this.id+"Fkt").value); if (isNaN(crimeFkt) || crimeFkt <= 0) crimeFkt = 1; document.getElementById(this.id+"Fkt").value = crimeFkt; PGu_setValue("AutoCrimeFkt", crimeFkt); var buttons = document.getElementsByName("CbCrime"); for (i = 0; i < buttons.length; i++) { var crimep = buttons[i].parentNode.parentNode.parentNode.innerHTML.split('plunder_crime/')[1].split('"')[0]; if (crimepic != crimep) { document.getElementById(buttons[i].id).checked = false; document.getElementById(buttons[i].id+"Fkt").value = ""; } } } else { PGu_setValue("AutoCrimePic", ""); PGu_setValue("AutoCrimeNr", 0); PGu_setValue("AutoCrimeFkt", 0); PGu_setValue("AutoCrime", false); } }, false); } function insertCheckBox4() { var newtd = document.createElement("li"); newtd.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtd.innerHTML = ' Geld automatisch einsacken'; var tieritems = document.getElementsByClassName("tieritemA"); for (i = 0; i < tieritems.length; i++) { if (tieritems[i].innerHTML.indexOf("minijobs") != -1) { var lis = tieritems[i].getElementsByClassName("double")[1].getElementsByTagName("li"); lis[lis.length-1].parentNode.appendChild(newtd, lis[lis.length-1]); document.getElementById("GSCheckbox").checked = PGu_getValue("getSalary", false); // Click-Handler hinzufügen document.getElementById("GSCheckbox").addEventListener("click", function(event) { // Klickstatus speichern PGu_setValue("getSalary", this.checked); }, false); } } } // *********************************************************************************************** // *********************************************************************************************** // check for enemy game and play it // *********************************************************************************************** // *********************************************************************************************** function CheckEnemygame () { if (!document.getElementById("enemy_info")) return; GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/enemies/', onload:function(responseDetails) { var content = responseDetails.responseText; var pos = content.indexOf('id="fight_button'); if (pos != -1) { if (content.substr(pos, 100).indexOf('counter(') == -1) setTimeout(Enemyattack, 1500); return; } pos = content.indexOf('hp_bar_blue'); if (pos == -1) { return; } else { var poscnt = content.indexOf('counter(', pos); if (poscnt != -1) { var cnt = parseInt(content.substr(poscnt+8).split(")")[0].split(',')[0]); if (cnt > 0) setTimeout(enemyreload, cnt*1000); } } } }); } function getSeks(counter) { if (counter == done) return 0; var cnt = counter.split(":"); var seks = 0; for (i = 0; i < cnt.length; i++) seks = seks * 60 + Number(cnt[i]); return seks; } function getvcounter () { var vcounter = done; if (document.getElementsByClassName("chest_counter").length == 0) { var tbl = document.getElementsByTagName("table"); for (i = tbl.length - 1; i > 0; i--) if (tbl[i].className) if (tbl[i].className == "cbox") break; var trs = tbl[i].getElementsByTagName("tr"); if (trs.length > 2) { var span = trs[2].getElementsByTagName("span"); for (i = 0; i < span.length; i++) { if (span[i].id) if (span[i].id.substr(0, 7) == "counter") { vcounter = span[i].innerHTML; if (trimString(vcounter) == done0) // is the time 00:00 ? vcounter = done; break; } } } } return getSeks(vcounter); } function submit(){ if(window.location.pathname.indexOf("/activities/") != -1 && window.location.pathname.indexOf("/crime/") == -1 && autoSubmit){ if (document.getElementsByClassName("chest_key_on").length > 0) { var href = document.getElementsByClassName("chest_menu")[0].getElementsByClassName("chest_button")[0].href; window.location.href = href; } if (getvcounter() != 0) { var lastURL = PGu_getValue("AutoCollURL", ""); if (lastURL != "") { PGu_setValue ("AutoCollURL", ""); window.location.replace( lastURL ); } else { PGu_setValue(nameTime, time); PGu_setValue("AskedForCollect", 0); checkInterval = window.setInterval(check,intervalTime); } return; } var lastCollectTime = PGu_getValue(nameLastCollectTime,0); var evt = document.createEvent("HTMLEvents"); evt.initEvent("change", true, true); var timeOptions = document.getElementsByName("time")[0]; if (!timeOptions) refer(); timeOptions.selectedIndex = lastCollectTime; timeOptions.dispatchEvent(evt); timeOptions.addEventListener( "change", function(){ PGu_setValue(nameLastCollectTime, document.getElementsByName("time")[0].selectedIndex); timeOptionsCaptcha.selectedIndex = timeOptions.selectedIndex; }, true ); var timeOptionsCaptcha = timeOptions.cloneNode(true); timeOptionsCaptcha.selectedIndex = timeOptions.selectedIndex; timeOptionsCaptcha.addEventListener( "change", function(){ PGu_setValue(nameLastCollectTime, document.getElementsByName("time")[0].selectedIndex); timeOptions.selectedIndex = timeOptionsCaptcha.selectedIndex;}, true); var captchaHolder = document.getElementById("holder"); var infoText = captchaHolder.insertBefore(document.createElement('p'),captchaHolder.getElementsByTagName("span")[1]); infoText.innerHTML = strTime; infoText.appendChild(timeOptionsCaptcha); infoText.style.margin = "0px"; infoText.style.marginTop = "8px"; captchaHolder.getElementsByTagName("span")[1].style.marginTop = "-8px"; captchaHolder.getElementsByTagName("span")[1].style.marginLeft = "-10px"; var cancelButton = captchaHolder.getElementsByClassName("cancel")[0]; cancelButton.style.margin = "0px"; cancelButton.style.marginLeft = "10px"; infoText.appendChild(cancelButton); var crimePic = PGu_getValue("AutoCrimePic", ""); var crimeFkt = PGu_getValue("AutoCrimeFkt", 0); var crimeTO = ""; if (PGu_getValue("AutoCrime", false) && crimePic != "" && crimeFkt > 0) { var crimeNr = PGu_getValue("AutoCrimeNr", -1); if (crimeNr > 0) { crimeTO = " if (document.getElementById('SCCheckbox').checked) window.location = window.location.protocol + '//' + window.location.host + '/activities/crime/?start_crime=" + crimeNr + "'"; PGu_setValue("AutoCrimeFkt", crimeFkt - 1); } else if (crimeNr == 0) { GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/activities/crime/', onload:function(responseDetails) { var content = responseDetails.responseText; var buttons = content.split("plunder_crime/"); for (i = 1; i < buttons.length; i++) { var crimep = buttons[i].split('"')[0]; if (crimePic == crimep) { crimeNr = buttons[i].split("start_crime(")[1].split(")")[0]; PGu_setValue("AutoCrimeNr", crimeNr); reload(); break; } } }}); } else { PGu_setValue("AutoCrimePic", ""); PGu_setValue("AutoCrime", false); setTimeout(reload, 1000); } } if (crimeTO != "") setTimeout("if (document.getElementById('SCCheckbox'))" + crimeTO + ";", 2000); // fails often if to fast else setTimeout("if (document.getElementById('BCCheckbox')) if (document.getElementById('BCCheckbox').checked) document.getElementsByName('Submit2')[0].click();", 3000); // fails often if to fast } else { PGu_setValue(nameTime, time); //store time for each domain to prevent multiple run in same domain checkInterval = window.setInterval(check,intervalTime); } } function check(){ function setPetCollectDay(day, status) { var val = PGu_getValue("AutoPetCollectDay", "0000000"); val = val.substr(0, day) + (status?"1":"0") + val.substr(day + 1); PGu_setValue("AutoPetCollectDay", val); PGu_setValue("AutoPetCollect", val != "0000000"); return; } if (window.location.pathname.indexOf("/pet/") != -1) { if (document.getElementById("submit_sets") && !document.getElementById("Checkbox1")) { var divs = document.getElementsByClassName("pet_tab_help"); var newdiv = divs[divs.length-1].cloneNode(true); newdiv.innerHTML = "

Automatisches Einlösen

Hier kannst Du einstellen, wann Deine Gegenstände automatisch eingelöst werden sollen.
"; var newtdMo = document.createElement("td"); newtdMo.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdMo.innerHTML = ' Montag '; newdiv.appendChild(newtdMo); var newtdDi = document.createElement("td"); newtdDi.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdDi.innerHTML = ' Dienstag '; newdiv.appendChild(newtdDi); var newtdMi = document.createElement("td"); newtdMi.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdMi.innerHTML = ' Mittwoch '; newdiv.appendChild(newtdMi); var newtdDo = document.createElement("td"); newtdDo.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdDo.innerHTML = ' Donnerstag '; newdiv.appendChild(newtdDo); var newtdFr = document.createElement("td"); newtdFr.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdFr.innerHTML = ' Freitag '; newdiv.appendChild(newtdFr); var newtdSa = document.createElement("td"); newtdSa.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdSa.innerHTML = ' Samstag '; newdiv.appendChild(newtdSa); var newtdSo = document.createElement("td"); newtdSo.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdSo.innerHTML = ' Sonntag '; newdiv.appendChild(newtdSo); var newtdvon = document.createElement("td"); newtdvon.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdvon.innerHTML = ' von '; newdiv.appendChild(newtdvon); var newtdbis = document.createElement("td"); newtdbis.setAttribute('style', 'padding-top: 10px; padding-bottom: 10px'); newtdbis.innerHTML = ' bis  Uhr '; newdiv.appendChild(newtdbis); divs[divs.length-1].parentNode.appendChild(newdiv); // Status setzen und Click-Handler hinzufügen for (i = 0; i < 7; i++) { document.getElementById("Checkbox"+i).checked = PGu_getValue("AutoPetCollectDay", "0000000").substr(i, 1) == "1"; document.getElementById("Checkbox"+i).addEventListener("click", function(event) { setPetCollectDay(this.id.substr(-1), this.checked); }, false); } document.getElementById("vonZeit").value = PGu_getValue("AutoPetCollectBegH", 11); document.getElementById("vonZeit").addEventListener("change", function(event) { var val = document.getElementById(this.id).value; if (isNaN(val) || parseInt(val) < 0 || parseInt(val) > 23) { alert("Bitte eine Zahl von 0 bis 23 eingeben"); document.getElementById(this.id).value = PGu_getValue("AutoCollectBegH", 11); return false; } else PGu_setValue("AutoPetCollectBegH", parseInt(val)); }, true); document.getElementById("bisZeit").value = PGu_getValue("AutoPetCollectEndH", 12); document.getElementById("bisZeit").addEventListener("change", function(event) { var val = document.getElementById(this.id).value; if (isNaN(val) || parseInt(val) < 0 || parseInt(val) > 23) { alert("Bitte eine Zahl von 0 bis 23 eingeben"); document.getElementById(this.id).value = PGu_getValue("AutoCollectEndH", 12); return false; } else PGu_setValue("AutoPetCollectEndH", parseInt(val)); }, false); } } if(PGu_getValue(nameTime) != time){ //script started somewhere else clearInterval(checkInterval); return 0; } var c=1; var posci = document.getElementById("enemy_info")?0:-1; if (posci != -1) posci = document.getElementById("enemy_info").innerHTML.indexOf('enemy_counter_info'); if (posci != -1) posci = document.getElementById("enemy_info").innerHTML.substr(posci+20,100).indexOf("counter"); if (posci != -1) c=2; var crime = false; try{ fcounter = document.getElementById("counter"+c).innerHTML; counter = document.getElementById("counter"+(c+1)).innerHTML; crime = document.getElementById("counter"+(c+1)).parentNode.innerHTML.split("counter(")[1].split(")")[0].split('"')[1].indexOf("crime") != -1; if (trimString(counter) == done0) // is the time 00:00 ? counter = done; } catch(err){ } var promille = GetPromille(document); if (fcounter == done && counter == done || PGu_getValue("AutoCrime", false) && PGu_getValue("AutoCrimeFkt", 0) > 0 && counter == done) { if(window.location.pathname.indexOf("/activities/") != -1 && window.location.pathname.indexOf("/crime/") == -1){ if (document.getElementsByClassName("chest_key_on").length > 0) { var href = document.getElementsByClassName("chest_menu")[0].getElementsByClassName("chest_button")[0].href; window.location.href = href; } if (getvcounter() != 0) return; // do nothing, if a crime is planned clearInterval(checkInterval); // stop script setTimeout(reload, 2000); } else { GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/activities/', onload:function(responseDetails) { var content = responseDetails.responseText; var text = content.split("setupForm('/activities/bottle/'"); if (text.length > 1) { text = text[1].split('>')[0].split(' '); text = text[text.length-1]; } if (text == "disabled") { clearInterval(checkInterval); // stop script checkInterval = window.setInterval(check,intervalTime*5); } /* deaktiviert !! else if (PGu_getValue("AutoCollect", false)) { var lastCollectTime = PGu_getValue(nameLastCollectTime, 0); var timesplit = content.split('name="time"')[1].split(" lastCollectTime + 1) var dauer = timesplit[lastCollectTime+1].split('value="')[1].split('"')[0]; else var dauer = 10; GM_xmlhttpRequest({method:'POST', url: 'http://' + window.location.hostname + '/activities/bottle/', headers: {'Content-type': 'application/x-www-form-urlencoded'}, data: encodeURI('bottlecollect_pending=True'), onload:function(responseDetails) { var content = responseDetails.responseText; GM_xmlhttpRequest({method:'POST', url: 'http://' + window.location.hostname + '/activities/bottle/', headers: {'Content-type': 'application/x-www-form-urlencoded'}, data: encodeURI('sammeln='+dauer), onload:function(responseDetails) { var content = responseDetails.responseText; var text = content.split("setupForm('/activities/bottle/'"); if (text.length > 1) { text = text[1].split('>')[0].split(' '); text = text[text.length-1]; } if (text == "disabled") { clearInterval(checkInterval); // stop script checkInterval = window.setInterval(check,intervalTime*5); } }}); }}); } */ else { clearInterval(checkInterval); // stop script setTimeout(refer, 10000); } }}); } } else if (crime && getSeks(counter) < 60 && promille > 0) { if (PGu_getValue("AutoCrimeURL", "") == "") PGu_setValue ("AutoCrimeURL", location.toString()); if (location.toString().substr(-5) != "food/") window.location.href = window.location.protocol + "//" + window.location.host + "/stock/foodstuffs/food/"; else { var breads = 0; var items = document.getElementsByClassName("item_list"); for (var i = items.length - 1; i >= 0; i--) { breads = Number(items[i].getElementsByTagName("tr")[0].getElementsByTagName("td")[1].innerHTML.split(">")[1].split(" ")[0]); var effect = -Number(document.getElementsByName("promille")[i].value)/100; if (i > 0 && effect > promille) continue; var id = document.getElementsByName("id")[i].value; if (i == 0) var nrofbreads = Math.min(Math.ceil(promille/effect), breads); else var nrofbreads = Math.min(Math.floor(promille/effect), breads); // ********************************************************************************** // *** GM_XMLHTTPREQUEST *** POSTEN der Essensnutzung // ********************************************************************************** GM_xmlhttpRequest({method: 'POST', url: 'http://' + window.location.hostname + '/stock/foodstuffs/use/', headers: {'Content-type': 'application/x-www-form-urlencoded'}, data: encodeURI('item=&promille=&id='+id+'&menge=' + nrofbreads), onload: function(responseDetails) { window.location.href = PGu_getValue("AutoCrimeURL", ""); PGu_setValue ("AutoCrimeURL", ""); } }); break; } } } else if (PGu_getValue("RefreshInterval", 0) > 0) setTimeout(reload, PGu_getValue("RefreshInterval", 0) * 60000); } function refer(){ var box = PGu_getValue("AutoCollect", false) || PGu_getValue("AutoCrime", false) && PGu_getValue("AutoCrimeFkt", 0) > 0; if (box) { // check input field in Mails and SB var f_text = document.getElementById("f_text"); if (f_text) box = f_text.value == ""; } if (!box && PGu_getValue("AskedForCollect", 0) < 3) { box = window.confirm( msgDone1 + "\n" + msgDone2 ); PGu_setValue("AskedForCollect", PGu_getValue("AskedForCollect", 0) + 1); } if (box) { PGu_setValue("AutoCollURL", location.toString()); window.location.href = window.location.protocol + "//" + window.location.host + "/activities/"; } } function reload(){ if (oldVersion || !autoSubmit) alert(msgDone1); if (window.location.toString().indexOf("event") != -1) window.location.href = window.location.toString(); else window.location.href = window.location.protocol + "//" + window.location.host + "/activities/"; } function enemyreload(){ var box = true; // check input field in Mails and SB var f_text = document.getElementById("f_text"); if (f_text) box = f_text.value == ""; if (!box) { box = window.confirm( msgAttackEnemy ); } if (box) { window.location.href = location.toString(); } } function Enemyattack(){ GM_xmlhttpRequest({ method:"POST", url: 'http://' + window.location.host + '/enemies/start_fight/', headers: {'Content-type': 'application/x-www-form-urlencoded'}, data: encodeURI(''), onload:function(responseDetails) { enemyreload(); } }); } function DoPetCollect() { GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/pet/tab/collections/', onload:function(responseDetails) { var content = responseDetails.responseText; var ptArray = new Array(); var uls = content.split("tabcontainer").pop().split('id="ul_'); for (i = 1; i < uls.length; i++) { var set = uls[i].split('">')[0]; var spans = uls[i].split("trade_in")[0].split(""); var trade = uls[i].split("trade_in")[1].split("")[0].split(">")[0].split("value=").pop(); var points = parseInt(trade.split(")")[0].split("(").pop()); var codeset = new Array(); var minanz = 99999; for (j = 0; j < spans.length - 1; j++) { var code = spans[j].split("item_count_")[1].split('">')[0]; var anz = Number(spans[j].split(">").pop()); codeset.push(new Array(code, anz)); if (anz < minanz) minanz = anz; } if (minanz == 0) continue; for (j = 0; j < ptArray.length; j++) if (ptArray[j][2] <= points) break; ptArray.splice(j, 0, new Array(set, codeset, points)); } for (i = 0; i < ptArray.length; i++) { var rew = ptArray[i][0]; var special = ""; if (rew.substr(0,8) == "special_") { special = "?special=true"; rew = rew.substr(8); } var minanz = 99999; for (j = 0; j < ptArray[i][1].length; j++) { if (ptArray[i][1][j][1] < minanz) minanz = ptArray[i][1][j][1]; } if (minanz == 0) continue; for (j = i; j < ptArray.length; j++) for (k = 0; k < ptArray[i][1].length; k++) for (kk = 0; kk < ptArray[j][1].length; kk++) if (ptArray[i][1][k][0] == ptArray[j][1][kk][0]) { ptArray[j][1][kk][1] -= minanz; break; } GM_xmlhttpRequest({ method: 'GET', url: 'http://' + window.location.hostname + '/pet/get_collection_reward/'+rew+"/"+minanz+"/"+special, onload: function(responseDetails) { } }); window.setTimeout("window.location.href = '" + location.toString() + "'", 2000); return; } }}); return; } // Die eigentliche Funktion function doTheAction () { if (document.getElementsByClassName('zleft profile-data').length > 0) oldVersion = 0; /*-*/ var host = window.location.host; if (host.substr(0,4) == "www.") host = host.substr(4); if (host.substr(0,7) == "change.") host = host.substr(7); if (GM_getValue(host + "_autologin", "xxx") == "xxx") { GM_setValue(host + "_autologin", GM_getValue("www." + host + "_autologin", false)); GM_setValue(host + "_username", GM_getValue("www." + host + "_username", "")); GM_setValue(host + "_password", GM_getValue("www." + host + "_password", "")); GM_deleteValue("www." + host + "_autologin"); GM_deleteValue("www." + host + "_username"); GM_deleteValue("www." + host + "_password"); GM_deleteValue("change." + host + "_autologin"); GM_deleteValue("change." + host + "_username"); GM_deleteValue("change." + host + "_password"); } var login = document.getElementById("loginform"); if (login) { login.addEventListener('submit', function(event) { var input = document.getElementById("loginform").getElementsByTagName("input"); for (var i = 0; i < input.length; i++) { if (input[i].name == "username" || input[i].name == "password") GM_setValue(host + "_" + input[i].name, input[i].value); } return true; }, false); } var myprof = document.getElementById("my-profile"); if (!myprof) { function doLogin() { var login = document.getElementById("loginform"); var input = login.getElementsByTagName("input"); var i = input.length - 1; if (GM_getValue(host + "_username", "") != "" && GM_getValue(host + "_password", "") != "") { document.getElementById("login_username").value = GM_getValue(host + "_username", ""); document.getElementById("password").value = GM_getValue(host + "_password", ""); input[i].click(); } else if (document.getElementById("login_username").value != "" && document.getElementById("password").value != "") { input[i].click(); } } var user = document.getElementById("login_username"); if (user) { var chb = document.createElement("input"); chb.type="checkbox"; chb.id="autologin"; chb.title="Auto-Login"; user.parentNode.appendChild(chb, user); document.getElementById("autologin").checked = GM_getValue(host + "_autologin", false); // Click-Handler hinzufügen document.getElementById("autologin").addEventListener("click", function(event) { // Klickstatus speichern GM_setValue(host + "_autologin", this.checked); }, false); } if (GM_getValue(host + "_autologin", false)) window.setTimeout(doLogin, 10000); return; } else if (myprof.getElementsByTagName("form").length > 0) { var input = myprof.getElementsByTagName("input"); if (input.length > 0) { myprof.getElementsByTagName("form")[0].addEventListener('mouseup', function(event) { GM_setValue(host + "_autologin", false); }, false); } } var mobBut = document.getElementById("mobile_button"); if (mobBut) if (mobBut.innerHTML == "Logout") { mobBut.getElementsByTagName("form")[0].addEventListener('mouseup', function(event) { GM_setValue(host + "_autologin", false); }, false); } // *********************************************************************************************** // *********************************************************************************************** // -------- Start of program-------------- // *********************************************************************************************** // *********************************************************************************************** // Wenn in Berlin gespielt wird m_ownuserid = getOwnUserID(); if (language == "bl_DE") { TOWNEXTENSION = 'B'; // Wenn in München gespielt wird } else if (language == "mu_DE") { TOWNEXTENSION = 'MU'; // Wenn in Köln gespielt wird } else if (language == "kl_DE") { TOWNEXTENSION = 'K'; // Wenn in Hamburg gespielt wird } else if (language == "de_DE") { TOWNEXTENSION = 'HH'; // Wenn in Hamburg reloaded gespielt wird } else if (language == "hr_DE") { TOWNEXTENSION = 'HR'; // Wenn in Operation Pennersturm gespielt wird } else if (language == "s6_DE") { TOWNEXTENSION = 'OP'; // Wenn in Sylt gespielt wird } else if (language == "sy_DE") { TOWNEXTENSION = 'SY'; // Wenn in Malle gespielt wird } else if (language == "ml_DE") { TOWNEXTENSION = 'ML'; // Wenn im Vatikan gespielt wird } else if (language == "vt_DE") { TOWNEXTENSION = 'VT'; PGu_setValue("RefreshInterval", 5); } else if (language == "us_EN") { TOWNEXTENSION = 'NY'; } else if (language == "kr_PL") { TOWNEXTENSION = 'KR'; } else if (language == "pl_PL" || language == "wr_PL") { TOWNEXTENSION = 'WA'; } else if (language == "ma_FR") { TOWNEXTENSION = 'MS'; } else if (language == "fr_FR" || language == "cr_FR") { TOWNEXTENSION = 'PA'; } else if (language == "ba_ES") { TOWNEXTENSION = 'BA'; } else if (language == "es_ES" || language == "er_ES") { TOWNEXTENSION = 'MD'; } else if (language == "sp_BR") { TOWNEXTENSION = 'SP'; } else if (language == "pt_BR") { TOWNEXTENSION = 'RJ'; } else if (language == "ru_RU") { TOWNEXTENSION = 'MO'; } else if (language == "en_EN") { TOWNEXTENSION = 'LO'; } if(window.location.pathname.indexOf("/stock/bottle/") != -1){ var trs = document.getElementsByClassName("item_list")[0].getElementsByTagName("tr"); var trnr = (TOWNEXTENSION == "VT"?3:1); var tr1 = trs[trnr].cloneNode(true); var tr2 = trs[trnr].cloneNode(true); var inp1 = document.createElement("input"); inp1.id = "minmoney"; inp1.type = "text"; inp1.value = PGu_getValue("minMoney", 0); inp1.size = "9"; var inp3 = document.createElement("input"); inp3.type = "button"; inp3.value = "übernehmen"; inp3.addEventListener("click", function(event) { PGu_setValue("minMoney", document.getElementById("minmoney").value); }, false); if (TOWNEXTENSION == "VT") { tr1.getElementsByTagName("td")[0].innerHTML = 'Mindestgeldbetrag:'; tr1.getElementsByTagName("td")[1].appendChild(inp1, tr1.getElementsByTagName("td")[1]); tr1.getElementsByTagName("td")[1].appendChild(inp3, tr1.getElementsByTagName("td")[1]); } else { tr1.getElementsByTagName("td")[1].innerHTML = 'Mindestgeldbetrag:'; tr1.getElementsByTagName("span")[0].parentNode.removeChild(tr1.getElementsByTagName("span")[0]); tr1.getElementsByTagName("td")[2].appendChild(inp1, tr1.getElementsByTagName("td")[1]); tr1.getElementsByTagName("td")[2].appendChild(inp3, tr1.getElementsByTagName("td")[1]); } trs[trnr].parentNode.appendChild(tr1, trs[trnr]); var inp2 = document.createElement("input"); inp2.id = "minprice"; inp2.type = "text"; inp2.value = "0," + ("0" + PGu_getValue("bottleprice", "0")).substr(-2); inp2.size = "5"; var inp4 = document.createElement("input"); inp4.type = "button"; inp4.value = "übernehmen"; inp4.addEventListener("click", function(event) { if (document.getElementById("minprice").value.substr(0,2) != "0,") alert ("Wert unzulässig!"); else PGu_setValue("bottleprice", Number(document.getElementById("minprice").value.substr(2))); }, false); if (TOWNEXTENSION == "VT") { tr2.getElementsByTagName("td")[0].innerHTML = 'Mindestverkaufspreis Flaschen:'; tr2.getElementsByTagName("td")[1].appendChild(inp2, tr2.getElementsByTagName("td")[1]); tr2.getElementsByTagName("td")[1].appendChild(inp4, tr2.getElementsByTagName("td")[1]); } else { tr2.getElementsByTagName("td")[1].innerHTML = 'Mindestverkaufspreis Flaschen:'; tr2.getElementsByTagName("span")[0].parentNode.removeChild(tr2.getElementsByTagName("span")[0]); tr2.getElementsByTagName("td")[2].appendChild(inp2, tr2.getElementsByTagName("td")[2]); tr2.getElementsByTagName("td")[2].appendChild(inp4, tr2.getElementsByTagName("td")[2]); } trs[trnr].parentNode.appendChild(tr2, trs[trnr+1]); } if (PGu_getValue("getSalary", 0) > 0) { GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/overview/', onload:function(responseDetails) { var content = responseDetails.responseText; if (content.indexOf("Lohn abholen") != -1) { var fass = content.split("Fassungsverm")[1].match(/[\d.,]+/); var maxmoney = Number(fass[0].replace(/[.,]/g,'')); var money = Number(document.getElementsByClassName("icon money")[0].innerHTML.split(">")[1].match(/[\d,.]+/)[0].replace(/[.,]/g, '')); var salary = Number(content.split(" jetzt einsacken")[0].match(/[\d,.]+/g).pop().replace(/[.,]/g, '')); if (money + salary < maxmoney) { var text = content.split("music_payout")[1]; var val = text.split('value="')[1].split('"')[0]; var name = text.split('name="')[1].split('"')[0]; GM_xmlhttpRequest({ method: 'POST', url: 'http://' + window.location.hostname + '/overview/music_payout/', headers: {'Content-type': 'application/x-www-form-urlencoded'}, data: encodeURI(name+"="+val), onload: function(responseDetails) { } }); } } }}); } if (PGu_getValue("minMoney", 0) > 0) { var price = Number(document.getElementsByClassName("icon bottle")[0].innerHTML.split(">")[1].match(/\d+/)); if (price >= PGu_getValue("bottleprice")) { GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/overview/', onload:function(responseDetails) { var content = responseDetails.responseText; var fass = content.split("Fassungsverm")[1].match(/[\d.,]+/); var maxmoney = Number(fass[0].replace(/[.,]/g,'')); var money = Number(document.getElementsByClassName("icon money")[0].innerHTML.split(">")[1].match(/[\d,.]+/)[0].replace(/[.,]/g, '')); if (money < maxmoney && money/100 < PGu_getValue("minMoney", 0)) GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/stock/bottle/', onload:function(responseDetails) { var content = responseDetails.responseText; var maxmenge = Math.floor((Math.min(PGu_getValue("minMoney", 0)*100, maxmoney)-money)/price) + 1; var menge = Math.min(maxmenge, Number(content.split('id="max"')[1].split('value="')[1].split('"')[0])); if (menge > 0) GM_xmlhttpRequest({ method: 'POST', url: 'http://' + window.location.hostname + '/stock/bottle/sell/', headers: {'Content-type': 'application/x-www-form-urlencoded'}, data: encodeURI('chkval='+price+"&max="+menge+"&sum="+menge), onload: function(responseDetails) { } }); }}); }}); } } // alert(PGu_getValue("minigame_value")); CheckForUpdate(); CheckMinigame(); CheckNewMinigame(); CheckEnemygame(); //var ghosts = document.getElementsByClassName("ghost_container").length; //if (ghosts > 0) alert (ghosts + " Geist" + (ghosts>1?"er":"")); GM_xmlhttpRequest({method:"GET", url: 'http://' + window.location.hostname + '/city/plundershop/', onload:function(responseDetails) { }}); if (PGu_getValue(nameLastCollectTime, -1) == -1) { var keys = GM_listValues(); for (i = 0; i < keys.length; i++) { var val = keys[i]; if (val.indexOf("-") != -1 || val.indexOf("pennersturm") != -1) GM_deleteValue(val); } PGu_setValue(nameLastCollectTime, 0); } var c=1; var posci = document.getElementById("enemy_info")?0:-1; if (posci != -1) posci = document.getElementById("enemy_info").innerHTML.indexOf('enemy_counter_info'); if (posci != -1) posci = document.getElementById("enemy_info").innerHTML.substr(posci+20,100).indexOf("counter"); if (posci != -1) c=2; try{ fcounter = document.getElementById("counter"+c).innerHTML; counter = document.getElementById("counter"+(c+1)).innerHTML; if (trimString(counter) == done0) // is the time 00:00 ? counter = done; } catch(err){ } var now = new Date(); var day = now.getDay(); var hour = now.getHours(); if (PGu_getValue("AutoPetCollect", false)) { var cDay = PGu_getValue("AutoPetCollectDay", "0000000"); var cBeg = PGu_getValue("AutoPetCollectBegH", 0); var cEnd = PGu_getValue("AutoPetCollectEndH", 0); if (cDay.substr(day, 1) == "1" && ((cBeg < cEnd && hour >= cBeg && hour <= cEnd) || (cBeg >= cEnd && (hour >= cBeg || hour < cEnd)))) DoPetCollect(); } if(window.location.pathname.indexOf("/activities/crime/") != -1){ var buttons = document.getElementsByClassName("button_area"); for (i = 0; i < buttons.length; i++) insertCheckBox3(buttons[i], i); } else if(window.location.pathname.indexOf("/activities/") != -1){ var timeOptions = document.getElementsByName("time")[0]; timeOptions.selectedIndex = PGu_getValue(nameLastCollectTime,0); insertCheckBox(); insertCheckBox2(); } else if(window.location.pathname.indexOf("/overview/") != -1){ insertCheckBox4(); } if (fcounter == done && counter == done || PGu_getValue("AutoCrime", false) && PGu_getValue("AutoCrimeFkt", 0) > 0 && counter == done) submit(); else { var lastURL = PGu_getValue("AutoCollURL", ""); if (lastURL != "") { PGu_setValue ("AutoCollURL", ""); window.location.replace( lastURL ); } else { PGu_setValue(nameTime, time); PGu_setValue("AskedForCollect", 0); checkInterval = window.setInterval(check,intervalTime); } } }