Facebook
From Sharp Leopard, 1 Week ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 52
  1. javascript:
  2. coords = "489|620 493|620 494|620 487|621 488|621 489|621 486|622 487|622 489|622 494|622 498|622 490|623 494|623 497|623 498|623 486|624 487|624 488|624 489|624 494|624 498|624 489|625 491|625 493|625 496|625 491|626 493|626 497|626 486|627 492|627 493|627 486|628 488|628 492|628 498|628 486|629 488|629 492|629 494|629 495|629 496|629 498|629 487|630 488|630 489|630 490|630 493|630 494|630 495|630 497|630 488|631 489|631 490|631 487|632 488|632 492|632 497|632 498|632".split(" ");
  3. var spear = 0; //Pikinierzy
  4. var sword = 0; //Miecznicy
  5. var axe = 120; //Topornicy
  6. var archer = 0; //Lucznicy
  7. var spy = 0; //Zwiadowcy
  8. var light = 20; //Lekka Kawaleria
  9. var marcher = 0; //Lucznicy na Koniu
  10. var heavy = 0; //Ciezka Kawaleria
  11. var ram = 1; //Tarany
  12. var catapult = 0; //Katapulty
  13. var snob = 0; //Szlachcic
  14.  
  15. var speed = 0;
  16. if(snob > 0){
  17.         speed = 35;
  18. } else if(ram > 0|| catapult > 0){
  19.         speed = 30;
  20. } else if(sword > 0){
  21.         speed = 22;
  22. } else if(spear > 0 || axe > 0 || archer > 0){
  23.         speed = 18;
  24. } else if(heavy > 0){
  25.         speed = 11;
  26. } else if(light > 0 || marcher > 0){
  27.         speed = 10;
  28. } else {
  29.         speed = 9;
  30. }
  31.  
  32. values = $("#menu_row2").find('b.nowrap').text().split("|");
  33. values[0] = values[0].replace("(","");
  34. values[1] = values[1].split(")")[0];
  35.  
  36. var startTime = '8:00:00';
  37. var endTime = '23:59:59';
  38. var date;
  39. var tmp = false;
  40.  
  41. startDate = new Date();
  42. startDate.setHours(startTime.split(":")[0]);
  43. startDate.setMinutes(startTime.split(":")[1]);
  44. startDate.setSeconds(startTime.split(":")[2]);
  45.  
  46. endDate = new Date();
  47. endDate.setHours(endTime.split(":")[0]);
  48. endDate.setMinutes(endTime.split(":")[1]);
  49. endDate.setSeconds(endTime.split(":")[2]);
  50.  
  51. index = Math.round(Math.random() * (coords.length - 1));
  52. coord = coords[index]
  53. result = coords[index].split("|");
  54. result[0] = result[0].replace("(","");
  55. result[1] = result[1].split(")")[0];
  56. a = Math.abs(values[0]-result[0]);
  57. b = Math.abs(values[1]-result[1]);
  58. c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
  59. date = Date.now();
  60. date += 1000 * 60 * speed * c;
  61. date = new Date(date);
  62. tmp = date.getHours() >= startDate.getHours() && date.getHours() <= endDate.getHours() && date.getMinutes() <= endDate.getMinutes() && date.getSeconds() <= endDate.getSeconds() && coords.length > 0;
  63.  
  64. while(tmp === false && coords.length > 0){
  65.         index = Math.round(Math.random() * (coords.length - 1));
  66.         coord = coords[index]
  67.         result = coords[index].split("|");
  68.         result[0] = result[0].replace("(","");
  69.         result[1] = result[1].split(")")[0];
  70.         a = Math.abs(values[0]-result[0]);
  71.         b = Math.abs(values[1]-result[1]);
  72.         c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
  73.         date = Date.now();
  74.         date += 1000 * 60 * 30 * c;
  75.         date = new Date(date);
  76.         tmp = date.getHours() >= startDate.getHours() && date.getHours() <= endDate.getHours() && date.getMinutes() <= endDate.getMinutes() && date.getSeconds() <= endDate.getSeconds();
  77.         coords.splice(index, 1);
  78. }
  79.  
  80. if(tmp === true){
  81.         document.getElementsByClassName("target-input-field target-input-autocomplete ui-autocomplete-input")[0].value = coord;
  82.         units("spear",spear); //Pikinierzy
  83.         units("sword",sword); //Miecznicy
  84.         units("axe",axe); //Topornicy
  85.         units("archer",archer); //Lucznicy
  86.         units("spy",spy); //Zwiadowcy
  87.         units("light",light); //Lekka Kawaleria
  88.         units("marcher",marcher); //Lucznicy na Koniu
  89.         units("heavy",heavy); //Ciezka Kawaleria
  90.         units("ram",ram); //Tarany
  91.         units("catapult",catapult) //Katapulty
  92.         units("snob",snob); //Szlachcic
  93. } else {
  94.         UI.InfoMessage('Brak wiosek do wprowadzenia lub ┼╝aden atak nie mie┼Ťci si─Ö w przedziale godzinowym 8:00:00 - 23:59:59.',8000,'error');
  95. }
  96.  
  97. function units(name, value) {
  98.         if(document.getElementById("unit_input_"+name)!== null){
  99.                 document.getElementById("unit_input_"+name).value=value;
  100.         }
  101. }