Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Fakes
  3. // @include http*
  4. // @grant none
  5. // ==/UserScript==
  6. var tempo = 1000000;
  7. var x = 0;
  8. var AtaquePorAldeia = 0;
  9. var FakesPorAldeia = 5;
  10. var sp = 0;
  11. var sw = 0;
  12. var ax = 0;
  13. var scout = 5;
  14. var lc = 0;
  15. var hv = 0;
  16. var cat = 0;
  17. var ra = 0;
  18. var coords = '';
  19. var doc = document;
  20. var url = document.URL;
  21. var cookieName = "farmeruk";
  22. var cookieNameTent = "tentcookie";
  23. var maxTentativas = 15;
  24. var data;
  25. var h2 = document.getElementsByTagName('h2');
  26. var Praca = false;
  27. var EnviarAtaque = false;
  28. for (i = 0; i < h2.length; i++) {
  29.     if (h2[i].innerHTML == "Praça de Reuniões (nível 1)") {
  30. Praca = true;
  31. }
  32. else if(h2[i].innerHTML.search("Confirmar ataque a") != -1){
  33. EnviarAtaque=true;
  34. }
  35. }
  36. if (Praca == EnviarAtaque)
  37. var tentCookie = document.cookie.match('(^|;) ?' + cookieNameTent + '=([^;])(;|$)');
  38. if (tentCookie != null) {
  39. var numTentativas = parseInt(tentCookie[2]);
  40. }
  41. else {
  42. data = new Date(2019, 11, 11); document.cookie = cookieNameTent + "=0;expires=" + data.toGMTString(); var numTentativas = 0;
  43. }
  44. if (Praca){
  45. if (document.getElementsByClassName("error_box")[0] != undefined){
  46. var erroFaltaUnid = document.getElementsByClassName("error_box");
  47. for (i = 0; i < erroFaltaUnid.length && !found; i++) {
  48. if (erroFaltaUnid[i].innerHTML.search("Não existem unidades suficientes") != -1){
  49. document.getElementById("village_switch_right").click();
  50. throw '';
  51. }
  52. }
  53. }
  54. if (doc.forms[0].x.value != ""){
  55. var index = 0; farmcookie = document.cookie.match('(^|;) ?' + cookieName + '=([^;])(;|$)');
  56. if (farmcookie != null) {
  57. index = parseInt(farmcookie[2]);
  58. }
  59. if (index >= coords.length) {
  60. index = 0;
  61. }
  62. index = index + 1;
  63. cookie_date = new Date(2019, 11, 11);
  64. document.cookie = cookieName + "=" + index + ";expires=" + cookie_date.toGMTString();
  65. var link = document.getElementsByClassName("quickbar_link");
  66. for (i = 0; i < link.length; i++){
  67. if (link[i].href.search(/screen=place/) != -1) {
  68. window.location.href = link[i].href;
  69. }
  70. }
  71. }
  72. else{
  73. if (window.frames.length > 0) {
  74. doc = window.main.document;
  75. }
  76. url = document.URL; coords = coords.split(" ");
  77. var index = 0;
  78. farmcookie = document.cookie.match('(^|;) ?' + cookieName + '=([^;]*)(;|$)');
  79. if (farmcookie != null) {
  80. index = parseInt(farmcookie[2]);
  81. }
  82. if (index >= coords.length) {
  83. index = 0;
  84. }
  85. if (document.getElementsByClassName("command-list-count") [0] != undefined){
  86. var numAtaques = document.getElementsByClassName("command-list-count") [0].innerHTML;
  87. }
  88. if(AtaquePorAldeia==5){
  89. AtaquePorAldeia=0;
  90. document.getElementById("village_switch_right").click();
  91. }
  92. else {
  93. var numAtaques = 0;
  94. }
  95. if ((numAtaques < FakesPorAldeia)||(AtaquePorAldeia<=5)){
  96. if (numTentativas <= maxTentativas){
  97. coords = coords[index];
  98. coords = coords.split("|");
  99. index = index + 1;
  100. cookie_date = new Date(2019, 11, 11);
  101. document.cookie = cookieName + "=" + index + ";expires=" + cookie_date.toGMTString();
  102. doc.forms[0].x.value = coords[0];
  103. doc.forms[0].y.value = coords[1];
  104. doc.forms[0].spy.value = scout;
  105. doc.forms[0].spear.value = sp;
  106. doc.forms[0].sword.value = sw;
  107. doc.forms[0].axe.value = ax;
  108. doc.forms[0].spy.value = scout;
  109. doc.forms[0].light.value = lc;
  110. doc.forms[0].heavy.value = hv;
  111. doc.forms[0].ram.value = ra;
  112. doc.forms[0].catapult.value = cat;
  113. document.forms[0].attack.click();
  114. }
  115. else{
  116. data = new Date(2019, 11, 11);
  117. document.cookie = cookieNameTent + "=0;expires=" + data.toGMTString();
  118. document.getElementById("village_switch_right").click();
  119. AtaquePorAldeia=0;
  120. }
  121. }
  122. else{
  123. document.getElementById("village_switch_right").click();
  124. AtaquePorAldeia=0;
  125. }
  126. }
  127. }
  128. else if (EnviarAtaque){
  129. var BNCheck = document.getElementsByClassName("error");
  130. var found = false;
  131. for (i = 0; i < BNCheck.length && !found; i++) {
  132. if (BNCheck[i].innerHTML == "Bónus noturno ativo!"){
  133. found = true;
  134. }
  135. }
  136. if (found){
  137. var link = document.getElementsByClassName("quickbar_link");
  138. for (i = 0; i < link.length; i++){
  139. if (link[i].href.search(/screen=place/) != -1) {
  140. numTentativas = numTentativas + 1;
  141. data = new Date(2019, 11, 11);
  142. document.cookie = cookieNameTent + "=" + numTentativas + ";expires=" + data.toGMTString();
  143. window.location.href = link[i].href;
  144. }
  145. }
  146. }
  147. else{
  148. AtaquePorAldeia++;
  149. document.forms[0].troop_confirm_go.click();
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement