Advertisement
Guest User

dobijanie margonem

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