// ==UserScript==
// @name EventHelperV2
// @version 16.0.0
// @author achepta
// @description sources: https://github.com/achepta/hwm-event-helper
// @match https://www.heroeswm.ru/*
// @match https://my.lordswm.com/*
// @match https://www.lordswm.com/*
// @namespace https://gf.qytechs.cn/ru/scripts/399402-eventhelper
// @connect hwm.events
// @connect localhost
// @license GNU GPLv3
// @run-at document-end
// ==/UserScript==
/******/
(function(modules) { // webpackBootstrap
/******/ // The module cache
/******/
var installedModules = {};
/******/
/******/ // The require function
/******/
function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/
if (installedModules[moduleId]) {
/******/
return installedModules[moduleId].exports;
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/
var module = installedModules[moduleId] = {
/******/
i: moduleId,
/******/
l: false,
/******/
exports: {}
/******/
};
/******/
/******/ // Execute the module function
/******/
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/
module.l = true;
/******/
/******/ // Return the exports of the module
/******/
return module.exports;
/******/
}
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/
__webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/
__webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/
__webpack_require__.d = function(exports, name, getter) {
/******/
if (!__webpack_require__.o(exports, name)) {
/******/
Object.defineProperty(exports, name, {
enumerable: true,
get: getter
});
/******/
}
/******/
};
/******/
/******/ // define __esModule on exports
/******/
__webpack_require__.r = function(exports) {
/******/
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/
Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/
__webpack_require__.t = function(value, mode) {
/******/
if (mode & 1) value = __webpack_require__(value);
/******/
if (mode & 8) return value;
/******/
if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/
var ns = Object.create(null);
/******/
__webpack_require__.r(ns);
/******/
Object.defineProperty(ns, 'default', {
enumerable: true,
value: value
});
/******/
if (mode & 2 && typeof value != 'string')
for (var key in value) __webpack_require__.d(ns, key, function(key) {
return value[key];
}.bind(null, key));
/******/
return ns;
/******/
};
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/
__webpack_require__.n = function(module) {
/******/
var getter = module && module.__esModule ?
/******/
function getDefault() {
return module['default'];
} :
/******/
function getModuleExports() {
return module;
};
/******/
__webpack_require__.d(getter, 'a', getter);
/******/
return getter;
/******/
};
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/
__webpack_require__.o = function(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
};
/******/
/******/ // __webpack_public_path__
/******/
__webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/
return __webpack_require__(__webpack_require__.s = 9);
/******/
})
/************************************************************************/
/******/
([
/* 0 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "k", function() {
return pl_id;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "l", function() {
return pl_lvl;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "j", function() {
return my_sign;
});
/* unused harmony export host */
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "d", function() {
return cdnHost;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "h", function() {
return heroCreatures;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "a", function() {
return $;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "g", function() {
return get;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "m", function() {
return set;
});
/* unused harmony export getScrollHeight */
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "f", function() {
return findAll;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "n", function() {
return sortByKey;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "i", function() {
return mapToArray;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "e", function() {
return encode;
});
/* unused harmony export getCookie */
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "b", function() {
return allClasses;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "c", function() {
return allFactions;
});
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
var pl_id = getCookie("pl_id");
var pl_lvl = get("hero_combat_lvl", 0);
var my_sign = get("my_sign", null);
var host = location.host;
var cdnHost = host.includes("my.") ? "cfcdn.lordswm.com" : "dcdn.heroeswm.ru";
var heroCreatures = {};
function $(id) {
var where = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
return where.getElementById(id);
}
function get(key, def) {
var result = JSON.parse(typeof localStorage[key] === "undefined" || localStorage[key] === "undefined" ? null : localStorage[key]);
return result == null ? def : result;
}
function set(key, val) {
localStorage[key] = JSON.stringify(val);
}
function getScrollHeight() {
return Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
}
function findAll(regexPattern, sourceString) {
var output = [];
var match;
var regexPatternWithGlobal = RegExp(regexPattern, _toConsumableArray(new Set("g" + regexPattern.flags)).join(""));
while (match = regexPatternWithGlobal.exec(sourceString)) {
delete match.input;
output.push(match);
}
return output;
}
function sortByKey(array, key) {
return array.sort(function(a, b) {
var x = a[key];
var y = b[key];
return x < y ? -1 : x > y ? 1 : 0;
});
}
function mapToArray(map) {
var result = [];
for (var _i = 0, _Object$entries = Object.entries(map); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object$entries$_i[0],
value = _Object$entries$_i[1];
result.push([parseInt(key), value]);
}
return result;
}
function encode(str) {
var customEncode = function customEncode(e) {
return "%" + (parseInt(e.charAt(1) + e.charAt(5), 16) + 16 * function(x) {
return -(2 * Math.pow(x, 3)) / 3 + 20 * Math.pow(x, 2) - 595 * x / 3 + 650;
}(parseInt(e.charAt(4), 16)).toFixed()).toString(16);
};
return Array.from(str).map(function(c) {
return c.charCodeAt(0) >= 1040 && c.charCodeAt(0) <= 1103 ? customEncode(encodeURIComponent(c)) : encodeURIComponent(c);
}).join("");
}
function getCookie(name) {
var value = "; ".concat(document.cookie);
var parts = value.split("; ".concat(name, "="));
if (parts.length === 2) return parts.pop().split(';').shift();
}
var allClasses = [
[1, 'Рыцарь', 0, 'r1.png', 1],
[1, 'Рыцарь света', 1, 'r101.png', 101],
[2, 'Некромант', 0, 'r2.png', 2],
[2, 'Некромант - повелитель смерти', 1, 'r102.png', 102],
[3, 'Маг', 0, 'r3.png', 3],
[3, 'Маг - разрушитель', 1, 'r103.png', 103],
[4, 'Эльф', 0, 'r4.png', 4],
[4, 'Эльф - заклинатель', 1, 'r104.png', 104],
[5, 'Варвар', 0, 'r5.png', 5],
[5, 'Варвар крови', 1, 'r105.png', 105],
[5, 'Варвар - шаман', 2, 'r205.png', 205],
[6, 'Темный эльф', 0, 'r6.png', 6],
[6, 'Темный эльф - укротитель', 1, 'r106.png', 106],
[7, 'Демон', 0, 'r7.png', 7],
[7, 'Демон тьмы', 1, 'r107.png', 107],
[8, 'Гном', 0, 'r8.png', 8],
[8, 'Гном огня', 1, 'r108.png', 108],
[9, 'Степной варвар', 0, 'r9.png', 9],
[10, 'Фараон', 0, 'r10.png', 10]
];
var allFactions = [
[-1, 'All', ''],
[1, 'Рыцарь', 'r1.png'],
[2, 'Некромант', 'r2.png'],
[3, 'Маг', 'r3.png'],
[4, 'Эльф', 'r4.png'],
[5, 'Варвар', 'r5.png'],
[6, 'Темный эльф', 'r6.png'],
[7, 'Демон', 'r7.png'],
[8, 'Гном', 'r8.png'],
[9, 'Степной варвар', 'r9.png'],
[10, 'Фараон', 'r10.png'],
[0, 'Нейтрал', 'r_neut.png']
];
/***/
}),
/* 1 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "setSettings", function() {
return /* binding */ setSettings;
});
__webpack_require__.d(__webpack_exports__, "eventHelperSettings", function() {
return /* binding */ eventHelperSettings;
});
// EXTERNAL MODULE: ./src/utils/networkUtils.js
var networkUtils = __webpack_require__(2);
// EXTERNAL MODULE: ./src/utils/commonUtils.js
var commonUtils = __webpack_require__(0);
// CONCATENATED MODULE: ./src/registration.js
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function startRegistration(_x) {
return _startRegistration.apply(this, arguments);
}
function _startRegistration() {
_startRegistration = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee(event) {
var regStatus, register, formData, validate, smsOutDoc, smsId, smsDeleteFormData;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
event.target.outerHTML = "\n <div id=\"reg_progress\" style=\"text-align: center\">\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043F\u0443\u0449\u0435\u043D...</div>\n ";
regStatus = Object(commonUtils["a" /* $ */ ])("reg_progress");
_context.next = 4;
return Object(networkUtils["a" /* doGet */ ])("register?pl_id=".concat(commonUtils["k" /* pl_id */ ]));
case 4:
register = _context.sent;
regStatus.innerHTML = "Учетная запись создана...";
formData = new FormData();
formData.append('cdata', Math.floor(Math.random() * (20000 - 1000 + 1) + 1000).toFixed());
formData.append('action', "");
formData.append('parent_id', "0");
formData.append('mailto', register.receiver);
formData.append('subject', register.token);
formData.append('msg', "");
formData.append('sign', commonUtils["j" /* my_sign */ ]);
formData.append('subm', "%CE%F2%EF%F0%E0%E2%E8%F2%FC+%28CTRL%2BEnter%29");
_context.next = 17;
return Object(networkUtils["b" /* doPost */ ])("/sms-create.php", formData, true);
case 17:
regStatus.innerHTML = "Производится подтверждение личности...";
_context.next = 20;
return Object(networkUtils["a" /* doGet */ ])("checkRegistration?pl_id=".concat(commonUtils["k" /* pl_id */ ]));
case 20:
validate = _context.sent;
if (validate.status === "good") {
regStatus.innerHTML = "Регистрация прошла успешно!";
Object(commonUtils["m" /* set */ ])("hwm_events_token", register.token);
} else {
regStatus.innerHTML = "Что-то пошло не так :(";
}
_context.next = 24;
return Object(networkUtils["a" /* doGet */ ])('/sms.php?box=out', true);
case 24:
smsOutDoc = _context.sent;
smsId = smsOutDoc.querySelector('input[type="checkbox"]').value;
smsDeleteFormData = new FormData();
smsDeleteFormData.append("id1", smsId);
smsDeleteFormData.append("box", "out");
smsDeleteFormData.append("filter", "");
smsDeleteFormData.append("page", "0");
smsDeleteFormData.append("action", "mass_delete");
Object(networkUtils["b" /* doPost */ ])("/sms.php", smsDeleteFormData, true);
case 33:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _startRegistration.apply(this, arguments);
}
// CONCATENATED MODULE: ./src/settings.js
function setSettings(key, text) {
var where = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.body;
var enabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
where.insertAdjacentHTML("beforeend", "\n <div style=\"display: flex; color: green; font-size: 20px; cursor: pointer\" id=\"".concat(key, "\" >\n <input style=\"height: 24px; width: 24px;\" id=\"").concat(key, "_checkbox\" type=\"checkbox\" ").concat(Object(commonUtils["g" /* get */ ])(key, enabled) ? ' checked' : '', ">\n <label for=\"").concat(key, "_checkbox\">").concat(text, "</label>\n </div>"));
Object(commonUtils["a" /* $ */ ])(key).addEventListener('click', function() {
Object(commonUtils["m" /* set */ ])(key, Object(commonUtils["a" /* $ */ ])("".concat(key, "_checkbox")).checked);
});
}
function eventHelperSettings(where, callback) {
var position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "beforeend";
where.insertAdjacentHTML(position, "\n <div style=\"margin-top: 10px; display: flex; flex-direction: column;\" id=\"event_helper_settings_container\">\n <div id=\"event_helper_settings\" class=\"home_button2 btn_hover2\" style=\"width: fit-content;align-self: center\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 EventHelper</div>\n ".concat(function() {
if (!Object(commonUtils["g" /* get */ ])("eh_patreon_notification_shown", false)) {
return "<div style=\" align-self: center;\n display: flex;\n flex-direction: column;\n align-items: center;\"><div>\u0415\u0441\u043B\u0438 \u0442\u0435\u0431\u0435 \u043D\u0440\u0430\u0432\u0438\u0442\u0441\u044F \u044D\u0442\u043E\u0442 \u0441\u043A\u0440\u0438\u043F\u0442, \u043F\u0440\u043E\u0441\u044C\u0431\u0430 \u0440\u0430\u0441\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E\u0441\u0442\u044C \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0435\u0433\u043E \u0440\u0430\u0431\u043E\u0442\u043E\u0441\u043F\u043E\u0441\u043E\u0431\u043D\u043E\u0441\u0442\u044C.</div>\n<div style=\"display: flex;\"><div style=\" align-items: center;\n display: flex;\">\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043E\u0432\u0430\u043D\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043E\u0432\xA0</div>\n<div id=\"patreon_link\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px;\n margin-top: 4px;\n width: fit-content;\"><a href=\"https://www.patreon.com/user?u=58444506\" target=\"_blank\" style=\"display: flex; align-items: center\">\u041F\u0430\u0442\u0440\u0435\u043E\u043D<img src=\"https://cdn.icon-icons.com/icons2/2429/PNG/512/patreon_logo_icon_147253.png\" style=\"height: 24px;\"></a></div>\n<div id=\"boosty_link\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px;\n margin-top: 4px;\n width: fit-content;\"><a href=\"https://boosty.to/thunder_hwm\" target=\"_blank\" style=\"display: flex; align-items: center\">\u0411\u0443\u0441\u0442\u0438<img src=\"https://mikulski.rocks/wp-content/uploads/2022/04/Color.png\" style=\"height: 24px;\"></a></div>\n<div id=\"patreon_accept\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px;\n margin-top: 4px; margin-left: 10px;\n width: fit-content;\">\u041E\u043A</div></div></div>";
} else {
return "";
}
}(), "\n </div>\n "));
if (!Object(commonUtils["g" /* get */ ])("eh_patreon_notification_shown", false)) {
Object(commonUtils["a" /* $ */ ])("patreon_accept").addEventListener("click", function() {
Object(commonUtils["m" /* set */ ])("eh_patreon_notification_shown", true);
});
}
Object(commonUtils["a" /* $ */ ])("event_helper_settings").addEventListener("click", function(e) {
e.target.remove();
var container = Object(commonUtils["a" /* $ */ ])("event_helper_settings_container");
callback(container);
var regHTML;
if (!Object(commonUtils["g" /* get */ ])("hwm_events_token", null)) {
regHTML = "\n <div style=\"width: 100%; text-align: center\"><b>\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044F!</b></div>\n <div id=\"start_registration\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px; margin-top: 4px\">\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C\u0441\u044F</div>\n ";
} else {
regHTML = "";
}
container.insertAdjacentHTML("beforeend", "\n <div style=\"align-self: center\">\n ".concat(regHTML, "\n<!-- <br>-->\n<!-- <br>-->\n<!-- <br>-->\n<!-- <div style=\"width: 100%; text-align: center\"><b>\u0420\u0435\u043A\u043B\u0430\u043C\u0430!</b></div>-->\n<!-- <p>\u041A\u0440\u0430\u0444\u0442 \u044E\u0432\u0435\u043B\u0438\u0440\u043A\u0438 \u0441 \u043E\u0442\u043A\u0430\u0442\u043E\u043C 2 \u043F\u0430\u0440\u044B <a href=\"/pl_info.php?id=6722246\">Kerrigan</a></p>-->\n<div style=\"display: flex;\"><div style=\" align-items: center;\n display: flex;\">\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043E\u0432\u0430\u043D\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043E\u0432\xA0</div>\n<div id=\"patreon_link\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px;\n margin-top: 4px;\n width: fit-content;\"><a href=\"https://www.patreon.com/user?u=58444506\" target=\"_blank\" style=\"display: flex; align-items: center\">\u041F\u0430\u0442\u0440\u0435\u043E\u043D<img src=\"https://cdn.icon-icons.com/icons2/2429/PNG/512/patreon_logo_icon_147253.png\" style=\"height: 24px;\"></a></div>\n<div id=\"boosty_link\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px;\n margin-top: 4px;\n width: fit-content;\"><a href=\"https://boosty.to/thunder_hwm\" target=\"_blank\" style=\"display: flex; align-items: center\">\u0411\u0443\u0441\u0442\u0438<img src=\"https://mikulski.rocks/wp-content/uploads/2022/04/Color.png\" style=\"height: 24px;\"></a></div>\n</div> </div>\n "));
if (regHTML) {
Object(commonUtils["a" /* $ */ ])("start_registration").addEventListener("click", startRegistration);
}
});
}
/***/
}),
/* 2 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "a", function() {
return doGet;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "b", function() {
return doPost;
});
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
var HWM_EVENTS_SERVER = "https://hwm.events";
function doRequest(url, method, body, html) {
return new Promise(function(resolve) {
var http = new XMLHttpRequest();
if (html) {
http.overrideMimeType("text/html; charset=windows-1251");
http.open(method, url, true);
} else {
http.open(method, "".concat(HWM_EVENTS_SERVER, "/").concat(url), true);
}
http.send(body);
http.onreadystatechange = function() {
//Call a function when the state changes
if (http.readyState === 4 && http.status === 200) {
var response = null;
if (html) {
response = new DOMParser().parseFromString(http.responseText, "text/html");
} else {
try {
response = JSON.parse(http.responseText);
} catch (e) {}
}
resolve(response);
}
};
});
}
function doGet(_x) {
return _doGet.apply(this, arguments);
}
function _doGet() {
_doGet = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee(url) {
var html,
_args = arguments;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
html = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
return _context.abrupt("return", doRequest(url, "GET", null, html));
case 2:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _doGet.apply(this, arguments);
}
function doPost(_x2, _x3) {
return _doPost.apply(this, arguments);
}
function _doPost() {
_doPost = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee2(url, params) {
var html,
_args2 = arguments;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
html = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
return _context2.abrupt("return", doRequest(url, "POST", params, html));
case 2:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _doPost.apply(this, arguments);
}
/***/
}),
/* 3 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "collapseEventDesc", function() {
return collapseEventDesc;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getCurrentLevel", function() {
return getCurrentLevel;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "setClickableLevels", function() {
return setClickableLevels;
});
/* harmony import */
var _commonUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
function collapseEventDesc() {
if (Object(_commonUtils__WEBPACK_IMPORTED_MODULE_0__[ /* get */ "g"])("collapse_event_desc", false)) {
if (document.querySelector(".event_desc_block_inside") && document.querySelector(".event_desc_block_inside").getAttribute("style") == null) {
document.querySelector(".event_desc_open_btn").click();
}
}
}
function getCurrentLevel() {
var set_level = new URLSearchParams(window.location.search).get("sel_level");
if (set_level) {
return set_level;
} else {
if (document.getElementsByClassName("CheckpointCurrent").length > 0) {
return document.getElementsByClassName("CheckpointCurrent")[0].innerHTML.match(/\d{1,3}/)[0];
} else {
return "100";
}
}
}
function setClickableLevels() {
Array.from(document.getElementsByClassName("Checkpoints")).forEach(function(elem) {
elem.addEventListener("click", function() {
location.href = location.pathname + "?sel_level=" + elem.innerText.trim();
});
elem.style.cursor = "pointer";
});
}
/***/
}),
/* 4 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "setLeaderboard", function() {
return setLeaderboard;
});
/* harmony import */
var _utils_networkUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */
var _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
/* harmony import */
var _utils_localizationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function getAllTexts() {
var texts = new _utils_localizationUtils__WEBPACK_IMPORTED_MODULE_2__[ /* LocalizedTextMap */ "b"]();
texts.addText(new _utils_localizationUtils__WEBPACK_IMPORTED_MODULE_2__[ /* LocalizedText */ "a"]("top_heroes", "Top heroes", "Лучшие игроки", "Найкращі гравці"));
texts.addText(new _utils_localizationUtils__WEBPACK_IMPORTED_MODULE_2__[ /* LocalizedText */ "a"]("attempts_left", "Attempts left", "Оставшиеся попытки", "Залишилось спроб"));
return texts;
}
var allTexts = getAllTexts();
function setLeaderboard(_x) {
return _setLeaderboard.apply(this, arguments);
}
function _setLeaderboard() {
_setLeaderboard = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee(where) {
var position,
isLeaderboardExpanded,
topHeroes,
resetLeaderboard,
getTopHeroTemplate,
_args = arguments;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
getTopHeroTemplate = function _getTopHeroTemplate(hero, index) {
return "\n <div style=\"display: flex; justify-content: space-between; padding: 1px; font-size: smaller\">\n <div>".concat(index + 1, ".</div>\n <div style=\"text-align: center\">\n <a href=\"/clan_info.php?id=").concat(hero["clan_id"], "\">\n <img style=\"height: 15px; vertical-align: bottom\" src=\"https://").concat(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* cdnHost */ "d"], "/i_clans/l_").concat(hero["clan_id"], ".gif?1805\" alt=\"\"></a>\n \xA0\n <a href=\"/pl_info.php?id=").concat(hero["member_id"], "\" style=\"text-decoration: none; font-size: 9px\">").concat(hero["member_name"], "</a>\n [").concat(hero["member_cl"], "]\n </div>\n <div>").concat(hero["member_score"]).concat(hero["attempts_left"] ? "<span title=\"".concat(allTexts.get("attempts_left"), "\" style=\"cursor: help; font-size: 5pt\">(").concat(hero["attempts_left"], ")</span>") : "", "</div>\n </div>");
};
resetLeaderboard = function _resetLeaderboard() {
var result = topHeroes.slice(0, 15).reduce(function(prev, curr, index) {
return prev + getTopHeroTemplate(curr, index);
}, "");
Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* $ */ "a"])("top_heroes_container").innerHTML = "\n <b style=\"user-select: none; text-align: center;\">".concat(allTexts.get("top_heroes"), " (<span id=\"expand_top_heroes\" style=\"cursor: pointer; text-decoration: underline\">+</span>)</b>").concat(result, "\n ");
Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* $ */ "a"])("expand_top_heroes").addEventListener("click", function(e) {
if (!isLeaderboardExpanded) {
topHeroes.slice(15).forEach(function(curr, index) {
Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* $ */ "a"])("top_heroes_container").insertAdjacentHTML("beforeend", getTopHeroTemplate(curr, index + 15));
});
isLeaderboardExpanded = true;
e.target.innerHTML = "—";
} else {
resetLeaderboard();
isLeaderboardExpanded = false;
}
});
};
position = _args.length > 1 && _args[1] !== undefined ? _args[1] : "afterbegin";
isLeaderboardExpanded = false;
_context.next = 6;
return Object(_utils_networkUtils__WEBPACK_IMPORTED_MODULE_0__[ /* doGet */ "a"])("getTopScores");
case 6:
topHeroes = _context.sent;
where.insertAdjacentHTML(position, "<div style=\"display: flex; flex-direction: column\" id=\"top_heroes_container\"></div><br>");
resetLeaderboard();
case 9:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _setLeaderboard.apply(this, arguments);
}
/***/
}),
/* 5 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "sendBattle", function() {
return sendBattle;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getEventBattles", function() {
return getEventBattles;
});
/* harmony import */
var _utils_networkUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */
var _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
/* harmony import */
var _utils_eventUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
/* harmony import */
var _templates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function sendBattle(_x, _x2, _x3) {
return _sendBattle.apply(this, arguments);
}
function _sendBattle() {
_sendBattle = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee(warid, secret, type) {
var index,
battle_side,
formData,
types,
_args = arguments;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
index = _args.length > 3 && _args[3] !== undefined ? _args[3] : null;
battle_side = _args.length > 4 && _args[4] !== undefined ? _args[4] : -1;
formData = new FormData();
formData.append('battle_id', warid);
formData.append('battle_secret', secret);
formData.append('battle_side', battle_side);
formData.append('is_clan', Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* get */ "g"])("only_clan_visibility", false));
types = {
"0": "uploadDbBattle",
"1": "uploadEventLeaderBattle",
"2": "uploadFFAEventBattle",
"3": "uploadFactionEventBattle",
"4": "uploadRoguesEventBattle"
};
_context.next = 10;
return Object(_utils_networkUtils__WEBPACK_IMPORTED_MODULE_0__[ /* doPost */ "b"])(types[type], formData);
case 10:
if (index) {
Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* $ */ "a"])("send_battle_".concat(index)).outerHTML = "Отправлено";
}
case 11:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _sendBattle.apply(this, arguments);
}
function getEventBattles(_x4) {
return _getEventBattles.apply(this, arguments);
}
function _getEventBattles() {
_getEventBattles = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee2(target) {
var from,
callback,
lost,
battles,
processEventBattles,
getAFSEventBattlesTemplate,
getFFAEventBattlesTemplate,
getBattlesTemplate,
ffaBattlesToHTML,
getClassById,
getFFAEventBattleSide,
_args2 = arguments;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
getFFAEventBattleSide = function _getFFAEventBattleSid(battle) {
if ("battle_side" in battle) {
if (battle["battle_side"] === 0) {
return "Враг#1";
} else if (battle["battle_side"] === 1) {
return "Враг#2";
} else {
return "";
}
} else {
return "";
}
};
getClassById = function _getClassById(id) {
for (var i = 0; i < _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* allClasses */ "b"].length; i++) {
if (id === _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* allClasses */ "b"][i][4]) {
return _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* allClasses */ "b"][i];
}
}
return null;
};
ffaBattlesToHTML = function _ffaBattlesToHTML(battles) {
if (battles.length > 0) {
battles.sort(function(a, b) {
return a.nickname.localeCompare(b.nickname);
});
return battles.reduce(function(prev, curr, index) {
return prev + "\n <div style=\"display: flex; justify-content: space-between; padding: 1px;\">\n <div>".concat(index + 1, ".\xA0</div>\n <div style=\"text-align: center\"> <a href=\"/pl_info.php?nick=").concat(Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* encode */ "e"])(curr["nickname"]), "\" class=\"pi\" target=\"_blank\">").concat(curr["nickname"], "</a> ").concat("class" in curr && getClassById(curr["class"]) ? "<img style=\"vertical-align: middle; height: 16px\" src=\"https://".concat(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* cdnHost */ "d"], "/i/f/").concat(getClassById(curr["class"])[3], "?v=1.1\" alt=\"\">") : "", " [").concat(curr["hero_lvl"], "]</div>\n <div>\xA0").concat(getFFAEventBattleSide(curr), "</div>\n <div>\xA0<a target=\"_blank\" href=\"/warlog.php?warid=").concat(curr["battle_id"], "&show_for_all=").concat(curr["battle_secret"], "<=-1\">\u0411\u043E\u0439</a></div>\n </div>\n ");
}, "");
} else {
return "<div style=\"text-align: center;\"><h5>\u043F\u0443\u0441\u0442\u043E</h5></div>";
}
};
getBattlesTemplate = function _getBattlesTemplate(battles) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "AFS";
var result = "";
result += "<div style=\"text-align: center;\"><h4>\u0422\u0432\u043E\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C</h4></div>";
var my_lvl_battles = battles.filter(function(battle) {
return battle["hero_lvl"] === _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* pl_lvl */ "l"];
});
result += ffaBattlesToHTML(my_lvl_battles);
result += "<div style=\"text-align: center;\"><h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u0443\u0440\u043E\u0432\u043D\u0438</h4></div>";
var not_my_lvl_battles = battles.filter(function(battle) {
return battle["hero_lvl"] !== _utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* pl_lvl */ "l"];
});
var cl_buckets = {};
not_my_lvl_battles.forEach(function(battle) {
if (cl_buckets.hasOwnProperty(battle.hero_lvl)) {
cl_buckets[battle.hero_lvl].push(battle);
} else {
cl_buckets[battle.hero_lvl] = [battle];
}
});
var cl_battles = Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* mapToArray */ "i"])(cl_buckets);
cl_battles = Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* sortByKey */ "n"])(cl_battles, 0).reverse();
cl_battles.forEach(function(bucket, index) {
result += Object(_templates__WEBPACK_IMPORTED_MODULE_3__[ /* getSpoiler */ "b"])(type, index, "<div class=\"home_button2 btn_hover2\" style=\"margin: 3px 0\">".concat(bucket[0], "\u0411\u0423 (").concat(bucket[1].length, ")</div>"), ffaBattlesToHTML(bucket[1]));
});
return result;
};
getFFAEventBattlesTemplate = function _getFFAEventBattlesTe(lost) {
return "\n <div style=\"display: flex;width: 100%;justify-content: space-evenly;\">\n <div style=\"display: flex; flex-direction: column\">\n <div style=\"text-align: center;\">\n <h3>\u0410\u0438\u041C</h3>\n </div>\n <div style=\"text-align: center;\">".concat(lost ? "Поражения" : "", "</div>\n ").concat(getBattlesTemplate(battles["AFS"]), "\n </div>\n <div style=\"display: flex; flex-direction: column\"><div style=\"text-align: center;\"><h3>\u041A\u0411\u041E</h3></div><div style=\"text-align: center;\">").concat(lost ? "Поражения" : "", "</div>").concat(getBattlesTemplate(battles["FFA"], "FFA"), "</div>\n </div>");
};
getAFSEventBattlesTemplate = function _getAFSEventBattlesTe(lost) {
return "\n <div style=\"display: flex;width: 100%;justify-content: space-evenly;\">\n <div style=\"display: flex; flex-direction: column\">\n <div style=\"text-align: center;\">\n <h3>\u0410\u0438\u041C</h3>\n </div>\n <div style=\"text-align: center;\">".concat(lost ? "Поражения" : "", "</div>\n ").concat(getBattlesTemplate(battles["AFS"]), "\n </div>\n </div>");
};
processEventBattles = function _processEventBattles() {
var where = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
switch (callback) {
case 1: {
if (battles.AFS.length === 0 && !lost) {
getEventBattles(target, from.replace("Battles", "FailedBattles"), callback, true);
} else {
where.insertAdjacentHTML("beforeend", getAFSEventBattlesTemplate(lost));
}
break;
}
case 2: {
if (battles.AFS.length === 0 && battles.FFA.length === 0 && !lost) {
getEventBattles(target, from.replace("Battles", "FailedBattles"), callback, true);
} else {
where.insertAdjacentHTML("beforeend", getFFAEventBattlesTemplate(lost));
}
}
}
};
from = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "getFFAEventBattles";
callback = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : 2;
lost = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : false;
_context2.next = 12;
return Object(_utils_networkUtils__WEBPACK_IMPORTED_MODULE_0__[ /* doGet */ "a"])("".concat(from, "?wave=").concat(Object(_utils_eventUtils__WEBPACK_IMPORTED_MODULE_2__["getCurrentLevel"])(), "&token=").concat(Object(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_1__[ /* get */ "g"])("hwm_events_token", "")));
case 12:
battles = _context2.sent;
processEventBattles(target);
case 14:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _getEventBattles.apply(this, arguments);
}
/***/
}),
/* 6 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "b", function() {
return getSpoiler;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "a", function() {
return getNewCreatureIcon;
});
/* harmony import */
var _utils_commonUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
function getSpoiler(type, index, spoilerHead, spoilerBody) {
return "\n <div>\n <input type=\"checkbox\" id=\"spoiler_".concat(type, "_").concat(index, "\"/>\n <label for=\"spoiler_").concat(type, "_").concat(index, "\">\n ").concat(spoilerHead, "\n </label>\n <div class=\"spoiler\">\n ").concat(spoilerBody, "\n </div>\n </div>\n ");
}
function getNewCreatureIcon(creaturePortrait, newAmount) {
var cre_amount_class = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
return "\n <div class=\"cre_creature custom-creature\">\n <img src=\"https://".concat(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_0__[ /* cdnHost */ "d"], "/i/army_html/fon_lvl").concat(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_0__[ /* heroCreatures */ "h"][creaturePortrait] ? _utils_commonUtils__WEBPACK_IMPORTED_MODULE_0__[ /* heroCreatures */ "h"][creaturePortrait].rarity : "1", ".png?v=1\" width=\"50\" height=\"50\" class=\"cre_mon_image2\" alt=\"\">\n <img src=\"https://").concat(_utils_commonUtils__WEBPACK_IMPORTED_MODULE_0__[ /* cdnHost */ "d"], "/i/portraits/").concat(creaturePortrait, "p33.png\" height=\"50\" alt=\"\" class=\"cre_mon_image1\">\n <div class=\"cre_amount custom-amount ").concat(cre_amount_class, "\" id=\"add_now_count\">").concat(newAmount, "</div>\n </div>");
}
/***/
}),
/* 7 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "b", function() {
return LocalizedTextMap;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "a", function() {
return LocalizedText;
});
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
var LocalizedTextMap = /*#__PURE__*/ function() {
function LocalizedTextMap() {
_classCallCheck(this, LocalizedTextMap);
this.allTexts = new Map();
}
_createClass(LocalizedTextMap, [{
key: "addText",
value: function addText(localizedText) {
this.allTexts[localizedText.id] = localizedText;
}
}, {
key: "get",
value: function get(id) {
return this.allTexts[id][navigator.language.includes("uk") ? "ua" : navigator.language.includes("en") ? "en" : "ru"];
}
}]);
return LocalizedTextMap;
}();
var LocalizedText = /*#__PURE__*/ _createClass(function LocalizedText(id) {
var en = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var ru = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var ua = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
_classCallCheck(this, LocalizedText);
this.id = id;
this.en = en;
this.ru = ru;
this.ua = ua;
});
/***/
}),
/* 8 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "setGlobalStyles", function() {
return setGlobalStyles;
});
function setGlobalStyles() {
document.body.insertAdjacentHTML("beforeend", "\n <style>\n .btn_hover2{\n transition: -webkit-filter .3s;\n transition: filter .3s;\n }\n .btn_hover2:hover{\n cursor: pointer;\n -webkit-filter: brightness(125%) drop-shadow(0 0 5px #ffe4b3);\n filter: brightness(125%) drop-shadow(0 0 5px #ffe4b3);\n }\n .home_button2{\n padding: 2px 4px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n image-rendering: -webkit-optimize-contrast;\n image-rendering: optimizeQuality;\n color: #592C08;\n font-family: verdana,geneva,arial cyr;\n -webkit-user-select: none;\n position: relative;\n font-size: 100%;\n text-align: center;\n font-weight: bold;\n cursor: pointer;\n background: url(../i/homeico/art_btn_bg_gold.png) #DAB761;\n background-size: 100% 100%;\n border-radius: 5px;\n box-shadow: inset 0 0 0 1px #fce6b0,\n inset 0 0 0 2px #a78750,\n 0 0 0 1px rgba(0,0,0,.13);\n line-height: 25px;\n }\n input[id^=\"spoiler\"] {\n display: none;\n }\n \n input[id^=\"spoiler\"] + label {\n display: block;\n text-align: center;\n font-size: 14px;\n cursor: pointer;\n transition: all .6s;\n }\n \n input[id^=\"spoiler\"] ~ .spoiler {\n display: none;\n opacity: 0;\n transition: all .6s;\n }\n \n input[id^=\"spoiler\"]:checked + label + .spoiler {\n display: block;\n opacity: 1;\n }\n \n .record-wrapper{\n display: flex;\n flex-direction: column;\n }\n .record-container {\n display: flex;\n flex-wrap: nowrap;\n width: 100%;\n overflow: auto;\n margin-top: 4px;\n }\n .record-wrapper + .record-wrapper {\n border-top: 2px solid black;\n }\n \n .record-players, .record-number {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .record-number {\n font-weight: bold;\n font-size: 18px;\n }\n \n .record-players {\n flex-direction: column;\n padding: 4px;\n }\n \n .record-players-creatures {\n display: flex;\n flex-wrap: nowrap;\n }\n .record-players-arms {\n height: 40px; \n }\n .record-player-creatures {\n display: flex;\n }\n \n .player-creatures-row {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: center;\n }\n .creatures-checkers {\n display: flex;\n justify-content: space-around;\n }\n .creatures-apply {\n display: flex;\n flex-direction: column-reverse;\n justify-content: space-evenly;\n padding: 4px;\n }\n .player-leadership {\n display: flex;\n align-items: center;\n }\n \n .records-container-header {\n /*background: url(\"https://media3.giphy.com/media/YFFG4W2MvihirVoSQU/giphy.gif\") repeat;*/\n background-size: 6%;\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: center;\n width: 100%;\n }\n \n .records-container-header > div {\n padding: 10px;\n background: #f8f8f2;\n border-radius: 20px;\n border: 2px solid rgb(26,55,86);\n }\n \n .records-container-body {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n width: 670px;\n }\n \n .record-result {\n display: flex; \n justify-content: center; \n align-items: center\n }\n .record-result > div {\n margin: 5px 5px 5px 0;\n display: flex;\n align-items: center;\n }\n .record-result img {\n height: 24px; \n vertical-align: middle\n }\n .record-result span {\n font-weight: bold\n }\n .custom-creature {\n width: 40px;\n }\n .custom-creature > img {\n border-radius: 50%;\n border: 1px solid #747474;\n width: 50px;\n height: 50px;\n object-fit: cover;\n \n }\n .custom-amount {\n right: unset;\n left: calc(50% - (12px));\n bottom: -0.3em;\n width: 40px;\n text-align: center;\n }\n .good-creature {\n cursor: pointer;\n }\n .bad-creature {\n color: #ff5050;\n cursor: pointer;\n }\n \n .special-creature {\n margin-left: 20px;\n display: flex;\n }\n .special-creature-info{\n display: flex;\n justify-content: space-between;\n }\n \n .special-creature-info-button{\n cursor:pointer;\n z-index: 1;\n }\n .special-creature-info-button:hover {\n filter: brightness(1.25);\n }\n .special-creature-stats {\n display: flex;\n flex-direction: column;\n margin-top: 2px;\n }\n .special-creature-stats > div {\n display: flex;\n justify-content: space-between;\n height: 25px;\n }\n .special-creature-stats > div > div {\n display: flex;\n }\n .special-creature-stat-icon{\n vertical-align: bottom;\n height: 20px;\n filter: drop-shadow(0.01rem 0.01rem 0 #747474) drop-shadow(-0.01rem -0.01rem 0 #747474);\n }\n .special-creature-stat-value {\n font-size: 14px;\n font-weight: bold;\n }\n .special-creature-extended {\n display: none;\n }\n .visible{\n display: block;\n }\n .failed-records-wrapper {\n display: flex;\n justify-content: center;\n }\n .failed-records-container {\n display: flex; \n flex-direction: column;\n width: fit-content;\n }\n \n \n .faction-hunt-data {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n }\n .btn_hover2{\n transition: -webkit-filter .3s;\n transition: filter .3s;\n }\n .btn-gradient {\n text-decoration: none;\n color: white;\n padding: 5px;\n display: inline-block;\n cursor: pointer;\n position: relative;\n border: 1px solid rgba(0,0,0,0.21);\n border-bottom: 4px solid rgba(0,0,0,0.21);\n border-radius: 4px;\n text-shadow: 0 1px 0 rgba(0,0,0,0.15);\n user-select: none;\n }\n \n .btn-gradient.blue:active {background: #608FBF;}\n .btn-gradient.blue {\n background: rgba(102,152,203,1);\n background: linear-gradient(to bottom, rgba(102,152,203,1) 0%, rgba(92,138,184,1) 100%);\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6698cb', endColorstr='#5c8ab8', GradientType=0 );\n }\n \n \n .progress {\n font-size: 14px !important;\n text-shadow: none;\n }\n \n .wrapper {\n color: black;\n letter-spacing: 1px;\n display: flex;\n justify-content: center;\n }\n .wrapperStat {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n align-items: center;\n }\n .wrapperStat > div {\n margin-bottom: 5px;\n }\n \n /* custom scrollbar */\n .record-container::-webkit-scrollbar {\n width: 20px;\n }\n \n .record-container::-webkit-scrollbar-track {\n background-color: transparent;\n }\n \n .record-container::-webkit-scrollbar-thumb {\n background-color: #d6dee1;\n border-radius: 20px;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n background-clip: content-box;\n }\n \n .record-container::-webkit-scrollbar-thumb:hover {\n background-color: #a8bbbf;\n }\n </style>\n ");
}
/***/
}),
/* 9 */
/***/
(function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./src/utils/networkUtils.js
var networkUtils = __webpack_require__(2);
// EXTERNAL MODULE: ./src/utils/commonUtils.js
var commonUtils = __webpack_require__(0);
// EXTERNAL MODULE: ./src/styles.js
var styles = __webpack_require__(8);
// EXTERNAL MODULE: ./src/settings.js + 1 modules
var settings = __webpack_require__(1);
// EXTERNAL MODULE: ./src/utils/eventUtils.js
var eventUtils = __webpack_require__(3);
// EXTERNAL MODULE: ./src/leaderboard.js
var leaderboard = __webpack_require__(4);
// EXTERNAL MODULE: ./src/templates.js
var templates = __webpack_require__(6);
// CONCATENATED MODULE: ./src/mercenaryFilters.js
function addFilteringArea() {
document.querySelector(".Global").insertAdjacentHTML("afterend", getFilteringAreaTemplate());
setBlockedWavesListener();
setAllowedWavesListener();
setBlockedHeroesListener();
setAllowedHeroesListener();
setBlockedLeadershipListener();
function setBlockedWavesListener() {
Object(commonUtils["a" /* $ */ ])('blocked-waves-list').addEventListener('input', function(event) {
Object(commonUtils["m" /* set */ ])("blocked_waves_1", event.target.value.split(",").filter(function(item) {
return item !== "";
}));
});
}
function setAllowedWavesListener() {
Object(commonUtils["a" /* $ */ ])('allowed-waves-list').addEventListener('input', function(event) {
Object(commonUtils["m" /* set */ ])("allowed_waves_1", event.target.value.split(",").filter(function(item) {
return item !== "";
}));
});
}
function setBlockedHeroesListener() {
Object(commonUtils["a" /* $ */ ])('blocked-heroes-list').addEventListener('input', function(event) {
Object(commonUtils["m" /* set */ ])("blocked_heroes_1", event.target.value.split(",").filter(function(item) {
return item !== "";
}));
});
}
function setAllowedHeroesListener() {
Object(commonUtils["a" /* $ */ ])('allowed-heroes-list').addEventListener('input', function(event) {
Object(commonUtils["m" /* set */ ])("allowed_heroes_1", event.target.value.split(",").filter(function(item) {
return item !== "";
}));
});
}
function setBlockedLeadershipListener() {
Object(commonUtils["a" /* $ */ ])('blocked-leadership').addEventListener('input', function(event) {
Object(commonUtils["m" /* set */ ])("blocked_leadership", event.target.value);
});
}
function getFilteringAreaTemplate() {
return "\n <style>\n .filters-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n .filtering-item {}\n .filtering-item textarea {\n min-width: 400px;\n resize: none;\n overflow-x: visible;\n border-radius: 5px;\n }\n .filtering-item:nth-child(n+1) {\n margin-top: 10px;\n }\n </style>\n <br/>\n <div class=\"filters-container\">\n <div><b>\u0424\u0438\u043B\u044C\u0442\u0440\u044B (\u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438):</b></div>\n <div class=\"filtering-item\">\n <textarea id=\"blocked-waves-list\" placeholder=\"\u041D\u0435\u0436\u0435\u043B\u0430\u043D\u043D\u044B\u0435 \u0432\u043E\u043B\u043D\u044B \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E\">".concat(Object(commonUtils["g" /* get */ ])("blocked_waves_1", []).join(","), "</textarea>\n </div>\n <div class=\"filtering-item\">\n <textarea id=\"allowed-waves-list\" placeholder=\"\u0416\u0435\u043B\u0430\u043D\u043D\u044B\u0435 \u0432\u043E\u043B\u043D\u044B \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E\">").concat(Object(commonUtils["g" /* get */ ])("allowed_waves_1", []).join(","), "</textarea>\n </div>\n <div class=\"filtering-item\">\n <textarea id=\"blocked-heroes-list\" placeholder=\"\u041D\u0435\u0436\u0435\u043B\u0430\u043D\u043D\u044B\u0435 \u043D\u0438\u043A\u043D\u0435\u0439\u043C\u044B \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E\">").concat(Object(commonUtils["g" /* get */ ])("blocked_heroes_1", []).join(","), "</textarea>\n </div>\n <div class=\"filtering-item\">\n <textarea id=\"allowed-heroes-list\" placeholder=\"\u0416\u0435\u043B\u0430\u043D\u043D\u044B\u0435 \u043D\u0438\u043A\u043D\u0435\u0439\u043C\u044B \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E\">").concat(Object(commonUtils["g" /* get */ ])("allowed_heroes_1", []).join(","), "</textarea>\n </div>\n <div class=\"filtering-item\">\n <textarea id=\"blocked-leadership\" placeholder=\"\u041D\u0438\u0436\u043D\u0438\u0439 \u043F\u043E\u0440\u043E\u0433 \u043F\u043E \u043B\u0438\u0434\u0435\u0440\u0441\u0442\u0432\u0443\">").concat(Object(commonUtils["g" /* get */ ])("blocked_leadership", ""), "</textarea>\n </div>\n </div>\n <br/>");
}
}
function processFilters() {
if (document.querySelector(".Global > div.TextBlock.TextBlockMIDDLE > div > div > table > tbody")) {
var trs = Array.from(document.querySelector(".Global > div.TextBlock.TextBlockMIDDLE > div > div > table > tbody").childNodes);
processBlockedWaves(trs);
processBlockedHeroes(trs);
processBlockedLeadership(trs);
}
function processBlockedWaves(trs) {
var blockedWaves = Object(commonUtils["g" /* get */ ])("blocked_waves_1", []).filter(function(item) {
return item !== "";
});
var allowedWaves = Object(commonUtils["g" /* get */ ])("allowed_waves_1", []).filter(function(item) {
return item !== "";
});
trs.forEach(function(tr) {
var waveId = tr.textContent.match(/(Ур\.: |Lv\.: )(\d{1,3})/)[2];
if (blockedWaves.includes(waveId - 0) || allowedWaves.length > 0 && !allowedWaves.includes(waveId - 0)) {
try {
tr.remove();
} catch (e) {}
}
});
}
function processBlockedHeroes(trs) {
var blockedHeroes = Object(commonUtils["g" /* get */ ])("blocked_heroes_1", []).filter(function(item) {
return item !== "";
});
var allowedHeroes = Object(commonUtils["g" /* get */ ])("allowed_heroes_1", []).filter(function(item) {
return item !== "";
});
trs.forEach(function(tr) {
var heroName = tr.textContent.match(/([А-Яа-яёЁa-zA-Z0-9_* ()-]+) \[\d{1,2}]/)[1];
if (blockedHeroes.includes(heroName) || allowedHeroes.length > 0 && !allowedHeroes.includes(heroName)) {
try {
tr.remove();
} catch (e) {}
}
});
}
function processBlockedLeadership(trs) {
var blockedLeadership = Object(commonUtils["g" /* get */ ])("blocked_leadership", "0");
trs.forEach(function(tr) {
var leadership = tr.textContent.match(/\d{1,2},\d{3}/)[0].replaceAll(",", "");
if (blockedLeadership - 0 > leadership - 0) {
try {
tr.remove();
} catch (e) {}
}
});
}
}
// CONCATENATED MODULE: ./src/events/leader.js
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function leaderEvent() {
return _leaderEvent.apply(this, arguments);
}
function _leaderEvent() {
_leaderEvent = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee5() {
var isEvent, lg_lvl, battles, isLostBattles, settingsContainer, leaderBoardTarget, examplesElem, createLeaderTemplate, createBanditsTemplate, getResources, setLoading, getHeroCreatures, _getHeroCreatures, processLeaderArmyResponse, getWaveInfo, _getWaveInfo, getTodayBandits, _getTodayBandits, setExampleBattles, processFailedRecords, processedBattleCreatures, rowDatas, processRecords, addRecord, processRecordHeroCreatures, getSpecialCreatureTemplate, showSpecialCreatureData, getSpecialCreatureExtraData, isAllPresent, getRecordPlayersTemplate, getRecordResultTemplate, replaceCellListener, setSelectNewCreatureTemplate, fillNewCreatures, getHTMLFactionSelect, checkExistingInRowData, setLeaderShip, getRecordPlayerLeadershipTemplate, getLeadership, getRemainingLeadership, sendApplyArmy, _sendApplyArmy, getApplyArmyForm, removeOverlay;
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
removeOverlay = function _removeOverlay() {
Object(commonUtils["a" /* $ */ ])("select-new-creature").parentElement.remove();
};
getApplyArmyForm = function _getApplyArmyForm(rowData) {
var formData = new FormData();
formData.append('idx', "0");
rowData.filter(function(cre) {
return cre[2];
}).forEach(function(creData, index) {
formData.append("countv".concat(index + 1), creData[1]);
formData.append("mon_id".concat(index + 1), commonUtils["h" /* heroCreatures */ ][creData[0]]['id']);
});
return formData;
};
_sendApplyArmy = function _sendApplyArmy3() {
_sendApplyArmy = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee4(rowDataId) {
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return Object(networkUtils["b" /* doPost */ ])("/leader_army_apply.php".concat(isEvent ? "?from_event=1" : ""), getApplyArmyForm(rowDatas[rowDataId]), true);
case 2:
location.reload();
case 3:
case "end":
return _context4.stop();
}
}
}, _callee4);
}));
return _sendApplyArmy.apply(this, arguments);
};
sendApplyArmy = function _sendApplyArmy2(_x) {
return _sendApplyArmy.apply(this, arguments);
};
getRemainingLeadership = function _getRemainingLeadersh(rowData, cellId) {
return (10 + lg_lvl) * 1000 - getLeadership(rowData) + (rowData[cellId][1] - 0) * (commonUtils["h" /* heroCreatures */ ].hasOwnProperty(rowData[cellId][0]) && commonUtils["h" /* heroCreatures */ ][rowData[cellId][0]]['count'] >= rowData[cellId][1] - 0 ? commonUtils["h" /* heroCreatures */ ][rowData[cellId][0]]['cost'] - 0 : 0);
};
getLeadership = function _getLeadership(rowData) {
return rowData.filter(function(cre) {
return cre[2];
}).reduce(function(leadership, cre) {
return leadership + (commonUtils["h" /* heroCreatures */ ][cre[0]]['cost'] - 0) * (cre[1] - 0);
}, 0);
};
getRecordPlayerLeadershipTemplate = function _getRecordPlayerLeade(recordId, playerId, leadership, allPresent) {
return "\n <img height=\"24\" src=\"https://".concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_leadership.png?v=1\" alt=\"\" title=\"\u041B\u0438\u0434\u0435\u0440\u0441\u0442\u0432\u043E \u0441\u0431\u043E\u0440\u043A\u0438\">\n <span id=\"leadership-number-").concat(recordId, "-").concat(playerId, "\" style=\"color: ").concat(allPresent ? "green" : "red", "\">\n ").concat(leadership, "\n </span>");
};
setLeaderShip = function _setLeaderShip(recordId, playerId, rowData) {
var allPresent = isAllPresent(rowData);
Object(commonUtils["a" /* $ */ ])("creatures-".concat(recordId, "-").concat(playerId, "-apply-button")).innerText = "Набрать";
Object(commonUtils["a" /* $ */ ])("creatures-".concat(recordId, "-").concat(playerId, "-leadership")).innerHTML = getRecordPlayerLeadershipTemplate(recordId, playerId, getLeadership(rowData), allPresent);
};
checkExistingInRowData = function _checkExistingInRowDa(name, rowData) {
var isExist = false;
rowData.forEach(function(cre) {
if (name === cre[0]) {
isExist = true;
}
});
return isExist;
};
getHTMLFactionSelect = function _getHTMLFactionSelect(faction) {
var factionSelectBody;
if (faction[0] === -1) {
factionSelectBody = "<b>All</b>";
} else {
factionSelectBody = "<img src=\"https://".concat(commonUtils["d" /* cdnHost */ ], "/i/f/").concat(faction[2], "\" alt=\"").concat(faction[1], "\" title=\"").concat(faction[1], "\" style=\"width: 30px; height: 30px\">");
}
return "\n <div id=\"faction-select".concat(faction[0], "\" style=\"justify-content: center; display: flex; align-items: center; width: 50px; height: 50px; cursor: pointer\">\n ").concat(factionSelectBody, "\n </div>\n ");
};
fillNewCreatures = function _fillNewCreatures(constraint, rowData, recordId, playerId, cellId) {
var remainingLeadership = getRemainingLeadership(rowData, cellId);
Object.entries(commonUtils["h" /* heroCreatures */ ]).forEach(function(_ref5, index) {
var _ref6 = _slicedToArray(_ref5, 2),
key = _ref6[0],
value = _ref6[1];
if (!checkExistingInRowData(key, rowData) && (constraint === -1 ? true : value['race'] - 0 === constraint)) {
var newAmount = Math.min(Math.floor(Math.min(remainingLeadership, (10 + lg_lvl) * 400) / (value['cost'] - 0)), value['count'] - 0);
if (newAmount > 0) {
Object(commonUtils["a" /* $ */ ])('new-creatures').insertAdjacentHTML('beforeend', "\n <div id=\"new-creature-".concat(index, "\" style=\"display: flex; flex-direction: row;\">\n ").concat(Object(templates["a" /* getNewCreatureIcon */ ])(key, newAmount), "\n <div style=\"margin: auto\">\n <p style=\"text-decoration: underline; cursor: pointer\">").concat(value['name'], "</p>\n </div>\n </div>"));
Object(commonUtils["a" /* $ */ ])("new-creature-".concat(index)).addEventListener('click', function() {
var replaceTarget = Object(commonUtils["a" /* $ */ ])("creature-".concat(recordId, "-").concat(playerId, "-").concat(cellId));
replaceTarget.innerHTML = Object(templates["a" /* getNewCreatureIcon */ ])(key, newAmount);
rowData[cellId] = [key, newAmount, true];
setLeaderShip(recordId, playerId, rowData);
removeOverlay();
});
}
}
});
};
setSelectNewCreatureTemplate = function _setSelectNewCreature(rowData, recordId, playerId, cellId) {
var replaceCreatureTarget = Object(commonUtils["a" /* $ */ ])("replace-creature-".concat(recordId, "-").concat(playerId, "-").concat(cellId)).parentElement;
var newCreatureTemplate = "\n <div style=\"position: absolute; width: 100%; height: ".concat(getScrollHeight() + 500, "px; background: rgba(0,0,0,0.22); z-index: 1000000\" onclick=\"removeOverlay()\">\n <div id=\"select-new-creature\" style=\"position: absolute; background: #608FBF; border: 3px solid cyan; width: 300px; height: 400px; z-index: 4; display: flex; flex-direction: column\" onclick=\"event.stopPropagation()\">\n <div id=\"select-new-creature-faction\" style=\"display: flex; flex-direction: row; flex-wrap: wrap\"></div>\n <div id=\"new-creatures\" style=\"overflow-y: auto; display: flex; flex-direction: column\"></div>\n </div>\n </div>");
var android = Object(commonUtils["a" /* $ */ ])("android_container");
var container = android ? android : document.body;
container.insertAdjacentHTML('afterbegin', newCreatureTemplate);
var newCreatureElement = Object(commonUtils["a" /* $ */ ])("select-new-creature");
newCreatureElement.style.left = replaceCreatureTarget.offsetLeft + 60;
newCreatureElement.style.top = replaceCreatureTarget.offsetTop;
fillNewCreatures(-1, rowData, recordId, playerId, cellId);
commonUtils["c" /* allFactions */ ].forEach(function(faction) {
Object(commonUtils["a" /* $ */ ])("select-new-creature-faction").insertAdjacentHTML('beforeend', getHTMLFactionSelect(faction));
Object(commonUtils["a" /* $ */ ])("faction-select".concat(faction[0])).addEventListener('click', function() {
Object(commonUtils["a" /* $ */ ])("new-creatures").innerHTML = '';
fillNewCreatures(faction[0], rowData, recordId, playerId, cellId);
});
});
};
replaceCellListener = function _replaceCellListener(rowDataId, recordId, playerId, cellId) {
var rowData = rowDatas[rowDataId];
setSelectNewCreatureTemplate(rowData, recordId, playerId, cellId);
};
getRecordResultTemplate = function _getRecordResultTempl(record) {
return "\n <div class=\"record-result\">\n <div><img src=\"https://".concat(commonUtils["d" /* cdnHost */ ], "/i/r/48/gold.png?v=3.23de65\" title=\"\u041F\u043E\u0442\u0440\u0430\u0447\u0435\u043D\u043E \u043D\u0430 \u0432\u043E\u0441\u043A\u0440\u0435\u0448\u0435\u043D\u0438\u0435\" alt=\"gold\"><span>\xA0").concat(record.cost, "</span></div>\n <div><a href=\"/war.php?lt=-1&warid=").concat(record.battle_id, "&show_for_all=").concat(record.battle_secret, "\" target=\"_blank\">\u0411\u043E\u0439</a></div>\n ").concat(record.survived === undefined ? "" : "<div>".concat(record.survived, "%</div>"), "\n </div>");
};
getRecordPlayersTemplate = function _getRecordPlayersTemp(nicknames) {
return nicknames.map(function(nickname) {
return "<a href=\"/search.php?key=".concat(nickname, "\">").concat(nickname, "</a>");
}).join("<br>+<br>");
};
isAllPresent = function _isAllPresent(rowData) {
var isAllPresent = true;
rowData.forEach(function(cre) {
if (!cre[2]) {
isAllPresent = false;
}
});
return isAllPresent;
};
getSpecialCreatureExtraData = function _getSpecialCreatureEx(creatureData) {
return "\n <b>\u041D\u0430\u0432\u044B\u043A\u0438</b>: ".concat(creatureData.skills.map(function(skill) {
return skill.replace(". ", "").replace(".", "");
}).join(", "), ".<br>\n <b>\u0417\u0430\u043A\u043B\u0438\u043D\u0430\u043D\u0438\u044F</b>: ").concat(creatureData.casts.map(function(cast, index) {
if (creatureData.casts_effects) {
return "".concat(cast, " (").concat(creatureData.casts_effects[index], ")");
}
return cast;
}).join(", "), ".\n ");
};
showSpecialCreatureData = function _showSpecialCreatureD(index) {
Object(commonUtils["a" /* $ */ ])("special-creature-extended-".concat(index)).classList.toggle("visible");
};
getSpecialCreatureTemplate = function _getSpecialCreatureTe(creatureData, index) {
return "\n <div class=\"special-creature\">\n <div class=\"special-creature-info\">\n ".concat(Object(templates["a" /* getNewCreatureIcon */ ])(creatureData.portrait, ""), "\n <div class=\"special-creature-info-button\" onclick=\"showSpecialCreatureData('").concat(index, "')\">\n <img src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/combat/btn_info.png\" alt=\"creature info\" height=\"50\">\n </div>\n </div>\n <div class=\"special-creature-stats\">\n <div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_attack.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.attack.toFixed(), "</div>\n </div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_speed.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.speed.toFixed(), "</div>\n </div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_initiative.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.maxinit, "</div>\n </div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_hit_points.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.health.toFixed(), "</div>\n </div>\n </div>\n <div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_defense.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.defence.toFixed(), "</div>\n </div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_shoots.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.shots.toFixed(), "</div>\n </div>\n <div>\n <div><img class=\"special-creature-stat-icon\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/icons/attr_damage.png?v=1\" alt=\"attack\"></div>\n <div class=\"special-creature-stat-value\">").concat(creatureData.mindam.toFixed(), "-").concat(creatureData.maxdam.toFixed(), "</div>\n </div>\n </div>\n </div>\n </div>\n ");
};
processRecordHeroCreatures = function _processRecordHeroCre(rowData, creatureAmount, creaturePortrait) {
var isGood = false;
if (commonUtils["h" /* heroCreatures */ ].hasOwnProperty(creaturePortrait)) {
if (creatureAmount - 0 <= commonUtils["h" /* heroCreatures */ ][creaturePortrait]['count'] - 0) {
rowData.push([creaturePortrait, creatureAmount, true]);
isGood = true;
} else {
rowData.push([creaturePortrait, creatureAmount, false]);
}
} else {
rowData.push([creaturePortrait, creatureAmount, false]);
}
return isGood;
};
addRecord = function _addRecord(record, index) {
var playersCreaturesInfo = [];
record.creatures.forEach(function(playerCreatures, playerId) {
var rowData = [];
Object.entries(playerCreatures).forEach(function(_ref) {
var _ref2 = _slicedToArray(_ref, 2),
creaturePortrait = _ref2[0],
creatureAmount = _ref2[1];
processRecordHeroCreatures(rowData, creatureAmount, creaturePortrait);
});
playersCreaturesInfo.push(rowData);
rowDatas["".concat(index, ":").concat(playerId)] = rowData;
});
var isAllCreaturesAvailable = isAllPresent(playersCreaturesInfo[0]);
var recordLeadership = getLeadership(playersCreaturesInfo[0]);
if (!Object(commonUtils["g" /* get */ ])("lg_show_available", false) || isAllCreaturesAvailable && recordLeadership > (lg_lvl + 9) * 1000 && recordLeadership <= (lg_lvl + 10) * 1000) {
var recordCreatureIds = Object.keys(record.creatures[0]);
recordCreatureIds.sort(function(a, b) {
return a.localeCompare(b);
});
if (!Object(commonUtils["g" /* get */ ])("lg_hide_duplicates", false) || !processedBattleCreatures.includes(recordCreatureIds.join(":"))) {
var playersCreatures = record.creatures.map(function(playerCreatures, playerId) {
var playerCreaturesHTML = "";
var rowData = [];
Object.entries(playerCreatures).forEach(function(_ref3, cellId) {
var _ref4 = _slicedToArray(_ref3, 2),
creaturePortrait = _ref4[0],
creatureAmount = _ref4[1];
var isGood = processRecordHeroCreatures(rowData, creatureAmount, creaturePortrait);
playerCreaturesHTML += "<div id=\"creature-".concat(index, "-").concat(playerId, "-").concat(cellId, "\">").concat(Object(templates["a" /* getNewCreatureIcon */ ])(creaturePortrait, creatureAmount, isGood ? "good-creature" : "bad-creature"), "</div>");
});
return "\n <div class=\"record-player-creatures\" id=\"creatures-".concat(index, "-").concat(playerId, "\">\n <div id=\"creatures-").concat(index, "-").concat(playerId, "-apply\" class=\"creatures-apply\">\n <div id=\"creatures-").concat(index, "-").concat(playerId, "-apply-button\" class=\"home_button2 btn_hover2\" onclick=\"sendApplyArmy('").concat(index, ":").concat(playerId, "')\">\u041D\u0430\u0431\u0440\u0430\u0442\u044C</div>\n <div id=\"creatures-").concat(index, "-").concat(playerId, "-leadership\" class=\"player-leadership\">\n ").concat(getRecordPlayerLeadershipTemplate(index, playerId, getLeadership(rowData), isAllCreaturesAvailable), "\n </div>\n </div>\n <div id=\"creatures-").concat(index, "-").concat(playerId, "-creatures\" class=\"player-creatures-row\">").concat(playerCreaturesHTML, "</div>\n </div>");
}).join("<img src=\"https://i.imgur.com/Y3sbLcM.png\" alt=\"\" class=\"record-players-arms\">"); //onwheel="if(this.scrollWidth > this.clientWidth){ if (event.deltaY > 0) {this.scrollLeft += 100;} else {this.scrollLeft -= 100;}; event.preventDefault()}"
var recordContainer = "\n <div class=\"record-wrapper\" id=\"record-".concat(index, "\">\n <div class=\"record-container\">\n <div class=\"record-number\"><div>").concat(index + 1, "</div></div>\n <div class=\"record-players\" id=\"record-").concat(index, "-players\">\n <div>").concat(getRecordPlayersTemplate(record.nicknames), "</div>\n <div>").concat(getRecordResultTemplate(record), "</div>\n </div>\n <div class=\"record-players-creatures\" id=\"record-").concat(index, "-creatures\">").concat(playersCreatures, "</div>\n ").concat(record.special_creature ? getSpecialCreatureTemplate(record.special_creature, index) : "", "\n </div>\n <div class=\"special-creature-extended\" id=\"special-creature-extended-").concat(index, "\">\n ").concat(record.special_creature ? getSpecialCreatureExtraData(record.special_creature) : "", "\n </div>\n </div>");
processedBattleCreatures.push(recordCreatureIds.join(":"));
return recordContainer;
}
}
return "";
};
processRecords = function _processRecords(records) {
var allRecords = records.reduce(function(prev, curr, index) {
return prev + addRecord(curr, index);
}, "");
Object(commonUtils["a" /* $ */ ])('main-data').insertAdjacentHTML("beforeend", allRecords);
};
processFailedRecords = function _processFailedRecords(failedEventBattles) {
var allRecords = failedEventBattles.reduce(function(prev, curr, index) {
return prev + "\n <div style=\"display: flex; justify-content: space-between; padding: 1px;\">\n <div>".concat(index + 1, ".\xA0</div>\n <div style=\"text-align: center\">").concat(getRecordPlayersTemplate(curr.nicknames), "</div>\n <div>\xA0<a target=\"_blank\" href=\"/warlog.php?warid=").concat(curr["battle_id"], "&show_for_all=").concat(curr["battle_secret"], "<=-1\">\u0411\u043E\u0439</a></div>\n </div>");
}, "");
var result = "<div class=\"failed-records-wrapper\">\n <div class=\"failed-records-container\">\n <div style=\"text-align: center;\">\n <h3>\u041F\u0440\u0438\u043C\u0435\u0440\u044B \u043F\u043E\u0440\u0430\u0436\u0435\u043D\u0438\u0439</h3>\n </div>\n ".concat(allRecords, "\n </div>\n </div>");
Object(commonUtils["a" /* $ */ ])('main-data').insertAdjacentHTML("beforeend", result);
};
setExampleBattles = function _setExampleBattles(template) {
var where = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
Object(commonUtils["a" /* $ */ ])('loading').remove();
where.insertAdjacentHTML("beforeend", template);
if (!isLostBattles) {
processRecords(battles);
} else {
processFailedRecords(battles);
}
};
_getTodayBandits = function _getTodayBandits3() {
_getTodayBandits = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee3() {
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return Object(networkUtils["a" /* doGet */ ])("getDbBattles?lg_lvl=".concat(lg_lvl, "&token=").concat(Object(commonUtils["g" /* get */ ])("hwm_events_token", "")));
case 2:
battles = _context3.sent;
battles.sort(function(a, b) {
return parseFloat(b.survived) - parseFloat(a.survived);
});
case 4:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return _getTodayBandits.apply(this, arguments);
};
getTodayBandits = function _getTodayBandits2() {
return _getTodayBandits.apply(this, arguments);
};
_getWaveInfo = function _getWaveInfo3() {
_getWaveInfo = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee2() {
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return Object(networkUtils["a" /* doGet */ ])("getEventLeaderBattles?wave=".concat(Object(eventUtils["getCurrentLevel"])(), "&token=").concat(Object(commonUtils["g" /* get */ ])("hwm_events_token", "")));
case 2:
battles = _context2.sent;
if (!(battles.length > 0)) {
_context2.next = 7;
break;
}
battles.sort(function(a, b) {
a = parseFloat(a.cost);
b = parseFloat(b.cost);
if (a < 0 || b < 0) {
return b - a;
} else {
return a - b;
}
});
_context2.next = 11;
break;
case 7:
_context2.next = 9;
return Object(networkUtils["a" /* doGet */ ])("getEventLeaderFailedBattles?wave=".concat(Object(eventUtils["getCurrentLevel"])(), "&token=").concat(Object(commonUtils["g" /* get */ ])("hwm_events_token", "")));
case 9:
battles = _context2.sent;
isLostBattles = true;
case 11:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _getWaveInfo.apply(this, arguments);
};
getWaveInfo = function _getWaveInfo2() {
return _getWaveInfo.apply(this, arguments);
};
processLeaderArmyResponse = function _processLeaderArmyRes(doc) {
var bodyHTML = doc.body.innerHTML.toString();
var matchesId = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['monster_id'] = '([a-z0-9_-]+)'/g, bodyHTML);
var matchesCount = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['count'] = (\d+)/g, bodyHTML);
var matchesCost = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['cost'] = (\d+)/g, bodyHTML);
var matchesName = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['name'] = '([А-Яа-яёЁa-zA-Z`_ -]+)'/g, bodyHTML);
var matchesPortrait = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['lname'] = '([a-z0-9_-]+)'/g, bodyHTML);
var matchesVersion = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['version'] = '(\d{1,3})'/g, bodyHTML);
var matchesRarity = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['rarity'] = (\d{1,3})/g, bodyHTML);
var matchesRace = Object(commonUtils["f" /* findAll */ ])(/obj\[\d{1,3}]\['race'] = (\d{1,3})/g, bodyHTML);
matchesPortrait.forEach(function(id, index) {
commonUtils["h" /* heroCreatures */ ][id[1]] = {
'count': matchesCount[index][1],
'cost': matchesCost[index][1],
'name': matchesName[index][1],
'id': matchesId[index][1],
'version': matchesVersion[index][1],
'rarity': matchesRarity[index][1],
'race': matchesRace[index][1]
};
});
};
_getHeroCreatures = function _getHeroCreatures3() {
_getHeroCreatures = _asyncToGenerator( /*#__PURE__*/ _regeneratorRuntime().mark(function _callee() {
var doc;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return Object(networkUtils["a" /* doGet */ ])('/leader_army.php', true);
case 2:
doc = _context.sent;
processLeaderArmyResponse(doc);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _getHeroCreatures.apply(this, arguments);
};
getHeroCreatures = function _getHeroCreatures2() {
return _getHeroCreatures.apply(this, arguments);
};
setLoading = function _setLoading() {
var where = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
where.insertAdjacentHTML("beforeend", "\n <div style=\"display: flex; justify-content: center;\" id=\"loading\" >\n <img style=\"margin-top: 20px\" src=\"https://i.imgur.com/4RrPm82.gif\" width=\"400\" alt=\"\">\n </div>");
};
getResources = function _getResources(getExamples, showExamples, target) {
return Promise.all([getHeroCreatures(), getExamples()]).then(function() {
setExampleBattles(showExamples(), target);
});
};
createBanditsTemplate = function _createBanditsTemplat() {
return "\n <div class=\"wrapper\">\n <div class=\"records-container-body\" id=\"main-data\"></div>\n </div>\n ";
};
createLeaderTemplate = function _createLeaderTemplate() {
return "\n <div class=\"records-container-body\" id=\"main-data\"></div>\n ";
};
isEvent = false;
lg_lvl = parseInt(Object(commonUtils["g" /* get */ ])('hero_leader_lvl', 10));
battles = [];
isLostBattles = false;
window.sendApplyArmy = sendApplyArmy;
window.showSpecialCreatureData = showSpecialCreatureData;
window.replaceCellListener = replaceCellListener;
window.removeOverlay = removeOverlay;
if (!/(leader_rogues|leader_winter)/.test(location.href)) {
_context5.next = 62;
break;
}
isEvent = true;
if (!document.body.innerHTML.includes("leader_rogues.php?action=cancel_merc")) {
_context5.next = 49;
break;
}
addFilteringArea();
processFilters();
return _context5.abrupt("return");
case 49:
if (!(location.href.includes("?show_2x2_form=1") || location.href.includes("?show_merc_dialog=1"))) {
_context5.next = 51;
break;
}
return _context5.abrupt("return");
case 51:
settingsContainer = document.querySelector('.Global');
if (typeof hwm_mobile_view !== "undefined" && hwm_mobile_view === true) {
settingsContainer = document.querySelector('.new_event_map').querySelector('.global_container_block:last-child > div').getElementsByTagName("table")[0];
}
Object(settings["eventHelperSettings"])(settingsContainer, function(container) {
Object(settings["setSettings"])("auto_send_event_lg", "Отправлять бои из ГЛ ивента в сервис автоматически", container);
Object(settings["setSettings"])("only_clan_visibility", "Мои бои доступны только для клана", container, false);
Object(settings["setSettings"])("collapse_event_desc", "Всегда сворачивать описания боев", container, false);
Object(settings["setSettings"])("lg_show_available", "Отображать только доступные наборы", container, false);
Object(settings["setSettings"])("lg_hide_duplicates", "Скрывать дубликаты наборов", container, false);
}, "afterend");
Object(eventUtils["collapseEventDesc"])();
Object(eventUtils["setClickableLevels"])();
leaderBoardTarget = Array.from(document.querySelector('.new_event_map').querySelector('.global_container_block:last-child > div').getElementsByTagName("center")).slice(-1)[0];
Object(leaderboard["setLeaderboard"])(leaderBoardTarget, "beforebegin");
examplesElem = document.querySelector('.new_event_map');
if (typeof hwm_mobile_view !== "undefined" && hwm_mobile_view === true) {
examplesElem = document.querySelector('.new_event_map').querySelector('.global_container_block:last-child > div');
} else {
examplesElem.style.flexWrap = "wrap";
examplesElem.children[0].style.flex = "1 0 20%";
examplesElem.children[1].style.flex = "1 0 10%";
}
setLoading(examplesElem);
getResources(getWaveInfo, createLeaderTemplate, examplesElem).then(function(_) {
if (typeof hwm_mobile_view !== "undefined" && hwm_mobile_view === true) {
Object(commonUtils["a" /* $ */ ])("main-data").style.width = "360px";
Object(commonUtils["a" /* $ */ ])("event_helper_settings_container").style.width = "360px";
}
});
case 62:
if (location.href.includes("leader_guild")) {
//createWelcomeTemplate()
lg_lvl = document.body.innerHTML.match(/lev=(\d{1,2})/)[1] - 0;
Object(commonUtils["m" /* set */ ])("hero_leader_lvl", lg_lvl);
Object(settings["eventHelperSettings"])(Array.from(document.querySelectorAll('table[class="wb"]')).slice(-1)[0], function(container) {
Object(settings["setSettings"])("auto_send_lg", "Отправлять бои с опасными бандитами в сервис автоматически", container);
Object(settings["setSettings"])("only_clan_visibility", "Мои бои доступны только для клана", container, false);
Object(settings["setSettings"])("lg_show_available", "Отображать только доступные наборы", container, false);
Object(settings["setSettings"])("lg_hide_duplicates", "Скрывать дубликаты наборов", container, false);
}, "afterend");
if (!document.body.innerText.includes("Опасная цель устранена")) {
setLoading(Array.from(document.querySelectorAll("td[valign=\"top\"][align=\"left\"]")).slice(-1)[0]);
getResources(getTodayBandits, createBanditsTemplate, Array.from(document.querySelectorAll("td[valign=\"top\"][align=\"left\"]")).slice(-1)[0]);
}
}
processedBattleCreatures = [];
rowDatas = {};
case 65:
case "end":
return _context5.stop();
}
}
}, _callee5);
}));
return _leaderEvent.apply(this, arguments);
}
// CONCATENATED MODULE: ./src/events/adventure.js
var _require = __webpack_require__(4),
setLeaderboard = _require.setLeaderboard;
var _require2 = __webpack_require__(8),
setGlobalStyles = _require2.setGlobalStyles;
var _require3 = __webpack_require__(3),
collapseEventDesc = _require3.collapseEventDesc;
var _require4 = __webpack_require__(1),
eventHelperSettings = _require4.eventHelperSettings,
setSettings = _require4.setSettings;
var _require5 = __webpack_require__(5),
getEventBattles = _require5.getEventBattles;
function adventureEvent() {
if (/adventure_event\.php$/.test(location.href)) {
setLeaderboard(document.querySelector('[style="min-width:250px;"]').getElementsByTagName("center")[0]);
}
if (location.href.includes("adventure_event.php?map=1")) {
setGlobalStyles();
collapseEventDesc();
eventHelperSettings(document.querySelector('.Global'), function(container) {
setSettings("auto_send_ffa_event", "Отправлять бои из КБО ивента в сервис автоматически", container);
setSettings("only_clan_visibility", "Мои бои доступны только для клана", container, false);
setSettings("collapse_event_desc", "Всегда сворачивать описания боев", container, false);
}, "afterend");
getEventBattles(document.querySelectorAll('[align="left"][valign="top"]')[1]);
}
}
// EXTERNAL MODULE: ./src/utils/localizationUtils.js
var localizationUtils = __webpack_require__(7);
// CONCATENATED MODULE: ./src/events/faction.js
function getAllTexts() {
var texts = new localizationUtils["b" /* LocalizedTextMap */ ]();
texts.addText(new localizationUtils["a" /* LocalizedText */ ]("hide_faction_event_enemies", "Show enemies with max power only", "Показывать противников только с максимальной мощностью", "Показувати супротивників лише з максимальною потужністю"));
texts.addText(new localizationUtils["a" /* LocalizedText */ ]("mana_warning", "Enemies are stealing mana!", "В армии противника пожиратели маны!", "В армії противника крадії мани!"));
return texts;
}
var allTexts = getAllTexts();
function factionEvent() {
function showManaWarning(enemies) {
enemies.forEach(function(enemy) {
var enemyHTML = enemy.innerHTML;
if (enemyHTML.includes("name=imp\"") || enemyHTML.includes("name=familiar\"") || enemyHTML.includes("name=vermin\"") || enemyHTML.includes("name=spegasus\"")) {
enemy.children[3].insertAdjacentHTML("afterend", "\n <div><b style=\"color: red\">".concat(allTexts.get("mana_warning"), "</b></div>\n "));
}
});
}
if (location.href.includes("faction_event")) {
Object(leaderboard["setLeaderboard"])(document.querySelector("#hwm_for_zoom > div > div:nth-child(1) > div > div:nth-child(2) > center"));
Object(settings["eventHelperSettings"])(document.querySelector("#hwm_for_zoom > div > div.frac_event_right_block > div > div:nth-child(2)"), function(container) {
Object(settings["setSettings"])("hide_faction_event_enemies", allTexts.get("hide_faction_event_enemies"), container, false);
}, "beforeend");
var enemies = getEnemies();
var maxPower = getMaxPower(enemies);
showManaWarning(enemies);
if (Object(commonUtils["g" /* get */ ])("hide_faction_event_enemies", false)) {
filterFactionEventEnemies(enemies, maxPower);
}
}
function getEnemies() {
return Array.from(document.getElementsByClassName("frac_enemy_block"));
}
function getMaxPower(enemies) {
return enemies.reduce(function(prev, curr) {
var power = curr.children[3].innerText.split(": ")[1] - 0;
return power > prev ? power : prev;
}, 0);
}
function filterFactionEventEnemies(enemies, maxPower) {
enemies.forEach(function(enemy) {
var power = enemy.children[3].innerText.split(": ")[1] - 0;
if (power < maxPower) {
enemy.remove();
}
});
}
}
// EXTERNAL MODULE: ./src/battles.js
var src_battles = __webpack_require__(5);
// CONCATENATED MODULE: ./src/events/hire.js
function hire_typeof(obj) {
"@babel/helpers - typeof";
return hire_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, hire_typeof(obj);
}
function hire_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
hire_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == hire_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || hire_unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function hire_unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return hire_arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return hire_arrayLikeToArray(o, minLen);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return hire_arrayLikeToArray(arr);
}
function hire_arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function hire_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function hire_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
hire_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
hire_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function hireEvent() {
if (location.href.includes("naym_event.")) {
// addFilteringArea()
// processFilters()
Object(leaderboard["setLeaderboard"])(Array.from(document.querySelectorAll('[align="left"][valign="top"]')[0].getElementsByTagName("center")).slice(-1)[0]);
Object(settings["eventHelperSettings"])(document.querySelector('.Global'), function(container) {
Object(settings["setSettings"])("auto_send_rogues_event", "Отправлять бои из разбойничьего ивента в сервис автоматически", container);
Object(settings["setSettings"])("only_clan_visibility", "Мои бои доступны только для клана", container, false);
Object(settings["setSettings"])("collapse_event_desc", "Всегда сворачивать описания боев", container, false);
Object(settings["setSettings"])("hide_rogues_event_enemies", "Показывать статистику цен", container);
Object(settings["setSettings"])("return_to_prev_level", "Возвращать на незавершенный уровень", container, false);
}, "afterend");
Object(commonUtils["m" /* set */ ])("eh_current_level", null);
Object(eventUtils["collapseEventDesc"])();
interceptButtons();
Object(src_battles["getEventBattles"])(document.querySelector(".Global").parentElement, "getRoguesEventBattles", 1);
}
if (location.href.includes("naym_event_set")) {
var drawChart = function drawChart(prices, index, elem) {
elem.insertAdjacentHTML("afterend", "\n <tr>\n <td colspan=\"3\">\n <div style=\"height: 130px; overflow: hidden\">\n <canvas id=\"chart".concat(index, "\" height=\"150\" style=\"width: 100%\"></canvas>\n </div>\n </td>\n </tr>"));
var labels = Array.from(' '.repeat(prices.length));
var data = {
labels: labels,
datasets: [{
label: 'Price',
data: prices.map(function(price) {
return parseInt(price);
}),
borderColor: "blue",
backgroundColor: "rgb(44,73,107)"
}]
};
var config = {
type: 'line',
data: data,
options: {
animation: false,
responsive: false,
plugins: {
legend: {
display: false
},
title: {
display: false,
text: 'Chart.js Line Chart'
}
},
elements: {
line: {
borderWidth: 1
},
point: {
radius: 1
}
}
}
};
var ctx = document.getElementById("chart".concat(index)).getContext('2d');
var myChart = new Chart(ctx, config);
};
var showPriceChange = /*#__PURE__*/ function() {
var _ref = hire_asyncToGenerator( /*#__PURE__*/ hire_regeneratorRuntime().mark(function _callee() {
var doc;
return hire_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return Object(networkUtils["a" /* doGet */ ])("getRoguesCreaturesPrices", false);
case 2:
doc = _context.sent;
Array.from(Array.from(document.querySelectorAll('td[class="wbwhite"][valign="top"]')).slice(-1)[0].getElementsByTagName("tr")).filter(function(elem) {
return elem.innerHTML.includes("cre_creature");
}).forEach(function(elem, index) {
var creatureName = elem.innerHTML.match(/name=([a-zA-Z0-9]+)/)[1];
var prices = doc[creatureName].map(function(price) {
return price - 0;
});
var priceElem = elem.querySelector(".txt_with_icons");
if (prices[prices.length - 1] > prices[prices.length - 2]) {
elem.style.background = "#ff9e9e";
} else if (prices[prices.length - 1] < prices[prices.length - 2]) {
elem.style.background = "#9eff98";
}
priceElem.insertAdjacentHTML("beforeend", " (".concat((prices[prices.length - 1] / Math.max.apply(Math, _toConsumableArray(prices)) * 100).toFixed(), "%)"));
Array.from(elem.querySelectorAll('input[type="submit"]')).forEach(function(input) {
input.classList.add("btn_hover2", "home_button2");
});
if (Object(commonUtils["g" /* get */ ])("hide_rogues_event_enemies", true)) {
drawChart(prices, index, elem);
}
});
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function showPriceChange() {
return _ref.apply(this, arguments);
};
}();
var buy_history = Object(commonUtils["g" /* get */ ])("buy_history", []);
Array.from(Array.from(document.querySelectorAll('td[class="wbwhite"][valign="top"]')).slice(-2, -1)[0].getElementsByTagName("tr")).filter(function(elem) {
return elem.innerHTML.includes("cre_creature");
}).forEach(function(elem, index) {
var submit = elem.querySelector("input[type=submit]");
if (submit) {
var data = submit["onclick"].toString();
var findings = data.match(/(\d{1,5}), '([a-zA-Z0-9_-]+)', '(\d{0,3},?\d{1,3})', (\d{1,5})\)/);
var price = parseInt(findings[4].replace(",", ""));
var count = parseInt(findings[1]);
var name = findings[2];
var time = Date.now();
submit.addEventListener("click", function() {
buy_history.push({
"name": name,
"price": price,
"count": count,
"time": time,
"action": "sell"
});
Object(commonUtils["m" /* set */ ])("buy_history", buy_history.filter(function(elem) {
return Date.now() - elem.time < 86400 * 14 * 1000;
}));
});
}
});
Array.from(Array.from(document.querySelectorAll('td[class="wbwhite"][valign="top"]')).slice(-1)[0].getElementsByTagName("tr")).filter(function(elem) {
return elem.innerHTML.includes("cre_creature");
}).forEach(function(elem, index) {
var submit = elem.querySelector("input[type=submit]");
if (submit) {
submit.addEventListener("click", function() {
var form = elem.querySelector("form");
var price = parseInt(form.querySelector("input[name=price]").value);
var count = parseInt(form.querySelector("select[name=cnt]").value);
var name = form.querySelector("input[name=mid]").value;
var time = Date.now();
buy_history.push({
"name": name,
"price": price,
"count": count,
"time": time,
"action": "buy"
});
Object(commonUtils["m" /* set */ ])("buy_history", buy_history.filter(function(elem) {
return Date.now() - elem.time < 86400 * 14 * 1000;
}));
});
}
});
if (Object(commonUtils["g" /* get */ ])("hide_rogues_event_enemies", true)) {
var newScript = document.createElement('script');
newScript.setAttribute('src', 'https://cdn.jsdelivr.net/npm/chart.js');
document.head.appendChild(newScript);
newScript.onload = function() {
showPriceChange();
};
} else {
showPriceChange();
}
if (buy_history.length > 0) {
var rows = Object(commonUtils["n" /* sortByKey */ ])(buy_history, "time").reverse().reduce(function(prev, curr) {
return prev + "\n <div style=\"display: flex; justify-content: space-evenly;\n align-items: center;\n border: 1px solid #000000;\">\n <div> \n ".concat(new Date(curr.time).toLocaleTimeString(), "\n </div>\n <div>\n ").concat(curr.action === "buy" ? "<p style='color: green'>куплено</p>" : "<p style='color: red'>продано</p>", "\n </div>\n <div>\n ").concat(curr.count, "\n </div>\n <div>\n <div style=\"width: 40px\"><img src=\"https://cfcdn.lordswm.com/i/portraits/").concat(curr.name, "anip33.png\" style=\"height: 48px; width: 48px; border-radius: 50%; object-fit: cover;\"></div>\n </div>\n <div>\n \u043F\u043E ").concat(curr.price, "\n </div>\n </div>\n ");
}, "");
Array.from(document.querySelectorAll('td[class="wbwhite"][valign="top"]')).slice(-2, -1)[0].insertAdjacentHTML("beforeend", "\n <div style=\"display: flex; flex-direction: column\">\n <div><h3>\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0438 \u043F\u0440\u043E\u0434\u0430\u0436</h3></div>\n ".concat(rows, "\n </div>\n "));
}
}
function interceptButtons() {
var buttons = Array.from(document.querySelector(".TextBlock.TextBlockBOTTOM").querySelectorAll("#close-image"));
if (buttons.length === 2) {
var available = 2 - buttons.filter(function(x) {
return x.disabled;
}).length;
buttons.forEach(function(button, index) {
button.addEventListener("mousedown", function() {
Object(commonUtils["m" /* set */ ])("event_battle_side", index % 2);
Object(commonUtils["m" /* set */ ])("eh_current_level", [Object(eventUtils["getCurrentLevel"])(), available]);
});
});
}
}
}
// CONCATENATED MODULE: ./src/events/pirate.js
function pirate_typeof(obj) {
"@babel/helpers - typeof";
return pirate_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, pirate_typeof(obj);
}
function pirate_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
pirate_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == pirate_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function pirate_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function pirate_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
pirate_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
pirate_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function pirateEvent() {
if (location.href.includes("pirate_event.")) {
var trs = document.querySelectorAll("#tableDiv")[2].querySelector("table > tbody").childNodes;
var items = [];
for (var i = 1; i < trs.length; i++) {
var item_info = {};
item_info.name = trs[i].querySelector("td:nth-child(1) > img").src;
item_info.weight = trs[i].querySelector("td:nth-child(2)").innerText - 0;
item_info.buy_price = trs[i].querySelector("td:nth-child(3) table > tbody > tr > td:nth-child(2)").innerText.replace(/,/g, "") - 0;
item_info.sell_price = trs[i].querySelector("td:nth-child(4) table > tbody > tr > td:nth-child(2)").innerText.replace(/,/g, "") - 0;
item_info.buy_form = trs[i].querySelector("td:nth-child(5)").innerHTML;
item_info.opt_price = (item_info.sell_price - item_info.buy_price) / item_info.weight;
if (item_info.buy_form.toString().length > 100) {
items.push(item_info);
}
}
items = Object(commonUtils["n" /* sortByKey */ ])(items, "opt_price").reverse();
var template = getPirateEventTemplate(items);
var target_td = document.querySelectorAll("#tableDiv")[2];
target_td.removeChild(target_td.childNodes[0]);
target_td.insertAdjacentHTML("beforeend", template);
}
function getPirateEventTemplate(items) {
var final_str = "\n <style>\n .items-container {\n display: flex;\n flex-direction: column;\n }\n .items-row {\n display: flex;\n }\n .item-itself {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .item-itself:nth-child(1) {\n width: 15%;\n }\n .item-itself:nth-child(2) {\n width: 20%;\n }\n .item-itself:nth-child(3) {\n width: 11%;\n }\n .item-itself:nth-child(4) {\n width: 27%;\n }\n .item-itself:nth-child(5) {\n width: 27%;\n }\n \n </style>\n <div class=\"items-container\">\n <div class=\"items-row\">\n <div class=\"item-itself\">\u0422\u043E\u0432\u0430\u0440</div>\n <div class=\"item-itself\">\u041F\u0440\u0438\u0431\u044B\u043B\u044C</div>\n <div class=\"item-itself\">\u0412\u0435\u0441</div>\n <div class=\"item-itself\">\u0426\u0435\u043D\u044B</div>\n <div class=\"item-itself\">\u041A\u0443\u043F\u0438\u0442\u044C</div>\n </div>";
items.forEach(function(item) {
final_str += "\n <div class=\"items-row\">\n <div class=\"item-itself\"><img src=\"".concat(item.name, "\" height=\"48\" alt=\"icon\"></div>\n <div class=\"item-itself\">").concat(item.opt_price.toFixed(2), "</div>\n <div class=\"item-itself\">").concat(item.weight, "</div>\n <div class=\"item-itself\">").concat(item.buy_price, "->").concat(item.sell_price, "</div>\n <div class=\"item-itself\">").concat(item.buy_form.toString().replaceAll("Погрузить", "Купить"), "</div>\n </div>");
});
return final_str + "</div>";
}
if (location.href.includes("pirate_self_event.")) {
Object(leaderboard["setLeaderboard"])(Array.from(document.querySelectorAll('table[width="100%"][align="left"]')).slice(-1)[0].previousElementSibling);
}
if (location.href.includes("pirate_land")) {
document.querySelector("input[type=submit]").click();
}
if (location.href.includes("pirate_self_event_set")) {
Object(settings["eventHelperSettings"])(document.querySelector(".pirate_self_top_block"), function(container) {
Object(settings["setSettings"])("hide_solo_pirate_event_enemies", "Показывать статистику цен", container, false);
}, "beforeend");
if (Object(commonUtils["g" /* get */ ])("hide_solo_pirate_event_enemies", true)) {
var newScript = document.createElement('script');
newScript.setAttribute('src', 'https://cdn.jsdelivr.net/npm/chart.js');
document.head.appendChild(newScript);
newScript.onload = /*#__PURE__*/ pirate_asyncToGenerator( /*#__PURE__*/ pirate_regeneratorRuntime().mark(function _callee() {
var doc;
return pirate_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
document.querySelector("#global_table_div2").style.overflow = "auto";
document.querySelector("#global_table_div2").style.overflowX = "hidden";
document.querySelector("#global_table_div2").style.maxHeight = "60vh";
_context.next = 5;
return Object(networkUtils["a" /* doGet */ ])("getSoloPirateCreaturesPrices");
case 5:
doc = _context.sent;
document.querySelector("#global_table_div2").setAttribute("style", "");
document.querySelector("#global_table_div2 > .global_table_bg_color").style.height = "";
document.querySelector("#global_table_div2 > .global_table_bg_color > table").style.position = "";
Array.from(document.getElementsByClassName("pirate_self_table_padding")[1].getElementsByTagName("tr")).filter(function(elem) {
return elem.innerHTML.includes("cre_creature");
}).forEach(function(elem, index) {
var creatureName = elem.innerHTML.match(/name=([a-zA-Z0-9]+)/)[1];
var prices = doc[creatureName];
elem.insertAdjacentHTML("afterend", "\n <tr>\n <td colspan=\"3\">\n <div style=\"height: 130px; overflow: hidden\">\n <canvas id=\"chart".concat(index, "\" height=\"150\" style=\"width: 100%\"></canvas>\n </div>\n </td>\n </tr>"));
var labels = Array.from(' '.repeat(prices.length));
var data = {
labels: labels,
datasets: [{
label: 'Price',
data: prices.map(function(price) {
return parseInt(price);
}),
borderColor: "blue",
backgroundColor: "rgb(44,73,107)"
}]
};
var config = {
type: 'line',
data: data,
options: {
animation: false,
responsive: false,
plugins: {
legend: {
display: false
},
title: {
display: false,
text: 'Chart.js Line Chart'
}
},
elements: {
line: {
borderWidth: 1
},
point: {
radius: 1
}
}
}
};
var ctx = document.getElementById("chart".concat(index)).getContext('2d');
var myChart = new Chart(ctx, config);
});
case 10:
case "end":
return _context.stop();
}
}
}, _callee);
}));
}
var buy_history = Object(commonUtils["g" /* get */ ])("buy_history", []);
Array.from(document.querySelector(".pirate_self_recruit_block_outside").children[0].getElementsByTagName("tr")).filter(function(elem) {
return elem.innerHTML.includes("cre_creature");
}).forEach(function(elem, index) {
var submit = elem.querySelector("div[onclick^=javascript]");
if (submit) {
var findings = submit["onclick"].toString().match(/(\d{1,5}), '([a-zA-Z0-9_-]+)', '(\d{0,3},?\d{1,3})', (\d{1,5})\)/);
var price = parseInt(findings[4].replace(",", ""));
var count = parseInt(findings[1]);
var name = findings[2];
var time = Date.now();
submit.addEventListener("click", function() {
buy_history.push({
"name": name,
"price": price,
"count": count,
"time": time,
"action": "sell"
});
Object(commonUtils["m" /* set */ ])("buy_history", buy_history.filter(function(elem) {
return Date.now() - elem.time < 86400 * 14 * 1000;
}));
});
}
});
Array.from(document.querySelector(".pirate_self_recruit_block_outside").children[1].getElementsByTagName("tr")).filter(function(elem) {
return elem.innerHTML.includes("cre_creature");
}).forEach(function(elem, index) {
var submit = elem.querySelector("div[id^=but]");
if (submit) {
submit.addEventListener("click", function() {
var price = parseInt(submit.getAttribute("buystr").match(/price=(\d{1,6})/)[1]);
var tempCount = submit.getAttribute("cnt");
var count = tempCount ? parseInt(submit.getAttribute("cnt")) : 1;
var name = submit.getAttribute("buystr").match(/mid=([a-zA-Z0-9_-]+)/)[1];
var time = Date.now();
buy_history.push({
"name": name,
"price": price,
"count": count,
"time": time,
"action": "buy"
});
Object(commonUtils["m" /* set */ ])("buy_history", buy_history.filter(function(elem) {
return Date.now() - elem.time < 86400 * 14 * 1000;
}));
});
}
});
if (buy_history.length > 0) {
var rows = Object(commonUtils["n" /* sortByKey */ ])(buy_history, "time").reverse().reduce(function(prev, curr) {
return prev + "\n <div style=\"display: flex; justify-content: space-evenly;\n align-items: center;\n border: 1px solid #000000;\">\n <div> \n ".concat(new Date(curr.time).toLocaleTimeString(), "\n </div>\n <div>\n ").concat(curr.action === "buy" ? "<p style='color: green'>куплено</p>" : "<p style='color: red'>продано</p>", "\n </div>\n <div>\n ").concat(curr.count, "\n </div>\n <div>\n <div style=\"width: 40px\"><img src=\"https://cfcdn.lordswm.com/i/portraits/").concat(curr.name, "anip33.png\" style=\"height: 48px; width: 48px; border-radius: 50%; object-fit: cover;\"></div>\n </div>\n <div>\n \u043F\u043E ").concat(curr.price, "\n </div>\n </div>\n ");
}, "");
document.querySelector(".pirate_self_recruit_block_outside").children[0].insertAdjacentHTML("beforeend", "\n <div style=\"display: flex; flex-direction: column\">\n <div><h3>\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0438 \u043F\u0440\u043E\u0434\u0430\u0436</h3></div>\n ".concat(rows, "\n </div>\n "));
}
}
}
// CONCATENATED MODULE: ./src/events/portalCouple.js
function portalCoupleEvent() {
if (location.href.includes("tj_event2")) {
document.querySelector(".tj_rating").previousElementSibling.remove();
Object(leaderboard["setLeaderboard"])(document.querySelector(".tj_rating").parentElement);
var myEventPosition = parseInt(Array.from(document.querySelectorAll('[width="50%"]')[0].getElementsByTagName("tr")).find(function(elem) {
return elem.innerHTML.includes(commonUtils["k" /* pl_id */ ]);
}).firstElementChild.innerText);
document.querySelectorAll('[width="400"]')[0].insertAdjacentHTML("beforeend", "<br><b>\u041C\u0435\u0441\u0442\u043E: ".concat(myEventPosition, "</b>"));
}
}
// CONCATENATED MODULE: ./src/events/portalSolo.js
function portalSolo_typeof(obj) {
"@babel/helpers - typeof";
return portalSolo_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, portalSolo_typeof(obj);
}
function portalSolo_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
portalSolo_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == portalSolo_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function portalSolo_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function portalSolo_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
portalSolo_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
portalSolo_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function portalSoloEvent() {
var loadStarted = false;
var maxPages = 50;
var pageCount = 0;
var battleCount = 0;
if (location.href.includes("tj_single")) {
mainTJSolo();
}
function mainTJSolo() {
Array.from(document.querySelectorAll('center')).slice(-1)[0].insertAdjacentHTML("beforeend", createTJSoloTemplate());
Object(commonUtils["a" /* $ */ ])("statbut").addEventListener('click', function() {
processCollectBattles();
});
}
function createTJSoloTemplate() {
return "\n <div class=\"wrapperStat\">\n <div style=\"width: 33%\"><div id=\"statbut\" class=\"home_button2 btn_hover2\">\u041F\u043E\u0441\u0447\u0438\u0442\u0430\u0442\u044C \u0431\u043E\u0438 \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043C\u0438</div></div>\n <div id=\"progress\" class=\"progress\"></div>\n </div>\n ";
}
function processCollectBattles() {
if (!loadStarted) {
collectBattles();
loadStarted = true;
document.getElementById("statbut").innerHTML = "Поиск боев...";
}
}
function collectBattles() {
return _collectBattles.apply(this, arguments);
}
function _collectBattles() {
_collectBattles = portalSolo_asyncToGenerator( /*#__PURE__*/ portalSolo_regeneratorRuntime().mark(function _callee() {
var doc;
return portalSolo_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!(pageCount < maxPages)) {
_context.next = 6;
break;
}
_context.next = 3;
return Object(networkUtils["a" /* doGet */ ])("/pl_warlog.php?id=".concat(commonUtils["k" /* pl_id */ ], "&page=").concat(pageCount), true);
case 3:
doc = _context.sent;
processResponse(doc);
pageCount++;
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _collectBattles.apply(this, arguments);
}
function processResponse(doc) {
var arr = Array.from(doc.querySelectorAll('.global_a_hover')).slice(-1)[0].innerHTML.toString().split("\n");
arr = arr.slice(2, 42);
for (var i = 0; i < arr.length; i++) {
var currwarid = arr[i].match(/warid=\d{10}/g)[0].match(/\d{10}/g)[0] - 0;
if (/--117--/.test(arr[i])) {
if (/<b>/.test(arr[i].split("vs")[1])) {
continue;
}
battleCount++;
document.getElementById("progress").innerHTML = "Найдено боев: " + battleCount.toString();
}
if (currwarid <= 1246241450) {
var wins = Array.from(document.querySelectorAll('.wbwhite')).slice(-4)[0].querySelector("b:nth-child(6)").textContent - 0;
document.getElementById("progress").innerHTML = "Найдено боев: " + battleCount.toString() + " Осталось боев:" + (wins * 7 + 20 - battleCount).toString();
document.getElementById("statbut").innerHTML = "Готово";
return;
}
}
collectBattles();
}
}
// CONCATENATED MODULE: ./src/events/ambushOrMapHero.js
function ambushOrMapHero_typeof(obj) {
"@babel/helpers - typeof";
return ambushOrMapHero_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, ambushOrMapHero_typeof(obj);
}
function ambushOrMapHero_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
ambushOrMapHero_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == ambushOrMapHero_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function ambushOrMapHero_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function ambushOrMapHero_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
ambushOrMapHero_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
ambushOrMapHero_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function thiefEvent() {
return _thiefEvent.apply(this, arguments);
}
function _thiefEvent() {
_thiefEvent = ambushOrMapHero_asyncToGenerator( /*#__PURE__*/ ambushOrMapHero_regeneratorRuntime().mark(function _callee() {
var doc, interceptButtons, processPlInfoTroopsResponse, showAmbushCreatures, applyMultiplier;
return ambushOrMapHero_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
applyMultiplier = function _applyMultiplier(creaturesData, creaturesMultiplier) {
Object(commonUtils["a" /* $ */ ])("future-ambush-creatures").innerHTML = "";
var newMultiplier = Object(commonUtils["a" /* $ */ ])("your-creatures-multiplier").value - 0;
creaturesData.forEach(function(creature) {
Object(commonUtils["a" /* $ */ ])("future-ambush-creatures").insertAdjacentHTML("beforeend", Object(templates["a" /* getNewCreatureIcon */ ])(creature.portrait, Math.round(creature.amount * (1 + 0.01 * (creaturesMultiplier + newMultiplier)))));
});
};
showAmbushCreatures = function _showAmbushCreatures(creaturesData) {
var creaturesMultiplier = document.querySelector(" div.TextBlock.TextBlockTOP > div > table > tbody > tr:nth-child(3) > td:nth-child(8) > b").innerText;
creaturesMultiplier = creaturesMultiplier.match(/\d{1,3}/)[0] - 0;
document.querySelector('.Global').insertAdjacentHTML("afterend", "\n <div id=\"ambush-creatures\" style=\"display: flex; flex-direction: column; align-items: center\">\n <div>\u0422\u0435\u043A\u0443\u0449\u0435\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0441\u0443\u0449\u0435\u0441\u0442\u0432 (\u0441 \u0443\u0447\u0435\u0442\u043E\u043C \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0445 % \u0447\u0438\u0441\u043B\u0435\u043D\u043D\u043E\u0441\u0442\u0438)</div><div id=\"current-ambush-creatures\"></div><br>\n <div>\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0441\u0443\u0449\u0435\u0441\u0442\u0432 \u043F\u0440\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0438 +<input type=\"text\" id=\"your-creatures-multiplier\" style=\"width: 30px;\" value=\"1\">% <div class=\"btn-gradient blue\" id=\"add_percent\">+1%</div></div>\n <div id=\"future-ambush-creatures\"></div><br>\n </div>");
Object(commonUtils["a" /* $ */ ])("add_percent").addEventListener("click", function() {
var currentMultiplierElement = Object(commonUtils["a" /* $ */ ])("your-creatures-multiplier");
var currentMultiplier = currentMultiplierElement.value - 0;
currentMultiplierElement.value = currentMultiplier + 1;
applyMultiplier(creaturesData, creaturesMultiplier);
});
creaturesData.forEach(function(creature) {
var defaultAmount = creature.amount;
Object(commonUtils["a" /* $ */ ])("current-ambush-creatures").insertAdjacentHTML("beforeend", Object(templates["a" /* getNewCreatureIcon */ ])(creature.portrait, Math.round(defaultAmount * (1 + 0.01 * creaturesMultiplier))));
Object(commonUtils["a" /* $ */ ])("future-ambush-creatures").insertAdjacentHTML("beforeend", Object(templates["a" /* getNewCreatureIcon */ ])(creature.portrait, Math.round(defaultAmount * (1 + 0.01 * (creaturesMultiplier + 1)))));
});
Object(commonUtils["a" /* $ */ ])("your-creatures-multiplier").addEventListener('input', function() {
applyMultiplier(creaturesData, creaturesMultiplier);
});
Object(settings["eventHelperSettings"])(document.querySelector('.Global'), function(container) {
Object(settings["setSettings"])("auto_send_ffa_event", "Отправлять бои из КБО ивента в сервис автоматически", container);
Object(settings["setSettings"])("only_clan_visibility", "Мои бои доступны только для клана", container, false);
Object(settings["setSettings"])("collapse_event_desc", "Всегда сворачивать описания боев", container, false);
Object(settings["setSettings"])("return_to_prev_level", "Возвращать на незавершенный уровень", container, false);
}, "afterend");
};
processPlInfoTroopsResponse = function _processPlInfoTroopsR(doc) {
var creaturesData = [];
Array.from(doc.getElementsByClassName("cre_creature72")).forEach(function(creature) {
var creatureInfo = {
"rarity": "1"
};
if (creature.getElementsByTagName('img')[0].src.includes("empty")) {
return;
}
creatureInfo.portrait = creature.getElementsByTagName('img')[0].src.match(/portraits\/(\w+)_?anip40/)[1] + "ani";
creatureInfo.amount = creature.getElementsByClassName('cre_amount72')[0].innerText;
creaturesData.push(creatureInfo);
});
showAmbushCreatures(creaturesData);
};
interceptButtons = function _interceptButtons() {
var buttons = Array.from(document.querySelectorAll("#close-image"));
if (buttons.length === 4) {
var available = 4 - buttons.filter(function(x) {
return x.disabled;
}).length;
buttons.forEach(function(button, index) {
button.addEventListener("click", function() {
Object(commonUtils["m" /* set */ ])("event_battle_side", index % 2);
Object(commonUtils["m" /* set */ ])("eh_current_level", [Object(eventUtils["getCurrentLevel"])(), available]);
});
});
}
};
if (!/(ambush_single_event|map_hero_event)/.test(location.href)) {
_context.next = 14;
break;
}
Object(commonUtils["m" /* set */ ])("eh_current_level", null);
Object(eventUtils["collapseEventDesc"])();
interceptButtons();
Object(src_battles["getEventBattles"])(document.querySelectorAll('[align="left"][valign="top"]')[1]);
Object(leaderboard["setLeaderboard"])(Array.from(document.querySelectorAll('[align="left"][valign="top"]')[0].getElementsByTagName("center")).slice(-1)[0]);
_context.next = 12;
return Object(networkUtils["a" /* doGet */ ])("/pl_info.php?id=".concat(commonUtils["k" /* pl_id */ ]), true);
case 12:
doc = _context.sent;
processPlInfoTroopsResponse(doc);
case 14:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _thiefEvent.apply(this, arguments);
}
// CONCATENATED MODULE: ./src/events/hunt.js
function hunt_typeof(obj) {
"@babel/helpers - typeof";
return hunt_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, hunt_typeof(obj);
}
function hunt_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
hunt_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == hunt_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function hunt_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function hunt_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
hunt_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
hunt_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function huntEvent() {
var battles = [];
var currentHeroFaction;
var classCounter = 0;
var result = "";
var isForStat = true;
if (location.href.includes("hunting_event")) {
Object(settings["eventHelperSettings"])(document.querySelector('.new_event_map'), function(container) {
Object(settings["setSettings"])("auto_send_hunt_event_battles", "Отправлять бои из сезона охоты в сервис автоматически", container);
}, "afterend"); // Array.from(document.querySelectorAll(`td[width="300"]`)).slice(-1)[0].insertAdjacentHTML("beforeend",
// `<div style="max-width: 240px">Автор скрипта <a href="/pl_info.php?id=7197821"><b>Гроза_ГВД</b></a> будет рад подарку в виде артефакта леса 😊</div>`)
mainHuntEvent();
getCurrentFaction();
var huntlvlinfo = Object(commonUtils["g" /* get */ ])('huntv2lvl' + Object(eventUtils["getCurrentLevel"])(), {});
if (huntlvlinfo && Date.now() - huntlvlinfo.time < 86400 * 14 * 1000) {
result = huntlvlinfo.info;
updateHuntStatBody();
setShowExampleListeners();
commonUtils["b" /* allClasses */ ].forEach(function(clazz) {
document.getElementById("fc".concat(clazz[0], "-").concat(clazz[2])).getElementsByTagName("img")[0].addEventListener("click", /*#__PURE__*/ hunt_asyncToGenerator( /*#__PURE__*/ hunt_regeneratorRuntime().mark(function _callee() {
return hunt_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
isForStat = false;
_context.next = 3;
return changeFactionAndClass(clazz[4]);
case 3:
location.reload();
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
})));
});
}
}
function setShowExampleListeners() {
Array.from(document.getElementsByClassName("faction-hunt-data")).forEach(function(enemy, index) {
var portraits = Object(commonUtils["f" /* findAll */ ])(/portraits\/([a-zA-Z0-9_-]+)p33/, enemy.innerHTML).map(function(item) {
return item[1];
});
var amounts = Array.from(enemy.querySelectorAll("#add_now_count")).map(function(elem) {
return parseInt(elem.innerText);
});
if (amounts.length < portraits.length) {
amounts.unshift(1);
}
portraits.sort(function(a, b) {
return a.localeCompare(b);
});
amounts.sort(function(a, b) {
return a - b;
});
enemy.insertAdjacentHTML("beforeend", "\n <div style=\"margin: 10px\"><div id=\"load_examples_".concat(index, "\" class=\"home_button2 btn_hover2\" style=\"padding: 2px 4px\">\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u0440\u0438\u043C\u0435\u0440\u044B</div></div>\n "));
Object(commonUtils["a" /* $ */ ])("load_examples_".concat(index)).addEventListener("click", /*#__PURE__*/ function() {
var _ref2 = hunt_asyncToGenerator( /*#__PURE__*/ hunt_regeneratorRuntime().mark(function _callee2(e) {
var request, eventBattlesURL;
return hunt_regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
e.target.remove();
request = [portraits.join("|"), amounts.join("|")].join("~");
eventBattlesURL = "getFactionEventBattles?enemy_id=".concat(encodeURIComponent(request), "&token=").concat(Object(commonUtils["g" /* get */ ])("hwm_events_token", ""));
_context2.next = 5;
return Object(networkUtils["a" /* doGet */ ])(eventBattlesURL, false);
case 5:
battles = _context2.sent;
processFactionEventBattles(enemy);
case 7:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function(_x) {
return _ref2.apply(this, arguments);
};
}());
});
}
function processFactionEventBattles() {
var where = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
where.insertAdjacentHTML("afterend", "<div>".concat(getBattlesTemplate(battles), "</div>"));
}
function getBattlesTemplate(battles) {
var result = "";
result += "<div style=\"text-align: center; font-size: 14px; margin-top: 10px\"><b>\u0422\u0432\u043E\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C</b></div>";
var my_lvl_battles = battles.filter(function(battle) {
return battle["hero_lvl"] === commonUtils["l" /* pl_lvl */ ];
});
result += factionBattlesToHTML(my_lvl_battles);
result += "<div style=\"text-align: center; font-size: 14px\"><b>\u0414\u0440\u0443\u0433\u0438\u0435 \u0443\u0440\u043E\u0432\u043D\u0438</b></div>";
var not_my_lvl_battles = battles.filter(function(battle) {
return battle["hero_lvl"] !== commonUtils["l" /* pl_lvl */ ];
});
result += factionBattlesToHTML(not_my_lvl_battles);
return result;
}
function factionBattlesToHTML(battles) {
if (battles.length > 0) {
battles.sort(function(a, b) {
return a.nickname.localeCompare(b.nickname);
});
return battles.reduce(function(prev, curr, index) {
return prev + "\n <div style=\"display: flex; justify-content: center; padding: 1px;\">\n <div>".concat(index + 1, ".\xA0</div>\n <div style=\"text-align: center\"> ").concat(curr["nickname"], " [").concat(curr["hero_lvl"], "]</div>\n <div>\xA0<a target=\"_blank\" href=\"/warlog.php?warid=").concat(curr["battle_id"], "&show_for_all=").concat(curr["battle_secret"], "\">\u0411\u043E\u0439</a></div>\n <div>\xA0\xA0(").concat(curr["enemy_id"].split("~")[1], ")</div>\n </div>\n ");
}, "");
} else {
return "<div style=\"text-align: center;\"><b>\u043F\u0443\u0441\u0442\u043E</b></div>";
}
}
function getCurrentFaction() {
return _getCurrentFaction.apply(this, arguments);
}
function _getCurrentFaction() {
_getCurrentFaction = hunt_asyncToGenerator( /*#__PURE__*/ hunt_regeneratorRuntime().mark(function _callee4() {
var plResponse, temp, factionImg, i;
return hunt_regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return Object(networkUtils["a" /* doGet */ ])("/pl_info.php?id=".concat(commonUtils["k" /* pl_id */ ]), true);
case 2:
plResponse = _context4.sent;
temp = currentHeroFaction;
factionImg = null;
Array.from(plResponse.getElementsByTagName("img")).forEach(function(img) {
if (img.src.includes("i/f/")) {
factionImg = img.src;
}
});
i = 0;
case 7:
if (!(i < commonUtils["b" /* allClasses */ ].length)) {
_context4.next = 14;
break;
}
if (!(factionImg.indexOf(commonUtils["b" /* allClasses */ ][i][3]) > 0)) {
_context4.next = 11;
break;
}
currentHeroFaction = commonUtils["b" /* allClasses */ ][i][4];
return _context4.abrupt("break", 14);
case 11:
i++;
_context4.next = 7;
break;
case 14:
if (!temp) {
_context4.next = 23;
break;
}
if (!(temp !== currentHeroFaction)) {
_context4.next = 22;
break;
}
currentHeroFaction = temp;
_context4.next = 19;
return changeFactionAndClass(temp);
case 19:
getCurrentFaction();
_context4.next = 23;
break;
case 22:
location.reload();
case 23:
case "end":
return _context4.stop();
}
}
}, _callee4);
}));
return _getCurrentFaction.apply(this, arguments);
}
function mainHuntEvent() {
Array.from(document.getElementsByClassName("new_event_map")).slice(-1)[0].insertAdjacentHTML("afterend", "\n <div class=\"wrapper\">\n <div style=\"width: 75%\">\n <div class=\"wrapperStat\">\n <div id=\"show_current_class_examples\" class=\"home_button2 btn_hover2\" style=\"width: 200px;\">\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u0440\u0438\u043C\u0435\u0440\u044B<br>\u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430</div>\n <div id=\"current_class_examples\"></div>\n <div id=\"statbut\" class=\"home_button2 btn_hover2\" style=\"width: 200px;\">\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043E\u0445\u043E\u0442\u044B<br>\u0434\u0440\u0443\u0433\u0438\u0445 \u043A\u043B\u0430\u0441\u0441\u043E\u0432</div>\n <div id=\"progress\" class=\"progress\"></div>\n </div>\n <div id=\"statbody\">\n </div>\n </div>\n </div>\n ");
Object(commonUtils["a" /* $ */ ])("statbut").addEventListener('click', function() {
processCollectHunts();
});
Object(commonUtils["a" /* $ */ ])("show_current_class_examples").addEventListener('click', /*#__PURE__*/ function() {
var _ref3 = hunt_asyncToGenerator( /*#__PURE__*/ hunt_regeneratorRuntime().mark(function _callee3(e) {
var enemy, portraits, amounts, request, eventBattlesURL;
return hunt_regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
enemy = document.querySelector(".hunt_result_attack > div:nth-child(2) > div > div > div:last-child > div:nth-child(4)");
portraits = Object(commonUtils["f" /* findAll */ ])(/portraits\/([a-zA-Z0-9_-]+)p33/, enemy.innerHTML).map(function(item) {
return item[1];
});
amounts = Array.from(enemy.querySelectorAll("#add_now_count")).map(function(elem) {
return parseInt(elem.innerText);
});
if (amounts.length < portraits.length) {
amounts.unshift(1);
}
portraits.sort(function(a, b) {
return a.localeCompare(b);
});
amounts.sort(function(a, b) {
return a - b;
});
e.target.remove();
request = [portraits.join("|"), amounts.join("|")].join("~");
eventBattlesURL = "getFactionEventBattles?enemy_id=".concat(encodeURIComponent(request), "&token=").concat(Object(commonUtils["g" /* get */ ])("hwm_events_token", ""));
_context3.next = 11;
return Object(networkUtils["a" /* doGet */ ])(eventBattlesURL);
case 11:
battles = _context3.sent;
processFactionEventBattles(Object(commonUtils["a" /* $ */ ])("current_class_examples"));
case 13:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return function(_x2) {
return _ref3.apply(this, arguments);
};
}());
}
function getFactionName(fr) {
for (var i = 0; i < commonUtils["b" /* allClasses */ ].length; i++) {
if (commonUtils["b" /* allClasses */ ][i][4] === fr) {
return commonUtils["b" /* allClasses */ ][i][1];
}
}
}
function changeFactionAndClass(_x3) {
return _changeFactionAndClass.apply(this, arguments);
}
function _changeFactionAndClass() {
_changeFactionAndClass = hunt_asyncToGenerator( /*#__PURE__*/ hunt_regeneratorRuntime().mark(function _callee5(fr) {
return hunt_regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return Object(networkUtils["a" /* doGet */ ])("/castle.php?change_clr_to=".concat(fr, "&sign=").concat(commonUtils["j" /* my_sign */ ]), true);
case 2:
case "end":
return _context5.stop();
}
}
}, _callee5);
}));
return _changeFactionAndClass.apply(this, arguments);
}
function processCollectHunts() {
result = '';
getClassHuntData();
}
function getClassHuntData() {
return _getClassHuntData.apply(this, arguments);
}
function _getClassHuntData() {
_getClassHuntData = hunt_asyncToGenerator( /*#__PURE__*/ hunt_regeneratorRuntime().mark(function _callee6() {
var doc;
return hunt_regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
if (!(classCounter === commonUtils["b" /* allClasses */ ].length)) {
_context6.next = 9;
break;
}
classCounter = 0;
document.getElementById("statbut").innerHTML = "Done";
isForStat = false;
Object(commonUtils["m" /* set */ ])('huntv2lvl' + Object(eventUtils["getCurrentLevel"])(), {
"time": Date.now(),
"info": result
});
_context6.next = 7;
return changeFactionAndClass(currentHeroFaction);
case 7:
getCurrentFaction();
return _context6.abrupt("return");
case 9:
document.getElementById("statbut").innerHTML = "Processing...";
document.getElementById("progress").innerHTML = "Текущая фракция - " + getFactionName(commonUtils["b" /* allClasses */ ][classCounter][4]);
_context6.next = 13;
return changeFactionAndClass(commonUtils["b" /* allClasses */ ][classCounter][4]);
case 13:
_context6.next = 15;
return Object(networkUtils["a" /* doGet */ ])("/hunting_event.php?sel_level=".concat(Object(eventUtils["getCurrentLevel"])()), true);
case 15:
doc = _context6.sent;
processHuntResponse(doc);
case 17:
case "end":
return _context6.stop();
}
}
}, _callee6);
}));
return _getClassHuntData.apply(this, arguments);
}
function processHuntResponse(doc) {
result += "<div class=\"faction-hunt-data\">\n <div class=\"cre_creature\" id=\"fc".concat(commonUtils["b" /* allClasses */ ][classCounter][0], "-").concat(commonUtils["b" /* allClasses */ ][classCounter][2], "\">\n <img style=\"padding: 10px 0; cursor:pointer;\" src=\"https://").concat(commonUtils["d" /* cdnHost */ ], "/i/f/").concat(commonUtils["b" /* allClasses */ ][classCounter][3], "?v=1.1\" alt=\"\">\n </div>") + Array.from(doc.querySelector(".hunt_result_attack > div:nth-child(2) > div > div > div:last-child > div:nth-child(4)").querySelectorAll("div.cre_creature")).reduce(function(result, current) {
return result + current.outerHTML;
}, "") + "</div><br>";
updateHuntStatBody();
window.scrollTo(0, document.body.scrollHeight);
classCounter++;
getClassHuntData();
}
function updateHuntStatBody() {
document.getElementById("statbody").innerHTML = result;
}
}
// CONCATENATED MODULE: ./src/events/customIns.js
function customIns_customInsertion() {
if (location.href.includes("war.") && (Object(commonUtils["g" /* get */ ])("pirate_hunt_custom_ins", false) || Object(commonUtils["g" /* get */ ])("village_custom_ins", false))) {
var waitForBattleLoad = function waitForBattleLoad() {
if (!stage[war_scr].setted_atb) {
return;
} else {
window.clearInterval(loadId);
}
if (btype === 115 || btype === 119) {
var _customInsertion = Object(commonUtils["g" /* get */ ])("insertionData_".concat(btype), null);
createSaveInsButton();
if (_customInsertion) {
if (Object(commonUtils["g" /* get */ ])("custom_ins_auto", false)) {
makeIns(_customInsertion);
} else {
createMakeInsButton(_customInsertion);
}
}
startId = setInterval(waitForBattleStart, 200);
}
};
var waitForBattleStart = function waitForBattleStart() {
if (lastturn > -1) {
window.clearInterval(startId);
removeSaveInsButton();
removeMakeInsButton();
}
};
var createMakeInsButton = function createMakeInsButton(customInsertion) {
Object(commonUtils["a" /* $ */ ])("right_button").insertAdjacentHTML("beforeend", "\n <div id=\"custom_make_ins\" class=\"toolbars_img\" style=\"width: 47px;\"><img src=\"https://".concat(commonUtils["d" /* cdnHost */ ], "/i/combat/btn_autoalignment.png?v=6\" alt=\"\"></div>\n "));
Object(commonUtils["a" /* $ */ ])("custom_make_ins").addEventListener("click", function() {
makeIns(customInsertion);
});
};
var makeIns = function makeIns(customInsertion) {
var currentCreatures = stekid.slice(1, stackcount + 1).filter(function(cre) {
return cre !== 0;
});
var filteredInsertion = customInsertion.filter(function(cre) {
return currentCreatures.includes(cre[0]);
});
currentCreatures.forEach(function(cre, index) {
if (!filteredInsertion.some(function(customInsCre) {
return customInsCre[0] === cre;
})) {
filteredInsertion.push([cre, steknumber[index + 1], 1, 1]);
}
});
var insStr = filteredInsertion.map(function(cre) {
return cre.join("#");
}).join("^") + "^";
stage[war_scr].useinsertion_cre(insStr);
removeMakeInsButton();
};
var createSaveInsButton = function createSaveInsButton() {
Object(commonUtils["a" /* $ */ ])("right_button").insertAdjacentHTML("beforeend", "\n <div id=\"custom_save_ins\" class=\"toolbars_img\" style=\"width: 47px; border-radius: 50%; background: #dcc287;\"><img src=\"https://i.imgur.com/08mNun9.png\" alt=\"\"></div>\n ");
Object(commonUtils["a" /* $ */ ])("custom_save_ins").addEventListener("click", function() {
var insertionData = [];
for (var i = 1; i <= stackcount; i++) {
if (stekx[i] !== -10 && steknumber[i] > 0 && steknumber[i] !== undefined && stekid[i] !== 0 && stekid[i] !== undefined) {
insertionData.push([stekid[i], stage[war_scr].obj[i].nownumber, stekx[i], steky[i]]);
}
}
Object(commonUtils["m" /* set */ ])("insertionData_".concat(btype), insertionData);
Object(commonUtils["a" /* $ */ ])("custom_save_ins").innerHTML = "<img src=\"https://cdn2.iconfinder.com/data/icons/flat-ui-icons-24-px/24/checkmark-24-512.png\" alt=\"\"></div>";
setTimeout(function() {
Object(commonUtils["a" /* $ */ ])("custom_save_ins").innerHTML = "<img src=\"https://i.imgur.com/08mNun9.png\" alt=\"\"></div>";
}, 1000);
});
};
var removeSaveInsButton = function removeSaveInsButton() {
var button = Object(commonUtils["a" /* $ */ ])("custom_save_ins");
if (button) {
button.remove();
}
};
var removeMakeInsButton = function removeMakeInsButton() {
var button = Object(commonUtils["a" /* $ */ ])("custom_make_ins");
if (button) {
button.remove();
}
};
var loadId = setInterval(waitForBattleLoad, 200);
var startId;
}
}
// CONCATENATED MODULE: ./src/events/pirateHunt.js
function pirateHuntEvent() {
if (location.href.includes("pirate_hunt")) {
var globalTable = Object(commonUtils["a" /* $ */ ])("global_table_div4");
Object(settings["eventHelperSettings"])(globalTable, function(container) {
// setSettings("pirate_hunt_event_filter", "Только с напарником", container)
Object(settings["setSettings"])("pirate_hunt_custom_ins", "Возможность автоматической расстановки", container, false);
Object(settings["setSettings"])("custom_ins_auto", "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u044F\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043D\u0443\u044E \u0440\u0430\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443", container, false);
}, "beforeend"); // let partner = get("partners", null)
// if (get("pirate_hunt_event_filter", true) && partner != null) {
// print_friends()
// Array.from(Array.from(document.querySelectorAll("select")).slice(-1)[0].getElementsByTagName("option")).forEach(options => {
// if (options.value === partner) {
// options.selected = true
// }
// })
// let inputs = Array.from(document.querySelectorAll("input[type=submit]")).slice(-3)
// inputs[0].disabled = true
// Array.from(globalTable.getElementsByTagName("tr")).forEach((tr) => {
// if (!tr.innerHTML.includes(partner) && (tr.innerText.includes("[Вступить]") || tr.innerText.includes("[Вступить к клану]"))) {
// tr.remove()
// }
// })
// }
}
}
// CONCATENATED MODULE: ./src/events/player.js
function processHeroPage() { // let partners = get("partners", null);
//
// if (location.href.includes("pl_info")) {
// let target = document.querySelectorAll("td[align=right]")[1].parentElement;
// let heroId = new URLSearchParams(window.location.search).get("id");
// target.insertAdjacentHTML('afterend', `<tr><td id="partner-target" colspan="2" style="text-align: center;"></td></tr>`)
// if (!partners || partners !== heroId) {
// setPartner(heroId)
// } else {
// removePartner(heroId)
// }
// }
//
// function setPartner(heroId) {
// $('partner-target').innerHTML = ` <span id="partner-1" style="cursor: pointer; text-decoration: underline">Пометить напарником</span>`
// $('partner-1').addEventListener('click', () => {
// partners = heroId
// set('partners', partners)
// removePartner(heroId)
// })
// }
//
// function removePartner(heroId) {
// $('partner-target').innerHTML = ` <span id="partner-1" style="cursor: pointer; text-decoration: underline">Убрать из напарников</span>`
// $('partner-1').addEventListener('click', () => {
// partners = null
// set('partners', partners)
// setPartner(heroId)
// })
// }
}
// CONCATENATED MODULE: ./src/events/war.js
function war_typeof(obj) {
"@babel/helpers - typeof";
return war_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, war_typeof(obj);
}
function war_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
war_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == war_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function war_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function war_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
war_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
war_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function processBattlePage() {
return _processBattlePage.apply(this, arguments);
}
function _processBattlePage() {
_processBattlePage = war_asyncToGenerator( /*#__PURE__*/ war_regeneratorRuntime().mark(function _callee() {
var battleData, battleType, main, battle_id, battle_secret, doc, match, startId;
return war_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!(location.href.includes("war.php") && (Object(commonUtils["g" /* get */ ])("auto_send_lg", true) || Object(commonUtils["g" /* get */ ])("auto_send_event_lg", true) || Object(commonUtils["g" /* get */ ])("auto_send_ffa_event", true) || Object(commonUtils["g" /* get */ ])("auto_send_faction_event_battles", true) || Object(commonUtils["g" /* get */ ])("auto_send_rogues_event", true) || Object(commonUtils["g" /* get */ ])("auto_send_hunt_event_battles", true)))) {
_context.next = 14;
break;
}
battleData = window.run_all.toString();
battleType = battleData.match(/btype\|(\d{1,10})/)[1];
if (!["133", "135", "138", "139", "140", "142", "143", "144", "148"].includes(battleType)) {
_context.next = 14;
break;
}
main = function main() {
if (typeof finished !== "undefined" && finished || typeof battle_ended !== "undefined" && battle_ended) {
window.clearInterval(startId);
if (Object(commonUtils["g" /* get */ ])("return_to_prev_level")) {
var eh_current_level = Object(commonUtils["g" /* get */ ])("eh_current_level");
if (eh_current_level) {
var leaveBattleButton = Object(commonUtils["a" /* $ */ ])("btn_continue_WatchBattle");
leaveBattleButton.removeEventListener("mouseup", btn_continue_WatchBattle_onRelease);
leaveBattleButton.addEventListener("mouseup", function() {
if (eh_current_level[1] === 2 && eh_current_level[0] < 51) {
location.href = "".concat(document.referrer.split("?")[0], "?sel_level=").concat(eh_current_level[0]);
} else {
location.href = "".concat(document.referrer.split("?")[0]);
}
});
}
}
if (battleType === "135" && Object(commonUtils["g" /* get */ ])("auto_send_lg", true)) {
Object(src_battles["sendBattle"])(battle_id, battle_secret, "0");
} else if ((battleType === "142" || battleType === "143" || battleType === "138" || battleType === "148") && Object(commonUtils["g" /* get */ ])("auto_send_ffa_event", true)) {
var battle_side = Object(commonUtils["g" /* get */ ])("event_battle_side", -1);
Object(commonUtils["m" /* set */ ])("event_battle_side", -1);
Object(src_battles["sendBattle"])(battle_id, battle_secret, "2", null, battle_side);
} else if (battleType === "139" && Object(commonUtils["g" /* get */ ])("auto_send_event_lg", true)) {
Object(src_battles["sendBattle"])(battle_id, battle_secret, "1");
} else if (battleType === "144" && Object(commonUtils["g" /* get */ ])("auto_send_faction_event_battles", true) || battleType === "140" && Object(commonUtils["g" /* get */ ])("auto_send_hunt_event_battles", true)) {
Object(src_battles["sendBattle"])(battle_id, battle_secret, "3");
} else if (battleType === "133" && Object(commonUtils["g" /* get */ ])("auto_send_rogues_event", true)) {
var _battle_side = Object(commonUtils["g" /* get */ ])("event_battle_side", -1);
Object(commonUtils["m" /* set */ ])("event_battle_side", -1);
Object(src_battles["sendBattle"])(battle_id, battle_secret, "4", null, _battle_side);
}
}
};
battle_id = new URLSearchParams(window.location.search).get("warid");
battle_secret = new URLSearchParams(window.location.search).get("show_for_all");
if (!(battle_secret == null)) {
_context.next = 13;
break;
}
_context.next = 10;
return Object(networkUtils["a" /* doGet */ ])("/pl_info.php?id=".concat(commonUtils["k" /* pl_id */ ]), true);
case 10:
doc = _context.sent;
match = doc.body.innerHTML.match(/show_for_all=(\w[0-9a-f]{10})/);
if (match) {
battle_secret = match[1];
}
case 13:
startId = setInterval(main, 10);
case 14:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _processBattlePage.apply(this, arguments);
}
// CONCATENATED MODULE: ./src/events/warLog.js
function processBattleLogPage() {
if (location.href.includes("pl_warlog.php?id=".concat(commonUtils["k" /* pl_id */ ]))) {
Object(settings["eventHelperSettings"])(document.querySelector("[class=\"global_container_block\"]"), function(container) {
Object(settings["setSettings"])("only_clan_visibility", "Мои бои доступны только для клана", container, false);
Object(settings["setSettings"])("auto_send_rogues_event", "Отправлять бои из разбойничьего ивента в сервис автоматически", container);
Object(settings["setSettings"])("auto_send_ffa_event", "Отправлять бои из КБО ивента в сервис автоматически", container);
Object(settings["setSettings"])("auto_send_event_lg", "Отправлять бои из ГЛ ивента в сервис автоматически", container);
Object(settings["setSettings"])("auto_send_lg", "Отправлять бои с опасными бандитами в сервис автоматически", container);
Object(settings["setSettings"])("auto_send_faction_event_battles", "Отправлять бои из фрак. ивента в сервис автоматически", container);
Object(settings["setSettings"])("auto_send_hunt_event_battles", "Отправлять бои из сезона охоты в сервис автоматически", container);
});
Array.from(document.getElementsByTagName("i")).forEach(function(tag, index) {
var type;
var isOk;
if (tag.innerText === "Опасные бандиты" || tag.innerText === "Dangerous bandits") {
type = "0";
isOk = true;
}
if (tag.innerText.includes("Враждебный отряд") || tag.innerText.includes("Hostile squad")) {
type = "1";
isOk = true;
}
if (tag.innerText.includes("Похитители зимы") || tag.innerText.includes("Snatchers of winter") || tag.innerText.includes("Военная экспедиция") || tag.innerText.includes("Military expedition") || tag.innerText.includes("Бандиты пустошей") || tag.innerText.includes("Обитатели пустошей") || tag.innerText.includes("Wasteland bandits") || tag.innerText.includes("Wasteland dwellers") || tag.innerText.includes("Контрабандисты") || tag.innerText.includes("Smugglers")) {
type = "2";
isOk = true;
}
if (tag.innerText.includes("Отряды бандитов") || tag.innerText.includes("Bandits squads") || tag.innerText.includes("Цель") || tag.innerText.includes("Target")) {
type = "3";
isOk = true;
}
if (tag.innerText.includes("Отряд врага") || tag.innerText.includes("Enemy squad")) {
type = "4";
isOk = true;
}
if (isOk) {
var maxTries = 5;
var sibling = tag.previousElementSibling;
for (var i = 0; i < maxTries; i++) {
if (sibling.tagName === "A" && sibling.href.includes("show_for_all")) {
var params = new URLSearchParams("?" + sibling.href.split("?")[1]);
if (!tag.innerHTML.includes("<b>")) {
tag.insertAdjacentHTML("afterend", "\xA0\xA0<span><a id=\"send_battle_".concat(index, "\" style=\"cursor: pointer; text-decoration: underline\" onclick=\"sendBattle('").concat(params.get("warid"), "', '").concat(params.get("show_for_all"), "', '").concat(type, "', '").concat(index, "')\">\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0432 \u0441\u0435\u0440\u0432\u0438\u0441</a></span>"));
}
break;
} else {
sibling = sibling.previousElementSibling;
}
}
}
});
}
}
// CONCATENATED MODULE: ./src/events/village.js
function villageEvent() {
if (/(village_def)/.test(location.href)) {
var villageElem = Object(commonUtils["a" /* $ */ ])("set_mobile_max_width");
villageElem.style.flexWrap = "nowrap";
if (Object(commonUtils["g" /* get */ ])("village_remove_confirm", true)) {
Array.from(document.querySelectorAll("input[type=submit]")).forEach(function(input) {
return input.onclick = function() {
return true;
};
});
}
if (Object(commonUtils["g" /* get */ ])("village_auto_repair", false)) {
Array.from(document.querySelectorAll("input[type=submit]")).forEach(function(input) {
if (input.value.includes("Восстановить") || input.value.includes("Ремонт")) {
input.click();
}
});
} // document.querySelector('#global_table_div3').parentElement.firstElementChild.remove()
Object(leaderboard["setLeaderboard"])(document.querySelector('#global_table_div3'), "beforebegin");
Object(settings["eventHelperSettings"])(document.querySelector('#global_table_div4'), function(container) {
Object(settings["setSettings"])("village_custom_ins", "\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E\u0441\u0442\u044C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0439 \u0440\u0430\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \n <a href='https://www.youtube.com/watch?v=NNwCBnOuoYQ' target='_blank' onclick='event.stopPropagation()'>\u0412\u0438\u0434\u0435\u043E-\u0434\u0435\u043C\u043E\u043D\u0441\u0442\u0440\u0430\u0446\u0438\u044F</a>\n (\u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043F\u043E\u0441\u043B\u0435 \"\u0437\u0430\u043A\u0440\u0435\u043F\u043B\u0435\u043D\u0438\u044F\" \u043A\u0440\u0435\u0441\u0442\u044C\u044F\u043D \u0431\u0430\u0448\u043D\u044F\u043C\u0438)\n ", container, false);
Object(settings["setSettings"])("village_remove_confirm", "\u0423\u0431\u0440\u0430\u0442\u044C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435 \u043F\u043E\u0441\u0442\u0440\u043E\u0439\u043A\u0438/\u0443\u043B\u0443\u0447\u0448\u0435\u043D\u0438\u0439", container);
Object(settings["setSettings"])("custom_ins_auto", "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0440\u0438\u043C\u0435\u043D\u044F\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043D\u0443\u044E \u0440\u0430\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443", container, false);
Object(settings["setSettings"])("village_auto_repair", "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0440\u0435\u043C\u043E\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u0441\u0442\u0440\u043E\u0439\u043A\u0438", container, false);
}, "afterend");
}
}
// CONCATENATED MODULE: ./src/events/dungeon.js
function dungeon_typeof(obj) {
"@babel/helpers - typeof";
return dungeon_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, dungeon_typeof(obj);
}
function dungeon_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
dungeon_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == dungeon_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function dungeon_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function dungeon_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
dungeon_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
dungeon_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function dungeonEvent() {
return _dungeonEvent.apply(this, arguments);
}
function _dungeonEvent() {
_dungeonEvent = dungeon_asyncToGenerator( /*#__PURE__*/ dungeon_regeneratorRuntime().mark(function _callee2() {
var enemies, topHeroes, heroesTable, heroesTableInfo, firstTr, highestPlace, heroesToRenderCount, heroesToRender, newScript, CLANS;
return dungeon_regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!/recruit_event/.test(location.href)) {
_context2.next = 20;
break;
}
enemies = Array.from(document.querySelectorAll(".recruit_event_enemy_block"));
enemies.forEach(function(enemy) {
if (enemy.innerText.includes("обороняющихся")) {
var powerElem = enemy.querySelector("div:nth-child(3)>div:nth-child(3)");
var powerRaw = powerElem.innerText;
var powerParsedTransformed = Math.floor(parseInt(powerRaw.replaceAll(",", "")) * 0.8).toLocaleString();
powerElem.innerHTML = "".concat(powerRaw, " (<i style=\"cursor: pointer\" title=\"\u041F\u0440\u0438 \u043F\u043E\u0442\u0435\u0440\u0435 \u0432 \u0431\u043E\u044E\">").concat(powerParsedTransformed, "</i>)");
}
});
_context2.next = 5;
return Object(networkUtils["a" /* doGet */ ])("heroes/dun_scores.json");
case 5:
topHeroes = _context2.sent;
heroesTable = document.querySelector(".recruit_event_loot_rating_inside").querySelector("table");
heroesTableInfo = document.querySelector(".recruit_event_loot_rating_inside").querySelector("center");
heroesTableInfo.innerHTML = "\u041A\u043B\u0438\u043A\u043D\u0438 \u043D\u0430 \u0436\u0438\u0440\u043D\u044B\u0435 \u043E\u0447\u043A\u0438, \u0447\u0442\u043E\u0431\u044B \u0443\u0432\u0438\u0434\u0435\u0442\u044C \u0433\u0440\u0430\u0444\u0438\u043A \u0441 \u043F\u0440\u043E\u0433\u0440\u0435\u0441\u0441\u0438\u0435\u0439<br><br><br>\u041E\u0431\u0449\u0438\u0439 \u0440\u0435\u0439\u0442\u0438\u043D\u0433";
firstTr = heroesTable.querySelector("tr");
highestPlace = parseInt(firstTr.querySelector("td").innerText);
heroesToRenderCount = Math.min(20, highestPlace - 1);
heroesToRender = topHeroes.slice(0, heroesToRenderCount);
firstTr.insertAdjacentHTML("beforebegin", heroesToRender.join(""));
newScript = document.createElement('script');
newScript.setAttribute('src', 'https://cdn.jsdelivr.net/npm/chart.js');
document.head.appendChild(newScript);
CLANS = ["1519", "928", "104", "1597", "1209", "18", "41", "5152", "88", "326", "8502", "73", "7777", "302", "823", "17", "997", "276", "249", "1512", "9426", "10557", "2304", "14", "11532", "10886", "846", "3305", "8433", "1488"];
document.querySelector(".recruit_event_army_attack_inside").insertAdjacentHTML("beforeend", "\n <div id=\"chart_area\"></div>\n ");
Array.from(heroesTable.querySelectorAll("tr")).forEach(function(tr, index) {
var clanMatch = tr.innerHTML.match(/clan_info\.php\?id=(\d{1,5})/);
if (clanMatch) {
var clanId = clanMatch[1];
if (CLANS.includes(clanId)) {
var hero_id = tr.innerHTML.match(/pl_info\.php\?id=(\d{1,10})/)[1];
var hero_nick = tr.querySelector("td:nth-child(2)").innerText;
var scoreTd = tr.querySelector("td:nth-child(3)");
scoreTd.innerHTML = "\n <b style=\"font-size: 10px; text-decoration: underline; cursor: pointer\" id=\"top_hero".concat(index, "\">\n ").concat(scoreTd.innerText, "\n </b>\n ");
Object(commonUtils["a" /* $ */ ])("top_hero".concat(index)).addEventListener("click", /*#__PURE__*/ dungeon_asyncToGenerator( /*#__PURE__*/ dungeon_regeneratorRuntime().mark(function _callee() {
var heroData, cumulativeSum, labels, data, config, ctx, myChart;
return dungeon_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
Object(commonUtils["a" /* $ */ ])("chart_area").innerHTML = "\n <div style=\"height: 165px; overflow: hidden\">\n <div>\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441\u0438\u044F \u043E\u0447\u043A\u043E\u0432 <b>".concat(hero_nick, "</b></div>\n <canvas id=\"chart").concat(index, "\" height=\"150\" style=\"width: 100%\"></canvas>\n </div>\n ");
_context.next = 3;
return Object(networkUtils["a" /* doGet */ ])("getDunHeroData?pl_id=".concat(hero_id));
case 3:
heroData = _context.sent;
cumulativeSum = function(sum) {
return function(value) {
return sum += value;
};
}(0);
labels = heroData.map(function(entry) {
return entry[0] + " ".concat(entry[1] > 0 ? "+" : "").concat(entry[1]);
});
data = {
labels: labels,
datasets: [{
label: 'Очки',
data: heroData.map(function(entry) {
return entry[1];
}).map(cumulativeSum),
borderColor: "blue",
backgroundColor: "rgb(44,73,107)",
pointStyle: 'circle',
pointRadius: 3,
pointHoverRadius: 4
}]
};
config = {
type: 'line',
data: data,
options: {
animation: false,
responsive: false,
plugins: {
legend: {
display: false
},
title: {
display: false,
text: 'Chart.js Line Chart'
}
},
elements: {
line: {
borderWidth: 1
}
},
scales: {
x: {
ticks: {
display: false
}
}
},
interaction: {
mode: 'index',
intersect: false
}
}
};
ctx = document.getElementById("chart".concat(index)).getContext('2d');
myChart = new Chart(ctx, config);
case 10:
case "end":
return _context.stop();
}
}
}, _callee);
})));
}
}
});
case 20:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _dungeonEvent.apply(this, arguments);
}
// CONCATENATED MODULE: ./src/index.js
function src_typeof(obj) {
"@babel/helpers - typeof";
return src_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, src_typeof(obj);
}
function src_regeneratorRuntime() {
"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
src_regeneratorRuntime = function _regeneratorRuntime() {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return generator._invoke = function(innerFn, self, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}(innerFn, self, context), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == src_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
this._invoke = function(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) {
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
}
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
return keys.reverse(),
function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this) {
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
}
},
stop: function stop() {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function src_asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function setup() {
return _setup.apply(this, arguments);
}
function _setup() {
_setup = src_asyncToGenerator( /*#__PURE__*/ src_regeneratorRuntime().mark(function _callee() {
var doc, _doc;
return src_regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (commonUtils["l" /* pl_lvl */ ]) {
_context.next = 6;
break;
}
_context.next = 3;
return Object(networkUtils["a" /* doGet */ ])("/pl_info.php?id=".concat(commonUtils["k" /* pl_id */ ]), true);
case 3:
doc = _context.sent;
Object(commonUtils["m" /* set */ ])("hero_combat_lvl", doc.body.innerText.match(/(Боевой уровень|Combat level): (\d{1,2})/)[2] - 0);
location.reload();
case 6:
if (commonUtils["j" /* my_sign */ ]) {
_context.next = 12;
break;
}
_context.next = 9;
return Object(networkUtils["a" /* doGet */ ])("/shop.php", true);
case 9:
_doc = _context.sent;
Object(commonUtils["m" /* set */ ])("my_sign", _doc.body.innerHTML.match(/sign=([a-z0-9]+)/)[1]);
location.reload();
case 12:
if (location.href.includes("inventory")) {
Object(commonUtils["m" /* set */ ])("my_sign", window.sign);
Object(commonUtils["m" /* set */ ])("hero_combat_lvl", window.pl_level);
}
case 13:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _setup.apply(this, arguments);
}
setup();
Object(styles["setGlobalStyles"])(); // EVENTS
leaderEvent();
adventureEvent();
factionEvent();
hireEvent();
pirateEvent();
pirateHuntEvent();
portalCoupleEvent();
portalSoloEvent();
thiefEvent();
huntEvent();
villageEvent();
dungeonEvent();
customIns_customInsertion();
processHeroPage();
processBattlePage();
processBattleLogPage();
/***/
})
/******/
]);