Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name spy bot
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://s165-fr.ogame.gameforge.com/game/index.php?page=galaxy
- // @grant none
- // ==/UserScript==
- var $ = window.jQuery;
- (function() {
- 'use strict';
- var spyCount = 0;
- var isDoneSpyingLeftSide = (localStorage.getItem("isDoneSpyingLeftSide") == "true");
- console.log("left done:" + isDoneSpyingLeftSide)
- var isDoneSpyingRightSide = (localStorage.getItem("isDoneSpyingRightSide") == "true");
- console.log("right done:" + isDoneSpyingRightSide)
- var isDoneCompletely = (isDoneSpyingLeftSide == true && isDoneSpyingRightSide == true);
- const alert = new Audio("http://freesound.org/data/previews/24/24003_118241-lq.mp3");
- // mise en page
- $("body").prepend("<br><br><br><br>");
- $("body").prepend("_________________________________________<button id=\"start\">Start</button>___________");
- $("body").prepend("<br><br>");
- var spy = function(){
- var toTheLeft = !isDoneSpyingLeftSide
- // si on a déja atteint le quota de spy, on enregistre l'accomplissement pour la direction en cours et on retourne au menu galaxie
- if (spyCount == 50){
- console.log("Sent" + spyCount + " spy missions")
- spyCount = 0
- // enregistrer Right si Left était déja fait
- if (toTheLeft == true){
- localStorage.setItem("isDoneSpyingLeftSide","true");
- }
- // sinon, c'est Left qui vient de se finir
- else {
- localStorage.setItem("isDoneSpyingRightSide","true");
- }
- // dans les deux cas, redirection
- location.href='https://s153-fr.ogame.gameforge.com/game/index.php?page=galaxy';
- return
- }
- // sinon, spy le SS
- $(".vacation_filter").remove()
- if ($(".inactive_filter .espionage").length){
- // il y a des ina
- $(".inactive_filter .espionage").first().click();
- $("tr.inactive_filter").first().remove();
- spyCount += 1;
- console.log("espionnages cumulés : " + spyCount)
- }
- // il n'y a d'ina
- else {
- // changer de SS vers la bonne direction
- if (toTheLeft == true){
- submitOnKey(37);
- }
- else {
- submitOnKey(39);
- }
- }
- // repéter self dans 1,2s à 1,7s
- let random = Math.floor(Math.random() * 200);
- setTimeout(spy, 1400 + random);
- }
- $("#start").on("click",spy)
- if (isDoneCompletely == true){
- console.log("finished")
- localStorage.setItem("isDoneSpyingLeftSide","false");
- isDoneSpyingLeftSide = Boolean(localStorage.getItem("isDoneSpyingLeftSide"));
- console.log(isDoneSpyingLeftSide)
- localStorage.setItem("isDoneSpyingRightSide","false");
- isDoneSpyingRightSide = Boolean(localStorage.getItem("isDoneSpyingRightSide"));
- console.log(isDoneSpyingRightSide)
- alert.play()
- }
- else{
- if (isDoneSpyingRightSide == true){
- console.log("finished Right")
- }
- if (isDoneSpyingLeftSide == true){
- console.log("finished Left, starting Right")
- let random = Math.floor(Math.random() * 200);
- setTimeout(spy, 1400 + random);
- }
- }
- // Your code here...
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement