Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.30 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Bot E2
  3. // @version 1.54
  4. // @description bot na e2 w trakcie rozbudowy, dziala na NI i SI
  5. // @author Ee Bon
  6. // @match http://*.margonem.pl/
  7. // @match https://*.margonem.pl/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function _instanceof(left, right) {
  12. if (
  13. right != null &&
  14. typeof Symbol !== "undefined" &&
  15. right[Symbol.hasInstance]
  16. ) {
  17. return right[Symbol.hasInstance](left);
  18. } else {
  19. return left instanceof right;
  20. }
  21. }
  22.  
  23. function _slicedToArray(arr, i) {
  24. return (
  25. _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
  26. );
  27. }
  28.  
  29. function _nonIterableRest() {
  30. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  31. }
  32.  
  33. function _iterableToArrayLimit(arr, i) {
  34. var _arr = [];
  35. var _n = true;
  36. var _d = false;
  37. var _e = undefined;
  38. try {
  39. for (
  40. var _i = arr[Symbol.iterator](), _s;
  41. !(_n = (_s = _i.next()).done);
  42. _n = true
  43. ) {
  44. _arr.push(_s.value);
  45. if (i && _arr.length === i) break;
  46. }
  47. } catch (err) {
  48. _d = true;
  49. _e = err;
  50. } finally {
  51. try {
  52. if (!_n && _i["return"] != null) _i["return"]();
  53. } finally {
  54. if (_d) throw _e;
  55. }
  56. }
  57. return _arr;
  58. }
  59.  
  60. function _arrayWithHoles(arr) {
  61. if (Array.isArray(arr)) return arr;
  62. }
  63.  
  64. function _typeof(obj) {
  65. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  66. _typeof = function _typeof(obj) {
  67. return typeof obj;
  68. };
  69. } else {
  70. _typeof = function _typeof(obj) {
  71. return obj &&
  72. typeof Symbol === "function" &&
  73. obj.constructor === Symbol &&
  74. obj !== Symbol.prototype
  75. ? "symbol"
  76. : typeof obj;
  77. };
  78. }
  79. return _typeof(obj);
  80. }
  81.  
  82. function _classCallCheck(instance, Constructor) {
  83. if (!_instanceof(instance, Constructor)) {
  84. throw new TypeError("Cannot call a class as a function");
  85. }
  86. }
  87.  
  88. function _defineProperties(target, props) {
  89. for (var i = 0; i < props.length; i++) {
  90. var descriptor = props[i];
  91. descriptor.enumerable = descriptor.enumerable || false;
  92. descriptor.configurable = true;
  93. if ("value" in descriptor) descriptor.writable = true;
  94. Object.defineProperty(target, descriptor.key, descriptor);
  95. }
  96. }
  97.  
  98. function _createClass(Constructor, protoProps, staticProps) {
  99. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  100. if (staticProps) _defineProperties(Constructor, staticProps);
  101. return Constructor;
  102. }
  103.  
  104. (function() {
  105. var a =
  106. /*#__PURE__*/
  107. (function() {
  108. "use strict";
  109.  
  110. function a(_a, b, c, d, e, f) {
  111. _classCallCheck(this, a);
  112.  
  113. (this.width = b),
  114. (this.height = c),
  115. (this.collisions = this.parseCollisions(_a, b, c)),
  116. (this.additionalCollisions = f || {}),
  117. (this.start = this.collisions[d.x][d.y]),
  118. (this.end = this.collisions[e.x][e.y]),
  119. (this.start.beginning = !0),
  120. (this.start.g = 0),
  121. (this.start.f = this.heuristic(this.start, this.end)),
  122. (this.end.target = !0),
  123. (this.end.g = 0),
  124. this.addNeighbours(),
  125. (this.openSet = []),
  126. (this.closedSet = []),
  127. this.openSet.push(this.start);
  128. }
  129.  
  130. _createClass(a, [
  131. {
  132. key: "parseCollisions",
  133. value: function parseCollisions(a, c, d) {
  134. var e = Array(c);
  135.  
  136. for (var f = 0; f < c; f++) {
  137. e[f] = Array(d);
  138.  
  139. for (var g = 0; g < d; g++) {
  140. e[f][g] = new b(f, g, "0" !== a.charAt(f + g * c));
  141. }
  142. }
  143.  
  144. return e;
  145. }
  146. },
  147. {
  148. key: "addNeighbours",
  149. value: function addNeighbours() {
  150. for (var _a2 = 0; _a2 < this.width; _a2++) {
  151. for (var _b = 0; _b < this.height; _b++) {
  152. this.addPointNeighbours(this.collisions[_a2][_b]);
  153. }
  154. }
  155. }
  156. },
  157. {
  158. key: "addPointNeighbours",
  159. value: function addPointNeighbours(a) {
  160. var _ref = [a.x, a.y],
  161. b = _ref[0],
  162. c = _ref[1],
  163. d = [];
  164. 0 < b && d.push(this.collisions[b - 1][c]),
  165. 0 < c && d.push(this.collisions[b][c - 1]),
  166. b < this.width - 1 && d.push(this.collisions[b + 1][c]),
  167. c < this.height - 1 && d.push(this.collisions[b][c + 1]),
  168. (a.neighbours = d);
  169. }
  170. },
  171. {
  172. key: "anotherFindPath",
  173. value: function anotherFindPath() {
  174. for (; 0 < this.openSet.length; ) {
  175. var _a3 = this.getLowestF(),
  176. _b2 = this.openSet[_a3];
  177.  
  178. if (_b2 === this.end) return this.reconstructPath();
  179. this.openSet.splice(_a3, 1), this.closedSet.push(_b2);
  180. var _iteratorNormalCompletion = true;
  181. var _didIteratorError = false;
  182. var _iteratorError = undefined;
  183.  
  184. try {
  185. for (
  186. var _iterator = _b2.neighbours[Symbol.iterator](), _step;
  187. !(_iteratorNormalCompletion = (_step = _iterator.next())
  188. .done);
  189. _iteratorNormalCompletion = true
  190. ) {
  191. var _a4 = _step.value;
  192. if (this.closedSet.includes(_a4)) continue;
  193. else {
  194. var c = _b2.g + 1;
  195. var d = !1;
  196. this.end != this.collisions[_a4.x][_a4.y] &&
  197. (this.openSet.includes(_a4) ||
  198. _a4.collision ||
  199. this.additionalCollisions[_a4.x + 256 * _a4.y])
  200. ? c < _a4.g && !_a4.collision && (d = !0)
  201. : (this.openSet.push(_a4),
  202. (_a4.h = this.heuristic(_a4, this.end)),
  203. (d = !0)),
  204. d &&
  205. ((_a4.previous = _b2),
  206. (_a4.g = c),
  207. (_a4.f = _a4.g + _a4.h));
  208. }
  209. }
  210. } catch (err) {
  211. _didIteratorError = true;
  212. _iteratorError = err;
  213. } finally {
  214. try {
  215. if (!_iteratorNormalCompletion && _iterator.return != null) {
  216. _iterator.return();
  217. }
  218. } finally {
  219. if (_didIteratorError) {
  220. throw _iteratorError;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. },
  227. {
  228. key: "getLowestF",
  229. value: function getLowestF() {
  230. var a = 0;
  231.  
  232. for (var _b3 = 0; _b3 < this.openSet.length; _b3++) {
  233. this.openSet[_b3].f < this.openSet[a].f && (a = _b3);
  234. }
  235.  
  236. return a;
  237. }
  238. },
  239. {
  240. key: "reconstructPath",
  241. value: function reconstructPath() {
  242. var a = [];
  243.  
  244. for (var _b4 = this.end; _b4 !== this.start; ) {
  245. a.push(_b4), (_b4 = _b4.previous);
  246. }
  247.  
  248. return a;
  249. }
  250. },
  251. {
  252. key: "heuristic",
  253. value: function heuristic(a, b) {
  254. return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
  255. }
  256. }
  257. ]);
  258.  
  259. return a;
  260. })();
  261.  
  262. var b = function b(a, _b5, c) {
  263. "use strict";
  264.  
  265. _classCallCheck(this, b);
  266.  
  267. (this.x = a),
  268. (this.y = _b5),
  269. (this.collision = c),
  270. (this.g = 1e7),
  271. (this.f = 1e7),
  272. (this.neighbours = []),
  273. (this.beginning = !1),
  274. (this.target = !1),
  275. (this.previous = void 0);
  276. };
  277.  
  278. new /*#__PURE__*/
  279. ((function() {
  280. "use strict";
  281.  
  282. function _class() {
  283. _classCallCheck(this, _class);
  284.  
  285. (this.storage = JSON.parse(localStorage.getItem("adi-bot-storage")) || {
  286. x: 0,
  287. y: 0,
  288. name: "",
  289. minimalized: !1
  290. }),
  291. (this.interface =
  292. "object" == _typeof(window.Engine)
  293. ? "ni"
  294. : "object" == _typeof(window.g)
  295. ? "si"
  296. : "none"),
  297. (this.lootfilterSettings = JSON.parse(
  298. localStorage.getItem("adi-bot-lootfilterSettings123")
  299. ) || {
  300. stat: {
  301. all: {
  302. translation: "\u0141ap wszystkie itemki",
  303. active: !0
  304. },
  305. gold: {
  306. translation: "Z\u0142oto",
  307. active: !0
  308. },
  309. quest: {
  310. translation: "Questowe",
  311. active: !0
  312. },
  313. runes: {
  314. translation: "Runy",
  315. active: !0
  316. },
  317. unique: {
  318. translation: "Unikaty",
  319. active: !0
  320. },
  321. heroic: {
  322. translation: "Heroiki",
  323. active: !0
  324. },
  325. legendary: {
  326. translation: "Legendy",
  327. active: !0
  328. }
  329. },
  330. names: []
  331. }),
  332. (this.QuickGroupSettings = JSON.parse(
  333. localStorage.getItem("adi-bot-QuickGroupSettings12")
  334. ) || {
  335. adding: {
  336. translation: "Automatycznie dodawaj do grupy znaj/klan",
  337. active: !0
  338. },
  339. accepting: {
  340. translation: "Automatycznie przyjmuj zaproszenia do grupy",
  341. active: !0
  342. },
  343. reSendingMessage: {
  344. translation: "Automatycznie odpisuj innym graczom",
  345. active: !0
  346. }
  347. }),
  348. (this.npcToKillId = void 0),
  349. (this.lastAttackTimestamp = this.timeStamp),
  350. (this.timerData = JSON.parse(this.getCookie("adi-bot-timer")) || {}),
  351. (this.refreshTime = [3, 6]),
  352. (this.delayToRelog = 40),
  353. (this.waitForNpcRespawn = 120),
  354. (this.randomAnswers = [
  355. "nie interesuje mnie to",
  356. "kiedy\u015B to by\u0142o, nie to co tera",
  357. "to fajnie",
  358. "nom",
  359. "super",
  360. "co ?",
  361. "interesuj\u0105ce",
  362. "bombowo",
  363. "Bardzo si\u0119 ciesz\u0119.",
  364. "Xd",
  365. "co",
  366. "co.?",
  367. "co?",
  368. "xD",
  369. "xd",
  370. "ehhhhhh",
  371. "heh",
  372. "fajnie fajnie :]"
  373. ]),
  374. (this.answersBeforeAddingToEnemies = [
  375. "dobra, do wrog\xF3w cie daje :)",
  376. "papapappapapapap",
  377. "nara.",
  378. "w ty\u0142ku cie mam gosciu, nara",
  379. "papapapp",
  380. "nara kole\u017Cko",
  381. "lecisz do wrogow :P",
  382. "narka ;)",
  383. "hehehehhe, narq",
  384. "ej jeste\u015B?",
  385. "haha. ;)"
  386. ]),
  387. (this.messagesInc =
  388. JSON.parse(localStorage.getItem("adi-bot-messages")) || {}),
  389. (this.isHealing = !1),
  390. (this.isActuallySendingMessage = !1),
  391. (this.startInctementingLagRefresher = !1),
  392. (this.incrementValue = 0),
  393. this.init();
  394. }
  395.  
  396. _createClass(_class, [
  397. {
  398. key: "getNpcColsNI",
  399. value: function getNpcColsNI() {
  400. var a = {};
  401.  
  402. var _arr = Object.values(this.npcs);
  403.  
  404. for (var _i = 0; _i < _arr.length; _i++) {
  405. var _arr$_i = _arr[_i],
  406. _b6 = _arr$_i.x,
  407. c = _arr$_i.y;
  408. a[_b6 + 256 * c] = !0;
  409. }
  410.  
  411. return a;
  412. }
  413. },
  414. {
  415. key: "chatParser",
  416. value: function chatParser() {
  417. var _this = this;
  418.  
  419. "ni" === this.interface &&
  420. window.API.addCallbackToEvent("newMsg", function(_ref2) {
  421. var _ref3 = _slicedToArray(_ref2, 2),
  422. a = _ref3[0],
  423. b = _ref3[1];
  424.  
  425. _this.chatFilter(b);
  426. }),
  427. "si" === this.interface &&
  428. window.g.chat.parsers.push(function(a) {
  429. _this.chatFilter(a);
  430. });
  431. }
  432. },
  433. {
  434. key: "chatFilter",
  435. value: function chatFilter(a) {
  436. var b = a.n,
  437. c = a.t,
  438. d = a.ts,
  439. e = a.k;
  440.  
  441. if (
  442. "" !== b &&
  443. b !== this.hero.nick &&
  444. "System" !== b &&
  445. !1 !== this.QuickGroupSettings.reSendingMessage.active &&
  446. 5 >= window.unix_time(!0) - d &&
  447. !this.isActuallySendingMessage
  448. ) {
  449. if (
  450. void 0 !== this.messagesInc[b + this.world] &&
  451. 3 < this.messagesInc[b + this.world]
  452. )
  453. return;
  454. c.toLowerCase().includes(this.hero.nick.toLowerCase()) &&
  455. 0 === e &&
  456. this.sendMessage(b, e),
  457. 3 === e && this.sendMessage(b, e);
  458. }
  459. }
  460. },
  461. {
  462. key: "sendMessage",
  463. value: function sendMessage(a, b) {
  464. var _this2 = this;
  465.  
  466. var c =
  467. arguments.length > 2 && arguments[2] !== undefined
  468. ? arguments[2]
  469. : !1;
  470. var d = arguments.length > 3 ? arguments[3] : undefined;
  471. (this.isActuallySendingMessage = !0),
  472. this.messagesInc[a + this.world] === void 0
  473. ? (this.messagesInc[a + this.world] = 1)
  474. : this.messagesInc[a + this.world]++,
  475. this.saveMessages(),
  476. 3 < this.messagesInc[a + this.world] && (c = !0),
  477. (d = c
  478. ? this.answersBeforeAddingToEnemies[
  479. Math.floor(
  480. Math.random() * this.answersBeforeAddingToEnemies.length
  481. )
  482. ]
  483. : this.randomAnswers[
  484. Math.floor(Math.random() * this.randomAnswers.length)
  485. ]),
  486. 3 === b && (d = "@".concat(a.split(" ").join("_"), " ").concat(d)),
  487. this.Sleep(1e3 * (Math.floor(11 * Math.random()) + 5)).then(
  488. function() {
  489. window._g("chat", {
  490. c: d
  491. }),
  492. !0 === c && _this2.addToEnemy(a),
  493. (_this2.isActuallySendingMessage = !1);
  494. }
  495. );
  496. }
  497. },
  498. {
  499. key: "Sleep",
  500. value: function Sleep(a) {
  501. return new Promise(function(b) {
  502. setTimeout(function() {
  503. b(null);
  504. }, a);
  505. });
  506. }
  507. },
  508. {
  509. key: "saveMessages",
  510. value: function saveMessages() {
  511. localStorage.setItem(
  512. "adi-bot-messages",
  513. JSON.stringify(this.messagesInc)
  514. );
  515. }
  516. },
  517. {
  518. key: "addToEnemy",
  519. value: function addToEnemy(a) {
  520. window._g("friends&a=eadd&nick=".concat(a));
  521. }
  522. },
  523. {
  524. key: "getWay",
  525. value: function getWay(b, c) {
  526. return new a(
  527. this.collisions,
  528. this.map.x,
  529. this.map.y,
  530. {
  531. x: this.hero.x,
  532. y: this.hero.y
  533. },
  534. {
  535. x: b,
  536. y: c
  537. },
  538. this.npccol
  539. ).anotherFindPath();
  540. }
  541. },
  542. {
  543. key: "goTo",
  544. value: function goTo(a, b) {
  545. var c = this.getWay(a, b);
  546. Array.isArray(c) &&
  547. ("ni" === this.interface
  548. ? (window.Engine.hero.autoPath = c)
  549. : (window.road = c));
  550. }
  551. },
  552. {
  553. key: "getDistanceToNpc",
  554. value: function getDistanceToNpc(a, b) {
  555. var c = this.getWay(a, b);
  556. return Array.isArray(c) ? c.length : void 0;
  557. }
  558. },
  559. {
  560. key: "updateCollisions",
  561. value: function updateCollisions() {
  562. var a = [],
  563. _this$map = this.map,
  564. b = _this$map.x,
  565. c = _this$map.y;
  566.  
  567. for (var d = 0; d < c; d++) {
  568. for (var _c = 0; _c < b; _c++) {
  569. a.push(window.Engine.map.col.check(_c, d));
  570. }
  571. }
  572.  
  573. return a.join("");
  574. }
  575. },
  576. {
  577. key: "initBox",
  578. value: function initBox() {
  579. var _this3 = this;
  580.  
  581. var a = document.createElement("div");
  582. a.classList.add("adi-bot-box"),
  583. this.appendText(a, "Wprowad\u017A nazwy elit II:");
  584. var b = document.createElement("input");
  585. (b.type = "text"),
  586. b.classList.add("adi-bot-input-text"),
  587. (b.value = this.storage.name),
  588. b.addEventListener("keyup", function() {
  589. (_this3.storage.name = b.value), _this3.saveStorage();
  590. }),
  591. a.appendChild(b),
  592. this.appendText(a, "Lootfilter:");
  593.  
  594. var _arr2 = Object.entries(this.lootfilterSettings.stat);
  595.  
  596. var _loop = function _loop() {
  597. var _arr2$_i = _slicedToArray(_arr2[_i2], 2),
  598. b = _arr2$_i[0],
  599. _arr2$_i$ = _arr2$_i[1],
  600. c = _arr2$_i$.translation,
  601. d = _arr2$_i$.active;
  602.  
  603. _this3.createCheckBox(a, c, d, function(a) {
  604. (_this3.lootfilterSettings.stat[b].active = a),
  605. localStorage.setItem(
  606. "adi-bot-lootfilterSettings123",
  607. JSON.stringify(_this3.lootfilterSettings)
  608. );
  609. });
  610. };
  611.  
  612. for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
  613. _loop();
  614. }
  615.  
  616. this.appendText(a, "\u0141ap itemki po nazwie:");
  617. var c = document.createElement("input");
  618. c.classList.add("adi-bot-input-text"),
  619. (c.tip = "Oddzielaj przecinkiem!"),
  620. (c.type = "text"),
  621. (c.value = this.lootfilterSettings.names.join(", ")),
  622. c.addEventListener("keyup", function() {
  623. var a = c.value.split(",");
  624.  
  625. for (var _b7 = 0; _b7 < a.length; _b7++) {
  626. a[_b7] = a[_b7].trim();
  627. }
  628.  
  629. (_this3.lootfilterSettings.names = a),
  630. localStorage.setItem(
  631. "adi-bot-lootfilterSettings123",
  632. JSON.stringify(_this3.lootfilterSettings)
  633. );
  634. }),
  635. a.appendChild(c),
  636. this.appendText(a, "Ustawienia QG:");
  637.  
  638. var _arr3 = Object.entries(this.QuickGroupSettings);
  639.  
  640. var _loop2 = function _loop2() {
  641. var _arr3$_i = _slicedToArray(_arr3[_i3], 2),
  642. b = _arr3$_i[0],
  643. _arr3$_i$ = _arr3$_i[1],
  644. c = _arr3$_i$.translation,
  645. d = _arr3$_i$.active;
  646.  
  647. _this3.createCheckBox(a, c, d, function(a) {
  648. (_this3.QuickGroupSettings[b].active = a),
  649. localStorage.setItem(
  650. "adi-bot-QuickGroupSettings12",
  651. JSON.stringify(_this3.QuickGroupSettings)
  652. );
  653. });
  654. };
  655.  
  656. for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
  657. _loop2();
  658. }
  659.  
  660. this.makeBoxDraggable(a, function() {
  661. (_this3.storage.x = parseInt(a.style.left)),
  662. (_this3.storage.y = parseInt(a.style.top)),
  663. _this3.saveStorage(),
  664. window.message(
  665. '<span style="color: red">Zapisano pozycj\u0119 okienka :)</span>'
  666. );
  667. }),
  668. this.storage.hasOwnProperty("minimalized") ||
  669. ((this.storage.minimalized = !1), this.saveStorage()),
  670. a.addEventListener("dblclick", function(_ref4) {
  671. var b = _ref4.x,
  672. c = _ref4.y;
  673. !1 === _this3.storage.minimalized
  674. ? ((a.style.width = "10px"),
  675. (a.style.height = "10px"),
  676. (_this3.storage.minimalized = !0),
  677. _this3.changeVisibility(a, !0))
  678. : ((a.style.width = "360px"),
  679. (a.style.height = "290px"),
  680. (_this3.storage.minimalized = !1),
  681. _this3.changeVisibility(a, !1)),
  682. (a.style.left = b - parseInt(a.style.width) / 2 + "px"),
  683. (a.style.top = c - parseInt(a.style.height) / 2 + "px"),
  684. (_this3.storage.x = parseInt(a.style.left)),
  685. (_this3.storage.y = parseInt(a.style.top)),
  686. _this3.saveStorage();
  687. }),
  688. "ni" === this.interface
  689. ? document.querySelector(".game-window-positioner").appendChild(a)
  690. : document.body.appendChild(a),
  691. this.initStyle(),
  692. !0 === this.storage.minimalized &&
  693. ((a.style.width = "10px"),
  694. (a.style.height = "10px"),
  695. this.changeVisibility(a, !0));
  696. }
  697. },
  698. {
  699. key: "changeVisibility",
  700. value: function changeVisibility(a, b) {
  701. var _iteratorNormalCompletion2 = true;
  702. var _didIteratorError2 = false;
  703. var _iteratorError2 = undefined;
  704.  
  705. try {
  706. for (
  707. var _iterator2 = a.childNodes[Symbol.iterator](), _step2;
  708. !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
  709. _iteratorNormalCompletion2 = true
  710. ) {
  711. var c = _step2.value;
  712. c.style.display = !0 === b ? "none" : "";
  713. }
  714. } catch (err) {
  715. _didIteratorError2 = true;
  716. _iteratorError2 = err;
  717. } finally {
  718. try {
  719. if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
  720. _iterator2.return();
  721. }
  722. } finally {
  723. if (_didIteratorError2) {
  724. throw _iteratorError2;
  725. }
  726. }
  727. }
  728. }
  729. },
  730. {
  731. key: "appendText",
  732. value: function appendText(a, b) {
  733. var c = document.createElement("div");
  734. c.appendChild(document.createTextNode(b)), a.appendChild(c);
  735. }
  736. },
  737. {
  738. key: "createCheckBox",
  739. value: function createCheckBox(a, b, c, d) {
  740. var e = document.createElement("div"),
  741. f = document.createElement("input");
  742. (f.type = "checkbox"),
  743. (f.name = b + "adi-bot"),
  744. (f.id = b + "adi-bot"),
  745. (f.checked = c),
  746. e.appendChild(f);
  747. var g = document.createElement("label");
  748. g.setAttribute("for", b + "adi-bot"),
  749. (g.innerHTML = b),
  750. f.addEventListener("change", function() {
  751. d(f.checked);
  752. }),
  753. e.appendChild(g),
  754. a.appendChild(e);
  755. }
  756. },
  757. {
  758. key: "makeBoxDraggable",
  759. value: function makeBoxDraggable(a, b) {
  760. $(a).draggable({
  761. containment: "window",
  762. stop: b
  763. });
  764. }
  765. },
  766. {
  767. key: "saveStorage",
  768. value: function saveStorage() {
  769. localStorage.setItem("adi-bot-storage", JSON.stringify(this.storage));
  770. }
  771. },
  772. {
  773. key: "initStyle",
  774. value: function initStyle() {
  775. var a = document.createElement("style"),
  776. b = "\n .adi-bot-box {\n position: absolute;\n text-align: center;\n padding: 10px;\n height: 290px;\n width: 360px;\n left: "
  777. .concat(this.storage.x, "px;\n top: ")
  778. .concat(
  779. this.storage.y,
  780. "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 "
  781. );
  782. (a.type = "text/css"),
  783. a.appendChild(document.createTextNode(b)),
  784. document.head.appendChild(a);
  785. }
  786. },
  787. {
  788. key: "initNewNpc",
  789. value: function initNewNpc() {
  790. var _this4 = this;
  791.  
  792. if (
  793. ("ni" === this.interface &&
  794. (window.API.addCallbackToEvent("newNpc", function(a) {
  795. void 0 !== a && _this4.addNpcs(a.d);
  796. }),
  797. window.API.addCallbackToEvent("removeNpc", function(a) {
  798. void 0 !== a && _this4.removeNpcs(a.d);
  799. })),
  800. "si" === this.interface)
  801. ) {
  802. var _a5 = window.newNpc;
  803.  
  804. window.newNpc = function(b) {
  805. if (void 0 !== b) {
  806. var _arr4 = Object.entries(b);
  807.  
  808. for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
  809. var _arr4$_i = _slicedToArray(_arr4[_i4], 2),
  810. _a6 = _arr4$_i[0],
  811. c = _arr4$_i[1];
  812.  
  813. void 0 !== c.del && void 0 !== window.g.npc[_a6]
  814. ? _this4.removeNpcs(window.g.npc[_a6], _a6)
  815. : void 0 !== c && _this4.addNpcs(c, _a6);
  816. }
  817. }
  818.  
  819. _a5(b);
  820. };
  821. }
  822. }
  823. },
  824. {
  825. key: "initNewOther",
  826. value: function initNewOther() {
  827. var _this5 = this;
  828.  
  829. if (
  830. ("ni" === this.interface &&
  831. (this.makeParty(),
  832. window.API.addCallbackToEvent("newOther", function(a) {
  833. _this5.filterOther(a.d);
  834. })),
  835. "si" === this.interface)
  836. ) {
  837. this.makeParty();
  838. var _a7 = window.newOther;
  839.  
  840. window.newOther = function(b) {
  841. if ((_a7(b), void 0 !== b)) {
  842. var _arr5 = Object.values(b);
  843.  
  844. for (var _i5 = 0; _i5 < _arr5.length; _i5++) {
  845. var _a8 = _arr5[_i5];
  846.  
  847. _this5.filterOther(_a8);
  848. }
  849. }
  850. };
  851. }
  852. }
  853. },
  854. {
  855. key: "filterOther",
  856. value: function filterOther(a) {
  857. if (a !== void 0) {
  858. var _b8 = a.relation,
  859. c = a.id;
  860. !0 === this.canHeroTryToAttack() &&
  861. ["cl", "fr"].includes(_b8) &&
  862. !0 === this.QuickGroupSettings.adding.active &&
  863. this.sendInviteToParty(c);
  864. }
  865. }
  866. },
  867. {
  868. key: "makeParty",
  869. value: function makeParty() {
  870. if ("object" != _typeof(this.party)) return this.sendInvites();
  871. var a =
  872. "ni" === this.interface
  873. ? this.party.getLeaderId() === this.hero.id
  874. : 1 === this.party[this.hero.id].r;
  875. !0 == a && this.sendInvites();
  876. }
  877. },
  878. {
  879. key: "sendInvites",
  880. value: function sendInvites() {
  881. if (this.others !== void 0) {
  882. var _arr6 = Object.values(this.others);
  883.  
  884. for (var _i6 = 0; _i6 < _arr6.length; _i6++) {
  885. var _a9 = _arr6[_i6];
  886. this.filterOther(_a9);
  887. }
  888. }
  889. }
  890. },
  891. {
  892. key: "sendInviteToParty",
  893. value: function sendInviteToParty(a) {
  894. window._g("party&a=inv&id=".concat(a));
  895. }
  896. },
  897. {
  898. key: "initChecker",
  899. value: function initChecker() {
  900. var _this6 = this;
  901.  
  902. if (
  903. (setTimeout(function() {
  904. _this6.initChecker();
  905. }, 500),
  906. !0 === this.dead &&
  907. (this.removeNpcsFromThisCharId(this.hero.id), this.logout()),
  908. !0 === this.canHeroTryToAttack())
  909. )
  910. try {
  911. if (void 0 !== this.npcToKillId) {
  912. var _this$npcs$this$npcTo = this.npcs[this.npcToKillId],
  913. _a10 = _this$npcs$this$npcTo.x,
  914. _b9 = _this$npcs$this$npcTo.y;
  915. 1 >= Math.abs(this.hero.x - _a10) &&
  916. 1 >= Math.abs(this.hero.y - _b9)
  917. ? 0 < this.timeStamp - this.lastAttackTimestamp &&
  918. window._g(
  919. "fight&a=attack&ff=1&id=-".concat(this.npcToKillId),
  920. function(a) {
  921. return a.hasOwnProperty("alert") &&
  922. a.alert.includes(
  923. "Przeciwnik walczy ju\u017C z kim\u015B innym"
  924. )
  925. ? void (_this6.lastAttackTimestamp =
  926. _this6.timeStamp + 2)
  927. : void (_this6.lastAttackTimestamp =
  928. _this6.timeStamp + 1);
  929. }
  930. )
  931. : this.goTo(_a10, _b9);
  932. } else this.reFindNpcs();
  933. } catch (a) {
  934. this.npcToKillId = void 0;
  935. }
  936. }
  937. },
  938. {
  939. key: "canHeroTryToAttack",
  940. value: function canHeroTryToAttack() {
  941. return !(this.battle || this.dead);
  942. }
  943. },
  944. {
  945. key: "removeNpcs",
  946. value: function removeNpcs(a) {
  947. var b = a.x,
  948. c = a.y,
  949. d = a.nick,
  950. e = a.lvl;
  951. "ni" === this.interface
  952. ? window.Engine.map.col.unset(
  953. b,
  954. c,
  955. window.Engine.map.col.check(b, c)
  956. )
  957. : window.map.nodes.changeCollision(b, c, 0),
  958. this.storage.name !== void 0 &&
  959. this.storage.name.toLowerCase().includes(d.toLowerCase()) &&
  960. (this.addNpcToTimer(d, e),
  961. (this.npcToKillId = void 0),
  962. this.reFindNpcs());
  963. }
  964. },
  965. {
  966. key: "findEilteIIName",
  967. value: function findEilteIIName(a) {
  968. var _arr7 = Object.values(this.npcs);
  969.  
  970. for (var _i7 = 0; _i7 < _arr7.length; _i7++) {
  971. var _b10 = _arr7[_i7];
  972. var c = _b10.nick,
  973. d = _b10.lvl,
  974. e = _b10.grp,
  975. f = _b10.wt;
  976. if (e === a && 19 < f) return [c, d];
  977. }
  978. }
  979. },
  980. {
  981. key: "addNpcs",
  982. value: function addNpcs(a, b) {
  983. "ni" === this.interface && (b = a.id), this.filterNpc(a, b);
  984. }
  985. },
  986. {
  987. key: "isNpcFake",
  988. value: function isNpcFake(a, b) {
  989. var c = new Image(),
  990. d = document.createElement("canvas").getContext("2d"),
  991. e = function e() {
  992. var a = d.getImageData(Math.floor(d.width / 2), 0, 1, d.height)
  993. .data;
  994.  
  995. for (var _c2 = 3; _c2 < a.length; _c2 += 4) {
  996. if (0 < a[_c2]) return b(!1);
  997. }
  998.  
  999. return b(!0);
  1000. };
  1001.  
  1002. (c.onload = function() {
  1003. (d.width = this.width),
  1004. (d.height = this.height),
  1005. d.drawImage(c, 0, 0),
  1006. e();
  1007. }),
  1008. (c.src = a);
  1009. }
  1010. },
  1011. {
  1012. key: "filterNpc",
  1013. value: function filterNpc(a, b) {
  1014. var _this7 = this;
  1015.  
  1016. var c = a.nick,
  1017. d = a.icon,
  1018. e = a.type,
  1019. f = a.wt,
  1020. g = a.grp;
  1021.  
  1022. if (
  1023. !((2 !== e && 3 !== e) || 10 > f || void 0 === c) &&
  1024. void 0 === this.npcToKillId &&
  1025. this.storage.name.toLowerCase().includes(c.toLowerCase()) &&
  1026. "" !== this.storage.name &&
  1027. null !== this.storage.name
  1028. ) {
  1029. var _a11 = d.includes("/obrazki/npc/")
  1030. ? d
  1031. : "/obrazki/npc/".concat(d);
  1032.  
  1033. this.isNpcFake(_a11, function(a) {
  1034. !1 === a &&
  1035. ((_this7.npcToKillId =
  1036. 0 === g
  1037. ? parseInt(b)
  1038. : parseInt(_this7.findBestNpcFromGrp(g))),
  1039. _this7.makeParty());
  1040. });
  1041. }
  1042. }
  1043. },
  1044. {
  1045. key: "findBestNpcFromGrp",
  1046. value: function findBestNpcFromGrp(a) {
  1047. var b,
  1048. c = 999999;
  1049.  
  1050. var _arr8 = Object.entries(this.npcs);
  1051.  
  1052. for (var _i8 = 0; _i8 < _arr8.length; _i8++) {
  1053. var _arr8$_i = _slicedToArray(_arr8[_i8], 2),
  1054. d = _arr8$_i[0],
  1055. e = _arr8$_i[1];
  1056.  
  1057. var f = e.x,
  1058. g = e.y,
  1059. h = e.grp;
  1060.  
  1061. if (a === h) {
  1062. var _a12 = this.getDistanceToNpc(f, g);
  1063.  
  1064. _a12 < c && ((b = d), (c = _a12));
  1065. }
  1066. }
  1067.  
  1068. return b;
  1069. }
  1070. },
  1071. {
  1072. key: "reFindNpcs",
  1073. value: function reFindNpcs() {
  1074. var _arr9 = Object.entries(this.npcs);
  1075.  
  1076. for (var _i9 = 0; _i9 < _arr9.length; _i9++) {
  1077. var _arr9$_i = _slicedToArray(_arr9[_i9], 2),
  1078. _a13 = _arr9$_i[0],
  1079. _b11 = _arr9$_i[1];
  1080.  
  1081. this.filterNpc(_b11, _a13);
  1082. }
  1083. }
  1084. },
  1085. {
  1086. key: "logout",
  1087. value: function logout() {
  1088. this.battle ||
  1089. this.loots ||
  1090. this.issetMyNpcOnMap ||
  1091. this.isHealing ||
  1092. (window.location.href = "http://margonem.pl");
  1093. }
  1094. },
  1095. {
  1096. key: "logIn",
  1097. value: function logIn(a, b) {
  1098. if (
  1099. ("none" === this.interface ||
  1100. void 0 === this.hero.id ||
  1101. this.hero.id != a) &&
  1102. !(
  1103. "none" !== this.interface &&
  1104. (this.battle ||
  1105. this.loots ||
  1106. this.issetMyNpcOnMap ||
  1107. this.isHealing)
  1108. )
  1109. )
  1110. try {
  1111. var c = new Date();
  1112. c.setTime(c.getTime() + 259200000),
  1113. (document.cookie = "mchar_id="
  1114. .concat(a, "; path=/; expires=")
  1115. .concat(c.toGMTString(), "; domain=.margonem.pl")),
  1116. (window.location.href = "http://".concat(
  1117. b.toLowerCase(),
  1118. ".margonem.pl"
  1119. ));
  1120. } catch (a) {}
  1121. }
  1122. },
  1123. {
  1124. key: "getNewRespawnTime",
  1125. value: function getNewRespawnTime(a) {
  1126. return Math.round(
  1127. (1 *
  1128. (60 *
  1129. (200 < a
  1130. ? 18
  1131. : Math.min(18, 0.7 + 0.18 * a - 45e-5 * a * a)))) /
  1132. parseInt(this.serverTimerSpeed)
  1133. );
  1134. }
  1135. },
  1136. {
  1137. key: "addNpcToTimer",
  1138. value: function addNpcToTimer(a, b) {
  1139. var c = this.mapName;
  1140. (this.timerData[a + this.world] = {
  1141. name: a,
  1142. lvl: b,
  1143. mapName: c,
  1144. nextRespawn: this.timeStamp + this.getNewRespawnTime(b),
  1145. charId: this.hero.id,
  1146. world: this.world
  1147. }),
  1148. this.saveTimersCookies();
  1149. }
  1150. },
  1151. {
  1152. key: "deleteNpcFromTimer",
  1153. value: function deleteNpcFromTimer(a) {
  1154. this.timerData[a] !== void 0 &&
  1155. (delete this.timerData[a], this.saveTimersCookies());
  1156. }
  1157. },
  1158. {
  1159. key: "removeNpcsFromThisCharId",
  1160. value: function removeNpcsFromThisCharId(a) {
  1161. if (void 0 !== a) {
  1162. var _arr10 = Object.entries(this.timerData);
  1163.  
  1164. for (var _i10 = 0; _i10 < _arr10.length; _i10++) {
  1165. var _arr10$_i = _slicedToArray(_arr10[_i10], 2),
  1166. _b12 = _arr10$_i[0],
  1167. c = _arr10$_i[1];
  1168.  
  1169. c.charId == a && this.deleteNpcFromTimer(_b12);
  1170. }
  1171. }
  1172. }
  1173. },
  1174. {
  1175. key: "checkTimers",
  1176. value: function checkTimers() {
  1177. var _arr11 = Object.entries(this.timerData);
  1178.  
  1179. for (var _i11 = 0; _i11 < _arr11.length; _i11++) {
  1180. var _arr11$_i = _slicedToArray(_arr11[_i11], 2),
  1181. _a14 = _arr11$_i[0],
  1182. _b13 = _arr11$_i[1];
  1183.  
  1184. _b13.nextRespawn + this.waitForNpcRespawn < this.timeStamp &&
  1185. this.createNewRespawnTime(_a14);
  1186. }
  1187. }
  1188. },
  1189. {
  1190. key: "createNewRespawnTime",
  1191. value: function createNewRespawnTime(a) {
  1192. var _this8 = this;
  1193.  
  1194. if (
  1195. !(
  1196. Object.values(this.npcs).some(function(b) {
  1197. return b.nick == _this8.timerData[a].name;
  1198. }) || this.timerData[a].charId !== this.hero.id
  1199. )
  1200. ) {
  1201. for (; this.timeStamp > this.timerData[a].nextRespawn; ) {
  1202. this.timerData[a].nextRespawn += this.getNewRespawnTime(
  1203. this.timerData[a].lvl
  1204. );
  1205. }
  1206.  
  1207. this.saveTimersCookies();
  1208. }
  1209. }
  1210. },
  1211. {
  1212. key: "isThisHeroIssetInTimer",
  1213. value: function isThisHeroIssetInTimer(b) {
  1214. return (
  1215. void 0 !== b &&
  1216. Object.values(this.timerData).some(function(c) {
  1217. return c.charId == b;
  1218. })
  1219. );
  1220. }
  1221. },
  1222. {
  1223. key: "isntTimersInRange",
  1224. value: function isntTimersInRange() {
  1225. var _this9 = this;
  1226.  
  1227. return Object.values(this.timerData).every(function(b) {
  1228. return b.nextRespawn - _this9.timeStamp > _this9.delayToRelog;
  1229. });
  1230. }
  1231. },
  1232. {
  1233. key: "checkHeroOnGoodMap",
  1234. value: function checkHeroOnGoodMap(a) {
  1235. var _arr12 = Object.entries(this.timerData);
  1236.  
  1237. for (var _i12 = 0; _i12 < _arr12.length; _i12++) {
  1238. var _arr12$_i = _slicedToArray(_arr12[_i12], 2),
  1239. _b14 = _arr12$_i[0],
  1240. c = _arr12$_i[1];
  1241.  
  1242. var d = c.mapName,
  1243. e = c.charId;
  1244. e == a &&
  1245. this.mapName !== void 0 &&
  1246. d !== void 0 &&
  1247. d !== this.mapName &&
  1248. this.deleteNpcFromTimer(_b14);
  1249. }
  1250. }
  1251. },
  1252. {
  1253. key: "initTimer",
  1254. value: function initTimer() {
  1255. var _this10 = this;
  1256.  
  1257. if (0 < Object.keys(this.timerData).length)
  1258. if ("none" === this.interface) {
  1259. if (
  1260. Object.values(this.timerData).some(function(b) {
  1261. return (
  1262. b.nextRespawn - _this10.timeStamp <= _this10.delayToRelog
  1263. );
  1264. })
  1265. ) {
  1266. var _Object$values$reduce = Object.values(
  1267. this.timerData
  1268. ).reduce(function(c, a) {
  1269. return c.nextRespawn <= a.nextRespawn ? c : a;
  1270. }),
  1271. _a15 = _Object$values$reduce.world,
  1272. _b15 = _Object$values$reduce.charId;
  1273.  
  1274. void 0 !== _b15 && this.logIn(_b15, _a15);
  1275. }
  1276. } else if (
  1277. this.isntTimersInRange() &&
  1278. this.isThisHeroIssetInTimer(this.hero.id)
  1279. )
  1280. this.logout();
  1281. else {
  1282. this.checkHeroOnGoodMap(this.hero.id);
  1283.  
  1284. var _a16 = Object.values(this.timerData).filter(function(b) {
  1285. return (
  1286. b.nextRespawn - _this10.timeStamp <= _this10.delayToRelog
  1287. );
  1288. });
  1289.  
  1290. if (0 < _a16.length) {
  1291. var _a16$reduce = _a16.reduce(function(c, a) {
  1292. return c.nextRespawn <= a.nextRespawn ? c : a;
  1293. }),
  1294. _b16 = _a16$reduce.charId,
  1295. c = _a16$reduce.world;
  1296.  
  1297. void 0 !== this.hero.id &&
  1298. parseInt(_b16) !== this.hero.id &&
  1299. this.logIn(_b16, c);
  1300. }
  1301. }
  1302. this.checkTimers(),
  1303. setTimeout(function() {
  1304. _this10.initTimer();
  1305. }, 500);
  1306. }
  1307. },
  1308. {
  1309. key: "saveTimersCookies",
  1310. value: function saveTimersCookies() {
  1311. var a = new Date();
  1312. a.setMonth(a.getMonth() + 1),
  1313. this.setCookie(
  1314. "adi-bot-timer",
  1315. JSON.stringify(this.timerData),
  1316. a,
  1317. "/",
  1318. "margonem.pl"
  1319. );
  1320. }
  1321. },
  1322. {
  1323. key: "randomSeconds",
  1324. value: function randomSeconds(a, b) {
  1325. return (
  1326. (a *= 60), (b *= 60), Math.floor(Math.random() * (b - a + 1)) + a
  1327. );
  1328. }
  1329. },
  1330. {
  1331. key: "randomRefresh",
  1332. value: function randomRefresh() {
  1333. var _this$refreshTime = _slicedToArray(this.refreshTime, 2),
  1334. a = _this$refreshTime[0],
  1335. b = _this$refreshTime[1];
  1336.  
  1337. setTimeout(function() {
  1338. location.href = location.href;
  1339. }, 1e3 * this.randomSeconds(a, b));
  1340. }
  1341. },
  1342. {
  1343. key: "getCookie",
  1344. value: function getCookie(a) {
  1345. var b = document.cookie,
  1346. c = a + "=";
  1347. var d = b.indexOf("; " + c);
  1348. if (-1 != d) d += 2;
  1349. else if (((d = b.indexOf(c)), 0 != d)) return null;
  1350. var e = document.cookie.indexOf(";", d);
  1351. return (
  1352. -1 == e && (e = b.length), unescape(b.substring(d + c.length, e))
  1353. );
  1354. }
  1355. },
  1356. {
  1357. key: "setCookie",
  1358. value: function setCookie(a, b, c, d, e, f) {
  1359. var g =
  1360. a +
  1361. "=" +
  1362. escape(b) +
  1363. (c ? "; expires=" + c.toGMTString() : "") +
  1364. (d ? "; path=" + d : "") +
  1365. (e ? "; domain=" + e : "") +
  1366. (f ? "; secure" : "");
  1367. document.cookie = g;
  1368. }
  1369. },
  1370. {
  1371. key: "createTimerOnMainPage",
  1372. value: function createTimerOnMainPage() {
  1373. var _this11 = this;
  1374.  
  1375. if (0 === Object.keys(this.timerData).length) return;
  1376. var a = document.createElement("div");
  1377. a.classList.add("adi-bot-minutnik-strona-glowna"),
  1378. document.querySelector(".rmenu").appendChild(a);
  1379. var b = document.createElement("style");
  1380. (b.type = "text/css"),
  1381. b.appendChild(
  1382. document.createTextNode(
  1383. "\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 "
  1384. )
  1385. ),
  1386. document.head.appendChild(b),
  1387. this.addNpcsToTimerBox(a),
  1388. document.addEventListener("click", function(a) {
  1389. try {
  1390. if ("timer_data" === a.target.className) {
  1391. var _a$target$getAttribut = a.target
  1392. .getAttribute("timer-data")
  1393. .split("|"),
  1394. _a$target$getAttribut2 = _slicedToArray(
  1395. _a$target$getAttribut,
  1396. 2
  1397. ),
  1398. _b17 = _a$target$getAttribut2[0],
  1399. c = _a$target$getAttribut2[1];
  1400.  
  1401. c !== void 0 &&
  1402. _b17 !== void 0 &&
  1403. (_this11.deleteNpcFromTimer(_b17 + c),
  1404. window.showMsg(
  1405. "Usuni\u0119to "
  1406. .concat(_b17, " ze \u015Bwiata ")
  1407. .concat(c.charAt(0).toUpperCase() + c.slice(1), ".")
  1408. ));
  1409. }
  1410. } catch (a) {}
  1411. });
  1412. }
  1413. },
  1414. {
  1415. key: "addNpcsToTimerBox",
  1416. value: function addNpcsToTimerBox(a) {
  1417. var _this12 = this;
  1418.  
  1419. var b = {};
  1420.  
  1421. var _arr13 = Object.values(this.timerData);
  1422.  
  1423. for (var _i13 = 0; _i13 < _arr13.length; _i13++) {
  1424. var _c3 = _arr13[_i13];
  1425. var _a17 = _c3.name,
  1426. d = _c3.nextRespawn,
  1427. e = _c3.world;
  1428. b[e] === void 0
  1429. ? (b[e] = [
  1430. {
  1431. name: _a17,
  1432. nextRespawn: d
  1433. }
  1434. ])
  1435. : b[e].push({
  1436. name: _a17,
  1437. nextRespawn: d
  1438. });
  1439. }
  1440.  
  1441. var c = "";
  1442.  
  1443. var _arr14 = Object.entries(b);
  1444.  
  1445. for (var _i14 = 0; _i14 < _arr14.length; _i14++) {
  1446. var _arr14$_i = _slicedToArray(_arr14[_i14], 2),
  1447. d = _arr14$_i[0],
  1448. e = _arr14$_i[1];
  1449.  
  1450. (c += '<br><div style="text-align: center; font-weight: bold; text-decoration: underline">'.concat(
  1451. this.capitalizeWorld(d),
  1452. "</div>"
  1453. )),
  1454. e.sort(function(a, b) {
  1455. return a.nextRespawn - b.nextRespawn;
  1456. });
  1457. var _a18 = [];
  1458.  
  1459. _a18.push("");
  1460.  
  1461. var _iteratorNormalCompletion3 = true;
  1462. var _didIteratorError3 = false;
  1463. var _iteratorError3 = undefined;
  1464.  
  1465. try {
  1466. for (
  1467. var _iterator3 = e[Symbol.iterator](), _step3;
  1468. !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next())
  1469. .done);
  1470. _iteratorNormalCompletion3 = true
  1471. ) {
  1472. var _b18 = _step3.value;
  1473. var _c4 = _b18.name,
  1474. _e2 = _b18.nextRespawn;
  1475.  
  1476. _a18.push(
  1477. "<span>"
  1478. .concat(
  1479. this.getTimeToRespawn(_c4, _e2),
  1480. '</span><span class="timer_data" tip="Kliknij, aby usun\u0105\u0107 z timera." timer-data="'
  1481. )
  1482. .concat(_c4, "|")
  1483. .concat(d, '">---</span>')
  1484. );
  1485. }
  1486. } catch (err) {
  1487. _didIteratorError3 = true;
  1488. _iteratorError3 = err;
  1489. } finally {
  1490. try {
  1491. if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
  1492. _iterator3.return();
  1493. }
  1494. } finally {
  1495. if (_didIteratorError3) {
  1496. throw _iteratorError3;
  1497. }
  1498. }
  1499. }
  1500.  
  1501. _a18.push(""), (c += _a18.join("<hr>"));
  1502. }
  1503.  
  1504. (a.innerHTML = c),
  1505. setTimeout(function() {
  1506. _this12.addNpcsToTimerBox(a);
  1507. }, 1e3);
  1508. }
  1509. },
  1510. {
  1511. key: "capitalizeWorld",
  1512. value: function capitalizeWorld(a) {
  1513. return a.charAt(0).toUpperCase() + a.slice(1) + ":";
  1514. }
  1515. },
  1516. {
  1517. key: "getTimeToRespawn",
  1518. value: function getTimeToRespawn(a, b) {
  1519. var c = b - this.timeStamp,
  1520. d =
  1521. 10 > parseInt(c / 60)
  1522. ? "0".concat(parseInt(c / 60))
  1523. : parseInt(c / 60),
  1524. e = 10 > c % 60 ? "0".concat(c % 60) : c % 60;
  1525. return ""
  1526. .concat(a, ": ")
  1527. .concat(d, ":")
  1528. .concat(e);
  1529. }
  1530. },
  1531. {
  1532. key: "removeLockAdding",
  1533. value: function removeLockAdding() {
  1534. "ni" === this.interface &&
  1535. (window.Engine.lock.add = Function.prototype),
  1536. "si" === this.interface && (window.g.lock.add = Function.prototype),
  1537. (window.mAlert = Function.prototype);
  1538. }
  1539. },
  1540. {
  1541. key: "initLagRefresher",
  1542. value: function initLagRefresher() {
  1543. var _this13 = this;
  1544.  
  1545. !1 === this.startInctementingLagRefresher &&
  1546. ((this.startInctementingLagRefresher = !0),
  1547. setInterval(function() {
  1548. _this13.incrementValue++,
  1549. 8 < _this13.incrementValue && (location.href = location.href);
  1550. }, 500));
  1551. var a = this,
  1552. b = window.$.ajax;
  1553.  
  1554. window.$.ajax = function() {
  1555. for (
  1556. var _len = arguments.length, c = new Array(_len), _key = 0;
  1557. _key < _len;
  1558. _key++
  1559. ) {
  1560. c[_key] = arguments[_key];
  1561. }
  1562.  
  1563. if (c[0].url.includes("engine?t=")) {
  1564. var _b19 = c[0].success;
  1565.  
  1566. c[0].success = function() {
  1567. for (
  1568. var _len2 = arguments.length, c = new Array(_len2), _key2 = 0;
  1569. _key2 < _len2;
  1570. _key2++
  1571. ) {
  1572. c[_key2] = arguments[_key2];
  1573. }
  1574.  
  1575. var d =
  1576. "object" == _typeof(c[0]) &&
  1577. null !== c[0] &&
  1578. "ok" === c[0].e,
  1579. e = _b19.apply(_this13, c);
  1580.  
  1581. return d && a.parseAjaxData(c[0]), e;
  1582. };
  1583. }
  1584.  
  1585. return b.apply(_this13, c);
  1586. };
  1587. }
  1588. },
  1589. {
  1590. key: "parseAjaxData",
  1591. value: function parseAjaxData(a) {
  1592. if (
  1593. (((a.hasOwnProperty("d") && "stop" === a.d) ||
  1594. (a.hasOwnProperty("t") && "stop" === a.t)) &&
  1595. this.Sleep(2500).then(function() {
  1596. location.href = location.href;
  1597. }),
  1598. (this.incrementValue = 0),
  1599. a.hasOwnProperty("loot") &&
  1600. a.hasOwnProperty("item") &&
  1601. a.loot.hasOwnProperty("init") &&
  1602. a.loot.hasOwnProperty("source") &&
  1603. 0 < a.loot.init &&
  1604. "fight" === a.loot.source)
  1605. ) {
  1606. var _b20 = [],
  1607. c = [];
  1608.  
  1609. var _arr15 = Object.entries(a.item);
  1610.  
  1611. for (var _i15 = 0; _i15 < _arr15.length; _i15++) {
  1612. var _arr15$_i = _slicedToArray(_arr15[_i15], 2),
  1613. d = _arr15$_i[0],
  1614. e = _arr15$_i[1];
  1615.  
  1616. var _a19 = e.stat,
  1617. f = e.name;
  1618. !0 === this.isGoodItem(_a19, f) ? _b20.push(d) : c.push(d);
  1619. }
  1620.  
  1621. this.sendLoots(_b20, c);
  1622. }
  1623.  
  1624. a.hasOwnProperty("f") &&
  1625. a.f.hasOwnProperty("move") &&
  1626. a.f.hasOwnProperty("current") &&
  1627. 0 === a.f.current &&
  1628. -1 === a.f.move &&
  1629. (this.closeBattle(), a.f.hasOwnProperty("w") && this.autoHeal()),
  1630. a.hasOwnProperty("event_done") && this.autoHeal(),
  1631. a.hasOwnProperty("ask") &&
  1632. a.ask.hasOwnProperty("re") &&
  1633. "party&a=accept&answer=" === a.ask.re &&
  1634. !0 === this.QuickGroupSettings.accepting.active &&
  1635. window._g("party&a=accept&answer=1");
  1636. }
  1637. },
  1638. {
  1639. key: "isGoodItem",
  1640. value: function isGoodItem(a, b) {
  1641. if (!0 === this.lootfilterSettings.stat.all.active) return !0;
  1642. var c = [];
  1643.  
  1644. var _arr16 = Object.entries(this.lootfilterSettings.stat);
  1645.  
  1646. for (var _i16 = 0; _i16 < _arr16.length; _i16++) {
  1647. var _arr16$_i = _slicedToArray(_arr16[_i16], 2),
  1648. _d2 = _arr16$_i[0],
  1649. e = _arr16$_i[1].active;
  1650.  
  1651. !0 === e && c.push(_d2);
  1652. }
  1653.  
  1654. var d = this.lootfilterSettings.names;
  1655.  
  1656. for (var _i17 = 0; _i17 < c.length; _i17++) {
  1657. var _d3 = c[_i17];
  1658. if (a.includes(_d3)) return !0;
  1659. }
  1660.  
  1661. var _iteratorNormalCompletion4 = true;
  1662. var _didIteratorError4 = false;
  1663. var _iteratorError4 = undefined;
  1664.  
  1665. try {
  1666. for (
  1667. var _iterator4 = d[Symbol.iterator](), _step4;
  1668. !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done);
  1669. _iteratorNormalCompletion4 = true
  1670. ) {
  1671. var _c5 = _step4.value;
  1672. if (b.toLowerCase() === _c5.toLowerCase()) return !0;
  1673. }
  1674. } catch (err) {
  1675. _didIteratorError4 = true;
  1676. _iteratorError4 = err;
  1677. } finally {
  1678. try {
  1679. if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
  1680. _iterator4.return();
  1681. }
  1682. } finally {
  1683. if (_didIteratorError4) {
  1684. throw _iteratorError4;
  1685. }
  1686. }
  1687. }
  1688.  
  1689. return !1;
  1690. }
  1691. },
  1692. {
  1693. key: "sendLoots",
  1694. value: function sendLoots(a, b) {
  1695. window._g(
  1696. "loot&not="
  1697. .concat(b.join(","), "&want=&must=")
  1698. .concat(a.join(","), "&final=1")
  1699. ),
  1700. "si" === this.interface &&
  1701. (document.querySelector("#loots").style.display = "none");
  1702. }
  1703. },
  1704. {
  1705. key: "closeBattle",
  1706. value: function closeBattle() {
  1707. window._g("fight&a=quit"),
  1708. "si" === this.interface &&
  1709. (document.querySelector("#battle").style.display = "none");
  1710. }
  1711. },
  1712. {
  1713. key: "autoHeal",
  1714. value: function autoHeal() {
  1715. var _this14 = this;
  1716.  
  1717. if (this.dead) return;
  1718. var a =
  1719. "ni" === this.interface
  1720. ? window.Engine.hero.d.warrior_stats
  1721. : window.hero;
  1722. if (a.hp === a.maxhp) return (this.isHealing = !1);
  1723. this.isHealing = !0;
  1724. var b = [],
  1725. c = [];
  1726. var d = !1;
  1727. var _iteratorNormalCompletion5 = true;
  1728. var _didIteratorError5 = false;
  1729. var _iteratorError5 = undefined;
  1730.  
  1731. try {
  1732. for (
  1733. var _iterator5 = this.items[Symbol.iterator](), _step5;
  1734. !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done);
  1735. _iteratorNormalCompletion5 = true
  1736. ) {
  1737. var e = _step5.value;
  1738. var f = e.stat,
  1739. g = e.loc,
  1740. h = e.name;
  1741.  
  1742. if ("g" === g) {
  1743. var _this$parseItemStat = this.parseItemStat(f),
  1744. _g = _this$parseItemStat.timelimit,
  1745. i = _this$parseItemStat.lvl,
  1746. j = _this$parseItemStat.leczy,
  1747. k = _this$parseItemStat.fullheal;
  1748.  
  1749. if (_g !== void 0 && _g.includes(",")) continue;
  1750. if (void 0 !== i && i > a.lvl) continue;
  1751. j !== void 0 && (j <= a.maxhp - a.hp ? c.push(e) : (d = !0)),
  1752. "Czarna per\u0142a \u017Cycia" === h &&
  1753. (16e3 <= a.maxhp - a.hp ? c.push(e) : (d = !0)),
  1754. k !== void 0 && b.push(e);
  1755. }
  1756. }
  1757. } catch (err) {
  1758. _didIteratorError5 = true;
  1759. _iteratorError5 = err;
  1760. } finally {
  1761. try {
  1762. if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
  1763. _iterator5.return();
  1764. }
  1765. } finally {
  1766. if (_didIteratorError5) {
  1767. throw _iteratorError5;
  1768. }
  1769. }
  1770. }
  1771.  
  1772. if (0 < c.length) {
  1773. var _a20 = c.sort(function(a, b) {
  1774. return (
  1775. _this14.parseItemStat(b.stat).leczy -
  1776. _this14.parseItemStat(a.stat).leczy
  1777. );
  1778. });
  1779.  
  1780. this.useItem(_a20[0].id, function() {
  1781. _this14.Sleep(100).then(function() {
  1782. _this14.autoHeal();
  1783. });
  1784. });
  1785. } else
  1786. 0 < b.length
  1787. ? this.useItem(b[0].id, function() {
  1788. _this14.Sleep(100).then(function() {
  1789. _this14.autoHeal();
  1790. });
  1791. })
  1792. : !1 == d &&
  1793. window.message(
  1794. '<span style="color: red">Brakuje Ci potek!</span>'
  1795. );
  1796.  
  1797. this.isHealing = !1;
  1798. }
  1799. },
  1800. {
  1801. key: "parseItemStat",
  1802. value: function parseItemStat(a) {
  1803. var b = {},
  1804. c = a.split(";");
  1805. var _iteratorNormalCompletion6 = true;
  1806. var _didIteratorError6 = false;
  1807. var _iteratorError6 = undefined;
  1808.  
  1809. try {
  1810. for (
  1811. var _iterator6 = c[Symbol.iterator](), _step6;
  1812. !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done);
  1813. _iteratorNormalCompletion6 = true
  1814. ) {
  1815. var d = _step6.value;
  1816.  
  1817. var _d$split = d.split("="),
  1818. _d$split2 = _slicedToArray(_d$split, 2),
  1819. _a21 = _d$split2[0],
  1820. _c6 = _d$split2[1];
  1821.  
  1822. b[_a21] = _c6;
  1823. }
  1824. } catch (err) {
  1825. _didIteratorError6 = true;
  1826. _iteratorError6 = err;
  1827. } finally {
  1828. try {
  1829. if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
  1830. _iterator6.return();
  1831. }
  1832. } finally {
  1833. if (_didIteratorError6) {
  1834. throw _iteratorError6;
  1835. }
  1836. }
  1837. }
  1838.  
  1839. return b;
  1840. }
  1841. },
  1842. {
  1843. key: "useItem",
  1844. value: function useItem(a, b) {
  1845. window._g("moveitem&id=".concat(a, "&st=1"), b);
  1846. }
  1847. },
  1848. {
  1849. key: "init",
  1850. value: function init() {
  1851. if ((this.initTimer(), "none" === this.interface))
  1852. return this.createTimerOnMainPage();
  1853.  
  1854. if ("ni" === this.interface) {
  1855. var _a22 = window.Storage.prototype.setItem;
  1856.  
  1857. window.Storage.prototype.setItem = function(b, c) {
  1858. if ("Margonem" === b) {
  1859. var _a23 = JSON.parse(c);
  1860.  
  1861. (_a23.f = 0), (c = JSON.stringify(_a23));
  1862. }
  1863.  
  1864. _a22.apply(this, [b, c]);
  1865. };
  1866. } else window.bB = Function.prototype;
  1867.  
  1868. this.initBox(),
  1869. this.initNewNpc(),
  1870. this.initNewOther(),
  1871. this.removeLockAdding(),
  1872. this.initChecker(),
  1873. this.randomRefresh(),
  1874. this.initLagRefresher(),
  1875. this.chatParser();
  1876. }
  1877. },
  1878. {
  1879. key: "collisions",
  1880. get: function get() {
  1881. return "ni" === this.interface
  1882. ? this.updateCollisions()
  1883. : window.map.col;
  1884. }
  1885. },
  1886. {
  1887. key: "npccol",
  1888. get: function get() {
  1889. return "ni" === this.interface
  1890. ? this.getNpcColsNI()
  1891. : window.g.npccol;
  1892. }
  1893. },
  1894. {
  1895. key: "timeStamp",
  1896. get: function get() {
  1897. return Math.floor(new Date().getTime() / 1e3);
  1898. }
  1899. },
  1900. {
  1901. key: "hero",
  1902. get: function get() {
  1903. return "ni" === this.interface ? window.Engine.hero.d : window.hero;
  1904. }
  1905. },
  1906. {
  1907. key: "map",
  1908. get: function get() {
  1909. return "ni" === this.interface ? window.Engine.map.size : window.map;
  1910. }
  1911. },
  1912. {
  1913. key: "mapName",
  1914. get: function get() {
  1915. return "ni" === this.interface
  1916. ? window.Engine.map.d.name
  1917. : window.map.name;
  1918. }
  1919. },
  1920. {
  1921. key: "npcs",
  1922. get: function get() {
  1923. return "ni" === this.interface
  1924. ? this.npcsOnNewInterface
  1925. : window.g.npc;
  1926. }
  1927. },
  1928. {
  1929. key: "others",
  1930. get: function get() {
  1931. return "ni" === this.interface
  1932. ? this.othersOnNewInterface
  1933. : window.g.other;
  1934. }
  1935. },
  1936. {
  1937. key: "world",
  1938. get: function get() {
  1939. return "ni" === this.interface
  1940. ? window.Engine.worldName
  1941. : window.g.worldname;
  1942. }
  1943. },
  1944. {
  1945. key: "serverTimerSpeed",
  1946. get: function get() {
  1947. return "none" !== this.interface &&
  1948. [
  1949. "nerthus",
  1950. "aldous",
  1951. "berufs",
  1952. "brutal",
  1953. "classic",
  1954. "gefion",
  1955. "hutena",
  1956. "jaruna",
  1957. "katahha",
  1958. "lelwani",
  1959. "majuna",
  1960. "nomada",
  1961. "perkun",
  1962. "tarhuna",
  1963. "telawel",
  1964. "tempest",
  1965. "zemyna",
  1966. "zorza"
  1967. ].includes(this.world.toLowerCase())
  1968. ? 1
  1969. : "none" !== this.interface &&
  1970. "syberia" === this.world.toLowerCase()
  1971. ? 2
  1972. : 3;
  1973. }
  1974. },
  1975. {
  1976. key: "battle",
  1977. get: function get() {
  1978. return "ni" === this.interface
  1979. ? !!window.Engine.battle && !window.Engine.battle.endBattle
  1980. : window.g.battle;
  1981. }
  1982. },
  1983. {
  1984. key: "dead",
  1985. get: function get() {
  1986. return "ni" === this.interface ? window.Engine.dead : window.g.dead;
  1987. }
  1988. },
  1989. {
  1990. key: "party",
  1991. get: function get() {
  1992. return "ni" === this.interface ? Engine.party : window.g.party;
  1993. }
  1994. },
  1995. {
  1996. key: "loots",
  1997. get: function get() {
  1998. return "ni" === this.interface
  1999. ? window.Engine.loots !== void 0 &&
  2000. !!(0 < Object.keys(window.Engine.loots.items).length)
  2001. : !1 !== window.g.loots;
  2002. }
  2003. },
  2004. {
  2005. key: "issetMyNpcOnMap",
  2006. get: function get() {
  2007. var _this15 = this;
  2008.  
  2009. return Object.values(this.npcs).some(function(a) {
  2010. return _this15.storage.name
  2011. .toLowerCase()
  2012. .includes(a.nick.toLowerCase());
  2013. });
  2014. }
  2015. },
  2016. {
  2017. key: "items",
  2018. get: function get() {
  2019. return "ni" === this.interface
  2020. ? window.Engine.items.fetchLocationItems("g")
  2021. : Object.values(window.g.item);
  2022. }
  2023. },
  2024. {
  2025. key: "npcsOnNewInterface",
  2026. get: function get() {
  2027. var a = window.Engine.npcs.check(),
  2028. b = {};
  2029.  
  2030. var _arr17 = Object.entries(a);
  2031.  
  2032. for (var _i18 = 0; _i18 < _arr17.length; _i18++) {
  2033. var _arr17$_i = _slicedToArray(_arr17[_i18], 2),
  2034. c = _arr17$_i[0],
  2035. d = _arr17$_i[1];
  2036.  
  2037. b[c] = d.d;
  2038. }
  2039.  
  2040. return b;
  2041. }
  2042. },
  2043. {
  2044. key: "othersOnNewInterface",
  2045. get: function get() {
  2046. var a = window.Engine.others.check(),
  2047. b = {};
  2048.  
  2049. var _arr18 = Object.entries(a);
  2050.  
  2051. for (var _i19 = 0; _i19 < _arr18.length; _i19++) {
  2052. var _arr18$_i = _slicedToArray(_arr18[_i19], 2),
  2053. c = _arr18$_i[0],
  2054. d = _arr18$_i[1];
  2055.  
  2056. b[c] = d.d;
  2057. }
  2058.  
  2059. return b;
  2060. }
  2061. }
  2062. ]);
  2063.  
  2064. return _class;
  2065. })())();
  2066. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement