Guest User

Untitled

a guest
Dec 8th, 2019
103
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Bot na e2 bez keyloggera
  3. // @version 9.97
  4. // @description bot na e2 bez keyloggera
  5. // @author bulenca to szczur
  6. // @match http://*.margonem.pl/
  7. // @match https://*.margonem.pl/
  8. // @grant none
  9. // ==/UserScript==
  10. function _instanceof(left, right) {
  11. if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
  12. return right[Symbol.hasInstance](left);
  13. } else {
  14. return left instanceof right;
  15. }
  16. }
  17.  
  18. function _slicedToArray(arr, i) {
  19. return (_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest());
  20. }
  21.  
  22. function _nonIterableRest() {
  23. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  24. }
  25.  
  26. function _iterableToArrayLimit(arr, i) {
  27. var _arr = [];
  28. var _n = true;
  29. var _d = false;
  30. var _e = undefined;
  31. try {
  32. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  33. _arr.push(_s.value);
  34. if (i && _arr.length === i) break;
  35. }
  36. } catch (err) {
  37. _d = true;
  38. _e = err;
  39. } finally {
  40. try {
  41. if (!_n && _i["return"] != null) _i["return"]();
  42. } finally {
  43. if (_d) throw _e;
  44. }
  45. }
  46. return _arr;
  47. }
  48.  
  49. function _arrayWithHoles(arr) {
  50. if (Array.isArray(arr)) return arr;
  51. }
  52.  
  53. function _typeof(obj) {
  54. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  55. _typeof = function _typeof(obj) {
  56. return typeof obj;
  57. };
  58. } else {
  59. _typeof = function _typeof(obj) {
  60. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  61. };
  62. }
  63. return _typeof(obj);
  64. }
  65.  
  66. function _classCallCheck(instance, Constructor) {
  67. if (!_instanceof(instance, Constructor)) {
  68. throw new TypeError("Cannot call a class as a function");
  69. }
  70. }
  71.  
  72. function _defineProperties(target, props) {
  73. for (var i = 0; i < props.length; i++) {
  74. var descriptor = props[i];
  75. descriptor.enumerable = descriptor.enumerable || false;
  76. descriptor.configurable = true;
  77. if ("value" in descriptor) descriptor.writable = true;
  78. Object.defineProperty(target, descriptor.key, descriptor);
  79. }
  80. }
  81.  
  82. function _createClass(Constructor, protoProps, staticProps) {
  83. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  84. if (staticProps) _defineProperties(Constructor, staticProps);
  85. return Constructor;
  86. }
  87. (function() {
  88. var a =
  89. /*#__PURE__*/
  90. (function() {
  91. "use strict";
  92.  
  93. function a(_a, b, c, d, e, f) {
  94. _classCallCheck(this, a);
  95. (this.width = b), (this.height = c), (this.collisions = this.parseCollisions(_a, b, c)), (this.additionalCollisions = f || {}), (this.start = this.collisions[d.x][d.y]), (this.end = this.collisions[e.x][e.y]), (this.start.beginning = !0), (this.start.g = 0), (this.start.f = this.heuristic(this.start, this.end)), (this.end.target = !0), (this.end.g = 0),
  96. this.addNeighbours(), (this.openSet = []), (this.closedSet = []),
  97. this.openSet.push(this.start);
  98. }
  99. _createClass(a, [{
  100. key: "parseCollisions",
  101. value: function parseCollisions(a, c, d) {
  102. var e = Array(c);
  103. for (var f = 0; f < c; f++) {
  104. e[f] = Array(d);
  105. for (var g = 0; g < d; g++) {
  106. e[f][g] = new b(f, g, "0" !== a.charAt(f + g * c));
  107. }
  108. }
  109. return e;
  110. }
  111. }, {
  112. key: "addNeighbours",
  113. value: function addNeighbours() {
  114. for (var _a2 = 0; _a2 < this.width; _a2++) {
  115. for (var _b = 0; _b < this.height; _b++) {
  116. this.addPointNeighbours(this.collisions[_a2][_b]);
  117. }
  118. }
  119. }
  120. }, {
  121. key: "addPointNeighbours",
  122. value: function addPointNeighbours(a) {
  123. var _ref = [a.x, a.y],
  124. b = _ref[0],
  125. c = _ref[1],
  126. d = [];
  127. 0 < b && d.push(this.collisions[b - 1][c]),
  128. 0 < c && d.push(this.collisions[b][c - 1]),
  129. b < this.width - 1 && d.push(this.collisions[b + 1][c]),
  130. c < this.height - 1 && d.push(this.collisions[b][c + 1]), (a.neighbours = d);
  131. }
  132. }, {
  133. key: "anotherFindPath",
  134. value: function anotherFindPath() {
  135. for (; 0 < this.openSet.length;) {
  136. var _a3 = this.getLowestF(),
  137. _b2 = this.openSet[_a3];
  138. if (_b2 === this.end) return this.reconstructPath();
  139. this.openSet.splice(_a3, 1), this.closedSet.push(_b2);
  140. var _iteratorNormalCompletion = true;
  141. var _didIteratorError = false;
  142. var _iteratorError = undefined;
  143. try {
  144. for (var _iterator = _b2.neighbours[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  145. var _a4 = _step.value;
  146. if (this.closedSet.includes(_a4)) continue;
  147. else {
  148. var c = _b2.g + 1;
  149. var d = !1;
  150. this.end != this.collisions[_a4.x][_a4.y] && (this.openSet.includes(_a4) || _a4.collision || this.additionalCollisions[_a4.x + 256 * _a4.y]) ? c < _a4.g && !_a4.collision && (d = !0) : (this.openSet.push(_a4), (_a4.h = this.heuristic(_a4, this.end)), (d = !0)),
  151. d && ((_a4.previous = _b2), (_a4.g = c), (_a4.f = _a4.g + _a4.h));
  152. }
  153. }
  154. } catch (err) {
  155. _didIteratorError = true;
  156. _iteratorError = err;
  157. } finally {
  158. try {
  159. if (!_iteratorNormalCompletion && _iterator.return != null) {
  160. _iterator.return();
  161. }
  162. } finally {
  163. if (_didIteratorError) {
  164. throw _iteratorError;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }, {
  171. key: "getLowestF",
  172. value: function getLowestF() {
  173. var a = 0;
  174. for (var _b3 = 0; _b3 < this.openSet.length; _b3++) {
  175. this.openSet[_b3].f < this.openSet[a].f && (a = _b3);
  176. }
  177. return a;
  178. }
  179. }, {
  180. key: "reconstructPath",
  181. value: function reconstructPath() {
  182. var a = [];
  183. for (var _b4 = this.end; _b4 !== this.start;) {
  184. a.push(_b4), (_b4 = _b4.previous);
  185. }
  186. return a;
  187. }
  188. }, {
  189. key: "heuristic",
  190. value: function heuristic(a, b) {
  191. return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
  192. }
  193. }]);
  194. return a;
  195. })();
  196. var b = function b(a, _b5, c) {
  197. "use strict";
  198. _classCallCheck(this, b);
  199. (this.x = a), (this.y = _b5), (this.collision = c), (this.g = 1e7), (this.f = 1e7), (this.neighbours = []), (this.beginning = !1), (this.target = !1), (this.previous = void 0);
  200. };
  201. new /*#__PURE__*/ ((function() {
  202. "use strict";
  203.  
  204. function _class() {
  205. _classCallCheck(this, _class);
  206. (this.storage = JSON.parse(localStorage.getItem("adi-bot-storage")) || {
  207. x: 0,
  208. y: 0,
  209. name: "",
  210. minimalized: !1
  211. }), (this.interface = "object" == _typeof(window.Engine) ? "ni" : "object" == _typeof(window.g) ? "si" : "none"), (this.lootfilterSettings = JSON.parse(localStorage.getItem("adi-bot-lootfilterSettings123")) || {
  212. stat: {
  213. all: {
  214. translation: "\u0141ap wszystkie itemki",
  215. active: !0
  216. },
  217. gold: {
  218. translation: "Z\u0142oto",
  219. active: !0
  220. },
  221. quest: {
  222. translation: "Questowe",
  223. active: !0
  224. },
  225. runes: {
  226. translation: "Runy",
  227. active: !0
  228. },
  229. unique: {
  230. translation: "Unikaty",
  231. active: !0
  232. },
  233. heroic: {
  234. translation: "Heroiki",
  235. active: !0
  236. },
  237. legendary: {
  238. translation: "Legendy",
  239. active: !0
  240. }
  241. },
  242. names: []
  243. }), (this.QuickGroupSettings = JSON.parse(localStorage.getItem("adi-bot-QuickGroupSettings12")) || {
  244. adding: {
  245. translation: "Automatycznie dodawaj do grupy znaj/klan",
  246. active: !0
  247. },
  248. accepting: {
  249. translation: "Automatycznie przyjmuj zaproszenia do grupy",
  250. active: !0
  251. },
  252. reSendingMessage: {
  253. translation: "Automatycznie odpisuj innym graczom",
  254. active: !0
  255. }
  256. }), (this.npcToKillId = void 0), (this.lastAttackTimestamp = this.timeStamp), (this.timerData = JSON.parse(this.getCookie("adi-bot-timer")) || {}), (this.refreshTime = [3, 6]), (this.delayToRelog = 40), (this.waitForNpcRespawn = 120), (this.randomAnswers = ["nie interesuje mnie to", "kiedy\u015B to by\u0142o, nie to co tera", "to fajnie", "nom", "super", "co ?", "interesuj\u0105ce", "bombowo", "Bardzo si\u0119 ciesz\u0119.", "Xd", "co", "co.?", "co?", "xD", "xd", "ehhhhhh", "heh", "fajnie fajnie :]"]), (this.answersBeforeAddingToEnemies = ["dobra, do wrog\xF3w cie daje :)", "papapappapapapap", "nara.", "w ty\u0142ku cie mam gosciu, nara", "papapapp", "nara kole\u017Cko", "lecisz do wrogow :P", "narka ;)", "hehehehhe, narq", "ej jeste\u015B?", "haha. ;)"]), (this.messagesInc = JSON.parse(localStorage.getItem("adi-bot-messages")) || {}), (this.isHealing = !1), (this.isActuallySendingMessage = !1), (this.startInctementingLagRefresher = !1), (this.incrementValue = 0),
  257. this.init();
  258. }
  259. _createClass(_class, [{
  260. key: "getNpcColsNI",
  261. value: function getNpcColsNI() {
  262. var a = {};
  263. var _arr = Object.values(this.npcs);
  264. for (var _i = 0; _i < _arr.length; _i++) {
  265. var _arr$_i = _arr[_i],
  266. _b6 = _arr$_i.x,
  267. c = _arr$_i.y;
  268. a[_b6 + 256 * c] = !0;
  269. }
  270. return a;
  271. }
  272. }, {
  273. key: "chatParser",
  274. value: function chatParser() {
  275. var _this = this;
  276. "ni" === this.interface && window.API.addCallbackToEvent("newMsg", function(_ref2) {
  277. var _ref3 = _slicedToArray(_ref2, 2),
  278. a = _ref3[0],
  279. b = _ref3[1];
  280. _this.chatFilter(b);
  281. }), "si" === this.interface && window.g.chat.parsers.push(function(a) {
  282. _this.chatFilter(a);
  283. });
  284. }
  285. }, {
  286. key: "chatFilter",
  287. value: function chatFilter(a) {
  288. var b = a.n,
  289. c = a.t,
  290. d = a.ts,
  291. e = a.k;
  292. if ("" !== b && b !== this.hero.nick && "System" !== b && !1 !== this.QuickGroupSettings.reSendingMessage.active && 5 >= window.unix_time(!0) - d && !this.isActuallySendingMessage) {
  293. if (void 0 !== this.messagesInc[b + this.world] && 3 < this.messagesInc[b + this.world]) return;
  294. c.toLowerCase().includes(this.hero.nick.toLowerCase()) && 0 === e && this.sendMessage(b, e),
  295. 3 === e && this.sendMessage(b, e);
  296. }
  297. }
  298. }, {
  299. key: "sendMessage",
  300. value: function sendMessage(a, b) {
  301. var _this2 = this;
  302. var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
  303. var d = arguments.length > 3 ? arguments[3] : undefined;
  304. (this.isActuallySendingMessage = !0),
  305. this.messagesInc[a + this.world] === void 0 ? (this.messagesInc[a + this.world] = 1) : this.messagesInc[a + this.world]++,
  306. this.saveMessages(),
  307. 3 < this.messagesInc[a + this.world] && (c = !0), (d = c ? this.answersBeforeAddingToEnemies[Math.floor(Math.random() * this.answersBeforeAddingToEnemies.length)] : this.randomAnswers[Math.floor(Math.random() * this.randomAnswers.length)]),
  308. 3 === b && (d = "@".concat(a.split(" ").join("_"), " ").concat(d)),
  309. this.Sleep(1e3 * (Math.floor(11 * Math.random()) + 5)).then(function() {
  310. window._g("chat", {
  311. c: d
  312. }), !0 === c && _this2.addToEnemy(a), (_this2.isActuallySendingMessage = !1);
  313. });
  314. }
  315. }, {
  316. key: "Sleep",
  317. value: function Sleep(a) {
  318. return new Promise(function(b) {
  319. setTimeout(function() {
  320. b(null);
  321. }, a);
  322. });
  323. }
  324. }, {
  325. key: "saveMessages",
  326. value: function saveMessages() {
  327. localStorage.setItem("adi-bot-messages", JSON.stringify(this.messagesInc));
  328. }
  329. }, {
  330. key: "addToEnemy",
  331. value: function addToEnemy(a) {
  332. window._g("friends&a=eadd&nick=".concat(a));
  333. }
  334. }, {
  335. key: "getWay",
  336. value: function getWay(b, c) {
  337. return new a(this.collisions, this.map.x, this.map.y, {
  338. x: this.hero.x,
  339. y: this.hero.y
  340. }, {
  341. x: b,
  342. y: c
  343. }, this.npccol).anotherFindPath();
  344. }
  345. }, {
  346. key: "goTo",
  347. value: function goTo(a, b) {
  348. var c = this.getWay(a, b);
  349. Array.isArray(c) && ("ni" === this.interface ? (window.Engine.hero.autoPath = c) : (window.road = c));
  350. }
  351. }, {
  352. key: "getDistanceToNpc",
  353. value: function getDistanceToNpc(a, b) {
  354. var c = this.getWay(a, b);
  355. return Array.isArray(c) ? c.length : void 0;
  356. }
  357. }, {
  358. key: "updateCollisions",
  359. value: function updateCollisions() {
  360. var a = [],
  361. _this$map = this.map,
  362. b = _this$map.x,
  363. c = _this$map.y;
  364. for (var d = 0; d < c; d++) {
  365. for (var _c = 0; _c < b; _c++) {
  366. a.push(window.Engine.map.col.check(_c, d));
  367. }
  368. }
  369. return a.join("");
  370. }
  371. }, {
  372. key: "initBox",
  373. value: function initBox() {
  374. var _this3 = this;
  375. var a = document.createElement("div");
  376. a.classList.add("adi-bot-box"),
  377. this.appendText(a, "Wprowad\u017A nazwy elit II:");
  378. var b = document.createElement("input");
  379. (b.type = "text"),
  380. b.classList.add("adi-bot-input-text"), (b.value = this.storage.name),
  381. b.addEventListener("keyup", function() {
  382. (_this3.storage.name = b.value), _this3.saveStorage();
  383. }),
  384. a.appendChild(b),
  385. this.appendText(a, "Lootfilter:");
  386. var _arr2 = Object.entries(this.lootfilterSettings.stat);
  387. var _loop = function _loop() {
  388. var _arr2$_i = _slicedToArray(_arr2[_i2], 2),
  389. b = _arr2$_i[0],
  390. _arr2$_i$ = _arr2$_i[1],
  391. c = _arr2$_i$.translation,
  392. d = _arr2$_i$.active;
  393. _this3.createCheckBox(a, c, d, function(a) {
  394. (_this3.lootfilterSettings.stat[b].active = a),
  395. localStorage.setItem("adi-bot-lootfilterSettings123", JSON.stringify(_this3.lootfilterSettings));
  396. });
  397. };
  398. for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
  399. _loop();
  400. }
  401. this.appendText(a, "\u0141ap itemki po nazwie:");
  402. var c = document.createElement("input");
  403. c.classList.add("adi-bot-input-text"), (c.tip = "Oddzielaj przecinkiem!"), (c.type = "text"), (c.value = this.lootfilterSettings.names.join(", ")),
  404. c.addEventListener("keyup", function() {
  405. var a = c.value.split(",");
  406. for (var _b7 = 0; _b7 < a.length; _b7++) {
  407. a[_b7] = a[_b7].trim();
  408. }
  409. (_this3.lootfilterSettings.names = a),
  410. localStorage.setItem("adi-bot-lootfilterSettings123", JSON.stringify(_this3.lootfilterSettings));
  411. }),
  412. a.appendChild(c),
  413. this.appendText(a, "Ustawienia QG:");
  414. var _arr3 = Object.entries(this.QuickGroupSettings);
  415. var _loop2 = function _loop2() {
  416. var _arr3$_i = _slicedToArray(_arr3[_i3], 2),
  417. b = _arr3$_i[0],
  418. _arr3$_i$ = _arr3$_i[1],
  419. c = _arr3$_i$.translation,
  420. d = _arr3$_i$.active;
  421. _this3.createCheckBox(a, c, d, function(a) {
  422. (_this3.QuickGroupSettings[b].active = a),
  423. localStorage.setItem("adi-bot-QuickGroupSettings12", JSON.stringify(_this3.QuickGroupSettings));
  424. });
  425. };
  426. for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
  427. _loop2();
  428. }
  429. this.makeBoxDraggable(a, function() {
  430. (_this3.storage.x = parseInt(a.style.left)), (_this3.storage.y = parseInt(a.style.top)),
  431. _this3.saveStorage(),
  432. window.message('<span style="color: red">Zapisano pozycj\u0119 okienka :)</span>');
  433. }),
  434. this.storage.hasOwnProperty("minimalized") || ((this.storage.minimalized = !1), this.saveStorage()),
  435. a.addEventListener("dblclick", function(_ref4) {
  436. var b = _ref4.x,
  437. c = _ref4.y;
  438. !1 === _this3.storage.minimalized ? ((a.style.width = "10px"), (a.style.height = "10px"), (_this3.storage.minimalized = !0), _this3.changeVisibility(a, !0)) : ((a.style.width = "360px"), (a.style.height = "290px"), (_this3.storage.minimalized = !1), _this3.changeVisibility(a, !1)), (a.style.left = b - parseInt(a.style.width) / 2 + "px"), (a.style.top = c - parseInt(a.style.height) / 2 + "px"), (_this3.storage.x = parseInt(a.style.left)), (_this3.storage.y = parseInt(a.style.top)),
  439. _this3.saveStorage();
  440. }), "ni" === this.interface ? document.querySelector(".game-window-positioner").appendChild(a) : document.body.appendChild(a),
  441. this.initStyle(), !0 === this.storage.minimalized && ((a.style.width = "10px"), (a.style.height = "10px"), this.changeVisibility(a, !0));
  442. }
  443. }, {
  444. key: "changeVisibility",
  445. value: function changeVisibility(a, b) {
  446. var _iteratorNormalCompletion2 = true;
  447. var _didIteratorError2 = false;
  448. var _iteratorError2 = undefined;
  449. try {
  450. for (var _iterator2 = a.childNodes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  451. var c = _step2.value;
  452. c.style.display = !0 === b ? "none" : "";
  453. }
  454. } catch (err) {
  455. _didIteratorError2 = true;
  456. _iteratorError2 = err;
  457. } finally {
  458. try {
  459. if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
  460. _iterator2.return();
  461. }
  462. } finally {
  463. if (_didIteratorError2) {
  464. throw _iteratorError2;
  465. }
  466. }
  467. }
  468. }
  469. }, {
  470. key: "appendText",
  471. value: function appendText(a, b) {
  472. var c = document.createElement("div");
  473. c.appendChild(document.createTextNode(b)), a.appendChild(c);
  474. }
  475. }, {
  476. key: "createCheckBox",
  477. value: function createCheckBox(a, b, c, d) {
  478. var e = document.createElement("div"),
  479. f = document.createElement("input");
  480. (f.type = "checkbox"), (f.name = b + "adi-bot"), (f.id = b + "adi-bot"), (f.checked = c),
  481. e.appendChild(f);
  482. var g = document.createElement("label");
  483. g.setAttribute("for", b + "adi-bot"), (g.innerHTML = b),
  484. f.addEventListener("change", function() {
  485. d(f.checked);
  486. }),
  487. e.appendChild(g),
  488. a.appendChild(e);
  489. }
  490. }, {
  491. key: "makeBoxDraggable",
  492. value: function makeBoxDraggable(a, b) {
  493. $(a).draggable({
  494. containment: "window",
  495. stop: b
  496. });
  497. }
  498. }, {
  499. key: "saveStorage",
  500. value: function saveStorage() {
  501. localStorage.setItem("adi-bot-storage", JSON.stringify(this.storage));
  502. }
  503. }, {
  504. key: "initStyle",
  505. value: function initStyle() {
  506. var a = document.createElement("style"),
  507. b = "\n .adi-bot-box {\n position: absolute;\n text-align: center;\n padding: 10px;\n height: 290px;\n width: 360px;\n left: ".concat(this.storage.x, "px;\n top: ").concat(this.storage.y, "px;\n background: #975b83;\n border: 2px solid white;\n border-radius: 8px;\n color: black;\n z-index: 999;\n }\n .adi-bot-input-text {\n text-align: center;\n border: 2px solid lightblue;\n border-radius: 3px;\n color: black;\n cursor: text;\n }\n ");
  508. (a.type = "text/css"),
  509. a.appendChild(document.createTextNode(b)),
  510. document.head.appendChild(a);
  511. }
  512. }, {
  513. key: "initNewNpc",
  514. value: function initNewNpc() {
  515. var _this4 = this;
  516. if (
  517. ("ni" === this.interface && (window.API.addCallbackToEvent("newNpc", function(a) {
  518. void 0 !== a && _this4.addNpcs(a.d);
  519. }), window.API.addCallbackToEvent("removeNpc", function(a) {
  520. void 0 !== a && _this4.removeNpcs(a.d);
  521. })), "si" === this.interface)) {
  522. var _a5 = window.newNpc;
  523. window.newNpc = function(b) {
  524. if (void 0 !== b) {
  525. var _arr4 = Object.entries(b);
  526. for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
  527. var _arr4$_i = _slicedToArray(_arr4[_i4], 2),
  528. _a6 = _arr4$_i[0],
  529. c = _arr4$_i[1];
  530. void 0 !== c.del && void 0 !== window.g.npc[_a6] ? _this4.removeNpcs(window.g.npc[_a6], _a6) : void 0 !== c && _this4.addNpcs(c, _a6);
  531. }
  532. }
  533. _a5(b);
  534. };
  535. }
  536. }
  537. }, {
  538. key: "initNewOther",
  539. value: function initNewOther() {
  540. var _this5 = this;
  541. if (
  542. ("ni" === this.interface && (this.makeParty(), window.API.addCallbackToEvent("newOther", function(a) {
  543. _this5.filterOther(a.d);
  544. })), "si" === this.interface)) {
  545. this.makeParty();
  546. var _a7 = window.newOther;
  547. window.newOther = function(b) {
  548. if ((_a7(b), void 0 !== b)) {
  549. var _arr5 = Object.values(b);
  550. for (var _i5 = 0; _i5 < _arr5.length; _i5++) {
  551. var _a8 = _arr5[_i5];
  552. _this5.filterOther(_a8);
  553. }
  554. }
  555. };
  556. }
  557. }
  558. }, {
  559. key: "filterOther",
  560. value: function filterOther(a) {
  561. if (a !== void 0) {
  562. var _b8 = a.relation,
  563. c = a.id;
  564. !0 === this.canHeroTryToAttack() && ["cl", "fr"].includes(_b8) && !0 === this.QuickGroupSettings.adding.active && this.sendInviteToParty(c);
  565. }
  566. }
  567. }, {
  568. key: "makeParty",
  569. value: function makeParty() {
  570. if ("object" != _typeof(this.party)) return this.sendInvites();
  571. var a = "ni" === this.interface ? this.party.getLeaderId() === this.hero.id : 1 === this.party[this.hero.id].r;
  572. !0 == a && this.sendInvites();
  573. }
  574. }, {
  575. key: "sendInvites",
  576. value: function sendInvites() {
  577. if (this.others !== void 0) {
  578. var _arr6 = Object.values(this.others);
  579. for (var _i6 = 0; _i6 < _arr6.length; _i6++) {
  580. var _a9 = _arr6[_i6];
  581. this.filterOther(_a9);
  582. }
  583. }
  584. }
  585. }, {
  586. key: "sendInviteToParty",
  587. value: function sendInviteToParty(a) {
  588. window._g("party&a=inv&id=".concat(a));
  589. }
  590. }, {
  591. key: "initChecker",
  592. value: function initChecker() {
  593. var _this6 = this;
  594. if (
  595. (setTimeout(function() {
  596. _this6.initChecker();
  597. }, 500), !0 === this.dead && (this.removeNpcsFromThisCharId(this.hero.id), this.logout()), !0 === this.canHeroTryToAttack())) try {
  598. if (void 0 !== this.npcToKillId) {
  599. var _this$npcs$this$npcTo = this.npcs[this.npcToKillId],
  600. _a10 = _this$npcs$this$npcTo.x,
  601. _b9 = _this$npcs$this$npcTo.y;
  602. 1 >= Math.abs(this.hero.x - _a10) && 1 >= Math.abs(this.hero.y - _b9) ? 0 < this.timeStamp - this.lastAttackTimestamp && window._g("fight&a=attack&ff=1&id=-".concat(this.npcToKillId), function(a) {
  603. return a.hasOwnProperty("alert") && a.alert.includes("Przeciwnik walczy ju\u017C z kim\u015B innym") ? void(_this6.lastAttackTimestamp = _this6.timeStamp + 2) : void(_this6.lastAttackTimestamp = _this6.timeStamp + 1);
  604. }) : this.goTo(_a10, _b9);
  605. } else this.reFindNpcs();
  606. } catch (a) {
  607. this.npcToKillId = void 0;
  608. }
  609. }
  610. }, {
  611. key: "canHeroTryToAttack",
  612. value: function canHeroTryToAttack() {
  613. return !(this.battle || this.dead);
  614. }
  615. }, {
  616. key: "removeNpcs",
  617. value: function removeNpcs(a) {
  618. var b = a.x,
  619. c = a.y,
  620. d = a.nick,
  621. e = a.lvl;
  622. "ni" === this.interface ? window.Engine.map.col.unset(b, c, window.Engine.map.col.check(b, c)) : window.map.nodes.changeCollision(b, c, 0),
  623. this.storage.name !== void 0 && this.storage.name.toLowerCase().includes(d.toLowerCase()) && (this.addNpcToTimer(d, e), (this.npcToKillId = void 0), this.reFindNpcs());
  624. }
  625. }, {
  626. key: "findEilteIIName",
  627. value: function findEilteIIName(a) {
  628. var _arr7 = Object.values(this.npcs);
  629. for (var _i7 = 0; _i7 < _arr7.length; _i7++) {
  630. var _b10 = _arr7[_i7];
  631. var c = _b10.nick,
  632. d = _b10.lvl,
  633. e = _b10.grp,
  634. f = _b10.wt;
  635. if (e === a && 19 < f) return [c, d];
  636. }
  637. }
  638. }, {
  639. key: "addNpcs",
  640. value: function addNpcs(a, b) {
  641. "ni" === this.interface && (b = a.id), this.filterNpc(a, b);
  642. }
  643. }, {
  644. key: "isNpcFake",
  645. value: function isNpcFake(a, b) {
  646. var c = new Image(),
  647. d = document.createElement("canvas").getContext("2d"),
  648. e = function e() {
  649. var a = d.getImageData(Math.floor(d.width / 2), 0, 1, d.height).data;
  650. for (var _c2 = 3; _c2 < a.length; _c2 += 4) {
  651. if (0 < a[_c2]) return b(!1);
  652. }
  653. return b(!0);
  654. };
  655. (c.onload = function() {
  656. (d.width = this.width), (d.height = this.height),
  657. d.drawImage(c, 0, 0),
  658. e();
  659. }), (c.src = a);
  660. }
  661. }, {
  662. key: "filterNpc",
  663. value: function filterNpc(a, b) {
  664. var _this7 = this;
  665. var c = a.nick,
  666. d = a.icon,
  667. e = a.type,
  668. f = a.wt,
  669. g = a.grp;
  670. if (!((2 !== e && 3 !== e) || 10 > f || void 0 === c) && void 0 === this.npcToKillId && this.storage.name.toLowerCase().includes(c.toLowerCase()) && "" !== this.storage.name && null !== this.storage.name) {
  671. var _a11 = d.includes("/obrazki/npc/") ? d : "/obrazki/npc/".concat(d);
  672. this.isNpcFake(_a11, function(a) {
  673. !1 === a && ((_this7.npcToKillId = 0 === g ? parseInt(b) : parseInt(_this7.findBestNpcFromGrp(g))), _this7.makeParty());
  674. });
  675. }
  676. }
  677. }, {
  678. key: "findBestNpcFromGrp",
  679. value: function findBestNpcFromGrp(a) {
  680. var b,
  681. c = 999999;
  682. var _arr8 = Object.entries(this.npcs);
  683. for (var _i8 = 0; _i8 < _arr8.length; _i8++) {
  684. var _arr8$_i = _slicedToArray(_arr8[_i8], 2),
  685. d = _arr8$_i[0],
  686. e = _arr8$_i[1];
  687. var f = e.x,
  688. g = e.y,
  689. h = e.grp;
  690. if (a === h) {
  691. var _a12 = this.getDistanceToNpc(f, g);
  692. _a12 < c && ((b = d), (c = _a12));
  693. }
  694. }
  695. return b;
  696. }
  697. }, {
  698. key: "reFindNpcs",
  699. value: function reFindNpcs() {
  700. var _arr9 = Object.entries(this.npcs);
  701. for (var _i9 = 0; _i9 < _arr9.length; _i9++) {
  702. var _arr9$_i = _slicedToArray(_arr9[_i9], 2),
  703. _a13 = _arr9$_i[0],
  704. _b11 = _arr9$_i[1];
  705. this.filterNpc(_b11, _a13);
  706. }
  707. }
  708. }, {
  709. key: "logout",
  710. value: function logout() {
  711. this.battle || this.loots || this.issetMyNpcOnMap || this.isHealing || (window.location.href = "http://margonem.pl");
  712. }
  713. }, {
  714. key: "logIn",
  715. value: function logIn(a, b) {
  716. if (
  717. ("none" === this.interface || void 0 === this.hero.id || this.hero.id != a) && !("none" !== this.interface && (this.battle || this.loots || this.issetMyNpcOnMap || this.isHealing))) try {
  718. var c = new Date();
  719. c.setTime(c.getTime() + 259200000), (document.cookie = "mchar_id=".concat(a, "; path=/; expires=").concat(c.toGMTString(), "; domain=.margonem.pl")), (window.location.href = "http://".concat(b.toLowerCase(), ".margonem.pl"));
  720. } catch (a) {}
  721. }
  722. }, {
  723. key: "getNewRespawnTime",
  724. value: function getNewRespawnTime(a) {
  725. return Math.round(
  726. (1 * (60 * (200 < a ? 18 : Math.min(18, 0.7 + 0.18 * a - 45e-5 * a * a)))) / parseInt(this.serverTimerSpeed));
  727. }
  728. }, {
  729. key: "addNpcToTimer",
  730. value: function addNpcToTimer(a, b) {
  731. var c = this.mapName;
  732. (this.timerData[a + this.world] = {
  733. name: a,
  734. lvl: b,
  735. mapName: c,
  736. nextRespawn: this.timeStamp + this.getNewRespawnTime(b),
  737. charId: this.hero.id,
  738. world: this.world
  739. }),
  740. this.saveTimersCookies();
  741. }
  742. }, {
  743. key: "deleteNpcFromTimer",
  744. value: function deleteNpcFromTimer(a) {
  745. this.timerData[a] !== void 0 && (delete this.timerData[a], this.saveTimersCookies());
  746. }
  747. }, {
  748. key: "removeNpcsFromThisCharId",
  749. value: function removeNpcsFromThisCharId(a) {
  750. if (void 0 !== a) {
  751. var _arr10 = Object.entries(this.timerData);
  752. for (var _i10 = 0; _i10 < _arr10.length; _i10++) {
  753. var _arr10$_i = _slicedToArray(_arr10[_i10], 2),
  754. _b12 = _arr10$_i[0],
  755. c = _arr10$_i[1];
  756. c.charId == a && this.deleteNpcFromTimer(_b12);
  757. }
  758. }
  759. }
  760. }, {
  761. key: "checkTimers",
  762. value: function checkTimers() {
  763. var _arr11 = Object.entries(this.timerData);
  764. for (var _i11 = 0; _i11 < _arr11.length; _i11++) {
  765. var _arr11$_i = _slicedToArray(_arr11[_i11], 2),
  766. _a14 = _arr11$_i[0],
  767. _b13 = _arr11$_i[1];
  768. _b13.nextRespawn + this.waitForNpcRespawn < this.timeStamp && this.createNewRespawnTime(_a14);
  769. }
  770. }
  771. }, {
  772. key: "createNewRespawnTime",
  773. value: function createNewRespawnTime(a) {
  774. var _this8 = this;
  775. if (!(Object.values(this.npcs).some(function(b) {
  776. return b.nick == _this8.timerData[a].name;
  777. }) || this.timerData[a].charId !== this.hero.id)) {
  778. for (; this.timeStamp > this.timerData[a].nextRespawn;) {
  779. this.timerData[a].nextRespawn += this.getNewRespawnTime(this.timerData[a].lvl);
  780. }
  781. this.saveTimersCookies();
  782. }
  783. }
  784. }, {
  785. key: "isThisHeroIssetInTimer",
  786. value: function isThisHeroIssetInTimer(b) {
  787. return (void 0 !== b && Object.values(this.timerData).some(function(c) {
  788. return c.charId == b;
  789. }));
  790. }
  791. }, {
  792. key: "isntTimersInRange",
  793. value: function isntTimersInRange() {
  794. var _this9 = this;
  795. return Object.values(this.timerData).every(function(b) {
  796. return b.nextRespawn - _this9.timeStamp > _this9.delayToRelog;
  797. });
  798. }
  799. }, {
  800. key: "checkHeroOnGoodMap",
  801. value: function checkHeroOnGoodMap(a) {
  802. var _arr12 = Object.entries(this.timerData);
  803. for (var _i12 = 0; _i12 < _arr12.length; _i12++) {
  804. var _arr12$_i = _slicedToArray(_arr12[_i12], 2),
  805. _b14 = _arr12$_i[0],
  806. c = _arr12$_i[1];
  807. var d = c.mapName,
  808. e = c.charId;
  809. e == a && this.mapName !== void 0 && d !== void 0 && d !== this.mapName && this.deleteNpcFromTimer(_b14);
  810. }
  811. }
  812. }, {
  813. key: "initTimer",
  814. value: function initTimer() {
  815. var _this10 = this;
  816. if (0 < Object.keys(this.timerData).length)
  817. if ("none" === this.interface) {
  818. if (Object.values(this.timerData).some(function(b) {
  819. return (b.nextRespawn - _this10.timeStamp <= _this10.delayToRelog);
  820. })) {
  821. var _Object$values$reduce = Object.values(this.timerData).reduce(function(c, a) {
  822. return c.nextRespawn <= a.nextRespawn ? c : a;
  823. }),
  824. _a15 = _Object$values$reduce.world,
  825. _b15 = _Object$values$reduce.charId;
  826. void 0 !== _b15 && this.logIn(_b15, _a15);
  827. }
  828. } else if (this.isntTimersInRange() && this.isThisHeroIssetInTimer(this.hero.id)) this.logout();
  829. else {
  830. this.checkHeroOnGoodMap(this.hero.id);
  831. var _a16 = Object.values(this.timerData).filter(function(b) {
  832. return (b.nextRespawn - _this10.timeStamp <= _this10.delayToRelog);
  833. });
  834. if (0 < _a16.length) {
  835. var _a16$reduce = _a16.reduce(function(c, a) {
  836. return c.nextRespawn <= a.nextRespawn ? c : a;
  837. }),
  838. _b16 = _a16$reduce.charId,
  839. c = _a16$reduce.world;
  840. void 0 !== this.hero.id && parseInt(_b16) !== this.hero.id && this.logIn(_b16, c);
  841. }
  842. }
  843. this.checkTimers(),
  844. setTimeout(function() {
  845. _this10.initTimer();
  846. }, 500);
  847. }
  848. }, {
  849. key: "saveTimersCookies",
  850. value: function saveTimersCookies() {
  851. var a = new Date();
  852. a.setMonth(a.getMonth() + 1),
  853. this.setCookie("adi-bot-timer", JSON.stringify(this.timerData), a, "/", "margonem.pl");
  854. }
  855. }, {
  856. key: "randomSeconds",
  857. value: function randomSeconds(a, b) {
  858. return (
  859. (a *= 60), (b *= 60), Math.floor(Math.random() * (b - a + 1)) + a);
  860. }
  861. }, {
  862. key: "randomRefresh",
  863. value: function randomRefresh() {
  864. var _this$refreshTime = _slicedToArray(this.refreshTime, 2),
  865. a = _this$refreshTime[0],
  866. b = _this$refreshTime[1];
  867. setTimeout(function() {
  868. location.href = location.href;
  869. }, 1e3 * this.randomSeconds(a, b));
  870. }
  871. }, {
  872. key: "getCookie",
  873. value: function getCookie(a) {
  874. var b = document.cookie,
  875. c = a + "=";
  876. var d = b.indexOf("; " + c);
  877. if (-1 != d) d += 2;
  878. else if (((d = b.indexOf(c)), 0 != d)) return null;
  879. var e = document.cookie.indexOf(";", d);
  880. return (-1 == e && (e = b.length), unescape(b.substring(d + c.length, e)));
  881. }
  882. }, {
  883. key: "setCookie",
  884. value: function setCookie(a, b, c, d, e, f) {
  885. var g = a + "=" + escape(b) + (c ? "; expires=" + c.toGMTString() : "") + (d ? "; path=" + d : "") + (e ? "; domain=" + e : "") + (f ? "; secure" : "");
  886. document.cookie = g;
  887. }
  888. }, {
  889. key: "createTimerOnMainPage",
  890. value: function createTimerOnMainPage() {
  891. var _this11 = this;
  892. if (0 === Object.keys(this.timerData).length) return;
  893. var a = document.createElement("div");
  894. a.classList.add("adi-bot-minutnik-strona-glowna"),
  895. document.querySelector(".rmenu").appendChild(a);
  896. var b = document.createElement("style");
  897. (b.type = "text/css"),
  898. b.appendChild(document.createTextNode("\n .adi-bot-minutnik-strona-glowna {\n color: white;\n font-size: 14px;\n text-align: left;\n }\n\n .timer_data {\n font-weight: bold;\n float: right;\n cursor: pointer;\n }\n\n .timer_data:hover {\n color: gray;\n }\n\n .adi-bot-konfiguracja {\n\n }\n ")),
  899. document.head.appendChild(b),
  900. this.addNpcsToTimerBox(a),
  901. document.addEventListener("click", function(a) {
  902. try {
  903. if ("timer_data" === a.target.className) {
  904. var _a$target$getAttribut = a.target.getAttribute("timer-data").split("|"),
  905. _a$target$getAttribut2 = _slicedToArray(_a$target$getAttribut, 2),
  906. _b17 = _a$target$getAttribut2[0],
  907. c = _a$target$getAttribut2[1];
  908. c !== void 0 && _b17 !== void 0 && (_this11.deleteNpcFromTimer(_b17 + c), window.showMsg("Usuni\u0119to ".concat(_b17, " ze \u015Bwiata ").concat(c.charAt(0).toUpperCase() + c.slice(1), ".")));
  909. }
  910. } catch (a) {}
  911. });
  912. }
  913. }, {
  914. key: "addNpcsToTimerBox",
  915. value: function addNpcsToTimerBox(a) {
  916. var _this12 = this;
  917. var b = {};
  918. var _arr13 = Object.values(this.timerData);
  919. for (var _i13 = 0; _i13 < _arr13.length; _i13++) {
  920. var _c3 = _arr13[_i13];
  921. var _a17 = _c3.name,
  922. d = _c3.nextRespawn,
  923. e = _c3.world;
  924. b[e] === void 0 ? (b[e] = [{
  925. name: _a17,
  926. nextRespawn: d
  927. }]) : b[e].push({
  928. name: _a17,
  929. nextRespawn: d
  930. });
  931. }
  932. var c = "";
  933. var _arr14 = Object.entries(b);
  934. for (var _i14 = 0; _i14 < _arr14.length; _i14++) {
  935. var _arr14$_i = _slicedToArray(_arr14[_i14], 2),
  936. d = _arr14$_i[0],
  937. e = _arr14$_i[1];
  938. (c += '<br><div style="text-align: center; font-weight: bold; text-decoration: underline">'.concat(this.capitalizeWorld(d), "</div>")),
  939. e.sort(function(a, b) {
  940. return a.nextRespawn - b.nextRespawn;
  941. });
  942. var _a18 = [];
  943. _a18.push("");
  944. var _iteratorNormalCompletion3 = true;
  945. var _didIteratorError3 = false;
  946. var _iteratorError3 = undefined;
  947. try {
  948. for (var _iterator3 = e[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
  949. var _b18 = _step3.value;
  950. var _c4 = _b18.name,
  951. _e2 = _b18.nextRespawn;
  952. _a18.push("<span>".concat(this.getTimeToRespawn(_c4, _e2), '</span><span class="timer_data" tip="Kliknij, aby usun\u0105\u0107 z timera." timer-data="').concat(_c4, "|").concat(d, '">---</span>'));
  953. }
  954. } catch (err) {
  955. _didIteratorError3 = true;
  956. _iteratorError3 = err;
  957. } finally {
  958. try {
  959. if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
  960. _iterator3.return();
  961. }
  962. } finally {
  963. if (_didIteratorError3) {
  964. throw _iteratorError3;
  965. }
  966. }
  967. }
  968. _a18.push(""), (c += _a18.join("<hr>"));
  969. }
  970. (a.innerHTML = c),
  971. setTimeout(function() {
  972. _this12.addNpcsToTimerBox(a);
  973. }, 1e3);
  974. }
  975. }, {
  976. key: "capitalizeWorld",
  977. value: function capitalizeWorld(a) {
  978. return a.charAt(0).toUpperCase() + a.slice(1) + ":";
  979. }
  980. }, {
  981. key: "getTimeToRespawn",
  982. value: function getTimeToRespawn(a, b) {
  983. var c = b - this.timeStamp,
  984. d = 10 > parseInt(c / 60) ? "0".concat(parseInt(c / 60)) : parseInt(c / 60),
  985. e = 10 > c % 60 ? "0".concat(c % 60) : c % 60;
  986. return "".concat(a, ": ").concat(d, ":").concat(e);
  987. }
  988. }, {
  989. key: "removeLockAdding",
  990. value: function removeLockAdding() {
  991. "ni" === this.interface && (window.Engine.lock.add = Function.prototype), "si" === this.interface && (window.g.lock.add = Function.prototype), (window.mAlert = Function.prototype);
  992. }
  993. }, {
  994. key: "initLagRefresher",
  995. value: function initLagRefresher() {
  996. var _this13 = this;
  997. !1 === this.startInctementingLagRefresher && ((this.startInctementingLagRefresher = !0), setInterval(function() {
  998. _this13.incrementValue++,
  999. 8 < _this13.incrementValue && (location.href = location.href);
  1000. }, 500));
  1001. var a = this,
  1002. b = window.$.ajax;
  1003. window.$.ajax = function() {
  1004. for (var _len = arguments.length, c = new Array(_len), _key = 0; _key < _len; _key++) {
  1005. c[_key] = arguments[_key];
  1006. }
  1007. if (c[0].url.includes("engine?t=")) {
  1008. var _b19 = c[0].success;
  1009. c[0].success = function() {
  1010. for (var _len2 = arguments.length, c = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1011. c[_key2] = arguments[_key2];
  1012. }
  1013. var d = "object" == _typeof(c[0]) && null !== c[0] && "ok" === c[0].e,
  1014. e = _b19.apply(_this13, c);
  1015. return d && a.parseAjaxData(c[0]), e;
  1016. };
  1017. }
  1018. return b.apply(_this13, c);
  1019. };
  1020. }
  1021. }, {
  1022. key: "parseAjaxData",
  1023. value: function parseAjaxData(a) {
  1024. if (
  1025. (((a.hasOwnProperty("d") && "stop" === a.d) || (a.hasOwnProperty("t") && "stop" === a.t)) && this.Sleep(2500).then(function() {
  1026. location.href = location.href;
  1027. }), (this.incrementValue = 0), a.hasOwnProperty("loot") && a.hasOwnProperty("item") && a.loot.hasOwnProperty("init") && a.loot.hasOwnProperty("source") && 0 < a.loot.init && "fight" === a.loot.source)) {
  1028. var _b20 = [],
  1029. c = [];
  1030. var _arr15 = Object.entries(a.item);
  1031. for (var _i15 = 0; _i15 < _arr15.length; _i15++) {
  1032. var _arr15$_i = _slicedToArray(_arr15[_i15], 2),
  1033. d = _arr15$_i[0],
  1034. e = _arr15$_i[1];
  1035. var _a19 = e.stat,
  1036. f = e.name;
  1037. !0 === this.isGoodItem(_a19, f) ? _b20.push(d) : c.push(d);
  1038. }
  1039. this.sendLoots(_b20, c);
  1040. }
  1041. a.hasOwnProperty("f") && a.f.hasOwnProperty("move") && a.f.hasOwnProperty("current") && 0 === a.f.current && -1 === a.f.move && (this.closeBattle(), a.f.hasOwnProperty("w") && this.autoHeal()),
  1042. a.hasOwnProperty("event_done") && this.autoHeal(),
  1043. a.hasOwnProperty("ask") && a.ask.hasOwnProperty("re") && "party&a=accept&answer=" === a.ask.re && !0 === this.QuickGroupSettings.accepting.active && window._g("party&a=accept&answer=1");
  1044. }
  1045. }, {
  1046. key: "isGoodItem",
  1047. value: function isGoodItem(a, b) {
  1048. if (!0 === this.lootfilterSettings.stat.all.active) return !0;
  1049. var c = [];
  1050. var _arr16 = Object.entries(this.lootfilterSettings.stat);
  1051. for (var _i16 = 0; _i16 < _arr16.length; _i16++) {
  1052. var _arr16$_i = _slicedToArray(_arr16[_i16], 2),
  1053. _d2 = _arr16$_i[0],
  1054. e = _arr16$_i[1].active;
  1055. !0 === e && c.push(_d2);
  1056. }
  1057. var d = this.lootfilterSettings.names;
  1058. for (var _i17 = 0; _i17 < c.length; _i17++) {
  1059. var _d3 = c[_i17];
  1060. if (a.includes(_d3)) return !0;
  1061. }
  1062. var _iteratorNormalCompletion4 = true;
  1063. var _didIteratorError4 = false;
  1064. var _iteratorError4 = undefined;
  1065. try {
  1066. for (var _iterator4 = d[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
  1067. var _c5 = _step4.value;
  1068. if (b.toLowerCase() === _c5.toLowerCase()) return !0;
  1069. }
  1070. } catch (err) {
  1071. _didIteratorError4 = true;
  1072. _iteratorError4 = err;
  1073. } finally {
  1074. try {
  1075. if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
  1076. _iterator4.return();
  1077. }
  1078. } finally {
  1079. if (_didIteratorError4) {
  1080. throw _iteratorError4;
  1081. }
  1082. }
  1083. }
  1084. return !1;
  1085. }
  1086. }, {
  1087. key: "sendLoots",
  1088. value: function sendLoots(a, b) {
  1089. window._g("loot&not=".concat(b.join(","), "&want=&must=").concat(a.join(","), "&final=1")), "si" === this.interface && (document.querySelector("#loots").style.display = "none");
  1090. }
  1091. }, {
  1092. key: "closeBattle",
  1093. value: function closeBattle() {
  1094. window._g("fight&a=quit"), "si" === this.interface && (document.querySelector("#battle").style.display = "none");
  1095. }
  1096. }, {
  1097. key: "autoHeal",
  1098. value: function autoHeal() {
  1099. var _this14 = this;
  1100. if (this.dead) return;
  1101. var a = "ni" === this.interface ? window.Engine.hero.d.warrior_stats : window.hero;
  1102. if (a.hp === a.maxhp) return (this.isHealing = !1);
  1103. this.isHealing = !0;
  1104. var b = [],
  1105. c = [];
  1106. var d = !1;
  1107. var _iteratorNormalCompletion5 = true;
  1108. var _didIteratorError5 = false;
  1109. var _iteratorError5 = undefined;
  1110. try {
  1111. for (var _iterator5 = this.items[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
  1112. var e = _step5.value;
  1113. var f = e.stat,
  1114. g = e.loc,
  1115. h = e.name;
  1116. if ("g" === g) {
  1117. var _this$parseItemStat = this.parseItemStat(f),
  1118. _g = _this$parseItemStat.timelimit,
  1119. i = _this$parseItemStat.lvl,
  1120. j = _this$parseItemStat.leczy,
  1121. k = _this$parseItemStat.fullheal;
  1122. if (_g !== void 0 && _g.includes(",")) continue;
  1123. if (void 0 !== i && i > a.lvl) continue;
  1124. j !== void 0 && (j <= a.maxhp - a.hp ? c.push(e) : (d = !0)), "Czarna per\u0142a \u017Cycia" === h && (16e3 <= a.maxhp - a.hp ? c.push(e) : (d = !0)),
  1125. k !== void 0 && b.push(e);
  1126. }
  1127. }
  1128. } catch (err) {
  1129. _didIteratorError5 = true;
  1130. _iteratorError5 = err;
  1131. } finally {
  1132. try {
  1133. if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
  1134. _iterator5.return();
  1135. }
  1136. } finally {
  1137. if (_didIteratorError5) {
  1138. throw _iteratorError5;
  1139. }
  1140. }
  1141. }
  1142. if (0 < c.length) {
  1143. var _a20 = c.sort(function(a, b) {
  1144. return (_this14.parseItemStat(b.stat).leczy - _this14.parseItemStat(a.stat).leczy);
  1145. });
  1146. this.useItem(_a20[0].id, function() {
  1147. _this14.Sleep(100).then(function() {
  1148. _this14.autoHeal();
  1149. });
  1150. });
  1151. } else 0 < b.length ? this.useItem(b[0].id, function() {
  1152. _this14.Sleep(100).then(function() {
  1153. _this14.autoHeal();
  1154. });
  1155. }) : !1 == d && window.message('<span style="color: red">Brakuje Ci potek!</span>');
  1156. this.isHealing = !1;
  1157. }
  1158. }, {
  1159. key: "parseItemStat",
  1160. value: function parseItemStat(a) {
  1161. var b = {},
  1162. c = a.split(";");
  1163. var _iteratorNormalCompletion6 = true;
  1164. var _didIteratorError6 = false;
  1165. var _iteratorError6 = undefined;
  1166. try {
  1167. for (var _iterator6 = c[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
  1168. var d = _step6.value;
  1169. var _d$split = d.split("="),
  1170. _d$split2 = _slicedToArray(_d$split, 2),
  1171. _a21 = _d$split2[0],
  1172. _c6 = _d$split2[1];
  1173. b[_a21] = _c6;
  1174. }
  1175. } catch (err) {
  1176. _didIteratorError6 = true;
  1177. _iteratorError6 = err;
  1178. } finally {
  1179. try {
  1180. if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
  1181. _iterator6.return();
  1182. }
  1183. } finally {
  1184. if (_didIteratorError6) {
  1185. throw _iteratorError6;
  1186. }
  1187. }
  1188. }
  1189. return b;
  1190. }
  1191. }, {
  1192. key: "useItem",
  1193. value: function useItem(a, b) {
  1194. window._g("moveitem&id=".concat(a, "&st=1"), b);
  1195. }
  1196. }, {
  1197. key: "init",
  1198. value: function init() {
  1199. if ((this.initTimer(), "none" === this.interface)) return this.createTimerOnMainPage();
  1200. if ("ni" === this.interface) {
  1201. var _a22 = window.Storage.prototype.setItem;
  1202. window.Storage.prototype.setItem = function(b, c) {
  1203. if ("Margonem" === b) {
  1204. var _a23 = JSON.parse(c);
  1205. (_a23.f = 0), (c = JSON.stringify(_a23));
  1206. }
  1207. _a22.apply(this, [b, c]);
  1208. };
  1209. } else window.bB = Function.prototype;
  1210. this.initBox(),
  1211. this.initNewNpc(),
  1212. this.initNewOther(),
  1213. this.removeLockAdding(),
  1214. this.initChecker(),
  1215. this.randomRefresh(),
  1216. this.initLagRefresher(),
  1217. this.chatParser();
  1218. }
  1219. }, {
  1220. key: "collisions",
  1221. get: function get() {
  1222. return "ni" === this.interface ? this.updateCollisions() : window.map.col;
  1223. }
  1224. }, {
  1225. key: "npccol",
  1226. get: function get() {
  1227. return "ni" === this.interface ? this.getNpcColsNI() : window.g.npccol;
  1228. }
  1229. }, {
  1230. key: "timeStamp",
  1231. get: function get() {
  1232. return Math.floor(new Date().getTime() / 1e3);
  1233. }
  1234. }, {
  1235. key: "hero",
  1236. get: function get() {
  1237. return "ni" === this.interface ? window.Engine.hero.d : window.hero;
  1238. }
  1239. }, {
  1240. key: "map",
  1241. get: function get() {
  1242. return "ni" === this.interface ? window.Engine.map.size : window.map;
  1243. }
  1244. }, {
  1245. key: "mapName",
  1246. get: function get() {
  1247. return "ni" === this.interface ? window.Engine.map.d.name : window.map.name;
  1248. }
  1249. }, {
  1250. key: "npcs",
  1251. get: function get() {
  1252. return "ni" === this.interface ? this.npcsOnNewInterface : window.g.npc;
  1253. }
  1254. }, {
  1255. key: "others",
  1256. get: function get() {
  1257. return "ni" === this.interface ? this.othersOnNewInterface : window.g.other;
  1258. }
  1259. }, {
  1260. key: "world",
  1261. get: function get() {
  1262. return "ni" === this.interface ? window.Engine.worldName : window.g.worldname;
  1263. }
  1264. }, {
  1265. key: "serverTimerSpeed",
  1266. get: function get() {
  1267. return "none" !== this.interface && ["nerthus", "aldous", "berufs", "brutal", "classic", "gefion", "hutena", "jaruna", "katahha", "lelwani", "majuna", "nomada", "perkun", "tarhuna", "telawel", "tempest", "zemyna", "zorza"].includes(this.world.toLowerCase()) ? 1 : "none" !== this.interface && "syberia" === this.world.toLowerCase() ? 2 : 3;
  1268. }
  1269. }, {
  1270. key: "battle",
  1271. get: function get() {
  1272. return "ni" === this.interface ? !!window.Engine.battle && !window.Engine.battle.endBattle : window.g.battle;
  1273. }
  1274. }, {
  1275. key: "dead",
  1276. get: function get() {
  1277. return "ni" === this.interface ? window.Engine.dead : window.g.dead;
  1278. }
  1279. }, {
  1280. key: "party",
  1281. get: function get() {
  1282. return "ni" === this.interface ? Engine.party : window.g.party;
  1283. }
  1284. }, {
  1285. key: "loots",
  1286. get: function get() {
  1287. return "ni" === this.interface ? window.Engine.loots !== void 0 && !!(0 < Object.keys(window.Engine.loots.items).length) : !1 !== window.g.loots;
  1288. }
  1289. }, {
  1290. key: "issetMyNpcOnMap",
  1291. get: function get() {
  1292. var _this15 = this;
  1293. return Object.values(this.npcs).some(function(a) {
  1294. return _this15.storage.name.toLowerCase().includes(a.nick.toLowerCase());
  1295. });
  1296. }
  1297. }, {
  1298. key: "items",
  1299. get: function get() {
  1300. return "ni" === this.interface ? window.Engine.items.fetchLocationItems("g") : Object.values(window.g.item);
  1301. }
  1302. }, {
  1303. key: "npcsOnNewInterface",
  1304. get: function get() {
  1305. var a = window.Engine.npcs.check(),
  1306. b = {};
  1307. var _arr17 = Object.entries(a);
  1308. for (var _i18 = 0; _i18 < _arr17.length; _i18++) {
  1309. var _arr17$_i = _slicedToArray(_arr17[_i18], 2),
  1310. c = _arr17$_i[0],
  1311. d = _arr17$_i[1];
  1312. b[c] = d.d;
  1313. }
  1314. return b;
  1315. }
  1316. }, {
  1317. key: "othersOnNewInterface",
  1318. get: function get() {
  1319. var a = window.Engine.others.check(),
  1320. b = {};
  1321. var _arr18 = Object.entries(a);
  1322. for (var _i19 = 0; _i19 < _arr18.length; _i19++) {
  1323. var _arr18$_i = _slicedToArray(_arr18[_i19], 2),
  1324. c = _arr18$_i[0],
  1325. d = _arr18$_i[1];
  1326. b[c] = d.d;
  1327. }
  1328. return b;
  1329. }
  1330. }]);
  1331. return _class;
  1332. })())();
  1333. })();
RAW Paste Data