Set Arrival Time Experimental

Set the desired arrival time in Tribal Wars and the script will automatically send the attack

目前為 2017-11-21 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Set Arrival Time Experimental
  3. // @description Set the desired arrival time in Tribal Wars and the script will automatically send the attack
  4. // @author FunnyPocketBook
  5. // @version 1.0
  6. // @date 21-11-2017
  7. // @namespace FunnyPocketBook
  8. // @include https://uk*.tribalwars.co.uk/game.php?village=*&screen=place&try=confirm
  9. // @include https://ch*.staemme.ch/game.php?village=*&screen=place&try=confirm
  10. // @include https://frs*.guerretribale.fr/game.php?village=*&screen=place&try=confirm
  11. // ==/UserScript==
  12.  
  13. // CHANGE THESE NUMBERS TO GET THE CORRECT ARRIVAL TIME - higher number means more delay. Change "windows.delayTime" before "intervalTime" and only change "intervalTime" if you can't get it quite correct with only "delayTime"
  14. window.delayTime = 2; // Set delay in ms
  15. window.intervalTime = 1; // Set interval in ms
  16.  
  17. // DON'T MESS WITH THIS IF YOU DON'T KNOW WHAT YOU ARE DOING
  18. window.showArrTimeTr = document.createElement("tr"); // Create button called btn as a link because any button causes the attack to launch
  19. window.showArrTimeTd = document.createElement("td");
  20. var pEle = document.getElementById("troop_confirm_go"); // Button comes after this element
  21. var btn = document.createElement("a"); // Create button called btn as a link because any button causes the attack to launch
  22. btn.setAttribute("id", "arrTime"); // Set ID of btn
  23. btn.setAttribute("style", "cursor:pointer;"); // Set cursor to pointer
  24. pEle.parentNode.insertBefore(btn, pEle.nextElementSibling); // Place btn after pEle
  25. var t = document.createTextNode("Set arrival time"); // btn has this text
  26. btn.appendChild(t); // Append text to btn
  27.  
  28. btn.onclick = function() {
  29. "use strict";
  30. var time = document.getElementsByClassName("relative_time")[0].textContent.slice(-8);
  31. var lalau = document.getElementById("date_arrival");
  32. window.input = prompt("Please enter desired arrival time", time);
  33. window.ms = parseInt(prompt("Please enter approximate milliseconds", "000"));
  34. window.showArrTimeTr.appendChild(window.showArrTimeTd);
  35. lalau.parentNode.parentNode.insertBefore(window.showArrTimeTr, lalau.parentNode[1]);
  36. window.showArrTimeTd.innerHTML = "You set the arrival time to: ~" + window.input + ":" + window.ms;
  37. window.showArrTimeTd.setAttribute("colspan", "2");
  38. window.showArrTimeTd.setAttribute("id", "showArrTime");
  39. };
  40.  
  41. setInterval(function captcha() {
  42. if(document.getElementsByClassName("rc-anchor-center-item").length > 0) {
  43. document.getElementsByClassName("rc-anchor-center-item")[0].click();
  44. } else{}
  45. }, 10);
  46.  
  47. setInterval(function retime() {
  48. "use strict";
  49. var arrival = document.getElementsByClassName("relative_time")[0].textContent;
  50. if(arrival.slice(-8) === window.input)
  51. {
  52. setTimeout(function() {document.getElementById("troop_confirm_go").click();}, window.ms + window.delayTime);
  53. } else {}
  54. }, window.intervalTime);