Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. // ==UserScript==
  2. // @name         spy bot
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://s165-fr.ogame.gameforge.com/game/index.php?page=galaxy
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. var $ = window.jQuery;
  12.  
  13.  
  14. (function() {
  15.     'use strict';
  16. var spyCount = 0;
  17. var isDoneSpyingLeftSide = (localStorage.getItem("isDoneSpyingLeftSide") == "true");
  18. console.log("left done:" + isDoneSpyingLeftSide)
  19. var isDoneSpyingRightSide = (localStorage.getItem("isDoneSpyingRightSide") == "true");
  20. console.log("right done:" + isDoneSpyingRightSide)
  21. var isDoneCompletely = (isDoneSpyingLeftSide == true && isDoneSpyingRightSide == true);
  22.  
  23.  
  24. const alert = new Audio("http://freesound.org/data/previews/24/24003_118241-lq.mp3");
  25.  
  26.  
  27.  
  28.  
  29.     // mise en page
  30.     $("body").prepend("<br><br><br><br>");
  31.     $("body").prepend("_________________________________________<button id=\"start\">Start</button>___________");
  32.     $("body").prepend("<br><br>");
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.     var spy = function(){
  40.         var toTheLeft = !isDoneSpyingLeftSide
  41.  
  42.         // 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
  43.  
  44.         if (spyCount == 50){
  45.             console.log("Sent" + spyCount + " spy missions")
  46.             spyCount = 0
  47.             // enregistrer Right si Left était déja fait
  48.             if (toTheLeft == true){
  49.                 localStorage.setItem("isDoneSpyingLeftSide","true");
  50.  
  51.             }
  52.             // sinon, c'est Left qui vient de se finir
  53.             else {
  54.                 localStorage.setItem("isDoneSpyingRightSide","true");
  55.             }
  56.             // dans les deux cas, redirection
  57.             location.href='https://s165-fr.ogame.gameforge.com/game/index.php?page=galaxy';
  58.             return
  59.         }
  60.  
  61.  
  62.         // sinon, spy le SS
  63.         $(".vacation_filter").remove()
  64.         if ($(".inactive_filter .espionage").length){
  65.             // il y a des ina
  66.             $(".inactive_filter .espionage").first().click();
  67.             $("tr.inactive_filter").first().remove();
  68.             spyCount += 1;
  69.             console.log("espionnages cumulés : " + spyCount)
  70.         }
  71.         // il n'y a d'ina
  72.         else {
  73.             // changer de SS vers la bonne direction
  74.             if (toTheLeft == true){
  75.                 submitOnKey(37);
  76.             }
  77.             else {
  78.                 submitOnKey(39);
  79.             }
  80.  
  81.  
  82.         }
  83.  
  84.         // repéter self dans 1,2s à 1,7s
  85.         let random = Math.floor(Math.random() * 200);
  86.         setTimeout(spy, 2200 + random);
  87.     }
  88.  
  89.     $("#start").on("click",spy)
  90.  
  91. if (isDoneCompletely == true){
  92.           console.log("finished")
  93.       localStorage.setItem("isDoneSpyingLeftSide","false");
  94.       isDoneSpyingLeftSide = Boolean(localStorage.getItem("isDoneSpyingLeftSide"));
  95.       console.log(isDoneSpyingLeftSide)
  96.       localStorage.setItem("isDoneSpyingRightSide","false");
  97.       isDoneSpyingRightSide = Boolean(localStorage.getItem("isDoneSpyingRightSide"));
  98.       console.log(isDoneSpyingRightSide)
  99. alert.play()
  100.     }
  101.  
  102.     else{
  103.  
  104.       if (isDoneSpyingRightSide == true){
  105.           console.log("finished Right")
  106.  
  107.     }
  108.  
  109.     if (isDoneSpyingLeftSide == true){
  110.         console.log("finished Left, starting Right")
  111.          let random = Math.floor(Math.random() * 200);
  112.         setTimeout(spy, 2200 + random);
  113.     }
  114.     }
  115.  
  116.  
  117.     // Your code here...
  118. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement