Guest User

Untitled

a guest
Sep 26th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Ikariam Pirate
  3. // @namespace http://www.userscripts.org/Ikariam Pirate
  4. // @description AutoPirate for ikariam
  5. // @version 1.0
  6. // ==/UserScript==
  7.  
  8. function click_townView(){
  9. var townView=document.evaluate("//a[@title='בחן את העיר שנבחרה']", document.body, null, 9, null).singleNodeValue;
  10. if ( townView ){ delay = getRandomInt (1000, 2000); townView.click(); }
  11. } //eof
  12.  
  13. function click_pirateFort(){
  14. var pirateFort=document.evaluate("//a[contains(@title,'מבצר הפיראטים')]", document.body, null, 9, null).singleNodeValue;
  15. if ( pirateFort ){ pirateFort.click(); }
  16. else{ delay = getRandomInt (1000, 2000); click_townView(); }
  17. } //eof
  18.  
  19. /* click_captureSmuglersBtn() is the function that keep clicking "Capture" button
  20. every 2.5 minutes.
  21. But if we are thrown out of the pirate fort, we need to get back into Town View,
  22. and then into the Pirate Fort, so we have click_townView() and click_pirateFort() too
  23. */
  24.  
  25. function click_captureSmuglersBtn(){
  26. var captureSmuglersBtn=document.evaluate("//a[contains(@class,'button capture')]", document.body, null, 9, null).singleNodeValue;
  27. if ( captureSmuglersBtn ){ captureSmuglersBtn.click();
  28. //setTimeout( clickBtn, 1500 ); // go to next city
  29. window.clearInterval(int1);
  30. setTimeout( myPause, 151000 ); // pause for 2.5 minutes and 1 sec
  31. }
  32. else{ delay = getRandomInt (1000, 2000); click_pirateFort(); }
  33. } //eof
  34.  
  35. var delay = getRandomInt (1000, 3000);
  36.  
  37. function myPause(){ int1=setInterval( click_captureSmuglersBtn, delay); }
  38.  
  39. var int1=setInterval( click_captureSmuglersBtn, delay);
  40.  
  41. //************ calculate random delays **************
  42. function getRandomInt (min, max) {
  43. return Math.floor(Math.random() * (max - min + 1)) + min;
  44. }
Add Comment
Please, Sign In to add comment