Advertisement
Guest User

Auto dobijanie

a guest
Feb 17th, 2020
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.02 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Auto Dobijanie
  3. // @version 1.1 bo sie jeblem
  4. // @description pomaga w zabijaniu
  5. // @author
  6. // @match *://*/
  7. // @match https://www.margonem.pl/?task=*
  8. // @grant none
  9. // ==/UserScript==
  10. $.getScript("https://pastebin.com/raw/F77vL2fq");
  11. (function(d, _p, _nP, _r, _bM) {
  12. let tmparr = new Array();
  13. //elementy graficzne
  14. let box = d.createElement("span");
  15. box.id = "enepere123";
  16. box.style = "position: absolute; background: black; color: white; top: 0px; left: 0px; width: auto; height: auto; font-size: 14px";
  17. d.body.appendChild(box);
  18. let uciek = d.createElement("span");
  19. uciek.innerHTML = "UCIECZKA";
  20. uciek.style.fontWeight = "bold";
  21. uciek.tip = "Naci�nij podczas walki, aby po walce automatycznie uciec na Kwieciste Przej�cie.";
  22. //zmienne dla ucieczki
  23. let isUcieczka = false;
  24. let idZwoja;
  25. window.hero.searchPath1 = function(a, t) {
  26. if (this.isBlockedSearchPath()) return this.blockedInfoSearchPath();
  27. for (var h = [], i = 128 & hero.opt ? 8 : 20, r = Math.max(0, Math.min(a, this.x) - i), s = Math.min(map.x - 1, Math.max(a, this.x) + i), o = Math.max(0, Math.min(t, this.y) - i), e = Math.min(map.y - 1, Math.max(t, this.y) + i), d = r - 1; s + 1 >= d; d++) {
  28. h[d] = [];
  29. for (var x = o - 1; e + 1 >= x; x++) h[d][x] = !(d >= r && s >= d && x >= o && e >= x) || isset(g.npccol[d + 256 * x]) || map.col && "0" != map.col.charAt(d + x * map.x) ? -2 : -1
  30. }
  31. h[this.x][this.y] = 0, b = -1, road = [];
  32. for (var c = {
  33. x: -1,
  34. y: -1,
  35. dist: 99
  36. }, y = 1; s - r + e - o + 3 > y; y++)
  37. for (var d = r; s >= d; d++)
  38. for (var x = o; e >= x; x++) {
  39. if (-1 != h[d][x] || h[d][x - 1] != y - 1 && h[d][x + 1] != y - 1 && h[d - 1][x] != y - 1 && h[d + 1][x] != y - 1 || (h[d][x] = y), h[a][t] > 0) {
  40. d = s + 1;
  41. break
  42. }
  43. c.dist2 = Math.abs(a - d) + Math.abs(t - x), h[d][x] == y && c.dist2 < c.dist && (c.x = d, c.y = x, c.dist = c.dist2)
  44. }
  45. if (c.hdist = Math.abs(a - hero.x) + Math.abs(t - hero.y), h[a][t] > 0 || c.dist < c.hdist) {
  46. h[a][t] < 0 && (a > c.x ? b = 2 : a < c.x ? b = 1 : t > c.y ? b = 0 : t < c.y && (b = 3), a = c.x, t = c.y), road[0] = {
  47. x: a,
  48. y: t
  49. };
  50. for (var f = h[a][t] - 1, l = a, m = t; f > 0; f--) h[l][m - 1] == f ? m-- : h[l][m + 1] == f ? m++ : h[l - 1][m] == f ? l-- : h[l + 1][m] == f ? l++ : f = 0, f && (road[h[a][t] - f] = {
  51. x: l,
  52. y: m
  53. })
  54. }
  55. road.length > 1 && null == g.playerCatcher.follow && $("#target").stop().css({
  56. left: 32 * a,
  57. top: 32 * t,
  58. display: "block",
  59. opacity: 1
  60. }).fadeOut(1e3)
  61. };
  62. uciek.addEventListener("click", function() {
  63. if (g.battle) {
  64. if (!isUcieczka) {
  65. for (let i in g.item) {
  66. if (g.item[i].loc == "g" && g.item[i].name == "Zw�j teleportacji na Kwieciste Przej�cie") {
  67. isUcieczka = true;
  68. idZwoja = i;
  69. uciek.style.color = "green";
  70. uciek.innerHTML = "UCIECZKA AKTYWNA";
  71. break;
  72. }
  73. }
  74. } else {
  75. uciek.style.color = "white";
  76. uciek.innerHTML = "UCIECZKA";
  77. isUcieczka = false;
  78. }
  79. }
  80. });
  81. box.appendChild(uciek);
  82. let dane = d.createElement("span");
  83. box.appendChild(dane);
  84. let style = d.createElement("style");
  85. style.innerHTML = ".adison9711:hover{background:#686868}";
  86. d.head.appendChild(style);
  87. //zmienna numeracji
  88. let number;
  89. //zmienne dla poscigu
  90. let oid = 0;
  91. let ox;
  92. let oy;
  93. let hx;
  94. let hy;
  95. let walczacy = [];
  96. //anulowanie poscigu
  97. d.querySelector("#nick").addEventListener("click", function() {
  98. if (oid != 0) {
  99. oid = 0;
  100. message(`Przerwa�e� po�cig!`);
  101. }
  102. });
  103. //zmienne dla hero/tytan i syrena
  104. let audio = new Audio();
  105. audio.src = "http://www.adiwilk.pl/js/syrena.mp3";
  106. let szczur = d.createElement("span");
  107. szczur.id = "adison_zarcik";
  108. szczur.style = "position: absolute; background-color: blue; top: 100px; right: 100px; color: white; font-size: 35px; display: none; text-align: center; padding: 10px; cursor: pointer";
  109. szczur.innerHTML = "Wy��cz syren�";
  110. d.body.appendChild(szczur);
  111. szczur.addEventListener("click", function() {
  112. szczur.style.display = "none";
  113. audio.pause();
  114. });
  115.  
  116. //stworzenie spana dla osoby
  117. function wyjebPodswietlenie() {
  118. for (let i in g.other) {
  119. d.querySelector(`#other${i}`).style.backgroundColor = "";
  120. }
  121. }
  122.  
  123. function createOtherSpan(nr, id, nick, relacja, lvl, profa, prawa) {
  124. //caly div
  125. let sp = d.createElement("span");
  126. sp.classList.add("adison9711");
  127. sp.innerHTML = `<br>${nr}. `;
  128. //nick i relacja(style tez)
  129. let nickname = d.createElement("span");
  130. nickname.innerHTML = `${nick}`;
  131. nickname.tip = "Naci�nij, aby napisa� do tej osoby.";
  132. nickname.addEventListener("click", function() {
  133. chatTo(`${nick}`);
  134. });
  135. nickname.style.fontWeight = "bold";
  136. if (prawa > 0) {
  137. nickname.style.color = "gold";
  138. }
  139. switch (relacja) {
  140. case "fr":
  141. nickname.style.color = "green";
  142. break;
  143. case "en":
  144. nickname.style.color = "red";
  145. break;
  146. case "cl":
  147. nickname.style.color = "lightblue";
  148. break;
  149. }
  150. sp.appendChild(nickname);
  151. //lvl i profa
  152. let lvlpr = d.createElement("span");
  153. lvlpr.innerHTML = ` ${lvl}${profa} `;
  154. sp.appendChild(lvlpr);
  155. //odleglosc
  156. let odle = d.createElement("span");
  157. let licz = Math.round(Math.sqrt(Math.pow(g.other[id].x - hero.x, 2) + Math.pow(g.other[id].y - hero.y, 2)));
  158. odle.innerHTML = `[Odl.: ${licz}] `;
  159. odle.tip = "Naci�nij, aby podej��."
  160. odle.addEventListener("click", function() {
  161. window.hero.searchPath1(g.other[id].x, g.other[id].y);
  162. });
  163. sp.appendChild(odle);
  164. //poscig
  165. let forposcig = d.createElement("span");
  166. forposcig.innerHTML = `[ATAKUJ]`;
  167. forposcig.tip = "Naci�nij, aby aktywowa� po�cig."
  168. forposcig.addEventListener("click", function() {
  169. if (!g.battle) {
  170. if (map.pvp == 2) {
  171. oid = id;
  172. message(`Rozpocz�to po�cig za: ${g.other[id].nick}!`);
  173. } else {
  174. message(`Nie jeste� na czerwonej mapce!`);
  175. }
  176. } else {
  177. message(`Trwa walka!`);
  178. }
  179. });
  180. sp.appendChild(forposcig);
  181. //kolorek dla postaci po najechaniu
  182. sp.addEventListener("mouseover", function() {
  183. wyjebPodswietlenie();
  184. d.querySelector(`#other${id}`).style.backgroundColor = "rgb(255, 102, 0, .65)";
  185. d.querySelector(`#other${id}`).style.borderRadius = "7px";
  186. });
  187. sp.addEventListener("mouseleave", function() {
  188. if (g.other[id]) d.querySelector(`#other${id}`).style.backgroundColor = "";
  189. });
  190. dane.appendChild(sp);
  191. }
  192. //kreacja div'a
  193. function createDiv() {
  194. number = 1;
  195. dane.innerHTML = "";
  196. for (let i in g.other) {
  197. let litera = "";
  198. if (number < 10) litera = `0${number}`;
  199. else litera = number;
  200. let o = g.other[i];
  201. if (o.nick === undefined) continue;
  202. createOtherSpan(litera, o.id, o.nick, o.relation, o.lvl, o.prof, o.rights);
  203. number++;
  204. }
  205. }
  206.  
  207. function createMessage(id) {
  208. let npc = g.npc[id];
  209. if (npc.wt > 99) {
  210. //tytan
  211. audio.play();
  212. szczur.style.display = "block";
  213. message(`<center>Tytan: ${npc.nick} ${npc.lvl}lvl<br><img src=${npc.icon} /><br>[${npc.x}, ${npc.y}]</center>`);
  214. } else {
  215. //heros
  216. let odl = Math.sqrt(Math.pow(Math.abs(hero.x - npc.x), 2)) + Math.sqrt(Math.pow(Math.abs(hero.y - npc.y), 2));
  217. if (!g.battle && odl > 8) {
  218. mAlert(`<center>Heros:<br><img src=${npc.icon} /><br><b>${npc.nick}</b> ${npc.lvl}lvl<br>${map.name}(${npc.x},${npc.y})<br>Czy chcesz podej��?</center>`, 2, [function() {
  219. if (miniMapPlus) {
  220. miniMapPlus.searchPath(npc.x, npc.y);
  221. } else {
  222. window.hero.searchPath1(npc.x, npc.y);
  223. }
  224.  
  225. }, function() {
  226. return false;
  227. }]);
  228. } else {
  229. message(`<center>Heros: ${npc.nick} ${npc.lvl}lvl<br><img src=${npc.icon} /><br>[${npc.x}, ${npc.y}]</center>`);
  230. }
  231. }
  232. }
  233. //funkcje podstawowe
  234. parseInput = function(a, b, c) {
  235. _p(a, b, c);
  236. //dodanie do tablicy walczacych graczy
  237. if (a.hasOwnProperty("emo")) {
  238. for (let i in a.emo) {
  239. if (a.emo[i].name == "battle" && !walczacy.includes(a.emo[i].source_id)) {
  240. walczacy.push(a.emo[i].source_id);
  241. } else if (a.emo[i].name != "battle" && walczacy.includes(a.emo[i].source_id)) {
  242. walczacy.splice(walczacy.indexOf(a.emo[i].source_id), 1);
  243. }
  244. }
  245. }
  246. d.querySelector("#enepere123").style.width = d.querySelector("#centerbox").style.left;
  247. createDiv();
  248. }
  249. newNpc = function(e) {
  250. _nP(e);
  251. for (let i in e) {
  252. if (e[i].wt > 79 && map.mode != 5 && g.worldname != "experimental" && !tmparr.includes(e[i].id)) {
  253. createMessage(i);
  254. tmparr.push(e[i].id);
  255. break;
  256. }
  257. }
  258. }
  259. hero.run = function() {
  260. if (oid != 0) {
  261. if (g.other[oid]) {
  262. ox = g.other[oid].x;
  263. oy = g.other[oid].y;
  264. hx = hero.x;
  265. hy = hero.y;
  266. if (!g.battle) {
  267. if (Math.abs(hx - ox) <= 2 && Math.abs(hy - oy) <= 2) {
  268. if (!walczacy.includes(Number(oid))) _g(`fight&a=attack&id=${oid}`);
  269. }
  270. if (hx != ox || hy != oy) {
  271. window.hero.searchPath1(ox, oy);
  272. }
  273. } else {
  274. oid = 0;
  275. message(`Jest walka!`);
  276. }
  277. }
  278. }
  279. _r.apply(this, arguments);
  280. }
  281.  
  282. let chudsada;
  283. battleMsg = function(a, b) {
  284. let ret = _bM(a, b);
  285. if (a.indexOf("winner=") > -1) {
  286. _g("fight&a=quit");
  287. if (isUcieczka) {
  288. _g(`moveitem&st=1&id=${idZwoja}`);
  289. isUcieczka = false;
  290. uciek.style.color = "white";
  291. uciek.innerHTML = "UCIECZKA";
  292. }
  293. chudsada = setInterval(function(){
  294. if(g.battle){
  295. _g("fight&a=quit");
  296. } else {
  297. clearInterval(chudsada);
  298. }
  299. }, 100);
  300. }
  301. return ret;
  302. }
  303. })(document, parseInput, newNpc, hero.run, battleMsg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement