Advertisement
Guest User

bod

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