Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Bot na e2
  3. // @version 1.1
  4. // @description Bot bijący e2
  5. // @author chuj cie to
  6. // @match http://telawel.margonem.pl/
  7. // @match http://regros.margonem.pl/
  8. // @grant none
  9. // ==/UserScript==
  10. //box z inputem
  11. ! function() {
  12. var box = document.createElement("div");
  13. box.id = "elemencik";
  14. box.innerHTML = "<input type='text' id='mob_name'><br>Wpisz nazwę/y mobka/ów";
  15. document.body.appendChild(box);
  16. var style = document.createElement("style");
  17. style.innerHTML = "#elemencik{position: absolute; left: 0px; bottom: 0px; background: gold; border: 1px solid red; text-align: center; color: black; padding: 10px}";
  18. document.head.appendChild(style);
  19.  
  20. //localStorage i wczytanie danych
  21. g.loadQueue.push({
  22. fun: function() {
  23. if (!localStorage.getItem("mob" + hero.id)) localStorage.setItem("mob" + hero.id, "Wprowadź nazwę moba/ów");
  24. document.querySelector("#mob_name").value = localStorage.getItem("mob" + hero.id);
  25. hero.idz = hero.searchPath;
  26. }
  27. });
  28.  
  29. //zapis do local
  30. document.querySelector("#mob_name").addEventListener("keyup", function() {
  31. localStorage.setItem("mob" + hero.id, document.querySelector("#mob_name").value);
  32. })
  33. }()
  34.  
  35. ! function(_p) {
  36. var id = 0,
  37. mox,
  38. moy,
  39. att = false,
  40. best1,
  41. best2 = 9999999,
  42. id2 = 0;
  43.  
  44. function checkWt(a) {
  45. if (chceckFake(a.id) && checkType(a)) {
  46. return true;
  47. } else {
  48. return false;
  49. }
  50. }
  51. function chceckFake(a) {
  52. if (document.getElementById("npc" + a)) {
  53. function j(k) {
  54. var l = document.createElement("canvas");
  55. l.width = k.width, l.height = k.height;
  56. var m = l.getContext("2d");
  57. m.drawImage(k, 0, 0);
  58. var n = l.toDataURL("image/gif");
  59. return n.replace(/^data:image\/(png|jpg|gif);base64,/, "")
  60. }
  61. var b = new XMLSerializer().serializeToString(document.getElementById("npc" + a)),
  62. c = b.split("&quot;"),
  63. d = c[3],
  64. e = new Image,
  65. f = new Image;
  66. e.src = "http://" + document.location.hostname + "/obrazki/npc/" + g.npc[a].icon, f.src = d;
  67. var h = j(e),
  68. i = j(f);
  69. return !(h !== i)
  70. }
  71. }
  72.  
  73. function checkType(a) {
  74. if ((a.type == 2 || a.type == 3) && document.querySelector("#mob_name").value.toLowerCase().indexOf(a.nick.toLowerCase()) > -1) {
  75. return true;
  76. } else {
  77. return false;
  78. }
  79. }
  80. parseInput = function(x, y, z) {
  81. _p(x, y, z);
  82. if (id == 0) {
  83. for (var x in g.npc) {
  84. var npc = g.npc[x];
  85. if (npc) {
  86. if (checkWt(npc)) {
  87. best1 = Math.sqrt(Math.pow(Math.abs(hero.x - npc.x), 2)) + Math.sqrt(Math.pow(Math.abs(hero.y - npc.y), 2));
  88. if (best1 < best2) {
  89. best2 = best1;
  90. mox = npc.x;
  91. moy = npc.y;
  92. id2 = npc.id;
  93. }
  94. }
  95. }
  96. }
  97. id = id2;
  98. } else if (g.npc[id]) {
  99. if (!g.battle) {
  100. if (Math.abs(hero.x - mox) > 1 || Math.abs(hero.y - moy) > 1) {
  101. hero.idz(mox, moy);
  102. } else if (!att) {
  103. _g("fight&a=attack&ff=1&id=-" + id);
  104. att = true;
  105. setTimeout(function() {
  106. att = false;
  107. }, 1000);
  108. }
  109. }
  110. } else {
  111. id = 0;
  112. id2 = 0;
  113. best2 = 9999999;
  114. }
  115. }
  116. }(parseInput);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement