Advertisement
SophieDebleeckere

Packet sender no archer

Aug 14th, 2020
1,408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: var popsend = 1000;
  2. var minPop = 1000;
  3. var alertWhenDone = 1;
  4. var nextVillageWhenDone = 1;
  5. var include = {
  6.     spear: 1,
  7.     sword: 1,
  8.     scout: 0,
  9.     heavy: 0,
  10.     cat: 0
  11. };
  12. var targets = 'ENTER COORDINATES HERE';
  13. var doc = (window.frames.length > 0) ? window.main.document : document;
  14.  
  15. function getTroop(a) {
  16.     return parseInt(doc.units[a].parentNode.getElementsByTagName("a")[1].innerHTML.match(/\d+/), 10);
  17. }
  18. var SP = include.spear ? getTroop("spear") : 0;
  19. var HC = include.heavy ? getTroop("heavy") : 0;
  20. var CAT = include.cat ? getTroop("catapult") : 0;
  21. var SPY = include.scout ? getTroop("spy") : 0;
  22. var SW = include.sword ? getTroop("sword") : 0;
  23. var pop = SP + SW + 2 * SPY + 8 * CAT + 4 * HC;
  24. if (pop > minPop) {
  25.     var ratio = popsend / pop;
  26.     ratio = ratio > 1 ? 1 : ratio;
  27.     doc.forms[0].spear.value = SP * ratio;
  28.     doc.forms[0].heavy.value = HC * ratio;
  29.     doc.forms[0].sword.value = SW * ratio;
  30.     doc.forms[0].catapult.value = CAT * ratio;
  31.     doc.forms[0].spy.value = SPY * ratio;
  32.     targets = targets.split(" ");
  33.     var index = 0;
  34.     var farmcookie = document.cookie.match("(^|;) ?fluffy_fake=([^;]*)(;|$)");
  35.     if (farmcookie == null) {
  36.         index = Math.floor(Math.random() * (targets.length + 1));
  37.     } else {
  38.         index = parseInt(farmcookie[2]);
  39.     }
  40.     if (index >= targets.length) index = 0;
  41.     var coord = targets[index].split("|");
  42.     index++;
  43.     cookie_date = new Date(2099, 11, 11);
  44.     document.cookie = "fluffy_fake=" + index + "; expires=" + cookie_date.toGMTString();
  45.     doc.forms[0].x.value = coord[0];
  46.     doc.forms[0].y.value = coord[1];
  47.     void(0);
  48. } else {
  49.     if (alertWhenDone) alert('done');
  50.     if (nextVillageWhenDone) {
  51.         var sitter = doc.URL.match(/t=\d+/);
  52.         sitter = sitter ? "&" + sitter : "";
  53.         window.location = "game.php?village=n" + window.game_data.village.id + "&screen=place" + sitter
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement