CowboySoberano

Ataque Fake

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