Facebook
From lucek, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 65
  1. // ==UserScript==
  2. // @name         Bot na e2 z robieniem grp
  3. // @version      1.54
  4. // @description  bot na e2 w trakcie rozbudowy, dziala na NI i SI
  5. // @author       ---
  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: "Zu0142oto",
  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.           "kiedyu015B to byu0142o, nie to co tera",
  357.           "to fajnie",
  358.           "nom",
  359.           "super",
  360.           "co ?",
  361.           "interesuju0105ce",
  362.           "bombowo",
  363.           "Bardzo siu0119 cieszu0119.",
  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 wrogxF3w cie daje :)",
  376.           "papapappapapapap",
  377.           "nara.",
  378.           "w tyu0142ku cie mam gosciu, nara",
  379.           "papapapp",
  380.           "nara koleu017Cko",
  381.           "lecisz do wrogow :P",
  382.           "narka ;)",
  383.           "hehehehhe, narq",
  384.           "ej jesteu015B?",
  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, "Wprowadu017A 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 pozycju0119 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 juu017C z kimu015B 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: "logIn",
  1087.         value: function logIn(a, b) {
  1088.           if (
  1089.             ("none" === this.interface ||
  1090.               void 0 === this.hero.id ||
  1091.               this.hero.id != a) &&
  1092.             !(
  1093.               "none" !== this.interface &&
  1094.               (this.battle ||
  1095.                 this.loots ||
  1096.                 this.issetMyNpcOnMap ||
  1097.                 this.isHealing)
  1098.             )
  1099.           )
  1100.             try {
  1101.               var c = new Date();
  1102.               c.setTime(c.getTime() + 259200000),
  1103.                 (document.cookie = "mchar_id="
  1104.                   .concat(a, "; path=/; expires=")
  1105.                   .concat(c.toGMTString(), "; domain=.margonem.pl")),
  1106.                 (window.location.href = "http://".concat(
  1107.                   b.toLowerCase(),
  1108.                   ".margonem.pl"
  1109.                 ));
  1110.             } catch (a) {}
  1111.         }
  1112.       },
  1113.       {
  1114.         key: "getNewRespawnTime",
  1115.         value: function getNewRespawnTime(a) {
  1116.           return Math.round(
  1117.             (1 *
  1118.               (60 *
  1119.                 (200 < a
  1120.                   ? 18
  1121.                   : Math.min(18, 0.7 + 0.18 * a - 45e-5 * a * a)))) /
  1122.               parseInt(this.serverTimerSpeed)
  1123.           );
  1124.         }
  1125.       },
  1126.       {
  1127.         key: "addNpcToTimer",
  1128.         value: function addNpcToTimer(a, b) {
  1129.           var c = this.mapName;
  1130.           (this.timerData[a + this.world] = {
  1131.             name: a,
  1132.             lvl: b,
  1133.             mapName: c,
  1134.             nextRespawn: this.timeStamp + this.getNewRespawnTime(b),
  1135.             charId: this.hero.id,
  1136.             world: this.world
  1137.           }),
  1138.             this.saveTimersCookies();
  1139.         }
  1140.       },
  1141.       {
  1142.         key: "deleteNpcFromTimer",
  1143.         value: function deleteNpcFromTimer(a) {
  1144.           this.timerData[a] !== void 0 &&
  1145.             (delete this.timerData[a], this.saveTimersCookies());
  1146.         }
  1147.       },
  1148.       {
  1149.         key: "removeNpcsFromThisCharId",
  1150.         value: function removeNpcsFromThisCharId(a) {
  1151.           if (void 0 !== a) {
  1152.             var _arr10 = Object.entries(this.timerData);
  1153.  
  1154.             for (var _i10 = 0; _i10 < _arr10.length; _i10++) {
  1155.               var _arr10$_i = _slicedToArray(_arr10[_i10], 2),
  1156.                 _b12 = _arr10$_i[0],
  1157.                 c = _arr10$_i[1];
  1158.  
  1159.               c.charId == a && this.deleteNpcFromTimer(_b12);
  1160.             }
  1161.           }
  1162.         }
  1163.       },
  1164.       {
  1165.         key: "checkTimers",
  1166.         value: function checkTimers() {
  1167.           var _arr11 = Object.entries(this.timerData);
  1168.  
  1169.           for (var _i11 = 0; _i11 < _arr11.length; _i11++) {
  1170.             var _arr11$_i = _slicedToArray(_arr11[_i11], 2),
  1171.               _a14 = _arr11$_i[0],
  1172.               _b13 = _arr11$_i[1];
  1173.  
  1174.             _b13.nextRespawn + this.waitForNpcRespawn < this.timeStamp &&
  1175.               this.createNewRespawnTime(_a14);
  1176.           }
  1177.         }
  1178.       },
  1179.       {
  1180.         key: "createNewRespawnTime",
  1181.         value: function createNewRespawnTime(a) {
  1182.           var _this8 = this;
  1183.  
  1184.           if (
  1185.             !(
  1186.               Object.values(this.npcs).some(function(b) {
  1187.                 return b.nick == _this8.timerData[a].name;
  1188.               }) || this.timerData[a].charId !== this.hero.id
  1189.             )
  1190.           ) {
  1191.             for (; this.timeStamp > this.timerData[a].nextRespawn; ) {
  1192.               this.timerData[a].nextRespawn += this.getNewRespawnTime(
  1193.                 this.timerData[a].lvl
  1194.               );
  1195.             }
  1196.  
  1197.             this.saveTimersCookies();
  1198.           }
  1199.         }
  1200.       },
  1201.       {
  1202.         key: "isThisHeroIssetInTimer",
  1203.         value: function isThisHeroIssetInTimer(b) {
  1204.           return (
  1205.             void 0 !== b &&
  1206.             Object.values(this.timerData).some(function(c) {
  1207.               return c.charId == b;
  1208.             })
  1209.           );
  1210.         }
  1211.       },
  1212.       {
  1213.         key: "isntTimersInRange",
  1214.         value: function isntTimersInRange() {
  1215.           var _this9 = this;
  1216.  
  1217.           return Object.values(this.timerData).every(function(b) {
  1218.             return b.nextRespawn - _this9.timeStamp > _this9.delayToRelog;
  1219.           });
  1220.         }
  1221.       },
  1222.       {
  1223.         key: "checkHeroOnGoodMap",
  1224.         value: function checkHeroOnGoodMap(a) {
  1225.           var _arr12 = Object.entries(this.timerData);
  1226.  
  1227.           for (var _i12 = 0; _i12 < _arr12.length; _i12++) {
  1228.             var _arr12$_i = _slicedToArray(_arr12[_i12], 2),
  1229.               _b14 = _arr12$_i[0],
  1230.               c = _arr12$_i[1];
  1231.  
  1232.             var d = c.mapName,
  1233.               e = c.charId;
  1234.             e == a &&
  1235.               this.mapName !== void 0 &&
  1236.               d !== void 0 &&
  1237.               d !== this.mapName &&
  1238.               this.deleteNpcFromTimer(_b14);
  1239.           }
  1240.         }
  1241.       },
  1242.       {
  1243.         key: "initTimer",
  1244.         value: function initTimer() {
  1245.           var _this10 = this;
  1246.  
  1247.           if (0 < Object.keys(this.timerData).length)
  1248.             if ("none" === this.interface) {
  1249.               if (
  1250.                 Object.values(this.timerData).some(function(b) {
  1251.                   return (
  1252.                     b.nextRespawn - _this10.timeStamp <= _this10.delayToRelog
  1253.                   );
  1254.                 })
  1255.               ) {
  1256.                 var _Object$values$reduce = Object.values(
  1257.                     this.timerData
  1258.                   ).reduce(function(c, a) {
  1259.                     return c.nextRespawn <= a.nextRespawn ? c : a;
  1260.                   }),
  1261.                   _a15 = _Object$values$reduce.world,
  1262.                   _b15 = _Object$values$reduce.charId;
  1263.  
  1264.                 void 0 !== _b15 && this.logIn(_b15, _a15);
  1265.               }
  1266.             } else if (
  1267.               this.isntTimersInRange() &&
  1268.               this.isThisHeroIssetInTimer(this.hero.id)
  1269.             )
  1270.               this.logout();
  1271.             else {
  1272.               this.checkHeroOnGoodMap(this.hero.id);
  1273.  
  1274.               var _a16 = Object.values(this.timerData).filter(function(b) {
  1275.                 return (
  1276.                   b.nextRespawn - _this10.timeStamp <= _this10.delayToRelog
  1277.                 );
  1278.               });
  1279.  
  1280.               if (0 < _a16.length) {
  1281.                 var _a16$reduce = _a16.reduce(function(c, a) {
  1282.                     return c.nextRespawn <= a.nextRespawn ? c : a;
  1283.                   }),
  1284.                   _b16 = _a16$reduce.charId,
  1285.                   c = _a16$reduce.world;
  1286.  
  1287.                 void 0 !== this.hero.id &&
  1288.                   parseInt(_b16) !== this.hero.id &&
  1289.                   this.logIn(_b16, c);
  1290.               }
  1291.             }
  1292.           this.checkTimers(),
  1293.             setTimeout(function() {
  1294.               _this10.initTimer();
  1295.             }, 500);
  1296.         }
  1297.       },
  1298.       {
  1299.         key: "saveTimersCookies",
  1300.         value: function saveTimersCookies() {
  1301.           var a = new Date();
  1302.           a.setMonth(a.getMonth() + 1),
  1303.             this.setCookie(
  1304.               "adi-bot-timer",
  1305.               JSON.stringify(this.timerData),
  1306.               a,
  1307.               "/",
  1308.               "margonem.pl"
  1309.             );
  1310.         }
  1311.       },
  1312.       {
  1313.         key: "randomSeconds",
  1314.         value: function randomSeconds(a, b) {
  1315.           return (
  1316.             (a *= 60), (b *= 60), Math.floor(Math.random() * (b - a + 1)) + a
  1317.           );
  1318.         }
  1319.       },
  1320.       {
  1321.         key: "randomRefresh",
  1322.         value: function randomRefresh() {
  1323.           var _this$refreshTime = _slicedToArray(this.refreshTime, 2),
  1324.             a = _this$refreshTime[0],
  1325.             b = _this$refreshTime[1];
  1326.  
  1327.           setTimeout(function() {
  1328.             location.href = location.href;
  1329.           }, 1e3 * this.randomSeconds(a, b));
  1330.         }
  1331.       },
  1332.       {
  1333.         key: "getCookie",
  1334.         value: function getCookie(a) {
  1335.           var b = document.cookie,
  1336.             c = a + "=";
  1337.           var d = b.indexOf("; " + c);
  1338.           if (-1 != d) d += 2;
  1339.           else if (((d = b.indexOf(c)), 0 != d)) return null;
  1340.           var e = document.cookie.indexOf(";", d);
  1341.           return (
  1342.             -1 == e && (e = b.length), unescape(b.substring(d + c.length, e))
  1343.           );
  1344.         }
  1345.       },
  1346.       {
  1347.         key: "setCookie",
  1348.         value: function setCookie(a, b, c, d, e, f) {
  1349.           var g =
  1350.             a +
  1351.             "=" +
  1352.             escape(b) +
  1353.             (c ? "; expires=" + c.toGMTString() : "") +
  1354.             (d ? "; path=" + d : "") +
  1355.             (e ? "; domain=" + e : "") +
  1356.             (f ? "; secure" : "");
  1357.           document.cookie = g;
  1358.         }
  1359.       },
  1360.       {
  1361.         key: "createTimerOnMainPage",
  1362.         value: function createTimerOnMainPage() {
  1363.           var _this11 = this;
  1364.  
  1365.           if (0 === Object.keys(this.timerData).length) return;
  1366.           var a = document.createElement("div");
  1367.           a.classList.add("adi-bot-minutnik-strona-glowna"),
  1368.             document.querySelector(".rmenu").appendChild(a);
  1369.           var b = document.createElement("style");
  1370.           (b.type = "text/css"),
  1371.             b.appendChild(
  1372.               document.createTextNode(
  1373.                 "n            .adi-bot-minutnik-strona-glowna {n                color: white;n                font-size: 14px;n                text-align: left;n            }nn            .timer_data {n                font-weight: bold;n                float: right;n                cursor: pointer;n            }nn            .timer_data:hover {n                color: gray;n            }nn            .adi-bot-konfiguracja {nn            }n        "
  1374.               )
  1375.             ),
  1376.             document.head.appendChild(b),
  1377.             this.addNpcsToTimerBox(a),
  1378.             document.addEventListener("click", function(a) {
  1379.               try {
  1380.                 if ("timer_data" === a.target.className) {
  1381.                   var _a$target$getAttribut = a.target
  1382.                       .getAttribute("timer-data")
  1383.                       .split("|"),
  1384.                     _a$target$getAttribut2 = _slicedToArray(
  1385.                       _a$target$getAttribut,
  1386.                       2
  1387.                     ),
  1388.                     _b17 = _a$target$getAttribut2[0],
  1389.                     c = _a$target$getAttribut2[1];
  1390.  
  1391.                   c !== void 0 &&
  1392.                     _b17 !== void 0 &&
  1393.                     (_this11.deleteNpcFromTimer(_b17 + c),
  1394.                     window.showMsg(
  1395.                       "Usuniu0119to "
  1396.                         .concat(_b17, " ze u015Bwiata ")
  1397.                         .concat(c.charAt(0).toUpperCase() + c.slice(1), ".")
  1398.                     ));
  1399.                 }
  1400.               } catch (a) {}
  1401.             });
  1402.         }
  1403.       },
  1404.       {
  1405.         key: "addNpcsToTimerBox",
  1406.         value: function addNpcsToTimerBox(a) {
  1407.           var _this12 = this;
  1408.  
  1409.           var b = {};
  1410.  
  1411.           var _arr13 = Object.values(this.timerData);
  1412.  
  1413.           for (var _i13 = 0; _i13 < _arr13.length; _i13++) {
  1414.             var _c3 = _arr13[_i13];
  1415.             var _a17 = _c3.name,
  1416.               d = _c3.nextRespawn,
  1417.               e = _c3.world;
  1418.             b[e] === void 0
  1419.               ? (b[e] = [
  1420.                   {
  1421.                     name: _a17,
  1422.                     nextRespawn: d
  1423.                   }
  1424.                 ])
  1425.               : b[e].push({
  1426.                   name: _a17,
  1427.                   nextRespawn: d
  1428.                 });
  1429.           }
  1430.  
  1431.           var c = "";
  1432.  
  1433.           var _arr14 = Object.entries(b);
  1434.  
  1435.           for (var _i14 = 0; _i14 < _arr14.length; _i14++) {
  1436.             var _arr14$_i = _slicedToArray(_arr14[_i14], 2),
  1437.               d = _arr14$_i[0],
  1438.               e = _arr14$_i[1];
  1439.  
  1440.             (c += '<br><div style="text-align: center; font-weight: bold; text-decoration: underline">'.concat(
  1441.               this.capitalizeWorld(d),
  1442.               "</div>"
  1443.             )),
  1444.               e.sort(function(a, b) {
  1445.                 return a.nextRespawn - b.nextRespawn;
  1446.               });
  1447.             var _a18 = [];
  1448.  
  1449.             _a18.push("");
  1450.  
  1451.             var _iteratorNormalCompletion3 = true;
  1452.             var _didIteratorError3 = false;
  1453.             var _iteratorError3 = undefined;
  1454.  
  1455.             try {
  1456.               for (
  1457.                 var _iterator3 = e[Symbol.iterator](), _step3;
  1458.                 !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next())
  1459.                   .done);
  1460.                 _iteratorNormalCompletion3 = true
  1461.               ) {
  1462.                 var _b18 = _step3.value;
  1463.                 var _c4 = _b18.name,
  1464.                   _e2 = _b18.nextRespawn;
  1465.  
  1466.                 _a18.push(
  1467.                   "<span>"
  1468.                     .concat(
  1469.                       this.getTimeToRespawn(_c4, _e2),
  1470.                       '</span><span class="timer_data" tip="Kliknij, aby usunu0105u0107 z timera." timer-data="'
  1471.                     )
  1472.                     .concat(_c4, "|")
  1473.                     .concat(d, '">---</span>')
  1474.                 );
  1475.               }
  1476.             } catch (err) {
  1477.               _didIteratorError3 = true;
  1478.               _iteratorError3 = err;
  1479.             } finally {
  1480.               try {
  1481.                 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
  1482.                   _iterator3.return();
  1483.                 }
  1484.               } finally {
  1485.                 if (_didIteratorError3) {
  1486.                   throw _iteratorError3;
  1487.                 }
  1488.               }
  1489.             }
  1490.  
  1491.             _a18.push(""), (c += _a18.join("<hr>"));
  1492.           }
  1493.  
  1494.           (a.innerHTML = c),
  1495.             setTimeout(function() {
  1496.               _this12.addNpcsToTimerBox(a);
  1497.             }, 1e3);
  1498.         }
  1499.       },
  1500.       {
  1501.         key: "capitalizeWorld",
  1502.         value: function capitalizeWorld(a) {
  1503.           return a.charAt(0).toUpperCase() + a.slice(1) + ":";
  1504.         }
  1505.       },
  1506.       {
  1507.         key: "getTimeToRespawn",
  1508.         value: function getTimeToRespawn(a, b) {
  1509.           var c = b - this.timeStamp,
  1510.             d =
  1511.               10 > parseInt(c / 60)
  1512.                 ? "0".concat(parseInt(c / 60))
  1513.                 : parseInt(c / 60),
  1514.             e = 10 > c % 60 ? "0".concat(c % 60) : c % 60;
  1515.           return ""
  1516.             .concat(a, ": ")
  1517.             .concat(d, ":")
  1518.             .concat(e);
  1519.         }
  1520.       },
  1521.       {
  1522.         key: "removeLockAdding",
  1523.         value: function removeLockAdding() {
  1524.           "ni" === this.interface &&
  1525.             (window.Engine.lock.add = Function.prototype),
  1526.             "si" === this.interface && (window.g.lock.add = Function.prototype),
  1527.             (window.mAlert = Function.prototype);
  1528.         }
  1529.       },
  1530.       {
  1531.         key: "initLagRefresher",
  1532.         value: function initLagRefresher() {
  1533.           var _this13 = this;
  1534.  
  1535.           !1 === this.startInctementingLagRefresher &&
  1536.             ((this.startInctementingLagRefresher = !0),
  1537.             setInterval(function() {
  1538.               _this13.incrementValue++,
  1539.                 8 < _this13.incrementValue && (location.href = location.href);
  1540.             }, 500));
  1541.           var a = this,
  1542.             b = window.$.ajax;
  1543.  
  1544.           window.$.ajax = function() {
  1545.             for (
  1546.               var _len = arguments.length, c = new Array(_len), _key = 0;
  1547.               _key < _len;
  1548.               _key++
  1549.             ) {
  1550.               c[_key] = arguments[_key];
  1551.             }
  1552.  
  1553.             if (c[0].url.includes("engine?t=")) {
  1554.               var _b19 = c[0].success;
  1555.  
  1556.               c[0].success = function() {
  1557.                 for (
  1558.                   var _len2 = arguments.length, c = new Array(_len2), _key2 = 0;
  1559.                   _key2 < _len2;
  1560.                   _key2++
  1561.                 ) {
  1562.                   c[_key2] = arguments[_key2];
  1563.                 }
  1564.  
  1565.                 var d =
  1566.                     "object" == _typeof(c[0]) &&
  1567.                     null !== c[0] &&
  1568.                     "ok" === c[0].e,
  1569.                   e = _b19.apply(_this13, c);
  1570.  
  1571.                 return d && a.parseAjaxData(c[0]), e;
  1572.               };
  1573.             }
  1574.  
  1575.             return b.apply(_this13, c);
  1576.           };
  1577.         }
  1578.       },
  1579.       {
  1580.         key: "parseAjaxData",
  1581.         value: function parseAjaxData(a) {
  1582.           if (
  1583.             (((a.hasOwnProperty("d") && "stop" === a.d) ||
  1584.               (a.hasOwnProperty("t") && "stop" === a.t)) &&
  1585.               this.Sleep(2500).then(function() {
  1586.                 location.href = location.href;
  1587.               }),
  1588.             (this.incrementValue = 0),
  1589.             a.hasOwnProperty("loot") &&
  1590.               a.hasOwnProperty("item") &&
  1591.               a.loot.hasOwnProperty("init") &&
  1592.               a.loot.hasOwnProperty("source") &&
  1593.               0 < a.loot.init &&
  1594.               "fight" === a.loot.source)
  1595.           ) {
  1596.             var _b20 = [],
  1597.               c = [];
  1598.  
  1599.             var _arr15 = Object.entries(a.item);
  1600.  
  1601.             for (var _i15 = 0; _i15 < _arr15.length; _i15++) {
  1602.               var _arr15$_i = _slicedToArray(_arr15[_i15], 2),
  1603.                 d = _arr15$_i[0],
  1604.                 e = _arr15$_i[1];
  1605.  
  1606.               var _a19 = e.stat,
  1607.                 f = e.name;
  1608.               !0 === this.isGoodItem(_a19, f) ? _b20.push(d) : c.push(d);
  1609.             }
  1610.  
  1611.             this.sendLoots(_b20, c);
  1612.           }
  1613.  
  1614.           a.hasOwnProperty("f") &&
  1615.             a.f.hasOwnProperty("move") &&
  1616.             a.f.hasOwnProperty("current") &&
  1617.             0 === a.f.current &&
  1618.             -1 === a.f.move &&
  1619.             (this.closeBattle(), a.f.hasOwnProperty("w") && this.autoHeal()),
  1620.             a.hasOwnProperty("event_done") && this.autoHeal(),
  1621.             a.hasOwnProperty("ask") &&
  1622.               a.ask.hasOwnProperty("re") &&
  1623.               "party&a=accept&answer=" === a.ask.re &&
  1624.               !0 === this.QuickGroupSettings.accepting.active &&
  1625.               window._g("party&a=accept&answer=1");
  1626.         }
  1627.       },
  1628.       {
  1629.         key: "isGoodItem",
  1630.         value: function isGoodItem(a, b) {
  1631.           if (!0 === this.lootfilterSettings.stat.all.active) return !0;
  1632.           var c = [];
  1633.  
  1634.           var _arr16 = Object.entries(this.lootfilterSettings.stat);
  1635.  
  1636.           for (var _i16 = 0; _i16 < _arr16.length; _i16++) {
  1637.             var _arr16$_i = _slicedToArray(_arr16[_i16], 2),
  1638.               _d2 = _arr16$_i[0],
  1639.               e = _arr16$_i[1].active;
  1640.  
  1641.             !0 === e && c.push(_d2);
  1642.           }
  1643.  
  1644.           var d = this.lootfilterSettings.names;
  1645.  
  1646.           for (var _i17 = 0; _i17 < c.length; _i17++) {
  1647.             var _d3 = c[_i17];
  1648.             if (a.includes(_d3)) return !0;
  1649.           }
  1650.  
  1651.           var _iteratorNormalCompletion4 = true;
  1652.           var _didIteratorError4 = false;
  1653.           var _iteratorError4 = undefined;
  1654.  
  1655.           try {
  1656.             for (
  1657.               var _iterator4 = d[Symbol.iterator](), _step4;
  1658.               !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done);
  1659.               _iteratorNormalCompletion4 = true
  1660.             ) {
  1661.               var _c5 = _step4.value;
  1662.               if (b.toLowerCase() === _c5.toLowerCase()) return !0;
  1663.             }
  1664.           } catch (err) {
  1665.             _didIteratorError4 = true;
  1666.             _iteratorError4 = err;
  1667.           } finally {
  1668.             try {
  1669.               if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
  1670.                 _iterator4.return();
  1671.               }
  1672.             } finally {
  1673.               if (_didIteratorError4) {
  1674.                 throw _iteratorError4;
  1675.               }
  1676.             }
  1677.           }
  1678.  
  1679.           return !1;
  1680.         }
  1681.       },
  1682.       {
  1683.         key: "sendLoots",
  1684.         value: function sendLoots(a, b) {
  1685.           window._g(
  1686.             "loot¬="
  1687.               .concat(b.join(","), "&want=&must=")
  1688.               .concat(a.join(","), "&final=1")
  1689.           ),
  1690.             "si" === this.interface &&
  1691.               (document.querySelector("#loots").style.display = "none");
  1692.         }
  1693.       },
  1694.       {
  1695.         key: "closeBattle",
  1696.         value: function closeBattle() {
  1697.           window._g("fight&a=quit"),
  1698.             "si" === this.interface &&
  1699.               (document.querySelector("#battle").style.display = "none");
  1700.         }
  1701.       },
  1702.       {
  1703.         key: "autoHeal",
  1704.         value: function autoHeal() {
  1705.           var _this14 = this;
  1706.  
  1707.           if (this.dead) return;
  1708.           var a =
  1709.             "ni" === this.interface
  1710.               ? window.Engine.hero.d.warrior_stats
  1711.               : window.hero;
  1712.           if (a.hp === a.maxhp) return (this.isHealing = !1);
  1713.           this.isHealing = !0;
  1714.           var b = [],
  1715.             c = [];
  1716.           var d = !1;
  1717.           var _iteratorNormalCompletion5 = true;
  1718.           var _didIteratorError5 = false;
  1719.           var _iteratorError5 = undefined;
  1720.  
  1721.           try {
  1722.             for (
  1723.               var _iterator5 = this.items[Symbol.iterator](), _step5;
  1724.               !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done);
  1725.               _iteratorNormalCompletion5 = true
  1726.             ) {
  1727.               var e = _step5.value;
  1728.               var f = e.stat,
  1729.                 g = e.loc,
  1730.                 h = e.name;
  1731.  
  1732.               if ("g" === g) {
  1733.                 var _this$parseItemStat = this.parseItemStat(f),
  1734.                   _g = _this$parseItemStat.timelimit,
  1735.                   i = _this$parseItemStat.lvl,
  1736.                   j = _this$parseItemStat.leczy,
  1737.                   k = _this$parseItemStat.fullheal;
  1738.  
  1739.                 if (_g !== void 0 && _g.includes(",")) continue;
  1740.                 if (void 0 !== i && i > a.lvl) continue;
  1741.                 j !== void 0 && (j <= a.maxhp - a.hp ? c.push(e) : (d = !0)),
  1742.                   "Czarna peru0142a u017Cycia" === h &&
  1743.                     (16e3 <= a.maxhp - a.hp ? c.push(e) : (d = !0)),
  1744.                   k !== void 0 && b.push(e);
  1745.               }
  1746.             }
  1747.           } catch (err) {
  1748.             _didIteratorError5 = true;
  1749.             _iteratorError5 = err;
  1750.           } finally {
  1751.             try {
  1752.               if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
  1753.                 _iterator5.return();
  1754.               }
  1755.             } finally {
  1756.               if (_didIteratorError5) {
  1757.                 throw _iteratorError5;
  1758.               }
  1759.             }
  1760.           }
  1761.  
  1762.           if (0 < c.length) {
  1763.             var _a20 = c.sort(function(a, b) {
  1764.               return (
  1765.                 _this14.parseItemStat(b.stat).leczy -
  1766.                 _this14.parseItemStat(a.stat).leczy
  1767.               );
  1768.             });
  1769.  
  1770.             this.useItem(_a20[0].id, function() {
  1771.               _this14.Sleep(100).then(function() {
  1772.                 _this14.autoHeal();
  1773.               });
  1774.             });
  1775.           } else
  1776.             0 < b.length
  1777.               ? this.useItem(b[0].id, function() {
  1778.                   _this14.Sleep(100).then(function() {
  1779.                     _this14.autoHeal();
  1780.                   });
  1781.                 })
  1782.               : !1 == d &&
  1783.                 window.message(
  1784.                   '<span style="color: red">Brakuje Ci potek!</span>'
  1785.                 );
  1786.  
  1787.           this.isHealing = !1;
  1788.         }
  1789.       },
  1790.       {
  1791.         key: "parseItemStat",
  1792.         value: function parseItemStat(a) {
  1793.           var b = {},
  1794.             c = a.split(";");
  1795.           var _iteratorNormalCompletion6 = true;
  1796.           var _didIteratorError6 = false;
  1797.           var _iteratorError6 = undefined;
  1798.  
  1799.           try {
  1800.             for (
  1801.               var _iterator6 = c[Symbol.iterator](), _step6;
  1802.               !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done);
  1803.               _iteratorNormalCompletion6 = true
  1804.             ) {
  1805.               var d = _step6.value;
  1806.  
  1807.               var _d$split = d.split("="),
  1808.                 _d$split2 = _slicedToArray(_d$split, 2),
  1809.                 _a21 = _d$split2[0],
  1810.                 _c6 = _d$split2[1];
  1811.  
  1812.               b[_a21] = _c6;
  1813.             }
  1814.           } catch (err) {
  1815.             _didIteratorError6 = true;
  1816.             _iteratorError6 = err;
  1817.           } finally {
  1818.             try {
  1819.               if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
  1820.                 _iterator6.return();
  1821.               }
  1822.             } finally {
  1823.               if (_didIteratorError6) {
  1824.                 throw _iteratorError6;
  1825.               }
  1826.             }
  1827.           }
  1828.  
  1829.           return b;
  1830.         }
  1831.       },
  1832.       {
  1833.         key: "useItem",
  1834.         value: function useItem(a, b) {
  1835.           window._g("moveitem&id=".concat(a, "&st=1"), b);
  1836.         }
  1837.       },
  1838.       {
  1839.         key: "init",
  1840.         value: function init() {
  1841.           if ((this.initTimer(), "none" === this.interface))
  1842.             return this.createTimerOnMainPage();
  1843.  
  1844.           if ("ni" === this.interface) {
  1845.             var _a22 = window.Storage.prototype.setItem;
  1846.  
  1847.             window.Storage.prototype.setItem = function(b, c) {
  1848.               if ("Margonem" === b) {
  1849.                 var _a23 = JSON.parse(c);
  1850.  
  1851.                 (_a23.f = 0), (c = JSON.stringify(_a23));
  1852.               }
  1853.  
  1854.               _a22.apply(this, [b, c]);
  1855.             };
  1856.           } else window.bB = Function.prototype;
  1857.  
  1858.           this.initBox(),
  1859.             this.initNewNpc(),
  1860.             this.initNewOther(),
  1861.             this.removeLockAdding(),
  1862.             this.initChecker(),
  1863.             this.randomRefresh(),
  1864.             this.initLagRefresher(),
  1865.             this.chatParser();
  1866.         }
  1867.       },
  1868.       {
  1869.         key: "collisions",
  1870.         get: function get() {
  1871.           return "ni" === this.interface
  1872.             ? this.updateCollisions()
  1873.             : window.map.col;
  1874.         }
  1875.       },
  1876.       {
  1877.         key: "npccol",
  1878.         get: function get() {
  1879.           return "ni" === this.interface
  1880.             ? this.getNpcColsNI()
  1881.             : window.g.npccol;
  1882.         }
  1883.       },
  1884.       {
  1885.         key: "timeStamp",
  1886.         get: function get() {
  1887.           return Math.floor(new Date().getTime() / 1e3);
  1888.         }
  1889.       },
  1890.       {
  1891.         key: "hero",
  1892.         get: function get() {
  1893.           return "ni" === this.interface ? window.Engine.hero.d : window.hero;
  1894.         }
  1895.       },
  1896.       {
  1897.         key: "map",
  1898.         get: function get() {
  1899.           return "ni" === this.interface ? window.Engine.map.size : window.map;
  1900.         }
  1901.       },
  1902.       {
  1903.         key: "mapName",
  1904.         get: function get() {
  1905.           return "ni" === this.interface
  1906.             ? window.Engine.map.d.name
  1907.             : window.map.name;
  1908.         }
  1909.       },
  1910.       {
  1911.         key: "npcs",
  1912.         get: function get() {
  1913.           return "ni" === this.interface
  1914.             ? this.npcsOnNewInterface
  1915.             : window.g.npc;
  1916.         }
  1917.       },
  1918.       {
  1919.         key: "others",
  1920.         get: function get() {
  1921.           return "ni" === this.interface
  1922.             ? this.othersOnNewInterface
  1923.             : window.g.other;
  1924.         }
  1925.       },
  1926.       {
  1927.         key: "world",
  1928.         get: function get() {
  1929.           return "ni" === this.interface
  1930.             ? window.Engine.worldName
  1931.             : window.g.worldname;
  1932.         }
  1933.       },
  1934.       {
  1935.         key: "serverTimerSpeed",
  1936.         get: function get() {
  1937.           return "none" !== this.interface &&
  1938.             [
  1939.               "nerthus",
  1940.               "aldous",
  1941.               "berufs",
  1942.               "brutal",
  1943.               "classic",
  1944.               "gefion",
  1945.               "hutena",
  1946.               "jaruna",
  1947.               "katahha",
  1948.               "lelwani",
  1949.               "majuna",
  1950.               "nomada",
  1951.               "perkun",
  1952.               "tarhuna",
  1953.               "telawel",
  1954.               "tempest",
  1955.               "zemyna",
  1956.               "zorza"
  1957.             ].includes(this.world.toLowerCase())
  1958.             ? 1
  1959.             : "none" !== this.interface &&
  1960.               "syberia" === this.world.toLowerCase()
  1961.               ? 2
  1962.               : 3;
  1963.         }
  1964.       },
  1965.       {
  1966.         key: "battle",
  1967.         get: function get() {
  1968.           return "ni" === this.interface
  1969.             ? !!window.Engine.battle && !window.Engine.battle.endBattle
  1970.             : window.g.battle;
  1971.         }
  1972.       },
  1973.       {
  1974.         key: "dead",
  1975.         get: function get() {
  1976.           return "ni" === this.interface ? window.Engine.dead : window.g.dead;
  1977.         }
  1978.       },
  1979.       {
  1980.         key: "party",
  1981.         get: function get() {
  1982.           return "ni" === this.interface ? Engine.party : window.g.party;
  1983.         }
  1984.       },
  1985.       {
  1986.         key: "loots",
  1987.         get: function get() {
  1988.           return "ni" === this.interface
  1989.             ? window.Engine.loots !== void 0 &&
  1990.                 !!(0 < Object.keys(window.Engine.loots.items).length)
  1991.             : !1 !== window.g.loots;
  1992.         }
  1993.       },
  1994.       {
  1995.         key: "issetMyNpcOnMap",
  1996.         get: function get() {
  1997.           var _this15 = this;
  1998.  
  1999.           return Object.values(this.npcs).some(function(a) {
  2000.             return _this15.storage.name
  2001.               .toLowerCase()
  2002.               .includes(a.nick.toLowerCase());
  2003.           });
  2004.         }
  2005.       },
  2006.       {
  2007.         key: "items",
  2008.         get: function get() {
  2009.           return "ni" === this.interface
  2010.             ? window.Engine.items.fetchLocationItems("g")
  2011.             : Object.values(window.g.item);
  2012.         }
  2013.       },
  2014.       {
  2015.         key: "npcsOnNewInterface",
  2016.         get: function get() {
  2017.           var a = window.Engine.npcs.check(),
  2018.             b = {};
  2019.  
  2020.           var _arr17 = Object.entries(a);
  2021.  
  2022.           for (var _i18 = 0; _i18 < _arr17.length; _i18++) {
  2023.             var _arr17$_i = _slicedToArray(_arr17[_i18], 2),
  2024.               c = _arr17$_i[0],
  2025.               d = _arr17$_i[1];
  2026.  
  2027.             b[c] = d.d;
  2028.           }
  2029.  
  2030.           return b;
  2031.         }
  2032.       },
  2033.       {
  2034.         key: "othersOnNewInterface",
  2035.         get: function get() {
  2036.           var a = window.Engine.others.check(),
  2037.             b = {};
  2038.  
  2039.           var _arr18 = Object.entries(a);
  2040.  
  2041.           for (var _i19 = 0; _i19 < _arr18.length; _i19++) {
  2042.             var _arr18$_i = _slicedToArray(_arr18[_i19], 2),
  2043.               c = _arr18$_i[0],
  2044.               d = _arr18$_i[1];
  2045.  
  2046.             b[c] = d.d;
  2047.           }
  2048.  
  2049.           return b;
  2050.         }
  2051.       }
  2052.     ]);
  2053.  
  2054.     return _class;
  2055.   })())();
  2056. })();