// ==UserScript==
// @name EventHelper
// @version 16.0.4
// @author achepta
// @description try to take over the world!
// @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
// @grant unsafeWindow
// @license GNU GPLv3
// @run-at document-end
// ==/UserScript==
async function start() {
async function saveScript() {
//let response = await fetch("https://hwm.events/scripts/code/EventHelperV2.user.js");
let scriptText = `function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
var $parcel$global =
typeof globalThis !== 'undefined'
? globalThis
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
var $parcel$modules = {};
var $parcel$inits = {};
var parcelRequire = $parcel$global["parcelRequire4808"];
if (parcelRequire == null) {
parcelRequire = function(id) {
if (id in $parcel$modules) {
return $parcel$modules[id].exports;
}
if (id in $parcel$inits) {
var init = $parcel$inits[id];
delete $parcel$inits[id];
var module = {id: id, exports: {}};
$parcel$modules[id] = module;
init.call(module.exports, module, module.exports);
return module.exports;
}
var err = new Error("Cannot find module '" + id + "'");
err.code = 'MODULE_NOT_FOUND';
throw err;
};
parcelRequire.register = function register(id, init) {
$parcel$inits[id] = init;
};
$parcel$global["parcelRequire4808"] = parcelRequire;
}
parcelRequire.register("85UD7", function(module, exports) {
var $aqxxv = parcelRequire("aqxxv");
var $dIwPZ = parcelRequire("dIwPZ");
var $gGPCy = parcelRequire("gGPCy");
var $cLY7G = parcelRequire("cLY7G");
var $86JDc = parcelRequire("86JDc");
var $av1kA = parcelRequire("av1kA");
var $jbjeJ = parcelRequire("jbjeJ");
var $2jsww = parcelRequire("2jsww");
var $cyF3r = parcelRequire("cyF3r");
var $bUtSC = parcelRequire("bUtSC");
var $d44k3 = parcelRequire("d44k3");
var $aXIev = parcelRequire("aXIev");
var $bKNGT = parcelRequire("bKNGT");
var $lBuTJ = parcelRequire("lBuTJ");
var $ag9Ot = parcelRequire("ag9Ot");
var $2GRXP = parcelRequire("2GRXP");
var $19fJa = parcelRequire("19fJa");
var $1MCWa = parcelRequire("1MCWa");
var $douos = parcelRequire("douos");
var $gJdWA = parcelRequire("gJdWA");
var $5Nw5f = parcelRequire("5Nw5f");
var $028DL = parcelRequire("028DL");
async function setup() {
if (!(0, $dIwPZ.pl_lvl)) {
let doc = await (0, $aqxxv.doGet)(\`/pl_info.php?id=\${(0, $dIwPZ.pl_id)}\`, true);
(0, $dIwPZ.set)("hero_combat_lvl", doc.body.innerText.match(/(Боевой уровень|Combat level): (\d{1,2})/)[2] - 0);
location.reload();
}
if (!(0, $dIwPZ.my_sign)) {
let doc = await (0, $aqxxv.doGet)(\`/shop.php\`, true);
(0, $dIwPZ.set)("my_sign", doc.body.innerHTML.match(/sign=([a-z0-9]+)/)[1]);
location.reload();
}
if (location.href.includes("inventory")) {
(0, $dIwPZ.set)("my_sign", window.sign);
(0, $dIwPZ.set)("hero_combat_lvl", window.pl_level);
}
}
setup();
if (location.href.includes("skillwheel.php") || location.href.includes("skillwheel_demo.php")) return;
(0, $gGPCy.setGlobalStyles)();
// EVENTS
(0, $cLY7G.default)();
(0, $86JDc.default)();
(0, $av1kA.default)();
(0, $jbjeJ.default)();
(0, $028DL.default)();
(0, $2jsww.default)();
(0, $lBuTJ.default)();
(0, $cyF3r.default)();
(0, $bUtSC.default)();
(0, $d44k3.default)();
(0, $aXIev.default)();
(0, $1MCWa.default)();
(0, $douos.default)();
(0, $gJdWA.default)();
(0, $bKNGT.default)();
(0, $ag9Ot.default)();
(0, $2GRXP.default)();
(0, $19fJa.default)();
(0, $5Nw5f.default)();
});
parcelRequire.register("aqxxv", function(module, exports) {
$parcel$export(module.exports, "doGet", () => $7976595477021521$export$9148a8a8d7b4fde3);
$parcel$export(module.exports, "doPost", () => $7976595477021521$export$872f4f09fb3b16a3);
const $7976595477021521$var$HWM_EVENTS_SERVER = "https://hwm.events";
function $7976595477021521$var$doRequest(url, method, body, html) {
return new Promise((resolve)=>{
let http = new XMLHttpRequest;
if (html) {
http.overrideMimeType("text/html; charset=windows-1251");
http.open(method, url, true);
} else http.open(method, \`\${$7976595477021521$var$HWM_EVENTS_SERVER}/\${url}\`, true);
http.send(body);
http.onreadystatechange = function() {
if (http.readyState === 4) {
if (http.status === 200 || http.status === 201) {
let response = null;
if (html) response = new DOMParser().parseFromString(http.responseText, "text/html");
else try {
response = JSON.parse(http.responseText);
} catch (e) {}
resolve(response);
} else resolve(http.responseText);
}
};
});
}
async function $7976595477021521$export$9148a8a8d7b4fde3(url, html = false) {
return $7976595477021521$var$doRequest(url, "GET", null, html);
}
async function $7976595477021521$export$872f4f09fb3b16a3(url, params, html = false) {
return $7976595477021521$var$doRequest(url, "POST", params, html);
}
});
parcelRequire.register("dIwPZ", function(module, exports) {
$parcel$export(module.exports, "pl_id", () => $9fc8db459327acdd$export$a98c729873a45942);
$parcel$export(module.exports, "pl_lvl", () => $9fc8db459327acdd$export$b03bbb98cf6bc44e);
$parcel$export(module.exports, "get", () => $9fc8db459327acdd$export$3988ae62b71be9a3);
$parcel$export(module.exports, "my_sign", () => $9fc8db459327acdd$export$4bed35a78e58f1ce);
$parcel$export(module.exports, "cdnHost", () => $9fc8db459327acdd$export$58f89a6e09e5c37e);
$parcel$export(module.exports, "heroCreatures", () => $9fc8db459327acdd$export$8f5b8658ad4b3d86);
$parcel$export(module.exports, "$", () => $9fc8db459327acdd$export$3d8c2f653ac9d0b9);
$parcel$export(module.exports, "set", () => $9fc8db459327acdd$export$adaa4cf7ef1b65be);
$parcel$export(module.exports, "findAll", () => $9fc8db459327acdd$export$18200ea6c8035394);
$parcel$export(module.exports, "sortByKey", () => $9fc8db459327acdd$export$584200199479c807);
$parcel$export(module.exports, "mapToArray", () => $9fc8db459327acdd$export$c24a744d5dd88a3b);
$parcel$export(module.exports, "arrayToMapByKey", () => $9fc8db459327acdd$export$258f6bc574c98342);
$parcel$export(module.exports, "groupBy", () => $9fc8db459327acdd$export$3f063810d7bf01bd);
$parcel$export(module.exports, "groupByKey", () => $9fc8db459327acdd$export$1fe5b8f7d230ae22);
$parcel$export(module.exports, "encode", () => $9fc8db459327acdd$export$c564cdbbe6da493);
$parcel$export(module.exports, "allClasses", () => $9fc8db459327acdd$export$be70899818c5d318);
$parcel$export(module.exports, "allFactions", () => $9fc8db459327acdd$export$cd6531c0958b6b1a);
let $9fc8db459327acdd$export$a98c729873a45942 = $9fc8db459327acdd$export$4be65e66cfa2648a("pl_id");
let $9fc8db459327acdd$export$b03bbb98cf6bc44e = $9fc8db459327acdd$export$3988ae62b71be9a3("hero_combat_lvl", 0);
let $9fc8db459327acdd$export$4bed35a78e58f1ce = $9fc8db459327acdd$export$3988ae62b71be9a3("my_sign", null);
let $9fc8db459327acdd$export$5e032988b71f6158 = location.host;
let $9fc8db459327acdd$export$58f89a6e09e5c37e = $9fc8db459327acdd$export$5e032988b71f6158.includes("my.") ? "cfcdn.lordswm.com" : "dcdn.heroeswm.ru";
let $9fc8db459327acdd$export$8f5b8658ad4b3d86 = {};
function $9fc8db459327acdd$export$3d8c2f653ac9d0b9(id, where = document) {
return where.getElementById(id);
}
function $9fc8db459327acdd$export$3988ae62b71be9a3(key, def) {
let result = JSON.parse(typeof localStorage[key] === "undefined" || localStorage[key] === "undefined" ? null : localStorage[key]);
return result == null ? def : result;
}
function $9fc8db459327acdd$export$adaa4cf7ef1b65be(key, val) {
localStorage[key] = JSON.stringify(val);
}
function $9fc8db459327acdd$export$9002ed06e448de20() {
return Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
}
function $9fc8db459327acdd$export$18200ea6c8035394(regexPattern, sourceString) {
let output = [];
let match;
let regexPatternWithGlobal = RegExp(regexPattern, [
...new Set("g" + regexPattern.flags)
].join(""));
while(match = regexPatternWithGlobal.exec(sourceString)){
delete match.input;
output.push(match);
}
return output;
}
function $9fc8db459327acdd$export$584200199479c807(array, key, asc = 1) {
return array.sort((a, b)=>{
let x = a[key];
let y = b[key];
return x < y ? -1 * asc : x > y ? 1 * asc : 0;
});
}
function $9fc8db459327acdd$export$c24a744d5dd88a3b(map) {
let result = [];
for (const [key, value] of Object.entries(map))result.push([
parseInt(key),
value
]);
return result;
}
function $9fc8db459327acdd$export$258f6bc574c98342(array, key) {
let result = {};
array.forEach((item)=>{
result[item[key]] = item;
});
return result;
}
function $9fc8db459327acdd$export$3f063810d7bf01bd(collection, property) {
var i = 0, val, index, values = [], result = [];
for(; i < collection.length; i++){
val = collection[i][property];
index = values.indexOf(val);
if (index > -1) result[index].push(collection[i]);
else {
values.push(val);
result.push([
collection[i]
]);
}
}
return result;
}
function $9fc8db459327acdd$export$1fe5b8f7d230ae22(array, key) {
return array.reduce((hash, obj)=>{
if (obj[key] === undefined) return hash;
return Object.assign(hash, {
[obj[key]]: (hash[obj[key]] || []).concat(obj)
});
}, {});
}
function $9fc8db459327acdd$export$c564cdbbe6da493(str) {
let customEncode = (e)=>{
return "%" + (parseInt(e.charAt(1) + e.charAt(5), 16) + 16 * ((x)=>-(2 * x ** 3) / 3 + 20 * x ** 2 - 595 * x / 3 + 650)(parseInt(e.charAt(4), 16)).toFixed()).toString(16);
};
return Array.from(str).map((c)=>c.charCodeAt(0) >= 1040 && c.charCodeAt(0) <= 1103 ? customEncode(encodeURIComponent(c)) : encodeURIComponent(c)).join("");
}
function $9fc8db459327acdd$export$4be65e66cfa2648a(name) {
const value = \`; \${document.cookie}\`;
const parts = value.split(\`; \${name}=\`);
if (parts.length === 2) return parts.pop().split(";").shift();
}
let $9fc8db459327acdd$export$be70899818c5d318 = [
[
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
]
];
let $9fc8db459327acdd$export$cd6531c0958b6b1a = [
[
-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"
]
];
});
parcelRequire.register("gGPCy", function(module, exports) {
$parcel$export(module.exports, "setGlobalStyles", () => $c2689c6d2105100d$export$e30d03af76db9a2d);
function $c2689c6d2105100d$export$e30d03af76db9a2d() {
document.body.insertAdjacentHTML("beforeend", \`
<style>
.battle_examples_container {
display: flex;
width: 100%;
justify-content: space-evenly;
}
@media (max-width: 800px) {
.battle_examples_container {
flex-direction: column;
justify-content: center;
}
}
@media (max-width: 1440px) {
.records-container-body{
grid-template-columns: 1fr 4fr !important;
}
.records-container-body > div:nth-child(n+5) {
border-top: unset !important;
}
.records-container-body > div:nth-child(5n+6), .records-container-body > div:nth-child(5n+7) {
border-top: 2px solid black !important;
}
.record-players-creatures, .special-creature, .special-creature-extended {
grid-column-start: 1;
grid-column-end: 3 !important;
}
}
.btn_hover2{
transition: -webkit-filter .3s;
transition: filter .3s;
}
.btn_hover2:hover{
cursor: pointer;
-webkit-filter: brightness(125%) drop-shadow(0 0 5px #ffe4b3);
filter: brightness(125%) drop-shadow(0 0 5px #ffe4b3);
}
.home_button2{
padding: 2px 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
image-rendering: -webkit-optimize-contrast;
image-rendering: optimizeQuality;
color: #592C08;
font-family: verdana,geneva,arial cyr;
-webkit-user-select: none;
position: relative;
font-size: 100%;
text-align: center;
font-weight: bold;
cursor: pointer;
background: url(../i/homeico/art_btn_bg_gold.png) #DAB761;
background-size: 100% 100%;
border-radius: 5px;
box-shadow: inset 0 0 0 1px #fce6b0,
inset 0 0 0 2px #a78750,
0 0 0 1px rgba(0,0,0,.13);
line-height: 25px;
}
input[id^="spoiler"] {
display: none;
}
input[id^="spoiler"] + label {
display: block;
text-align: center;
font-size: 14px;
cursor: pointer;
transition: all .6s;
}
input[id^="spoiler"] ~ .spoiler {
display: none;
opacity: 0;
transition: all .6s;
}
input[id^="spoiler"]:checked + label + .spoiler {
display: block;
opacity: 1;
width: 100%;
}
.roguesSpoilerWrapper{
width: 100%;
display: flex;
flex-direction: column;
}
.roguesSpoilerLabel{
width: 100%;
display: flex !important;
justify-content: center;
}
.record-wrapper{
display: flex;
flex-direction: column;
}
.record-container {
display: flex;
flex-wrap: nowrap;
width: 100%;
overflow: auto;
margin-top: 4px;
}
.record-players, .record-number {
display: flex;
align-items: center;
justify-content: center;
}
.record-number {
font-weight: bold;
font-size: 18px;
}
.fav_player_button {
cursor: pointer;
filter: opacity(0.5);
transition: transform 0.5s ease;
}
.fav_player_button svg {
width: 24px;
height: 24px;
}
.fav_player_button:hover {
filter: opacity(1);
transform: scale(1.2);
}
.record-players {
flex-direction: column;
padding: 4px;
}
.record-players-creatures {
display: flex;
flex-wrap: nowrap;
}
.record-players-arms {
height: 40px;
}
.record-player-creatures {
display: flex;
}
.player-creatures-row {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
}
.creatures-checkers {
display: flex;
justify-content: space-around;
}
.creatures-apply {
display: flex;
flex-direction: column-reverse;
justify-content: space-evenly;
padding: 4px;
}
.player-leadership {
display: flex;
align-items: center;
}
.records-container-header {
/*background: url("https://media3.giphy.com/media/YFFG4W2MvihirVoSQU/giphy.gif") repeat;*/
background-size: 6%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
width: 100%;
}
.records-container-header > div {
padding: 10px;
background: #f8f8f2;
border-radius: 20px;
border: 2px solid rgb(26,55,86);
}
.records-container-body {
margin-top: 10px;
flex-wrap: unset;
justify-content: unset;
display: grid;
grid-template-columns: 1fr 4fr 8fr 8fr;
overflow: auto;
width: 100%;
padding: unset;
}
.records-container-body > div:nth-child(n+5) {
border-top: 2px solid black;
}
.records-container-body > div:nth-child(5n) {
border-top: unset;
}
.record-result {
display: flex;
justify-content: center;
align-items: center
}
.record-result > div {
margin: 5px 5px 5px 0;
display: flex;
align-items: center;
}
.record-result img {
height: 24px;
vertical-align: middle
}
.record-result span {
font-weight: bold
}
.custom-creature {
width: 40px;
}
.custom-creature > img {
border-radius: 50%;
border: 1px solid #747474;
width: 50px;
height: 50px;
object-fit: cover;
}
.custom-amount {
right: unset;
left: calc(50% - (12px));
bottom: -0.3em;
width: 40px;
text-align: center;
}
.good-creature {
cursor: pointer;
}
.bad-creature {
color: #ff5050;
cursor: pointer;
}
.special-creature {
display: flex;
}
.special-creature-info{
display: flex;
justify-content: space-between;
}
.special-creature-info-button{
cursor:pointer;
z-index: 1;
}
.special-creature-info-button:hover {
filter: brightness(1.25);
}
.special-creature-stats {
display: flex;
flex-direction: column;
margin-top: 2px;
}
.special-creature-stats > div {
display: flex;
justify-content: space-between;
height: 25px;
}
.special-creature-stats > div > div {
display: flex;
}
.special-creature-stat-icon{
vertical-align: bottom;
height: 20px;
filter: drop-shadow(0.01rem 0.01rem 0 #747474) drop-shadow(-0.01rem -0.01rem 0 #747474);
}
.special-creature-stat-value {
font-size: 14px;
font-weight: bold;
}
.special-creature-extended {
display: none;
grid-column-start: 1;
grid-column-end: 5;
}
.visible{
display: block;
}
.failed-records-wrapper {
display: flex;
justify-content: center;
}
.failed-records-container {
display: flex;
flex-direction: column;
width: fit-content;
}
.faction-hunt-data {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.btn_hover2{
transition: -webkit-filter .3s;
transition: filter .3s;
}
.btn-gradient {
text-decoration: none;
color: white;
padding: 5px;
display: inline-block;
cursor: pointer;
position: relative;
border: 1px solid rgba(0,0,0,0.21);
border-bottom: 4px solid rgba(0,0,0,0.21);
border-radius: 4px;
text-shadow: 0 1px 0 rgba(0,0,0,0.15);
user-select: none;
}
.btn-gradient.blue:active {background: #608FBF;}
.btn-gradient.blue {
background: rgba(102,152,203,1);
background: linear-gradient(to bottom, rgba(102,152,203,1) 0%, rgba(92,138,184,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6698cb', endColorstr='#5c8ab8', GradientType=0 );
}
.progress {
font-size: 14px !important;
text-shadow: none;
}
.wrapper {
color: black;
letter-spacing: 1px;
display: flex;
justify-content: center;
}
.wrapperStat {
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
align-items: center;
}
.wrapperStat > div {
margin-bottom: 5px;
}
/* custom scrollbar */
.record-container::-webkit-scrollbar {
width: 20px;
}
.record-container::-webkit-scrollbar-track {
background-color: transparent;
}
.record-container::-webkit-scrollbar-thumb {
background-color: #d6dee1;
border-radius: 20px;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
background-clip: content-box;
}
.record-container::-webkit-scrollbar-thumb:hover {
background-color: #a8bbbf;
}
.battle_info_chip {
padding: 4px;
border: 2px solid #776c6c;
margin: 2px;
border-radius: 10px;
font-size: 20px;
background-color: #dbdad8;
background-image: url(https://cfcdn.lordswm.com/i/art_fon_100x100.png);
background-origin: border-box;
}
.battle_art_chip {
position: relative;
height: 50px;
width: 50px
}
.art_img {
width: 50px;
height: 50px;
position: absolute;
top: 4px;
left: 4px;
}
.art_mods_container {
height: 10px;
bottom: 0;
position: absolute;
z-index: 1;
display: inline-block;
white-space: nowrap;
text-align: right;
width: 50px
}
</style>
\`);
}
});
parcelRequire.register("cLY7G", function(module, exports) {
$parcel$export(module.exports, "default", () => $94c882ff7c0aae5d$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $jWJKf = parcelRequire("jWJKf");
var $ao0pt = parcelRequire("ao0pt");
var $8l3id = parcelRequire("8l3id");
var $aqxxv = parcelRequire("aqxxv");
var $eTbLz = parcelRequire("eTbLz");
var $8nxuZ = parcelRequire("8nxuZ");
async function $94c882ff7c0aae5d$export$2e2bcd8739ae039() {
let favourites = (0, $dIwPZ.get)("leader_favourites", []);
let isEvent = false;
let lg_lvl = parseInt((0, $dIwPZ.get)("hero_leader_lvl", 10));
let battles = [];
let isLostBattles = false;
window.sendApplyArmy = sendApplyArmy;
window.saveFav = saveFav;
window.showSpecialCreatureData = showSpecialCreatureData;
window.replaceCellListener = replaceCellListener;
window.removeOverlay = removeOverlay;
if (/(leader_rogues|leader_winter)/.test(location.href)) {
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
isEvent = true;
if (document.body.innerHTML.includes("leader_rogues.php?action=cancel_merc")) {
let filtersContainer = document.querySelector(".Global");
let filtersPosition = "afterend";
if (typeof hwm_mobile_view !== "undefined" && hwm_mobile_view === true) {
filtersContainer = document.querySelector("#lre_merc_block");
filtersPosition = "beforebegin";
}
(0, $8nxuZ.addFilteringArea)(filtersContainer, filtersPosition);
(0, $8nxuZ.processFilters)();
return;
}
if (location.href.includes("?show_2x2_form=1") || location.href.includes("?show_merc_dialog=1")) return;
let 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];
(0, $jWJKf.eventHelperSettings)(settingsContainer, (container)=>{
(0, $jWJKf.setSettings)("auto_send_event_lg", "Отправлять бои из ГЛ ивента в сервис автоматически", container);
(0, $jWJKf.setSettings)("only_clan_visibility", "Мои бои доступны только для клана", container, false);
(0, $jWJKf.setSettings)("collapse_event_desc", "Всегда сворачивать описания боев", container, false);
(0, $jWJKf.setSettings)("lg_show_available", "Отображать только доступные наборы", container, false);
(0, $jWJKf.setSettings)("lg_hide_duplicates", "Скрывать дубликаты наборов", container, false);
}, "afterend");
(0, $ao0pt.collapseEventDesc)();
(0, $ao0pt.setClickableLevels)();
let leaderBoardTarget = Array.from(document.querySelector(".new_event_map").querySelector(".global_container_block:last-child > div").getElementsByTagName("center")).slice(-1)[0];
(0, $8l3id.setLeaderboard)(leaderBoardTarget, "beforebegin");
let examplesElem;
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 = (0, $dIwPZ.$)(\`event_map\`);
(0, $dIwPZ.$)(\`hwm_no_zoom\`).style.width = "unset";
(0, $dIwPZ.$)(\`hwm_no_zoom\`).style.maxWidth = "80vw";
let mapContainer = document.querySelector(".new_event_map").children[0];
mapContainer.style.flex = "1 0 40%";
let mapHeight = mapContainer.style.height;
mapContainer.style.height = "unset";
(0, $dIwPZ.$)(\`Global\`).style.height = "unset";
(0, $dIwPZ.$)(\`Global\`).style.width = "unset";
mapContainer.querySelector(".CampaignMapBorder").style.width = "-webkit-fill-available";
mapContainer.querySelector(".CampaignMapBorder").style.width = "-moz-available";
mapContainer.querySelector(".CampaignMapCorners").style.width = "-webkit-fill-available";
mapContainer.querySelector(".CampaignMapCorners").style.width = "-moz-available";
(0, $dIwPZ.$)(\`CampaignMapContainer\`).style.height = mapHeight;
(0, $dIwPZ.$)(\`CampaignMapContainer\`).style.width = "unset";
document.querySelector(".new_event_map").children[1].style.flex = "1 0 0%";
}
setLoading(examplesElem);
getResources(getWaveInfo, createLeaderTemplate, examplesElem).then((_)=>{
if (typeof hwm_mobile_view !== "undefined" && hwm_mobile_view === true) {
(0, $dIwPZ.$)(\`main-data\`).style.width = "360px";
(0, $dIwPZ.$)(\`event_helper_settings_container\`).style.width = "360px";
}
});
}
function createLeaderTemplate() {
return \`
<div class="records-container-body global_container_block" id="main-data"></div>
\`;
}
if (location.href.includes("leader_guild")) {
//createWelcomeTemplate()
lg_lvl = document.body.innerHTML.match(/lev=(\d{1,2})/)[1] - 0;
(0, $dIwPZ.set)("hero_leader_lvl", lg_lvl);
(0, $jWJKf.eventHelperSettings)(Array.from(document.querySelectorAll('table[class="wb"]')).slice(-1)[0], (container)=>{
(0, $jWJKf.setSettings)("auto_send_lg", "Отправлять бои с опасными бандитами в сервис автоматически", container);
(0, $jWJKf.setSettings)("only_clan_visibility", "Мои бои доступны только для клана", container, false);
(0, $jWJKf.setSettings)("lg_show_available", "Отображать только доступные наборы", container, false);
(0, $jWJKf.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]);
}
}
function createBanditsTemplate() {
return \`
<div class="wrapper">
<div class="records-container-body" id="main-data"></div>
</div>
\`;
}
function getResources(getExamples, showExamples, target) {
return Promise.all([
getHeroCreatures(),
getExamples()
]).then(()=>{
setExampleBattles(showExamples(), target);
});
}
function setLoading(where = document.body) {
where.insertAdjacentHTML("beforeend", \`
<div style="display: flex; justify-content: center;" id="loading" >
<img style="margin-top: 20px" src="https://i.imgur.com/4RrPm82.gif" width="400" alt="">
</div>\`);
}
async function getHeroCreatures() {
let doc = await (0, $aqxxv.doGet)("/leader_army.php", true);
processLeaderArmyResponse(doc);
}
function processLeaderArmyResponse(doc) {
let bodyHTML = doc.body.innerHTML.toString();
let matchesId = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['monster_id'] = '([a-z0-9_-]+)'/g, bodyHTML);
let matchesCount = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['count'] = (\d+)/g, bodyHTML);
let matchesCost = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['cost'] = (\d+)/g, bodyHTML);
let matchesName = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['name'] = '([А-Яа-яёЁa-zA-Z\`_ -]+)'/g, bodyHTML);
let matchesPortrait = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['lname'] = '([a-z0-9_-]+)'/g, bodyHTML);
let matchesVersion = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['version'] = '(\d{1,3})'/g, bodyHTML);
let matchesRarity = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['rarity'] = (\d{1,3})/g, bodyHTML);
let matchesRace = (0, $dIwPZ.findAll)(/obj\[\d{1,3}]\['race'] = (\d{1,3})/g, bodyHTML);
matchesPortrait.forEach((id, index)=>{
(0, $dIwPZ.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]
};
});
}
async function getWaveInfo() {
battles = await (0, $aqxxv.doGet)(\`getEventLeaderBattles?wave=\${(0, $ao0pt.getCurrentLevel)()}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`);
if (battles.length > 0) battles.sort((a, b)=>{
a = parseFloat(a.cost);
b = parseFloat(b.cost);
if (a < 0 || b < 0) return b - a;
else return a - b;
});
else {
battles = await (0, $aqxxv.doGet)(\`getEventLeaderFailedBattles?wave=\${(0, $ao0pt.getCurrentLevel)()}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`);
isLostBattles = true;
}
}
async function getTodayBandits() {
battles = await (0, $aqxxv.doGet)(\`getDbBattles?lg_lvl=\${lg_lvl}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`);
battles.sort((a, b)=>parseFloat(b.survived) - parseFloat(a.survived));
}
function setExampleBattles(template, where = document.body) {
(0, $dIwPZ.$)("loading").remove();
where.insertAdjacentHTML("beforeend", template);
if (!isLostBattles) processRecords(battles);
else processFailedRecords(battles);
}
function processFailedRecords(failedEventBattles) {
let allRecords = failedEventBattles.reduce((prev, curr, index)=>{
return prev + \`
<div style="display: flex; justify-content: space-between; padding: 1px;">
<div>\${index + 1}. </div>
<div style="text-align: center">\${getRecordPlayersTemplate(curr.nicknames)}</div>
<div> <a target="_blank" href="/warlog.php?warid=\${curr["battle_id"]}&show_for_all=\${curr["battle_secret"]}<=-1">Бой</a></div>
</div>\`;
}, "");
let result = \`<div class="failed-records-wrapper">
<div class="failed-records-container">
<div style="text-align: center;">
<h3>Примеры поражений</h3>
</div>
\${allRecords}
</div>
</div>\`;
(0, $dIwPZ.$)("main-data").insertAdjacentHTML("beforeend", result);
}
let processedBattleCreatures = [];
let rowDatas = {};
function processRecords(records) {
let favRecords = records.filter((battle)=>favourites.includes(battle.nicknames[0]));
let notFavRecords = records.filter((battle)=>!favourites.includes(battle.nicknames[0]));
let allRecords = favRecords.concat(notFavRecords);
let pageIndex = 0;
let pageSize = 25;
function addPage() {
if (pageIndex * pageSize < allRecords.length) {
let result = allRecords.slice(pageIndex * pageSize, pageIndex * pageSize + 25).reduce((prev, curr, index)=>{
return prev + addRecord(curr, pageIndex * pageSize + index);
}, "");
(0, $dIwPZ.$)("main-data").insertAdjacentHTML("beforeend", result);
pageIndex++;
}
}
addPage();
setInterval(()=>{
if (!document.querySelector("#android_outside") && window.innerHeight + window.scrollY >= document.body.offsetHeight - 100) addPage();
else if (document.querySelector("#android_outside") && document.querySelector("#android_outside").clientHeight + document.querySelector("#android_outside").scrollTop >= document.querySelector("#hwm_no_zoom").offsetHeight - 100) addPage();
}, 50);
}
let fav_icon = \`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bookmark-star-fill" viewBox="0 0 16 16" style="vertical-align: middle">
<path fill-rule="evenodd" d="M2 15.5V2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.74.439L8 13.069l-5.26 2.87A.5.5 0 0 1 2 15.5zM8.16 4.1a.178.178 0 0 0-.32 0l-.634 1.285a.178.178 0 0 1-.134.098l-1.42.206a.178.178 0 0 0-.098.303L6.58 6.993c.042.041.061.1.051.158L6.39 8.565a.178.178 0 0 0 .258.187l1.27-.668a.178.178 0 0 1 .165 0l1.27.668a.178.178 0 0 0 .257-.187L9.368 7.15a.178.178 0 0 1 .05-.158l1.028-1.001a.178.178 0 0 0-.098-.303l-1.42-.206a.178.178 0 0 1-.134-.098L8.16 4.1z"/>
</svg>\`;
let not_fav_icon = \`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bookmark-star" viewBox="0 0 16 16" style="vertical-align: middle">
<path d="M7.84 4.1a.178.178 0 0 1 .32 0l.634 1.285a.178.178 0 0 0 .134.098l1.42.206c.145.021.204.2.098.303L9.42 6.993a.178.178 0 0 0-.051.158l.242 1.414a.178.178 0 0 1-.258.187l-1.27-.668a.178.178 0 0 0-.165 0l-1.27.668a.178.178 0 0 1-.257-.187l.242-1.414a.178.178 0 0 0-.05-.158l-1.03-1.001a.178.178 0 0 1 .098-.303l1.42-.206a.178.178 0 0 0 .134-.098L7.84 4.1z"/>
<path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v13.5a.5.5 0 0 1-.777.416L8 13.101l-5.223 2.815A.5.5 0 0 1 2 15.5V2zm2-1a1 1 0 0 0-1 1v12.566l4.723-2.482a.5.5 0 0 1 .554 0L13 14.566V2a1 1 0 0 0-1-1H4z"/>
</svg>\`;
function addRecord(record, index) {
let isFav = favourites.includes(record.nicknames[0]);
let playersCreaturesInfo = [];
record.creatures.forEach((playerCreatures, playerId)=>{
let rowData = [];
Object.entries(playerCreatures).forEach(([creaturePortrait, creatureAmount])=>{
processRecordHeroCreatures(rowData, creatureAmount, creaturePortrait);
});
playersCreaturesInfo.push(rowData);
rowDatas[\`\${index}:\${playerId}\`] = rowData;
});
let isAllCreaturesAvailable = isAllPresent(playersCreaturesInfo[0]);
let recordLeadership = getLeadership(playersCreaturesInfo[0]);
if (!(0, $dIwPZ.get)("lg_show_available", false) || isAllCreaturesAvailable && recordLeadership > (lg_lvl + 9) * 1000 && recordLeadership <= (lg_lvl + 10) * 1000 || isFav) {
let recordCreatureIds = Object.keys(record.creatures[0]);
recordCreatureIds.sort((a, b)=>a.localeCompare(b));
if (!(0, $dIwPZ.get)("lg_hide_duplicates", false) || !processedBattleCreatures.includes(recordCreatureIds.join(":")) || isFav) {
let playersCreatures = record.creatures.map((playerCreatures, playerId)=>{
let playerCreaturesHTML = "";
let rowData = [];
Object.entries(playerCreatures).forEach(([creaturePortrait, creatureAmount], cellId)=>{
let isGood = processRecordHeroCreatures(rowData, creatureAmount, creaturePortrait);
playerCreaturesHTML += \`<div id="creature-\${index}-\${playerId}-\${cellId}">\${(0, $eTbLz.getNewCreatureIcon)(creaturePortrait, creatureAmount, isGood ? "good-creature" : "bad-creature")}</div>\`;
});
return \`
<div class="record-player-creatures" id="creatures-\${index}-\${playerId}">
<div id="creatures-\${index}-\${playerId}-apply" class="creatures-apply">
<div id="creatures-\${index}-\${playerId}-apply-button" class="home_button2 btn_hover2" onclick="sendApplyArmy('\${index}:\${playerId}')">Набрать</div>
<div id="creatures-\${index}-\${playerId}-leadership" class="player-leadership">
\${getRecordPlayerLeadershipTemplate(index, playerId, getLeadership(rowData), isAllCreaturesAvailable)}
</div>
</div>
<div id="creatures-\${index}-\${playerId}-creatures" class="player-creatures-row">\${playerCreaturesHTML}</div>
</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()}"
let recordContainer = \`
<div class="record-number">
\${record.is_clan ? \`<img src="https://www.freeiconspng.com/thumbs/lock-icon/black-lock-icon-14.png" style="height: 14px;">\` : ""}
<div>\${index + 1}</div>
<div id="fav_\${index}" class="fav_player_button" onclick="saveFav('\${record.nicknames[0]}', this)">
\${isFav ? fav_icon : not_fav_icon}
</div>
</div>
<div class="record-players" id="record-\${index}-players">
<div>\${getRecordPlayersTemplate(record.nicknames)}</div>
<div>\${getRecordResultTemplate(record)}</div>
</div>
<div class="record-players-creatures" id="record-\${index}-creatures">\${playersCreatures}</div>
\${record.special_creature ? getSpecialCreatureTemplate(record.special_creature, index) : \`<div class="special-creature"></div>\`}
<div class="special-creature-extended" id="special-creature-extended-\${index}">
\${record.special_creature ? getSpecialCreatureExtraData(record.special_creature) : ""}
</div>\`;
processedBattleCreatures.push(recordCreatureIds.join(":"));
return recordContainer;
}
}
return "";
}
function saveFav(nickname, elem) {
if (favourites.includes(nickname)) {
elem.innerHTML = not_fav_icon;
favourites = favourites.filter((v)=>v !== nickname);
} else {
elem.innerHTML = fav_icon;
favourites.push(nickname);
}
(0, $dIwPZ.set)("leader_favourites", favourites);
}
function processRecordHeroCreatures(rowData, creatureAmount, creaturePortrait) {
let isGood = false;
if ((0, $dIwPZ.heroCreatures).hasOwnProperty(creaturePortrait)) {
if (creatureAmount - 0 <= (0, $dIwPZ.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;
}
function getSpecialCreatureTemplate(creatureData, index) {
return \`
<div class="special-creature">
<div class="special-creature-info">
\${(0, $eTbLz.getNewCreatureIcon)(creatureData.portrait, "")}
<div class="special-creature-info-button" onclick="showSpecialCreatureData('\${index}')">
<img src="https://\${0, $dIwPZ.cdnHost}/i/combat/btn_info.png" alt="creature info" height="50">
</div>
</div>
<div class="special-creature-stats">
<div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_attack.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.attack.toFixed()}</div>
</div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_speed.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.speed.toFixed()}</div>
</div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_initiative.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.maxinit}</div>
</div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_hit_points.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.health.toFixed()}</div>
</div>
</div>
<div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_defense.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.defence.toFixed()}</div>
</div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_mana.png?v=1" alt="mana"></div>
<div class="special-creature-stat-value">\${creatureData.maxmanna.toFixed()}</div>
</div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_shoots.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.shots.toFixed()}</div>
</div>
<div>
<div><img class="special-creature-stat-icon" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_damage.png?v=1" alt="attack"></div>
<div class="special-creature-stat-value">\${creatureData.mindam.toFixed()}-\${creatureData.maxdam.toFixed()}</div>
</div>
</div>
</div>
</div>
\`;
}
function showSpecialCreatureData(index) {
(0, $dIwPZ.$)(\`special-creature-extended-\${index}\`).classList.toggle("visible");
}
function getSpecialCreatureExtraData(creatureData) {
return \`
<b>Навыки</b>: \${creatureData.skills.map((skill)=>skill.replace(". ", "").replace(".", "")).join(", ")}.<br>
<b>Заклинания</b>: \${creatureData.casts.map((cast, index)=>{
if (creatureData.casts_effects) return \`\${cast} (\${creatureData.casts_effects[index]})\`;
return cast;
}).join(", ")}.
\`;
}
function isAllPresent(rowData) {
let isAllPresent = true;
rowData.forEach((cre)=>{
if (!cre[2]) isAllPresent = false;
});
return isAllPresent;
}
function getRecordPlayersTemplate(nicknames) {
return nicknames.map((nickname)=>\`<a href="/search.php?key=\${nickname}">\${nickname}</a>\`).join("<br>+<br>");
}
function getRecordResultTemplate(record) {
return \`
<div class="record-result">
<div><img src="https://\${0, $dIwPZ.cdnHost}/i/r/48/gold.png?v=3.23de65" title="Потрачено на воскрешение" alt="gold"><span> \${record.cost}</span></div>
<div><a href="/war.php?lt=-1&warid=\${record.battle_id}&show_for_all=\${record.battle_secret}" target="_blank">Бой</a></div>
\${record.survived === undefined ? "" : \`<div>\${record.survived}%</div>\`}
</div>\`;
}
function replaceCellListener(rowDataId, recordId, playerId, cellId) {
let rowData = rowDatas[rowDataId];
setSelectNewCreatureTemplate(rowData, recordId, playerId, cellId);
}
function setSelectNewCreatureTemplate(rowData, recordId, playerId, cellId) {
let replaceCreatureTarget = (0, $dIwPZ.$)(\`replace-creature-\${recordId}-\${playerId}-\${cellId}\`).parentElement;
let newCreatureTemplate = \`
<div style="position: absolute; width: 100%; height: \${getScrollHeight() + 500}px; background: rgba(0,0,0,0.22); z-index: 1000000" onclick="removeOverlay()">
<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()">
<div id="select-new-creature-faction" style="display: flex; flex-direction: row; flex-wrap: wrap"></div>
<div id="new-creatures" style="overflow-y: auto; display: flex; flex-direction: column"></div>
</div>
</div>\`;
let android = (0, $dIwPZ.$)(\`android_container\`);
let container = android ? android : document.body;
container.insertAdjacentHTML("afterbegin", newCreatureTemplate);
let newCreatureElement = (0, $dIwPZ.$)(\`select-new-creature\`);
newCreatureElement.style.left = replaceCreatureTarget.offsetLeft + 60;
newCreatureElement.style.top = replaceCreatureTarget.offsetTop;
fillNewCreatures(-1, rowData, recordId, playerId, cellId);
(0, $dIwPZ.allFactions).forEach((faction)=>{
(0, $dIwPZ.$)(\`select-new-creature-faction\`).insertAdjacentHTML("beforeend", getHTMLFactionSelect(faction));
(0, $dIwPZ.$)(\`faction-select\${faction[0]}\`).addEventListener("click", ()=>{
(0, $dIwPZ.$)(\`new-creatures\`).innerHTML = "";
fillNewCreatures(faction[0], rowData, recordId, playerId, cellId);
});
});
}
function fillNewCreatures(constraint, rowData, recordId, playerId, cellId) {
let remainingLeadership = getRemainingLeadership(rowData, cellId);
Object.entries((0, $dIwPZ.heroCreatures)).forEach(([key, value], index)=>{
if (!checkExistingInRowData(key, rowData) && (constraint === -1 ? true : value["race"] - 0 === constraint)) {
let newAmount = Math.min(Math.floor(Math.min(remainingLeadership, (10 + lg_lvl) * 400) / (value["cost"] - 0)), value["count"] - 0);
if (newAmount > 0) {
(0, $dIwPZ.$)("new-creatures").insertAdjacentHTML("beforeend", \`
<div id="new-creature-\${index}" style="display: flex; flex-direction: row;">
\${(0, $eTbLz.getNewCreatureIcon)(key, newAmount)}
<div style="margin: auto">
<p style="text-decoration: underline; cursor: pointer">\${value["name"]}</p>
</div>
</div>\`);
(0, $dIwPZ.$)(\`new-creature-\${index}\`).addEventListener("click", ()=>{
let replaceTarget = (0, $dIwPZ.$)(\`creature-\${recordId}-\${playerId}-\${cellId}\`);
replaceTarget.innerHTML = (0, $eTbLz.getNewCreatureIcon)(key, newAmount);
rowData[cellId] = [
key,
newAmount,
true
];
setLeaderShip(recordId, playerId, rowData);
removeOverlay();
});
}
}
});
}
function getHTMLFactionSelect(faction) {
let factionSelectBody;
if (faction[0] === -1) factionSelectBody = \`<b>All</b>\`;
else factionSelectBody = \`<img src="https://\${0, $dIwPZ.cdnHost}/i/f/\${faction[2]}" alt="\${faction[1]}" title="\${faction[1]}" style="width: 30px; height: 30px">\`;
return \`
<div id="faction-select\${faction[0]}" style="justify-content: center; display: flex; align-items: center; width: 50px; height: 50px; cursor: pointer">
\${factionSelectBody}
</div>
\`;
}
function checkExistingInRowData(name, rowData) {
let isExist = false;
rowData.forEach((cre)=>{
if (name === cre[0]) isExist = true;
});
return isExist;
}
function setLeaderShip(recordId, playerId, rowData) {
let allPresent = isAllPresent(rowData);
(0, $dIwPZ.$)(\`creatures-\${recordId}-\${playerId}-apply-button\`).innerText = "Набрать";
(0, $dIwPZ.$)(\`creatures-\${recordId}-\${playerId}-leadership\`).innerHTML = getRecordPlayerLeadershipTemplate(recordId, playerId, getLeadership(rowData), allPresent);
}
function getRecordPlayerLeadershipTemplate(recordId, playerId, leadership, allPresent) {
return \`
<img height="24" src="https://\${0, $dIwPZ.cdnHost}/i/icons/attr_leadership.png?v=1" alt="" title="Лидерство сборки">
<span id="leadership-number-\${recordId}-\${playerId}" style="color: \${allPresent ? "green" : "red"}">
\${leadership}
</span>\`;
}
function getLeadership(rowData) {
return rowData.filter((cre)=>cre[2]).reduce((leadership, cre)=>{
return leadership + ((0, $dIwPZ.heroCreatures)[cre[0]]["cost"] - 0) * (cre[1] - 0);
}, 0);
}
function getRemainingLeadership(rowData, cellId) {
return (10 + lg_lvl) * 1000 - getLeadership(rowData) + (rowData[cellId][1] - 0) * ((0, $dIwPZ.heroCreatures).hasOwnProperty(rowData[cellId][0]) && (0, $dIwPZ.heroCreatures)[rowData[cellId][0]]["count"] >= rowData[cellId][1] - 0 ? (0, $dIwPZ.heroCreatures)[rowData[cellId][0]]["cost"] - 0 : 0);
}
async function sendApplyArmy(rowDataId) {
await (0, $aqxxv.doPost)(\`/leader_army_apply.php\${isEvent ? "?from_event=1" : ""}\`, getApplyArmyForm(rowDatas[rowDataId]), true);
location.reload();
}
function getApplyArmyForm(rowData) {
let formData = new FormData();
formData.append("idx", "0");
rowData.filter((cre)=>cre[2]).forEach((creData, index)=>{
formData.append(\`countv\${index + 1}\`, creData[1]);
formData.append(\`mon_id\${index + 1}\`, (0, $dIwPZ.heroCreatures)[creData[0]]["id"]);
});
return formData;
}
function removeOverlay() {
(0, $dIwPZ.$)(\`select-new-creature\`).parentElement.remove();
}
}
});
parcelRequire.register("jWJKf", function(module, exports) {
$parcel$export(module.exports, "setSettings", () => $e856eb178f3c6d9a$export$dc86d17a64679bc7);
$parcel$export(module.exports, "eventHelperSettings", () => $e856eb178f3c6d9a$export$2d8715349e4d9139);
var $hPiir = parcelRequire("hPiir");
var $dIwPZ = parcelRequire("dIwPZ");
var $afXBq = parcelRequire("afXBq");
function $e856eb178f3c6d9a$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("settings", "Settings", "Настройки", "Налаштування"));
texts.addText(new (0, $afXBq.LocalizedText)("support_alert", "If you like this script, please consider supporting it.", "Если тебе нравится этот скрипт, просьба рассмотреть возможность поддержать его работоспособность.", "Якщо тобі подобається цей скрипт, прохання розглянути можливість підтримати його працездатність."));
texts.addText(new (0, $afXBq.LocalizedText)("support", "Keep the services alive", "Поддержать существование сервисов", "Підтримати існування сервісів"));
texts.addText(new (0, $afXBq.LocalizedText)("patreon", "Patreon", "Патреон", "Патреон"));
texts.addText(new (0, $afXBq.LocalizedText)("boosty", "Boosty", "Бусти", "Бусті"));
texts.addText(new (0, $afXBq.LocalizedText)("ok", "X", "X", "X"));
texts.addText(new (0, $afXBq.LocalizedText)("reg_available", "Registration available!", "Доступна регистрация!", "Доступна реєстрація!"));
texts.addText(new (0, $afXBq.LocalizedText)("signup", "Sign up", "Зарегистрироваться", "Зареєструватись"));
return texts;
}
let $e856eb178f3c6d9a$var$allTexts = $e856eb178f3c6d9a$var$getAllTexts();
function $e856eb178f3c6d9a$export$dc86d17a64679bc7(key, text, where = document.body, enabled = true) {
where.insertAdjacentHTML("beforeend", \`
<div style="display: flex; color: green; font-size: 20px; cursor: pointer" id="\${key}" >
<input style="height: 24px; width: 24px;" id="\${key}_checkbox" type="checkbox" \${(0, $dIwPZ.get)(key, enabled) ? " checked" : ""}>
<label for="\${key}_checkbox">\${text}</label>
</div>\`);
(0, $dIwPZ.$)(key).addEventListener("click", ()=>{
(0, $dIwPZ.set)(key, (0, $dIwPZ.$)(\`\${key}_checkbox\`).checked);
});
}
function $e856eb178f3c6d9a$export$2d8715349e4d9139(where, callback, position = "beforeend") {
where.insertAdjacentHTML(position, \`
<div style="margin-top: 10px; display: flex; flex-direction: column;" id="event_helper_settings_container">
<div id="event_helper_settings" class="home_button2 btn_hover2" style="width: fit-content;align-self: center">\${$e856eb178f3c6d9a$var$allTexts.get("settings")} EventHelper</div>
\${(()=>{
if (!(0, $dIwPZ.get)("eh_patreon_notification_shown", false)) return \`<div style=" align-self: center;
display: flex;
flex-direction: column;
align-items: center;"><div>\${$e856eb178f3c6d9a$var$allTexts.get("support_alert")}</div>
<div style="display: flex;"><div style=" align-items: center;
display: flex;">\${$e856eb178f3c6d9a$var$allTexts.get("support")} </div>
<div id="patreon_link" class="home_button2 btn_hover2" style="padding: 2px 4px;
margin-top: 4px;
width: fit-content;"><a href="https://www.patreon.com/user?u=58444506" target="_blank" style="display: flex; align-items: center">\${$e856eb178f3c6d9a$var$allTexts.get("patreon")}<img src="https://cdn.icon-icons.com/icons2/2429/PNG/512/patreon_logo_icon_147253.png" style="height: 24px;"></a></div>
<div id="boosty_link" class="home_button2 btn_hover2" style="padding: 2px 4px;
margin-top: 4px;
width: fit-content;"><a href="https://boosty.to/thunder_hwm" target="_blank" style="display: flex; align-items: center">\${$e856eb178f3c6d9a$var$allTexts.get("boosty")}<img src="https://mikulski.rocks/wp-content/uploads/2022/04/Color.png" style="height: 24px;"></a></div>
<div id="patreon_accept" class="home_button2 btn_hover2" style="padding: 2px 4px;
margin-top: 4px; margin-left: 10px;
width: fit-content;">\${$e856eb178f3c6d9a$var$allTexts.get("ok")}</div></div></div>\`;
else return \`\`;
})()}
</div>
\`);
if (!(0, $dIwPZ.get)("eh_patreon_notification_shown", false)) (0, $dIwPZ.$)(\`patreon_accept\`).addEventListener("click", ()=>{
(0, $dIwPZ.set)("eh_patreon_notification_shown", true);
});
(0, $dIwPZ.$)(\`event_helper_settings\`).addEventListener("click", (e)=>{
e.target.remove();
let container = (0, $dIwPZ.$)(\`event_helper_settings_container\`);
callback(container);
let regHTML;
if (!(0, $dIwPZ.get)("hwm_events_token", null)) regHTML = \`
<div style="width: 100%; text-align: center"><b>\${$e856eb178f3c6d9a$var$allTexts.get("reg_available")}</b></div>
<div id="start_registration" class="home_button2 btn_hover2" style="padding: 2px 4px; margin-top: 4px">\${$e856eb178f3c6d9a$var$allTexts.get("signup")}</div>
\`;
else regHTML = "";
container.insertAdjacentHTML("beforeend", \`
<div style="align-self: center">
\${regHTML}
<!-- <br>-->
<!-- <br>-->
<!-- <br>-->
<!-- <div style="width: 100%; text-align: center"><b>Реклама!</b></div>-->
<!-- <p>Крафт ювелирки с откатом 2 пары <a href="/pl_info.php?id=6722246">Kerrigan</a></p>-->
<div style="display: flex;"><div style=" align-items: center;
display: flex;">\${$e856eb178f3c6d9a$var$allTexts.get("support")} </div>
<div id="patreon_link" class="home_button2 btn_hover2" style="padding: 2px 4px;
margin-top: 4px;
width: fit-content;"><a href="https://www.patreon.com/user?u=58444506" target="_blank" style="display: flex; align-items: center">\${$e856eb178f3c6d9a$var$allTexts.get("patreon")}<img src="https://cdn.icon-icons.com/icons2/2429/PNG/512/patreon_logo_icon_147253.png" style="height: 24px;"></a></div>
<div id="boosty_link" class="home_button2 btn_hover2" style="padding: 2px 4px;
margin-top: 4px;
width: fit-content;"><a href="https://boosty.to/thunder_hwm" target="_blank" style="display: flex; align-items: center">\${$e856eb178f3c6d9a$var$allTexts.get("boosty")}<img src="https://mikulski.rocks/wp-content/uploads/2022/04/Color.png" style="height: 24px;"></a></div>
</div> </div>
\`);
if (regHTML) (0, $dIwPZ.$)(\`start_registration\`).addEventListener("click", (0, $hPiir.startRegistration));
});
}
});
parcelRequire.register("hPiir", function(module, exports) {
$parcel$export(module.exports, "startRegistration", () => $cfa5645e0adeda32$export$20d6f277a113c2ce);
var $aqxxv = parcelRequire("aqxxv");
var $dIwPZ = parcelRequire("dIwPZ");
async function $cfa5645e0adeda32$export$20d6f277a113c2ce(event) {
event.target.outerHTML = \`
<div id="reg_progress" style="text-align: center">Процесс регистрации запущен...</div>
\`;
let regStatus = (0, $dIwPZ.$)(\`reg_progress\`);
let register = await (0, $aqxxv.doGet)(\`register?pl_id=\${(0, $dIwPZ.pl_id)}\`);
regStatus.innerHTML = "Учетная запись создана...";
let formData = new FormData();
formData.append("cdata", Math.floor(Math.random() * 19001 + 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", (0, $dIwPZ.my_sign));
formData.append("subm", "%CE%F2%EF%F0%E0%E2%E8%F2%FC+%28CTRL%2BEnter%29");
await (0, $aqxxv.doPost)(\`/sms-create.php\`, formData, true);
regStatus.innerHTML = "Производится подтверждение личности...";
let validate = await (0, $aqxxv.doGet)(\`checkRegistration?pl_id=\${(0, $dIwPZ.pl_id)}\`);
if (validate.status === "good") {
regStatus.innerHTML = "Регистрация прошла успешно!";
(0, $dIwPZ.set)("hwm_events_token", register.token);
} else regStatus.innerHTML = "Что-то пошло не так :(";
let smsOutDoc = await (0, $aqxxv.doGet)("/sms.php?box=out", true);
let smsId = smsOutDoc.querySelector('input[type="checkbox"]').value;
let smsDeleteFormData = new FormData();
smsDeleteFormData.append("id1", smsId);
smsDeleteFormData.append("box", "out");
smsDeleteFormData.append("filter", "");
smsDeleteFormData.append("page", "0");
smsDeleteFormData.append("action", "mass_delete");
(0, $aqxxv.doPost)("/sms.php", smsDeleteFormData, true);
}
});
parcelRequire.register("afXBq", function(module, exports) {
$parcel$export(module.exports, "LocalizedTextMap", () => $777989ee19108b74$export$e2cdacd256e1e5e1);
$parcel$export(module.exports, "LocalizedText", () => $777989ee19108b74$export$6806bb0283a0c326);
let $777989ee19108b74$var$locale = "ru";
if (location.host === "my.lordswm.com" || navigator.language.includes("uk")) $777989ee19108b74$var$locale = "ua";
if (location.host === "www.lordswm.com") $777989ee19108b74$var$locale = "en";
class $777989ee19108b74$export$e2cdacd256e1e5e1 {
constructor(){
this.allTexts = new Map();
}
addText(localizedText) {
this.allTexts[localizedText.id] = localizedText;
}
get(id) {
return this.allTexts[id][$777989ee19108b74$var$locale];
}
}
class $777989ee19108b74$export$6806bb0283a0c326 {
constructor(id, en = null, ru = null, ua = null){
this.id = id;
this.en = en;
this.ru = ru;
this.ua = ua;
}
}
});
parcelRequire.register("ao0pt", function(module, exports) {
$parcel$export(module.exports, "collapseEventDesc", () => $78fc76acb8006c44$export$74006e6f0c324459);
$parcel$export(module.exports, "getCurrentLevel", () => $78fc76acb8006c44$export$7503ec8cf78f3211);
$parcel$export(module.exports, "setClickableLevels", () => $78fc76acb8006c44$export$a12bccc8d3170544);
$parcel$export(module.exports, "setTimer", () => $78fc76acb8006c44$export$7b3d6d4401c78312);
var $dIwPZ = parcelRequire("dIwPZ");
var $afXBq = parcelRequire("afXBq");
function $78fc76acb8006c44$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("time_d", "d", "д", "д"));
texts.addText(new (0, $afXBq.LocalizedText)("time_h", "h", "ч", "г"));
texts.addText(new (0, $afXBq.LocalizedText)("time_m", "m", "м", "х"));
texts.addText(new (0, $afXBq.LocalizedText)("time_s", "s", "с", "с"));
return texts;
}
let $78fc76acb8006c44$var$allTexts = $78fc76acb8006c44$var$getAllTexts();
function $78fc76acb8006c44$export$74006e6f0c324459() {
if ((0, $dIwPZ.get)("collapse_event_desc", false)) {
if (document.querySelector(".event_desc_block_inside") && document.querySelector(".event_desc_block_inside").getAttribute("style") == null && document.querySelector("#event_desc_block") !== null && document.querySelector("#event_desc_block").style.display !== "none") document.querySelector(".event_desc_open_btn").click();
}
}
function $78fc76acb8006c44$export$7503ec8cf78f3211() {
let set_level = new URLSearchParams(window.location.search).get("sel_level");
if (set_level) return set_level;
let match = document.body.innerText.match(/(Уровень сложности|Difficulty level): (\d{1,3})/);
if (match && match.length > 0) return match[2];
if (document.getElementsByClassName("CheckpointCurrent").length > 0) return document.getElementsByClassName("CheckpointCurrent")[0].innerHTML.match(/\d{1,3}/)[0];
return "100";
}
function $78fc76acb8006c44$export$a12bccc8d3170544() {
document.querySelectorAll(".Checkpoints").forEach((cp)=>{
cp.style.zIndex = "1";
});
Array.from(document.querySelectorAll(".Checkpoints")).filter((elem)=>elem.classList.contains("CheckpointComplete") || elem.classList.contains("CheckpointLocked")).forEach((elem)=>{
elem.style.pointerEvents = "all";
elem.addEventListener("click", ()=>{
location.href = location.pathname + "?sel_level=" + elem.innerText.trim();
});
elem.style.cursor = "pointer";
});
}
function $78fc76acb8006c44$export$7b3d6d4401c78312(where) {
where.style.display = "flex";
where.style.justifyContent = "center";
where.insertAdjacentHTML("beforeend", \` <span id="timer_container"></span>\`);
let container = (0, $dIwPZ.$)("timer_container");
let countDownDate = new Date(1698181200000).getTime();
function process() {
let now = new Date().getTime();
let distance = countDownDate - now;
let days = Math.floor(distance / 86400000);
let hours = Math.floor(distance % 86400000 / 3600000);
let minutes = Math.floor(distance % 3600000 / 60000);
let seconds = Math.floor(distance % 60000 / 1000);
if (distance > 86400000) container.innerHTML = \`\${days}\${$78fc76acb8006c44$var$allTexts.get("time_d")} \${hours}\${$78fc76acb8006c44$var$allTexts.get("time_h")} \${minutes}\${$78fc76acb8006c44$var$allTexts.get("time_m")} \${seconds}\${$78fc76acb8006c44$var$allTexts.get("time_s")}\`;
else if (distance < 0) {
clearInterval(timer);
container.innerHTML = "";
} else container.innerHTML = \`<div style="color: red">\${days}\${$78fc76acb8006c44$var$allTexts.get("time_d")} \${hours}\${$78fc76acb8006c44$var$allTexts.get("time_h")} \${minutes}\${$78fc76acb8006c44$var$allTexts.get("time_m")} \${seconds}\${$78fc76acb8006c44$var$allTexts.get("time_s")}</div>\`;
}
let timer = setInterval(process, 1000);
process();
}
});
parcelRequire.register("8l3id", function(module, exports) {
$parcel$export(module.exports, "setLeaderboard", () => $6122d6c588ef4b85$export$d01e4b19d1fd9b89);
$parcel$export(module.exports, "setTopClanAttempts", () => $6122d6c588ef4b85$export$343e177ae088f8e2);
var $aqxxv = parcelRequire("aqxxv");
var $dIwPZ = parcelRequire("dIwPZ");
var $afXBq = parcelRequire("afXBq");
let $6122d6c588ef4b85$var$TOP_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"
];
function $6122d6c588ef4b85$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("top_heroes", "Top heroes", "Лучшие игроки", "Найкращі гравці"));
texts.addText(new (0, $afXBq.LocalizedText)("top_clans", "Top clans", "Лучшие кланы", "Найкращі клани"));
texts.addText(new (0, $afXBq.LocalizedText)("attempts_left", "Attempts left", "Оставшиеся попытки", "Залишилось спроб"));
texts.addText(new (0, $afXBq.LocalizedText)("progression", "Score progression", "Прогрессия очков", "Прогресія очок"));
return texts;
}
let $6122d6c588ef4b85$var$allTexts = $6122d6c588ef4b85$var$getAllTexts();
async function $6122d6c588ef4b85$export$d01e4b19d1fd9b89(where, position = "afterbegin", withClan = false, showStat = false) {
window.showProgression = $6122d6c588ef4b85$var$showProgression;
let isLeaderboardExpanded = false;
let topHeroes = await (0, $aqxxv.doGet)(\`getTopScoresV2\`);
where.insertAdjacentHTML(position, \`<div style="display: flex; flex-direction: column" id="top_heroes_container"></div><br>\`);
resetLeaderboard(showStat);
if (showStat) document.querySelectorAll(".global_container_block")[1].insertAdjacentHTML("afterend", \`
<div id="chart_area" class="global_container_block" style="display: none"></div>
\`);
if (withClan) {
let topClans = await (0, $aqxxv.doGet)(\`getTopClanScores\`);
let result = topClans.reduce((prev, curr, index)=>{
return prev + getTopClanTemplate(curr, index);
}, "");
where.insertAdjacentHTML(position, \`<div style="display: flex; flex-direction: column" id="top_clans_container">
<b style="user-select: none; text-align: center;">\${$6122d6c588ef4b85$var$allTexts.get("top_clans")}</b>\${result}
</div><br>\`);
}
function resetLeaderboard(showStat) {
let result = topHeroes.slice(0, 15).reduce((prev, curr, index)=>{
return prev + getTopHeroTemplate(curr, index, showStat);
}, "");
(0, $dIwPZ.$)(\`top_heroes_container\`).innerHTML = \`
<b style="user-select: none; text-align: center;">\${$6122d6c588ef4b85$var$allTexts.get("top_heroes")} (<span id="expand_top_heroes" style="cursor: pointer; text-decoration: underline">+</span>)</b>\${result}
\`;
(0, $dIwPZ.$)(\`expand_top_heroes\`).addEventListener("click", (e)=>{
if (!isLeaderboardExpanded) {
topHeroes.slice(15).forEach((curr, index)=>{
(0, $dIwPZ.$)(\`top_heroes_container\`).insertAdjacentHTML("beforeend", getTopHeroTemplate(curr, index + 15, showStat));
});
isLeaderboardExpanded = true;
e.target.innerHTML = "—";
} else {
resetLeaderboard(showStat);
isLeaderboardExpanded = false;
}
});
}
function getTopHeroTemplate(hero, index, showStat) {
let scoreElem = hero["member_score"];
if (showStat && $6122d6c588ef4b85$var$TOP_CLANS.includes(hero["clan_id"])) scoreElem = \`<b style="font-size: 10px; text-decoration: underline; cursor: pointer" onclick="showProgression(\${hero["member_id"]}, '\${hero["member_name"]}')">\${hero["member_score"]}</b>\`;
return \`
<div style="display: flex; justify-content: space-between; padding: 1px; font-size: smaller">
<span style="display: inline-block">\${index + 1}.</span>
<span style="display: inline-block; text-align: center">
<a href="/clan_info.php?id=\${hero["clan_id"]}">
<img style="height: 15px; vertical-align: bottom" src="https://\${0, $dIwPZ.cdnHost}/i_clans/l_\${hero["clan_id"]}.gif?1805" alt=""></a>
<a href="/pl_info.php?id=\${hero["member_id"]}" style="text-decoration: none; font-size: 9px">\${hero["member_name"]}</a>
[\${hero["member_cl"]}]
</span>
<span style="display: inline-block">\${scoreElem}\${hero["attempts_left"] ? \`<span title="\${$6122d6c588ef4b85$var$allTexts.get("attempts_left")}" style="cursor: help; font-size: 5pt">(\${hero["attempts_left"]})</span>\` : ""}</span>
</div>\`;
}
function getTopClanTemplate(hero, index) {
return \`
<div style="display: flex; justify-content: space-between; padding: 1px; font-size: smaller">
<span style="display: inline-block">\${index + 1}.</span>
<span style="display: inline-block; text-align: center">
<a href="/clan_info.php?id=\${hero[0]}">
<img style="height: 15px; vertical-align: bottom" src="https://\${0, $dIwPZ.cdnHost}/i_clans/l_\${hero[0]}.gif?1805" alt=""></a>
<a href="/clan_info.php?id=\${hero[0]}" style="text-decoration: none; font-size: 9px">#\${hero[0]}</a>
</span>
<span style="display: inline-block">\${hero[1]}</span>
</div>\`;
}
}
async function $6122d6c588ef4b85$var$showProgression(id, name) {
let chartArea = (0, $dIwPZ.$)(\`chart_area\`);
chartArea.style.display = "flex";
chartArea.innerHTML = \`
<div style="height: 165px; overflow: hidden">
<div>\${$6122d6c588ef4b85$var$allTexts.get("progression")} <b>\${name}</b></div>
<canvas id="chart\${id}" style="width: 100%; height: 150px"></canvas>
</div>
\`;
let heroData = await (0, $aqxxv.doGet)(\`getDunHeroData?pl_id=\${id}\`);
const cumulativeSum = ((sum)=>(value)=>sum += value)(0);
const labels = heroData.map((entry)=>entry[0] + \` \${entry[1] > 0 ? "+" : ""}\${entry[1]}\`);
const data = {
labels: labels,
datasets: [
{
label: "Очки",
data: heroData.map((entry)=>entry[1]).map(cumulativeSum),
borderColor: "blue",
backgroundColor: "rgb(44,73,107)",
pointStyle: "circle",
pointRadius: 3,
pointHoverRadius: 4
}
]
};
const 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
}
}
};
const ctx = document.getElementById(\`chart\${id}\`).getContext("2d");
const myChart = new Chart(ctx, config);
}
async function $6122d6c588ef4b85$export$343e177ae088f8e2(where) {
let topClanAttempts = await (0, $aqxxv.doGet)(\`getTopClanTotalAttempts\`);
where.querySelectorAll("tr").forEach((clanElem)=>{
let clanId = clanElem.innerHTML.match(/id=(\d{1,5})/)[1];
let scoreElem = Array.from(clanElem.querySelectorAll("td")).at(-1);
let clanAttempts = topClanAttempts[clanId];
if (clanAttempts) scoreElem.insertAdjacentHTML("beforeend", \`
<span title="Оставшиеся попытки" style="cursor: help; font-size: 5pt">(\${clanAttempts})</span>
\`);
});
}
});
parcelRequire.register("eTbLz", function(module, exports) {
$parcel$export(module.exports, "getSpoiler", () => $ad6f5445145af1e6$export$ca0c33c349afe188);
$parcel$export(module.exports, "getNewCreatureIcon", () => $ad6f5445145af1e6$export$b49d3c66fe569a18);
var $dIwPZ = parcelRequire("dIwPZ");
function $ad6f5445145af1e6$export$ca0c33c349afe188(type, index, spoilerHead, spoilerBody, spoilerWrapperClass = "", spoilerLabelClass = "") {
return \`
<div class="\${spoilerWrapperClass}" style="display: flex;
flex-direction: column;
align-items: center;">
<input type="checkbox" id="spoiler_\${type}_\${index}"/>
<label for="spoiler_\${type}_\${index}" class="\${spoilerLabelClass}">
\${spoilerHead}
</label>
<div class="spoiler">
\${spoilerBody}
</div>
</div>
\`;
}
function $ad6f5445145af1e6$export$b49d3c66fe569a18(creaturePortrait, newAmount, cre_amount_class = "") {
return \`
<div class="cre_creature custom-creature">
<img src="https://\${0, $dIwPZ.cdnHost}/i/army_html/fon_lvl\${(0, $dIwPZ.heroCreatures)[creaturePortrait] ? (0, $dIwPZ.heroCreatures)[creaturePortrait].rarity : "1"}.png?v=1" width="50" height="50" class="cre_mon_image2" alt="">
<img src="https://\${0, $dIwPZ.cdnHost}/i/portraits/\${creaturePortrait}p33.png" height="50" alt="" class="cre_mon_image1">
<div class="cre_amount custom-amount \${cre_amount_class}" id="add_now_count">\${newAmount}</div>
</div>\`;
}
});
parcelRequire.register("8nxuZ", function(module, exports) {
$parcel$export(module.exports, "addFilteringArea", () => $619a74dd35eb4e69$export$571dc493ff6b06fe);
$parcel$export(module.exports, "processFilters", () => $619a74dd35eb4e69$export$a6dafd6bb972b970);
var $dIwPZ = parcelRequire("dIwPZ");
function $619a74dd35eb4e69$export$571dc493ff6b06fe(where, position) {
where.insertAdjacentHTML(position, getFilteringAreaTemplate());
setBlockedWavesListener();
setAllowedWavesListener();
setBlockedHeroesListener();
setAllowedHeroesListener();
setBlockedLeadershipListener();
function setBlockedWavesListener() {
(0, $dIwPZ.$)("blocked-waves-list").addEventListener("input", (event)=>{
(0, $dIwPZ.set)("blocked_waves_1", event.target.value.split(",").filter((item)=>item !== "").map((item)=>item.trim()));
});
}
function setAllowedWavesListener() {
(0, $dIwPZ.$)("allowed-waves-list").addEventListener("input", (event)=>{
(0, $dIwPZ.set)("allowed_waves_1", event.target.value.split(",").filter((item)=>item !== "").map((item)=>item.trim()));
});
}
function setBlockedHeroesListener() {
(0, $dIwPZ.$)("blocked-heroes-list").addEventListener("input", (event)=>{
(0, $dIwPZ.set)("blocked_heroes_1", event.target.value.split(",").filter((item)=>item !== "").map((item)=>item.trim()));
});
}
function setAllowedHeroesListener() {
(0, $dIwPZ.$)("allowed-heroes-list").addEventListener("input", (event)=>{
(0, $dIwPZ.set)("allowed_heroes_1", event.target.value.split(",").filter((item)=>item !== "").map((item)=>item.trim()));
});
}
function setBlockedLeadershipListener() {
(0, $dIwPZ.$)("blocked-leadership").addEventListener("input", (event)=>{
(0, $dIwPZ.set)("blocked_leadership", event.target.value.trim());
});
}
function getFilteringAreaTemplate() {
return \`
<style>
.filters-container {
display: flex;
flex-direction: column;
align-items: center;
}
.filtering-item {
width: 100%;
}
.filtering-item textarea {
min-width: min(400px, 100%);
resize: none;
overflow-x: visible;
border-radius: 5px;
}
.filtering-item:nth-child(n+1) {
margin-top: 10px;
}
</style>
<br/>
<div class="filters-container">
<div><b>Фильтры (сохраняется автоматически):</b></div>
<div class="filtering-item">
<textarea id="blocked-waves-list" placeholder="Нежеланные волны через запятую">\${(0, $dIwPZ.get)("blocked_waves_1", []).join(",")}</textarea>
</div>
<div class="filtering-item">
<textarea id="allowed-waves-list" placeholder="Желанные волны через запятую">\${(0, $dIwPZ.get)("allowed_waves_1", []).join(",")}</textarea>
</div>
<div class="filtering-item">
<textarea id="blocked-heroes-list" placeholder="Нежеланные никнеймы через запятую">\${(0, $dIwPZ.get)("blocked_heroes_1", []).join(",")}</textarea>
</div>
<div class="filtering-item">
<textarea id="allowed-heroes-list" placeholder="Желанные никнеймы через запятую">\${(0, $dIwPZ.get)("allowed_heroes_1", []).join(",")}</textarea>
</div>
<div class="filtering-item">
<textarea id="blocked-leadership" placeholder="Нижний порог по лидерству">\${(0, $dIwPZ.get)("blocked_leadership", "")}</textarea>
</div>
</div>
<br/>\`;
}
}
function $619a74dd35eb4e69$export$a6dafd6bb972b970() {
if (document.querySelector("#lre_merc_block > div")) {
window.leader_rogues_event_state_handle = function() {
if (this.readyState == 4) {
var txt = this.responseText;
var short_txt = txt.substring(0, 11);
if (short_txt != "|merc_stat|") {
window.location = "leader_rogues.php";
return 0;
}
var data = txt.split("|merc_stat|");
if (data && data[1] && document.getElementById("lre_merc_block")) {
let doc = new DOMParser().parseFromString(data[1], "text/html");
let trs = Array.from(doc.querySelector("div").childNodes).filter((node)=>node.innerText.length > 0);
processBlockedWaves(trs);
processBlockedHeroes(trs);
processBlockedLeadership(trs);
document.getElementById("lre_merc_block").innerHTML = doc.documentElement.innerHTML;
if (typeof hwm_hints_init === "function") hwm_hints_init();
}
}
};
let trs = Array.from(document.querySelector("#lre_merc_block > div").childNodes).filter((node)=>node.innerText.length > 0);
processBlockedWaves(trs);
processBlockedHeroes(trs);
processBlockedLeadership(trs);
}
function processBlockedWaves(trs) {
let blockedWaves = (0, $dIwPZ.get)("blocked_waves_1", []).filter((item)=>item !== "").map((item)=>item.trim());
let allowedWaves = (0, $dIwPZ.get)("allowed_waves_1", []).filter((item)=>item !== "").map((item)=>item.trim());
trs.forEach((tr)=>{
let waveId = tr.textContent.match(/(Ур\.: |Lv\.: )(\d{1,3})/)[2];
if (blockedWaves.includes(waveId) || allowedWaves.length > 0 && !allowedWaves.includes(waveId)) try {
tr.previousSibling.remove();
tr.remove();
} catch (e) {}
});
}
function processBlockedHeroes(trs) {
let blockedHeroes = (0, $dIwPZ.get)("blocked_heroes_1", []).filter((item)=>item !== "").map((item)=>item.trim());
let allowedHeroes = (0, $dIwPZ.get)("allowed_heroes_1", []).filter((item)=>item !== "").map((item)=>item.trim());
trs.forEach((tr)=>{
let heroName = tr.textContent.match(/([А-Яа-яёЁa-zA-Z0-9_* ()-]+) \[\d{1,2}]/)[1];
if (blockedHeroes.includes(heroName) || allowedHeroes.length > 0 && !allowedHeroes.includes(heroName)) try {
tr.previousSibling.remove();
tr.remove();
} catch (e) {}
});
}
function processBlockedLeadership(trs) {
let blockedLeadership = (0, $dIwPZ.get)("blocked_leadership", "0").trim();
trs.forEach((tr)=>{
let leadership = tr.textContent.match(/\d{1,2},\d{3}/)[0].replaceAll(",", "");
if (blockedLeadership - 0 > leadership - 0) try {
tr.previousSibling.remove();
tr.remove();
} catch (e) {}
});
}
}
});
parcelRequire.register("86JDc", function(module, exports) {
$parcel$export(module.exports, "default", () => $5e7247b2082ebe89$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $8l3id = parcelRequire("8l3id");
var $ao0pt = parcelRequire("ao0pt");
var $8l3id = parcelRequire("8l3id");
var $5e7247b2082ebe89$require$setLeaderboard = $8l3id.setLeaderboard;
var $ao0pt = parcelRequire("ao0pt");
var $5e7247b2082ebe89$require$collapseEventDesc = $ao0pt.collapseEventDesc;
var $jWJKf = parcelRequire("jWJKf");
var $5e7247b2082ebe89$require$eventHelperSettings = $jWJKf.eventHelperSettings;
var $5e7247b2082ebe89$require$setSettings = $jWJKf.setSettings;
var $6rIzz = parcelRequire("6rIzz");
var $5e7247b2082ebe89$require$getEventBattles = $6rIzz.getEventBattles;
function $5e7247b2082ebe89$export$2e2bcd8739ae039() {
if (/adventure_event\.php$/.test(location.href)) {
$5e7247b2082ebe89$require$setLeaderboard(document.querySelector('[style="min-width:250px;"]').getElementsByTagName("center")[0]);
if ((0, $dIwPZ.get)("show_top_clan_attempts", true)) (0, $8l3id.setTopClanAttempts)(document.querySelector('[style="min-width:250px;"] > table'));
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector("h2"));
}
if (location.href.includes("adventure_event.php?map=1")) {
$5e7247b2082ebe89$require$collapseEventDesc();
$5e7247b2082ebe89$require$eventHelperSettings(document.querySelector(".Global"), (container)=>{
$5e7247b2082ebe89$require$setSettings("auto_send_ffa_event", "Отправлять бои из КБО ивента в сервис автоматически", container);
$5e7247b2082ebe89$require$setSettings("only_clan_visibility", "Мои бои доступны только для клана", container, false);
$5e7247b2082ebe89$require$setSettings("collapse_event_desc", "Всегда сворачивать описания боев", container, false);
}, "afterend");
$5e7247b2082ebe89$require$getEventBattles(document.querySelectorAll('[align="left"][valign="top"]')[1]);
}
}
});
parcelRequire.register("6rIzz", function(module, exports) {
$parcel$export(module.exports, "sendBattle", () => $4b17d6e8488eae62$export$fa6a22bf5c2892b6);
$parcel$export(module.exports, "getEventBattles", () => $4b17d6e8488eae62$export$ee3c8d0c774798be);
var $aqxxv = parcelRequire("aqxxv");
var $dIwPZ = parcelRequire("dIwPZ");
var $ao0pt = parcelRequire("ao0pt");
var $eTbLz = parcelRequire("eTbLz");
var $afXBq = parcelRequire("afXBq");
function $4b17d6e8488eae62$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("sent", "Sent", "Отправлено", "Надіслано"));
texts.addText(new (0, $afXBq.LocalizedText)("examples", "Battle examples", "Примеры боёв", "Приклади боїв"));
texts.addText(new (0, $afXBq.LocalizedText)("cl", "CL", "БУ", "БР"));
texts.addText(new (0, $afXBq.LocalizedText)("afs", "AFS", "АиМ", "АзМ"));
texts.addText(new (0, $afXBq.LocalizedText)("ffa", "FFA", "КБО", "КБО"));
texts.addText(new (0, $afXBq.LocalizedText)("your_cl", "Your CL", "Твой уровень", "Твій рівень"));
texts.addText(new (0, $afXBq.LocalizedText)("another_cl", "Another CLs", "Другие уровни", "Інші рівні"));
texts.addText(new (0, $afXBq.LocalizedText)("another_cl_army", "Starting from the 51st wave, the opponents at all combat levels are the same. The difference is only in quantity.", "Начиная с 51й волны, противники на всех уровнях одинаковые. Разница только в количестве.", "Починаючи з 51 хвилі, противники на всіх бойових рівнях однакові. Різниця лише у кількості."));
texts.addText(new (0, $afXBq.LocalizedText)("battle", "Battle", "Бой", "Бій"));
texts.addText(new (0, $afXBq.LocalizedText)("empty", "empty", "пусто", "порожньо"));
texts.addText(new (0, $afXBq.LocalizedText)("enemy", "Enemy", "Враг", "Ворог"));
texts.addText(new (0, $afXBq.LocalizedText)("search", "Search", "Поиск", "Пошук"));
texts.addText(new (0, $afXBq.LocalizedText)("loses", "Loses", "Поражения", "Поразки"));
texts.addText(new (0, $afXBq.LocalizedText)("nickname", "nickname", "никнейм", "нікнейм"));
texts.addText(new (0, $afXBq.LocalizedText)("search", "Search", "Поиск", "Пошук"));
texts.addText(new (0, $afXBq.LocalizedText)("hire", "Hire", "Набрать", "Найняти"));
texts.addText(new (0, $afXBq.LocalizedText)("hwmevents", \`Website with examples <a href="https://hwm.events/ffa" target="_blank">https://hwm.events/ffa</a> Share with friends!\`, \`Проходки есть и на сайте <a href="https://hwm.events/ffa" target="_blank">https://hwm.events/ffa</a> Поделись с другом!\`, \`Приклади також є і на сайті <a href="https://hwm.events/ffa" target="_blank">https://hwm.events/ffa</a> Поділися з друзями!\`));
texts.addText(new (0, $afXBq.LocalizedText)("hwmevents_rogues", \`Website with examples <a href="https://hwm.events/rogues" target="_blank">https://hwm.events/rogues</a> Share with friends!\`, \`Проходки есть и на сайте <a href="https://hwm.events/rogues" target="_blank">https://hwm.events/rogues</a> Поделись с другом!\`, \`Приклади також є і на сайті <a href="https://hwm.events/rogues" target="_blank">https://hwm.events/rogues</a> Поділися з друзями!\`));
return texts;
}
let $4b17d6e8488eae62$var$allTexts = $4b17d6e8488eae62$var$getAllTexts();
async function $4b17d6e8488eae62$export$fa6a22bf5c2892b6(warid, secret, type, index = null, battle_side = -1) {
let formData = new FormData();
formData.append("battle_id", warid);
formData.append("battle_secret", secret);
formData.append("battle_side", battle_side);
formData.append("is_clan", (0, $dIwPZ.get)("only_clan_visibility", false));
let types = {
"0": "uploadDbBattle",
"1": "uploadEventLeaderBattle",
"2": "uploadFFAEventBattle",
"3": "uploadFactionEventBattle",
"4": "uploadRoguesEventBattle"
};
(0, $aqxxv.doPost)(types[type], formData).then(()=>{
if (index != null) (0, $dIwPZ.$)(\`send_battle_\${index}\`).outerHTML = $4b17d6e8488eae62$var$allTexts.get("sent");
});
}
async function $4b17d6e8488eae62$export$ee3c8d0c774798be(target, from = "getFFAEventBattles", callback = 2, lost = false) {
window.sendApplyArmy = sendApplyArmy;
let creaturesInfo = (0, $dIwPZ.get)("eventCreaturesInfo", {});
let currentSilver = 0;
try {
currentSilver = 10000 + parseInt(document.body.innerText.match(/(Добыто серебра|Silver gained): (\d{0,3},?\d{1,3})/)[2].replace(",", ""));
} catch (e) {}
document.body.insertAdjacentHTML("afterbegin", \`<style>.hwm_event_example_block {
display: flex;
flex-wrap: wrap;
flex-direction: column;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border-radius: 5px;
position: relative;
align-items: center;
justify-content: center;
margin: 2px;
padding: 6px;
background-color: #fffef9;
box-shadow: inset 0 0 0 1px #b19673, 0 2px 2px rgb(0 0 0 / 25%);
}</style>\`);
let battles = await (0, $aqxxv.doGet)(\`\${from}?wave=\${(0, $ao0pt.getCurrentLevel)()}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`);
processEventBattles(target, battles);
function processEventBattles(where = document.body, battles) {
switch(callback){
case 1:
if (battles.AFS.length === 0 && !lost) $4b17d6e8488eae62$export$ee3c8d0c774798be(target, from.replace("Battles", "FailedBattles"), callback, true);
else {
where.insertAdjacentHTML("beforeend", \`<div style="text-align: center"><b>\${$4b17d6e8488eae62$var$allTexts.get("hwmevents_rogues")}</b></div>\` + getAFSEventBattlesTemplate(lost, battles));
(0, $dIwPZ.$)("search_nickname").addEventListener("keypress", (e)=>{
if (e.key === "Enter") (0, $dIwPZ.$)("process_search").click();
});
(0, $dIwPZ.$)("process_search").addEventListener("click", async ()=>{
let player_battles = await (0, $aqxxv.doGet)(\`getRoguesPlayerBattles?nickname=\${encodeURIComponent((0, $dIwPZ.$)("search_nickname").value.trim())}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`);
(0, $dIwPZ.$)("player_battles").innerHTML = (0, $dIwPZ.groupBy)((0, $dIwPZ.sortByKey)(player_battles["AFS"], "wave", -1), "wave").map((currentWaveList)=>(0, $dIwPZ.sortByKey)(currentWaveList, "battle_id", -1)).flatMap((currentWaveList)=>currentWaveList).reduce((prev, curr, index)=>{
return prev + \`
<div class="hwm_event_example_block">
<div style="width: 80%;display: flex;justify-content: space-evenly;">
<div style="text-align: center"> <a href="/pl_info.php?nick=\${(0, $dIwPZ.encode)(curr["nickname"])}" class="pi" target="_blank">\${curr["nickname"]}</a> \${"class" in curr && getClassById(curr["class"]) ? \`<img style="vertical-align: middle; height: 16px" src="https://\${0, $dIwPZ.cdnHost}/i/f/\${getClassById(curr["class"])[3]}?v=1.1" alt="">\` : ""} [\${curr["hero_lvl"] ?? ""}]</div>
<div style="display: flex;min-width: 120px;justify-content: space-between;">
<div>\${curr["wave"]}</div>
<div> <a target="_blank" href="/warlog.php?warid=\${curr["battle_id"]}&show_for_all=\${curr["battle_secret"]}<=-1" style="color:\${curr["isLost"] ?? false ? "red" : "green"}">\${getFFAEventBattleSide(curr)}</a></div>
</div>
</div>
</div>
\`;
}, "");
});
}
break;
case 2:
if (battles.AFS.length === 0 && battles.FFA.length === 0 && !lost) $4b17d6e8488eae62$export$ee3c8d0c774798be(target, from.replace("Battles", "FailedBattles"), callback, true);
else where.insertAdjacentHTML("beforeend", getFFAEventBattlesTemplate(lost, battles));
}
}
function getAFSEventBattlesTemplate(lost, battles) {
let result = getBattlesTemplate(battles["AFS"]);
return (0, $eTbLz.getSpoiler)("examples", "AFS", \`<div class="home_button2 btn_hover2" style="margin: 3px 0; min-width: 100px;">\${$4b17d6e8488eae62$var$allTexts.get("examples")} (\${result[1]}/\${result[2]})</div>\`, \`
<div style="display: flex; flex-direction: column">
<div id="search_by_player">
<div id="search_container" style="display: flex;justify-content: space-evenly;">
<input type="text" name="search_nickname" id="search_nickname" placeholder="\${$4b17d6e8488eae62$var$allTexts.get("nickname")}...">
<div id="process_search" class="btn_hover2 home_button2" style="width: 100px">\${$4b17d6e8488eae62$var$allTexts.get("search")}</div>
</div>
<div id="player_battles"></div>
</div>
<div style="text-align: center;">
<h3>\${$4b17d6e8488eae62$var$allTexts.get("afs")}</h3>
</div>
<div style="text-align: center;">\${lost ? $4b17d6e8488eae62$var$allTexts.get("loses") : ""}</div>
\${result[0]}
</div>\`);
}
function getFFAEventBattlesTemplate(lost, battles) {
return \`
<div style="text-align: center"><b>\${$4b17d6e8488eae62$var$allTexts.get("hwmevents")}</b></div>
<div class="battle_examples_container">
<div style="display: flex; flex-direction: column">
<div style="text-align: center;">
<h3>\${$4b17d6e8488eae62$var$allTexts.get("afs")}</h3>
</div>
<div style="text-align: center;">\${lost ? $4b17d6e8488eae62$var$allTexts.get("loses") : ""}</div>
\${getBattlesTemplate(battles["AFS"])[0]}
</div>
<div style="display: flex; flex-direction: column">
<div style="text-align: center;">
<h3>\${$4b17d6e8488eae62$var$allTexts.get("ffa")}</h3>
</div>
<div style="text-align: center;">\${lost ? $4b17d6e8488eae62$var$allTexts.get("loses") : ""}</div>
\${getBattlesTemplate(battles["FFA"], "FFA")[0]}
</div>
</div>\`;
}
function getBattlesTemplate(battles, type = "AFS") {
let result = "";
result += \`<div style="text-align: center;"><h4>\${$4b17d6e8488eae62$var$allTexts.get("your_cl")}</h4></div>\`;
let my_lvl_battles = battles.filter((battle)=>battle["hero_lvl"] === (0, $dIwPZ.pl_lvl));
result += ffaBattlesToHTML(my_lvl_battles);
result += \`<div style="text-align: center;"><h4>\${$4b17d6e8488eae62$var$allTexts.get("another_cl")}</h4><h6>\${$4b17d6e8488eae62$var$allTexts.get("another_cl_army")}</h6></div>\`;
let not_my_lvl_battles = battles.filter((battle)=>battle["hero_lvl"] !== (0, $dIwPZ.pl_lvl));
let cl_buckets = {};
not_my_lvl_battles.forEach((battle)=>{
if (cl_buckets.hasOwnProperty(battle.hero_lvl)) cl_buckets[battle.hero_lvl].push(battle);
else cl_buckets[battle.hero_lvl] = [
battle
];
});
let cl_battles = (0, $dIwPZ.mapToArray)(cl_buckets);
cl_battles = (0, $dIwPZ.sortByKey)(cl_battles, 0).reverse();
cl_battles.forEach((bucket, index)=>{
result += (0, $eTbLz.getSpoiler)(type, index, \`<div class="home_button2 btn_hover2" style="margin: 3px 0; min-width: 100px;">\${bucket[0]}\${$4b17d6e8488eae62$var$allTexts.get("cl")} (\${bucket[1].length})</div>\`, ffaBattlesToHTML(bucket[1]));
});
return [
result,
my_lvl_battles.length,
not_my_lvl_battles.length
];
}
function getCreaturesHTML(battle, index) {
if (currentSilver === 0 || !("creatures" in battle) || !location.href.includes("reaping_event") || Object.keys(creaturesInfo).length === 0) return "";
let creatures = battle.creatures[0];
let totalPrice = Object.entries(creatures).reduce((prev, [portrait, amount])=>{
return prev + creaturesInfo[portrait][1] * amount;
}, 0);
let playerCreaturesHTML = "";
Object.entries(creatures).forEach(([creaturePortrait, creatureAmount], cellId)=>{
playerCreaturesHTML += \`<div id="creature-\${index}-\${cellId}">\${(0, $eTbLz.getNewCreatureIcon)(creaturePortrait, creatureAmount, "good-creature")}</div>\`;
});
return \`
<div style="width: 80%;display: flex;justify-content: space-between;">
<div class="record-player-creatures" id="creatures-\${index}">
<div id="creatures-\${index}-apply" class="creatures-apply">
\${totalPrice <= currentSilver ? \`<div id="creatures-\${index}-apply-button" class="home_button2 btn_hover2" onclick="sendApplyArmy('\${battle.battle_id}')" >\${$4b17d6e8488eae62$var$allTexts.get("hire")}</div>\` : ""}
<div id="creatures-\${index}-leadership" class="player-leadership">
<img height="24" src="https://\${0, $dIwPZ.cdnHost}/i/adv_ev_silver48.png" alt="">
<span id="leadership-number-\${index}" style="color: \${totalPrice <= currentSilver ? "green" : "red"}">
\${totalPrice}
</span>
</div>
</div>
<div id="creatures-\${index}-creatures" class="player-creatures-row">\${playerCreaturesHTML}</div>
</div>
</div>
\`;
}
let applyingArmy = false;
async function sendApplyArmy(battleId) {
if (applyingArmy) return;
applyingArmy = true;
document.body.style.cursor = "wait";
let creatures = battles["AFS"].find((battle)=>battle.battle_id === battleId).creatures[0];
let doc = await (0, $aqxxv.doGet)("/reaping_event_set.php", true);
let creaturesToRemove = Array.from(doc.querySelectorAll("#ne_set_current_army .cre_creature")).reduce((result, elem)=>{
if (elem.children.length > 2) {
let portrait = elem.innerHTML.match(/portraits\/([a-zA-Z0-9_-]+)p33/)[1];
let creatureId = creaturesInfo[portrait][0];
let amount = elem.children[2].innerText - 0;
let price = creaturesInfo[portrait][1];
result[creatureId] = {
portrait: portrait,
amount: amount,
price: price
};
}
return result;
}, {});
for (const [creatureId, creatureInfo] of Object.entries(creaturesToRemove)){
if (creatureInfo.portrait in creatures && creatures[creatureInfo.portrait] === creatureInfo.amount) continue;
let url = new URL(\`https://\${location.host}/reaping_event_set.php\`);
url.searchParams.set("del", creatureId);
url.searchParams.set("sign", (0, $dIwPZ.my_sign));
url.searchParams.set("js", "1");
url.searchParams.set("rand", (Math.random() * 1000000).toString());
await (0, $aqxxv.doGet)(url.toString(), true);
}
doc = await (0, $aqxxv.doGet)("/reaping_event_set.php", true);
let creaturesToSell = Array.from(doc.querySelectorAll("#ne_set_available_troops .cre_creature")).reduce((result, elem)=>{
let portrait = elem.innerHTML.match(/portraits\/([a-zA-Z0-9_-]+)p33/)[1];
let creatureId = creaturesInfo[portrait][0];
let amount = elem.children[2].innerText - 0;
let price = creaturesInfo[portrait][1];
result[creatureId] = {
portrait: portrait,
amount: amount,
price: price
};
return result;
}, {});
for (const [creatureId, creatureInfo] of Object.entries(creaturesToSell)){
if (creatureInfo.portrait in creatures && creatures[creatureInfo.portrait] === creatureInfo.amount) continue;
let url = new URL(\`https://\${location.host}/reaping_event_set.php\`);
url.searchParams.set("act", "sell_unit");
url.searchParams.set("mid", creatureId);
url.searchParams.set("price", creatureInfo.price);
url.searchParams.set("sign", (0, $dIwPZ.my_sign));
url.searchParams.set("js", "1");
url.searchParams.set("rand", (Math.random() * 1000000).toString());
await (0, $aqxxv.doGet)(url.toString(), true);
}
for (const [portrait, amount] of Object.entries(creatures)){
if (creaturesInfo[portrait][0] in creaturesToSell && creaturesToSell[creaturesInfo[portrait][0]].amount === amount) continue;
let url = new URL(\`https://\${location.host}/reaping_event_set.php\`);
url.searchParams.set("act", "buy");
url.searchParams.set("mid", creaturesInfo[portrait][0]);
url.searchParams.set("price", creaturesInfo[portrait][1]);
url.searchParams.set("cnt", amount.toString());
url.searchParams.set("sign", (0, $dIwPZ.my_sign));
url.searchParams.set("js", "1");
url.searchParams.set("rand", (Math.random() * 1000000).toString());
await (0, $aqxxv.doGet)(url.toString(), true);
}
location.reload();
// applyingArmy = false
}
function ffaBattlesToHTML(battles) {
if (battles.length > 0) {
battles.sort((a, b)=>a.nickname.localeCompare(b.nickname));
return (0, $dIwPZ.groupBy)(battles, "nickname").reduce((prev, curr, index)=>{
let creatures = getCreaturesHTML(curr[0], index);
return prev + \`
<div class="hwm_event_example_block">
<div style="width: 80%;display: flex;justify-content: space-between;">
<div>\${curr[0].is_clan ? \`<img src="https://www.freeiconspng.com/thumbs/lock-icon/black-lock-icon-14.png" style="height: 14px;">\` : ""}\${index + 1}. </div>
<div style="text-align: center"> <a href="/pl_info.php?nick=\${(0, $dIwPZ.encode)(curr[0]["nickname"])}" class="pi" target="_blank">\${curr[0]["nickname"]}</a></div>
<div style="display: flex;min-width: 120px;justify-content: space-between;">
\${(0, $dIwPZ.sortByKey)(curr, "battle_side").reduce((prev_entry, curr_entry)=>{
return prev_entry + \`
<div> <a target="_blank" href="/warlog.php?warid=\${curr_entry["battle_id"]}&show_for_all=\${curr_entry["battle_secret"]}<=-1">\${getFFAEventBattleSide(curr_entry)}</a></div>
\`;
}, "")}
</div>
</div>
\${creatures}
</div>
\`;
}, "");
} else return \`<div style="text-align: center;"><h5>\${$4b17d6e8488eae62$var$allTexts.get("empty")}</h5></div>\`;
}
function getClassById(id) {
for(let i = 0; i < (0, $dIwPZ.allClasses).length; i++){
if (id === (0, $dIwPZ.allClasses)[i][4]) return (0, $dIwPZ.allClasses)[i];
}
return null;
}
function getFFAEventBattleSide(battle) {
let class_img = "class" in battle && getClassById(battle["class"]) ? \`<img style="vertical-align: middle; height: 16px" src="https://\${0, $dIwPZ.cdnHost}/i/f/\${getClassById(battle["class"])[3]}?v=1.1" alt=""> \` : "";
if ("battle_side" in battle) {
if (battle["battle_side"] === 0) return \`\${class_img}\${$4b17d6e8488eae62$var$allTexts.get("enemy")}#1\`;
else if (battle["battle_side"] === 1) return \`\${class_img}\${$4b17d6e8488eae62$var$allTexts.get("enemy")}#2\`;
else return \`\${class_img}\${$4b17d6e8488eae62$var$allTexts.get("battle")}\`;
} else return \`\${class_img}\${$4b17d6e8488eae62$var$allTexts.get("battle")}\`;
}
return battles;
}
});
parcelRequire.register("av1kA", function(module, exports) {
$parcel$export(module.exports, "default", () => $7a4dd4ee2fd4704c$export$2e2bcd8739ae039);
var $8l3id = parcelRequire("8l3id");
var $jWJKf = parcelRequire("jWJKf");
var $dIwPZ = parcelRequire("dIwPZ");
var $afXBq = parcelRequire("afXBq");
function $7a4dd4ee2fd4704c$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("hide_faction_event_enemies", "Show enemies with max power only", "Показывать противников только с максимальной мощностью", "Показувати супротивників лише з максимальною потужністю"));
texts.addText(new (0, $afXBq.LocalizedText)("mana_warning", "Enemies are stealing mana!", "В армии противника пожиратели маны!", "В армії противника крадії мани!"));
texts.addText(new (0, $afXBq.LocalizedText)("faction_custom_ins", \`Enable unit placement saving
<img src="https://hwm.events/battles/custom_ins.gif" height="400px" onclick='event.stopPropagation()'>
(fields with different height require different saved placement)
\`, \`Возможность автоматической расстановки
<img src="https://hwm.events/battles/custom_ins.gif" height="400px" onclick='event.stopPropagation()'>
(для полей разной высоты нужна своя расстановка)
\`, \`Можливість автоматичного розміщення
<img src="https://hwm.events/battles/custom_ins.gif" height="400px" onclick='event.stopPropagation()'>
(для поля різної висоти потрібне своє розміщення)
\`));
texts.addText(new (0, $afXBq.LocalizedText)("custom_ins_auto", "Automatically apply saved placement", \`Автоматически применять сохраненную расстановку\`, "Автоматично застосовувати збережене розміщення"));
return texts;
}
let $7a4dd4ee2fd4704c$var$allTexts = $7a4dd4ee2fd4704c$var$getAllTexts();
function $7a4dd4ee2fd4704c$export$2e2bcd8739ae039() {
function showManaWarning(enemies) {
enemies.forEach((enemy)=>{
let 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", \`
<div><b style="color: red">\${$7a4dd4ee2fd4704c$var$allTexts.get("mana_warning")}</b></div>
\`);
});
}
if (location.href.includes("faction_event")) {
(0, $8l3id.setLeaderboard)(document.querySelector("#hwm_for_zoom > div > div:nth-child(1) > div > div:nth-child(2) > center"));
(0, $jWJKf.eventHelperSettings)(document.querySelector("#hwm_for_zoom > div > div.frac_event_right_block > div > div:nth-child(2)"), (container)=>{
(0, $jWJKf.setSettings)("hide_faction_event_enemies", $7a4dd4ee2fd4704c$var$allTexts.get("hide_faction_event_enemies"), container, false);
(0, $jWJKf.setSettings)("faction_custom_ins", $7a4dd4ee2fd4704c$var$allTexts.get("faction_custom_ins"), container, true);
(0, $jWJKf.setSettings)("custom_ins_auto", $7a4dd4ee2fd4704c$var$allTexts.get("custom_ins_auto"), container, false);
}, "beforeend");
let enemies = getEnemies();
let maxPower = getMaxPower(enemies);
if ((0, $dIwPZ.get)("hide_faction_event_enemies", false)) filterFactionEventEnemies(enemies, maxPower);
showManaWarning(enemies);
}
function getEnemies() {
return Array.from(document.getElementsByClassName("frac_enemy_block"));
}
function getMaxPower(enemies) {
return enemies.reduce((prev, curr)=>{
let power = curr.children[3].innerText.split(": ")[1] - 0;
return power > prev ? power : prev;
}, 0);
}
function filterFactionEventEnemies(enemies, maxPower) {
enemies.forEach((enemy)=>{
let power = enemy.children[3].innerText.split(": ")[1] - 0;
if (power < maxPower) enemy.remove();
});
}
}
});
parcelRequire.register("jbjeJ", function(module, exports) {
$parcel$export(module.exports, "default", () => $df6df76886fa26a3$export$2e2bcd8739ae039);
var $8l3id = parcelRequire("8l3id");
var $jWJKf = parcelRequire("jWJKf");
var $dIwPZ = parcelRequire("dIwPZ");
var $ao0pt = parcelRequire("ao0pt");
var $6rIzz = parcelRequire("6rIzz");
var $aqxxv = parcelRequire("aqxxv");
var $afXBq = parcelRequire("afXBq");
var $eTbLz = parcelRequire("eTbLz");
function $df6df76886fa26a3$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("auto_send_rogues_event", "Send battles from the rogue event to the service automatically", "Отправлять бои из разбойничьего ивента в сервис автоматически", "Відправляти бої з розбійницького івента у сервіс автоматично"));
texts.addText(new (0, $afXBq.LocalizedText)("only_clan_visibility", "My battles are only available to the clan", "Мои бои доступны только для клана", "Мої бої доступні лише для клану"));
texts.addText(new (0, $afXBq.LocalizedText)("collapse_event_desc", "Always collapse fight descriptions", "Всегда сворачивать описания боев", "Завжди згортати описи боїв"));
texts.addText(new (0, $afXBq.LocalizedText)("hide_rogues_event_enemies", "Show price statistics", "Показывать статистику цен", "Показувати статистику цін"));
texts.addText(new (0, $afXBq.LocalizedText)("return_to_prev_level", "Return to an unfinished level", "Возвращать на незавершенный уровень", "Повертати на незавершений рівень"));
texts.addText(new (0, $afXBq.LocalizedText)("bought", "bought", "куплено", "куплено"));
texts.addText(new (0, $afXBq.LocalizedText)("sold", "sold", "продано", "продано"));
texts.addText(new (0, $afXBq.LocalizedText)("trade_for", "for", "по", "по"));
texts.addText(new (0, $afXBq.LocalizedText)("trade_history", "Trade history", "История покупок и продаж", "Історія покупок та продажів"));
texts.addText(new (0, $afXBq.LocalizedText)("show_event_timer", "Show time until the end of the event", "Показывать время до конца ивента", "Показувати час до кінця івента"));
texts.addText(new (0, $afXBq.LocalizedText)("show_top_clan_attempts", "Show remaining attempts for TOP3 clans", "Показывать оставшиеся попытки у ТОП3 кланов", "Показувати спроби, що залишилися, у ТОП3 кланів"));
texts.addText(new (0, $afXBq.LocalizedText)("hire_hint", "Red means higher prices, while green means the opposite. At this event, the cost of a creature can only be within + -15% of the initial cost. Thus, if 115% is written next to the price, it will no longer rise upwards, and if the price is 85%, then it will no longer fall either.", "Красный цвет значит подорожание, а зеленый наоборот. На этом ивенте цена существа может находиться только в пределах +-15% от изначальной стоимости. Таким образом, если рядом с ценой написано 115%, она больше расти вверх не будет, а если цена 85%, то падать больше не будет тоже.", "Червоний колір означає подорожчання, а зелений – навпаки. На цьому івенті ціна істоти може бути лише в межах +-15% від початкової вартості. Таким чином, якщо поряд з ціною написано 115%, вона більше не зростатиме, а якщо ціна 85%, то падати більше не буде теж."));
return texts;
}
let $df6df76886fa26a3$var$allTexts = $df6df76886fa26a3$var$getAllTexts();
function $df6df76886fa26a3$export$2e2bcd8739ae039() {
if (location.href.includes("naym_event.")) {
// addFilteringArea()
// processFilters()
(0, $8l3id.setLeaderboard)(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).getElementsByTagName("center")).at(-1));
if ((0, $dIwPZ.get)("show_top_clan_attempts", true)) (0, $8l3id.setTopClanAttempts)(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).getElementsByTagName("table")).at(-1));
(0, $jWJKf.eventHelperSettings)(Array.from(document.querySelectorAll(".global_container_block")).at(-1).firstChild, (container)=>{
(0, $jWJKf.setSettings)("auto_send_rogues_event", $df6df76886fa26a3$var$allTexts.get("auto_send_rogues_event"), container);
(0, $jWJKf.setSettings)("only_clan_visibility", $df6df76886fa26a3$var$allTexts.get("only_clan_visibility"), container, false);
(0, $jWJKf.setSettings)("collapse_event_desc", $df6df76886fa26a3$var$allTexts.get("collapse_event_desc"), container, false);
(0, $jWJKf.setSettings)("hide_rogues_event_enemies", $df6df76886fa26a3$var$allTexts.get("hide_rogues_event_enemies"), container);
(0, $jWJKf.setSettings)("return_to_prev_level", $df6df76886fa26a3$var$allTexts.get("return_to_prev_level"), container, false);
(0, $jWJKf.setSettings)("show_top_clan_attempts", $df6df76886fa26a3$var$allTexts.get("show_top_clan_attempts"), container);
(0, $jWJKf.setSettings)("show_event_timer", $df6df76886fa26a3$var$allTexts.get("show_event_timer"), container);
}, "afterbegin");
(0, $dIwPZ.set)("eh_current_level", null);
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
(0, $ao0pt.collapseEventDesc)();
(0, $ao0pt.setClickableLevels)();
(0, $6rIzz.getEventBattles)(Array.from(document.querySelectorAll(".global_container_block")).at(-2), "getRoguesEventBattles", 1);
interceptButtons();
}
if (location.href.includes("naym_event_set")) {
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
Array.from(document.querySelectorAll(".hwm_event_block_header")).at(-1).insertAdjacentHTML("beforeend", \`
<div class="hwm_event_block_miniheader">\${$df6df76886fa26a3$var$allTexts.get("hire_hint")}</div>
\`);
let buy_history = (0, $dIwPZ.get)("buy_history", []);
if ((0, $dIwPZ.get)("hide_rogues_event_enemies", true)) {
let newScript = document.createElement("script");
newScript.setAttribute("src", "https://cdn.jsdelivr.net/npm/chart.js");
document.head.appendChild(newScript);
newScript.onload = ()=>{
showPriceChange();
};
} else showPriceChange();
setTotalPrice();
setListeners();
showBuyHistory();
setInterval(()=>{
if (!(0, $dIwPZ.$)("set_check")) {
setListeners();
showPriceChange();
showBuyHistory();
}
}, 100);
function drawChart(prices, index, elem) {
elem.insertAdjacentHTML("afterend", \`
<tr>
<td colspan="3">
<div style="height: 165px; overflow: hidden">
<canvas id="chart\${index}" height="150" style="width: 100%"></canvas>
</div>
</td>
</tr>\`);
function padTo2Digits(num) {
return num.toString().padStart(2, "0");
}
function formatDate(date) {
return [
padTo2Digits(date.getHours()),
"00"
].join(":") + " " + [
padTo2Digits(date.getDate()),
date.toLocaleString("default", {
month: "long"
})
].join("-");
}
let date = new Date(1681783201000);
const labels = prices.map(()=>{
let label = formatDate(date);
date.setHours(date.getHours() + 1);
return label;
});
const data = {
labels: labels,
datasets: [
{
label: "Price",
data: prices.map((price)=>parseInt(price)),
borderColor: "rgb(100,100,100)",
backgroundColor: "rgb(116,152,168)",
pointStyle: "circle",
pointRadius: 1.5,
pointHoverRadius: 5
}
]
};
const 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
},
grid: {
display: false
}
},
y: {
grid: {
display: false
}
}
},
interaction: {
mode: "index",
intersect: false
}
}
};
const ctx = document.getElementById(\`chart\${index}\`).getContext("2d");
const myChart = new Chart(ctx, config);
}
async function showPriceChange() {
let doc = await (0, $aqxxv.doGet)(\`getRoguesCreaturesPrices\`, false);
Array.from(document.querySelector("#ne_set_troops_on_market").querySelectorAll(".hwm_event_set_stack_block")).filter((elem)=>elem.innerHTML.includes("cre_creature")).forEach((elem, index)=>{
let creatureName = elem.innerHTML.match(/name=([a-zA-Z0-9]+)/)[1];
let prices = doc[creatureName].map((price)=>price - 0);
let priceElem = elem.querySelectorAll(".txt_with_icons")[1];
if (prices[prices.length - 1] - 0 > prices[prices.length - 2] - 0) elem.style.background = "#ff9e9e";
else if (prices[prices.length - 1] - 0 < prices[prices.length - 2] - 0) elem.style.background = "#9eff98";
priceElem.insertAdjacentHTML("beforeend", \` (\${Math.max(Math.min(Math.round(prices.at(-1) / prices[0] * 100), 115), 85)}%)\`);
Array.from(elem.querySelectorAll('input[type="submit"]')).forEach((input)=>{
input.classList.add("btn_hover2", "home_button2");
});
if ((0, $dIwPZ.get)("hide_rogues_event_enemies", true)) drawChart(prices, index, elem);
});
}
function showBuyHistory() {
if (buy_history.length > 0) {
let rows = (0, $dIwPZ.groupBy)((0, $dIwPZ.sortByKey)(buy_history, "time").reverse(), "name").reduce((result, currCreatureList)=>{
return result + \`
<div style="display: flex; justify-content: space-evenly;align-items: center;padding: 0" class="hwm_event_set_stack_block">
\${(0, $eTbLz.getSpoiler)(currCreatureList[0].name, "", \`
<div style="width: 40px">
<img src="https://cfcdn.lordswm.com/i/portraits/\${currCreatureList[0].name}anip33.png" style="height: 48px; width: 48px; border-radius: 50%; object-fit: cover;" alt="">
</div>
\`, currCreatureList.reduce((prev, curr)=>{
return prev + \`
<div style="display: flex; justify-content: space-evenly;align-items: center;padding: 0" class="hwm_event_set_stack_block">
<div>
\${new Date(curr.time).toLocaleTimeString()}
</div>
<div>
\${curr.action === "buy" ? \`<p style='color: green'>\${$df6df76886fa26a3$var$allTexts.get("bought")}</p>\` : \`<p style='color: red'>\${$df6df76886fa26a3$var$allTexts.get("sold")}</p>\`}
</div>
<div>
\${curr.count}
</div>
<div>
<div style="width: 40px"><img src="https://cfcdn.lordswm.com/i/portraits/\${curr.name}anip33.png" style="height: 48px; width: 48px; border-radius: 50%; object-fit: cover;" alt=""></div>
</div>
<div>
\${$df6df76886fa26a3$var$allTexts.get("trade_for")} \${curr.price}
</div>
</div>
\`;
}, ""), "roguesSpoilerWrapper", "roguesSpoilerLabel")}
</div>
\`;
}, "");
document.querySelector("#ne_set_available_troops").insertAdjacentHTML("beforeend", \`
<div style="display: flex; flex-direction: column">
<div style="text-align: center"><h3>\${$df6df76886fa26a3$var$allTexts.get("trade_history")}</h3></div>
\${rows}
</div>
\`);
}
}
function setTotalPrice() {
let totalPrice = Array.from(document.querySelector("#ne_set_available_troops").querySelectorAll(".hwm_event_set_stack_block")).map((elem)=>{
return parseInt(Array.from(elem.querySelectorAll(".txt_with_icons.hwm_ne_event_img_q")).at(-1).innerText.replace(",", ""));
}).reduce((previousValue, currentValue)=>previousValue + currentValue, 0).toLocaleString();
document.querySelector("#ne_set_now_power").insertAdjacentHTML("afterend", \`
<span id="ne_set_now_power" class="txt_with_icons hwm_ne_event_img_q" style="font-weight: bold; background-image: url('https://dcdn.heroeswm.ru/i/adv_ev_silver48.png')">\${totalPrice}</span>
\`);
}
function setListeners() {
document.querySelector("#ne_set_available_troops").insertAdjacentHTML("beforeend", \`<div id="set_check"><div>\`);
Array.from(document.querySelector("#ne_set_available_troops").children).filter((elem)=>elem.innerHTML.includes("cre_creature")).forEach((elem, index)=>{
let creatureName = elem.innerHTML.match(/\?name=([a-zA-Z0-9_-]+)/)[1];
let creatureCount = elem.querySelector(".cre_amount").innerText - 0;
let creatureHistory = (0, $dIwPZ.groupByKey)((0, $dIwPZ.sortByKey)(buy_history, "time").reverse(), "name")[creatureName] ?? [];
let recentPurchases = [];
creatureHistory.some((item)=>{
if ("sell" === item.action) return true;
else recentPurchases.push(item);
});
let [totalCount, totalPrice] = recentPurchases.reduce(([resultCount, resultPrice], currentPurchase)=>{
return [
resultCount + currentPurchase["count"],
resultPrice + currentPurchase["count"] * currentPurchase["price"]
];
}, [
0,
0
]);
let target = Array.from(elem.querySelectorAll(".txt_with_icons.hwm_ne_event_img_q")).at(-1);
if (totalPrice !== 0) {
let currentPriceElement = target.firstChild;
let currentPrice = currentPriceElement.innerText.replace(",", "") - 0;
if (totalCount === creatureCount) {
if (currentPrice > totalPrice) currentPriceElement.style.color = "green";
else if (currentPrice < totalPrice) currentPriceElement.style.color = "red";
}
target.insertAdjacentHTML("beforeend", \`
\${$df6df76886fa26a3$var$allTexts.get("bought")} \${totalCount} \${$df6df76886fa26a3$var$allTexts.get("trade_for")} \${totalPrice}
\`);
}
let submit = elem.querySelector("input[type=submit]");
if (submit) {
let data = submit["onclick"].toString();
let findings = data.match(/(\d{1,5}), '([a-zA-Z0-9_-]+)', '(\d{0,3},?\d{1,3})', (\d{1,5})\)/);
let price = parseInt(findings[4].replace(",", ""));
let count = parseInt(findings[1]);
let name = findings[2];
let time = Date.now();
submit.addEventListener("click", ()=>{
buy_history.push({
"name": name,
"price": price,
"count": count,
"time": time,
"action": "sell"
});
(0, $dIwPZ.set)("buy_history", buy_history.filter((elem)=>Date.now() - elem.time < 1209600000));
});
}
});
Array.from(document.querySelector("#ne_set_troops_on_market").querySelectorAll(".hwm_event_set_stack_block")).filter((elem)=>elem.innerHTML.includes("cre_creature")).forEach((elem, index)=>{
let submit = elem.querySelector("div[id^=ne_set_button]");
if (submit) {
let submit_a = submit.querySelector("a");
submit.addEventListener("click", ()=>{
let data = submit_a["onclick"].toString();
let findings = data.match(/'([a-zA-Z0-9_-]+)', (\d{1,5})\)/);
let price = parseInt(elem.querySelector("input[id^=ne_set_market_price]").value);
let count = parseInt(elem.querySelector("select[name=cnt]").value);
let name = findings[1];
let time = Date.now();
buy_history.push({
"name": name,
"price": price,
"count": count,
"time": time,
"action": "buy"
});
(0, $dIwPZ.set)("buy_history", buy_history.filter((elem)=>Date.now() - elem.time < 1209600000));
});
}
});
}
}
function interceptButtons() {
let buttons = Array.from(document.querySelectorAll("input[id^=ne_attack_button]"));
if (buttons.length === 2) {
let available = 2 - buttons.filter((x)=>x.disabled).length;
buttons.forEach((button, index)=>{
button.addEventListener("mousedown", ()=>{
(0, $dIwPZ.set)("event_battle_side", index % 2);
(0, $dIwPZ.set)("eh_current_level", [
(0, $ao0pt.getCurrentLevel)(),
available
]);
});
});
}
}
}
});
parcelRequire.register("2jsww", function(module, exports) {
$parcel$export(module.exports, "default", () => $1af37b4d2518eafd$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $8l3id = parcelRequire("8l3id");
var $jWJKf = parcelRequire("jWJKf");
var $aqxxv = parcelRequire("aqxxv");
var $afXBq = parcelRequire("afXBq");
var $ao0pt = parcelRequire("ao0pt");
function $1af37b4d2518eafd$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("item", "Item", "Товар", "Товар"));
texts.addText(new (0, $afXBq.LocalizedText)("profit", "Profit per 1t.", "Прибыль за 1т.", "Прибуток за 1т."));
texts.addText(new (0, $afXBq.LocalizedText)("weight", "Weight", "Вес", "Вага"));
texts.addText(new (0, $afXBq.LocalizedText)("prices", "Prices", "Цены", "Ціни"));
texts.addText(new (0, $afXBq.LocalizedText)("buy", "Buy", "Купить", "Придбати"));
texts.addText(new (0, $afXBq.LocalizedText)("fill_max", "Load maximum", "Набрать максимум", "Набрати максимум"));
texts.addText(new (0, $afXBq.LocalizedText)("hire_all", "Recruit all", "Нанять всех", "Найняти всіх"));
texts.addText(new (0, $afXBq.LocalizedText)("fill_maxoff5", "Load -5 from the maximum", "Набрать -5 от максимума", "Набрати -5 від максимуму"));
texts.addText(new (0, $afXBq.LocalizedText)("fill_process", "Loading in progress", "Идет погрузка", "Триває навантаження"));
texts.addText(new (0, $afXBq.LocalizedText)("auto_return_after_battle", "Auto return after battle", "Автовозврат после боя", "Автоповернення після бою"));
texts.addText(new (0, $afXBq.LocalizedText)("show_autofill_options", "Buttons for fast loading", "Кнопки для быстрой загрузки", "Кнопки для швидкого завантаження"));
texts.addText(new (0, $afXBq.LocalizedText)("sort_products", "Sort products by profit", "Сортировать товары по прибыли", "Сортувати товари за прибутком"));
texts.addText(new (0, $afXBq.LocalizedText)("show_event_timer", "Show time until the end of the event", "Показывать время до конца ивента", "Показувати час до кінця івента"));
texts.addText(new (0, $afXBq.LocalizedText)("show_ship_available_alert", "Notify about new ship", "Уведомлять о новом корабле", "Повідомляти про новий корабель"));
texts.addText(new (0, $afXBq.LocalizedText)("ship_available_alert", "STOP! New ship is available", "СТОЙ! Доступен новый корабль", "СТІЙ! Доступний новий корабель"));
return texts;
}
let $1af37b4d2518eafd$var$allTexts = $1af37b4d2518eafd$var$getAllTexts();
function $1af37b4d2518eafd$export$2e2bcd8739ae039() {
if (location.href.includes("pirate_event.")) {
document.querySelector(".pirate_event_blocks").style.width = "100%";
document.querySelector("#set_mobile_max_width").style.justifyContent = "center";
document.querySelector(".global_inside_shadow.pirate_event_picture").remove();
Array.from(document.querySelectorAll("#tableDiv")).forEach((tdiv)=>{
tdiv.style.height = "max-content";
tdiv.firstChild.style.position = "unset";
});
if ((0, $dIwPZ.get)("show_ship_available_alert", true)) {
let isNewShipAvailable = false;
let newShipButton = Array.from(document.querySelectorAll("input[type='submit']")).filter((input)=>input.nextElementSibling?.value === "buy_new_ship");
if (newShipButton.length > 0) isNewShipAvailable = !newShipButton[0].disabled;
let battleButton = Array.from(document.querySelectorAll("input[type='submit']")).filter((input)=>input.parentElement.previousElementSibling?.value === "go_go_go")[0];
let isBattleAvailable = !battleButton.disabled;
if (isNewShipAvailable && isBattleAvailable) {
battleButton.insertAdjacentHTML("beforebegin", \`<p><b style="color: red">\${$1af37b4d2518eafd$var$allTexts.get("ship_available_alert")}</b></p>\`);
let wasPrank = false;
battleButton.addEventListener("mouseover", ()=>{
if (!wasPrank) {
battleButton.style.transform = "translateX(100px)";
wasPrank = true;
}
});
}
}
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
let tableDiv = document.querySelectorAll("#tableDiv")[2];
let trs = tableDiv.querySelector("table > tbody").childNodes;
let items = Array.from(trs).filter((item)=>item.querySelector("td:nth-child(5)").innerHTML.length > 100).map((item)=>{
let item_info = {};
item_info.name = item.querySelector("td:nth-child(1) > img").src;
item_info.res_id = item.querySelector(\`input[name="res_id"]\`).value;
item_info.weight = item.querySelector("td:nth-child(2)").innerText - 0;
item_info.buy_price = item.querySelector("td:nth-child(3) table > tbody > tr > td:nth-child(2)").innerText.replace(/,/g, "") - 0;
item_info.sell_price = item.querySelector("td:nth-child(4) table > tbody > tr > td:nth-child(2)").innerText.replace(/,/g, "") - 0;
item_info.buy_form = item.querySelector("td:nth-child(5)").innerHTML;
item_info.profit = item_info.sell_price - item_info.buy_price;
item_info.opt_price = item_info.profit / item_info.weight;
return item_info;
});
let itemsMap = (0, $dIwPZ.arrayToMapByKey)(items, "name");
items = (0, $dIwPZ.sortByKey)(items, "opt_price", -1);
let template = getPirateEventTemplate(items);
let target_td = document.querySelectorAll("#tableDiv")[2];
if ((0, $dIwPZ.get)("sort_products", true)) {
target_td.removeChild(target_td.childNodes[0]);
target_td.insertAdjacentHTML("beforeend", template);
}
let tonns = (0, $dIwPZ.findAll)(/[- ](\d{1,3}) [tт]\.\n[a-zA-Zа-яА-Я]+: (\d{1,3}) [tт]/, document.querySelectorAll("#tableDiv")[0].querySelector(" table > tbody > tr:nth-child(2) > td").innerText);
let maxCapacity = tonns[0][1] - 0;
let currentCapacity = tonns[0][2] - 0;
if (currentCapacity === 0 && (0, $dIwPZ.get)("show_autofill_options", true)) {
target_td.insertAdjacentHTML("beforeend", \`
<div id="fill_container">
<div id="fill_result" style="display: none; flex-direction: column; align-items: center">
<div><img src="https://hwm.events/img/shiploading.gif" width="300"></div>
<div><p><b>\${$1af37b4d2518eafd$var$allTexts.get("fill_process")}</b></p></div>
</div>
<div id="fill_options" style="display: flex; flex-direction: column; align-items: center">
<div id="fill_max" class="home_button2 btn_hover2" style="width: 80%; margin-bottom: 10px">\${$1af37b4d2518eafd$var$allTexts.get("fill_max")}</div>
<div id="fill_maxOff5" class="home_button2 btn_hover2" style="width: 80%;">\${$1af37b4d2518eafd$var$allTexts.get("fill_maxoff5")}</div>
</div>
</div>
\`);
async function fillShip(itemsForCapacity) {
(0, $dIwPZ.$)(\`fill_result\`).style.display = "flex";
(0, $dIwPZ.$)(\`fill_options\`).remove();
(0, $dIwPZ.$)(\`items_container\`)?.remove();
for (const item of itemsForCapacity){
let count = item[1];
let res_id = itemsMap[item[0]].res_id;
let formData = new FormData();
formData.append("action", "load");
formData.append("buy_cnt", count);
formData.append("res_id", res_id);
formData.append("sign", (0, $dIwPZ.my_sign));
await (0, $aqxxv.doPost)(\`/pirate_event.php\`, formData, true);
}
}
(0, $dIwPZ.$)(\`fill_max\`).addEventListener("click", async ()=>{
await fillShip(getItemsForCapacity(items, maxCapacity));
setTimeout(()=>location.reload(), 500);
});
(0, $dIwPZ.$)(\`fill_maxOff5\`).addEventListener("click", async ()=>{
await fillShip(getItemsForCapacity(items, maxCapacity - 5));
setTimeout(()=>location.reload(), 500);
});
}
(0, $jWJKf.eventHelperSettings)(target_td, (container)=>{
(0, $jWJKf.setSettings)("auto_return_after_battle", $1af37b4d2518eafd$var$allTexts.get("auto_return_after_battle"), container);
(0, $jWJKf.setSettings)("show_autofill_options", $1af37b4d2518eafd$var$allTexts.get("show_autofill_options"), container);
(0, $jWJKf.setSettings)("sort_products", $1af37b4d2518eafd$var$allTexts.get("sort_products"), container);
(0, $jWJKf.setSettings)("show_event_timer", $1af37b4d2518eafd$var$allTexts.get("show_event_timer"), container);
(0, $jWJKf.setSettings)("show_ship_available_alert", $1af37b4d2518eafd$var$allTexts.get("show_ship_available_alert"), container);
});
}
function getItemsForCapacity(items, target) {
const lookup = Array.apply(null, Array(target + 1)).map(()=>{
return {
items: [],
totalProfit: 0
};
});
for(let i = 0; i <= target; i++)for(let j = 0; j < items.length; j++){
if (items[j].weight <= i) {
if (lookup[i].totalProfit < lookup[i - items[j].weight].totalProfit + items[j].profit) {
let newItems = JSON.parse(JSON.stringify(lookup[i - items[j].weight].items));
newItems.push(items[j]);
lookup[i].items = newItems;
lookup[i].totalProfit = lookup[i - items[j].weight].totalProfit + items[j].profit;
}
}
}
return Object.entries((0, $dIwPZ.groupByKey)(lookup[target].items, "name")).map(([key, value])=>[
key,
value.length
]);
}
if (location.href.includes("pirate_land")) {
if ((0, $dIwPZ.get)("auto_return_after_battle", true)) document.querySelector("input[type=submit]").click();
}
function getPirateEventTemplate(items) {
let final_str = \`
<style>
.items-container {
display: flex;
flex-direction: column;
}
.items-row {
display: flex;
}
.item-itself {
display: flex;
justify-content: center;
align-items: center;
}
.item-itself:nth-child(1) {
width: 15%;
}
.item-itself:nth-child(2) {
width: 20%;
}
.item-itself:nth-child(3) {
width: 11%;
}
.item-itself:nth-child(4) {
width: 27%;
}
.item-itself:nth-child(5) {
width: 27%;
}
</style>
<div class="items-container" id="items_container">
<div class="items-row">
<div class="item-itself">\${$1af37b4d2518eafd$var$allTexts.get("item")}</div>
<div class="item-itself">\${$1af37b4d2518eafd$var$allTexts.get("profit")}</div>
<div class="item-itself">\${$1af37b4d2518eafd$var$allTexts.get("weight")}</div>
<div class="item-itself">\${$1af37b4d2518eafd$var$allTexts.get("prices")}</div>
<div class="item-itself">\${$1af37b4d2518eafd$var$allTexts.get("buy")}</div>
</div>\`;
items.forEach((item)=>{
final_str += \`
<div class="items-row">
<div class="item-itself"><img src="\${item.name}" height="48" alt="icon"></div>
<div class="item-itself">\${item.opt_price.toFixed(2)}</div>
<div class="item-itself">\${item.weight}</div>
<div class="item-itself">\${item.buy_price}->\${item.sell_price}</div>
<div class="item-itself">\${item.buy_form.toString().replaceAll("Погрузить", "Купить").replaceAll("Load", "Buy")}</div>
</div>\`;
});
return final_str + \`</div>\`;
}
if (location.href.includes("pirate_self_event.")) {
(0, $8l3id.setLeaderboard)(Array.from(document.querySelectorAll('table[width="100%"][align="left"]')).slice(-1)[0].previousElementSibling, "afterbegin", false, true);
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(Array.from(document.querySelectorAll(".global_container_block_header")).at(1));
if ((0, $dIwPZ.get)("show_top_clan_attempts", true)) (0, $8l3id.setTopClanAttempts)(Array.from(document.querySelectorAll(".global_container_block")[0].getElementsByTagName("table")).at(-1));
let newScript = document.createElement("script");
newScript.setAttribute("src", "https://cdn.jsdelivr.net/npm/chart.js");
document.head.appendChild(newScript);
}
if (location.href.includes("pirate_self_event_set")) {
let availableSilver = parseInt(document.body.innerText.match(/(Доступно серебра|Silver available): (\d{0,3},?\d{1,3})/)[2].replace(",", ""));
Array.from(document.getElementsByClassName("pirate_self_table_padding")).forEach((table)=>{
table.style.position = "unset";
table.parentElement.style.height = "";
});
Array.from(document.getElementsByClassName("pirate_self_table_padding")[1].getElementsByTagName("tr")).filter((elem)=>elem.innerHTML.includes("cre_creature")).forEach((elem, index)=>{
let submit = elem.querySelector("div[id^=but]");
if (submit) {
let name = submit.getAttribute("buystr").match(/mid=([a-zA-Z0-9_-]+)/)[1];
let price = parseInt(submit.getAttribute("buystr").match(/price=(\d{1,6})/)[1]);
let maxAmount = parseInt(elem.innerHTML.match(/(Макс|Max)\. (\d{1,3})/)[2]);
let currentAmount = 0;
let currentHire = Array.from(document.querySelector(".pirate_self_recruit_block_outside").children[0].getElementsByTagName("tr")).filter((elem)=>elem.innerHTML.includes("cre_creature")).filter((elem)=>elem.innerHTML.includes(\`=\${name}"\`));
if (currentHire.length > 0) currentAmount = parseInt(currentHire[0].querySelector(".cre_creature").innerText);
let possibleAmount = maxAmount - currentAmount;
possibleAmount = Math.min(parseInt(availableSilver / price), possibleAmount);
let allSubmit = submit.cloneNode(true);
allSubmit.innerText = $1af37b4d2518eafd$var$allTexts.get("hire_all");
allSubmit.id = \`hire_all_\${index}\`;
allSubmit.setAttribute("style", "");
allSubmit.setAttribute("onclick", \`location="pirate_self_event_set.php?\${submit.getAttribute("buystr")}&cnt=\${possibleAmount}"\`);
submit.insertAdjacentHTML("afterend", allSubmit.outerHTML);
}
});
}
}
});
parcelRequire.register("cyF3r", function(module, exports) {
$parcel$export(module.exports, "default", () => $92488199d9697845$export$2e2bcd8739ae039);
var $8l3id = parcelRequire("8l3id");
var $dIwPZ = parcelRequire("dIwPZ");
function $92488199d9697845$export$2e2bcd8739ae039() {
if (location.href.includes("tj_event2")) {
document.querySelector(".tj_rating").previousElementSibling.remove();
(0, $8l3id.setLeaderboard)(document.querySelector(".tj_rating").parentElement);
let myEventPosition = parseInt(Array.from(document.querySelectorAll('[width="50%"]')[0].getElementsByTagName("tr")).find((elem)=>elem.innerHTML.includes((0, $dIwPZ.pl_id))).firstElementChild.innerText);
document.querySelectorAll('[width="400"]')[0].insertAdjacentHTML("beforeend", \`<br><b>Место: \${myEventPosition}</b>\`);
}
}
});
parcelRequire.register("bUtSC", function(module, exports) {
$parcel$export(module.exports, "default", () => $8abc1a37aa4fbccb$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $aqxxv = parcelRequire("aqxxv");
var $8l3id = parcelRequire("8l3id");
var $ao0pt = parcelRequire("ao0pt");
async function $8abc1a37aa4fbccb$export$2e2bcd8739ae039() {
let loadStarted = false;
let maxPages = 50;
let pageCount = 0;
let battleCount = 0;
if (location.href.includes("tj_single.")) {
(0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
(0, $8l3id.setLeaderboard)(Array.from(document.querySelector(".tj_left_div").getElementsByTagName("center")).at(-1));
mainTJSolo();
}
if (location.href.includes("tj_single_set")) {
let megas = {};
Array.from(document.querySelectorAll("a")).filter((a)=>a.href.includes("name=mega")).forEach((a)=>megas[a.href] = "");
let all_megas = await (0, $aqxxv.doPost)("getPortalMegaCreatures", JSON.stringify(megas));
let filtered = {};
Object.entries(all_megas).map((entry)=>[
entry[0].split("/").at(-1),
entry[1]
]).forEach((entry)=>filtered[entry[0]] = entry[1]);
Array.from(document.querySelectorAll(".tj_block")).at(-1).insertAdjacentHTML("afterend", \`<div class="tj_block" style="width: 100%; margin-bottom: 1em;margin-top:1em;">
<div class="global_table_div_bg"></div>
<div class="tj_inside_div">\${Object.entries(filtered).sort((a, b)=>a[1].localeCompare(b[1])).reduce((prev, [href, text])=>{
return prev + \`<div style="font-size: 16px; text-align: center;"><a href="/\${href}">\${text}</a></div>\`;
}, "")}</div>
</div>
\`);
}
function mainTJSolo() {
Array.from(document.querySelectorAll(".tj_inside_div")).at(-1).insertAdjacentHTML("beforeend", createTJSoloTemplate());
(0, $dIwPZ.$)(\`statbut\`).addEventListener("click", ()=>{
processCollectBattles();
});
}
function createTJSoloTemplate() {
return \`
<div class="wrapperStat">
<div><div id="statbut" class="home_button2 btn_hover2">Посчитать бои с существами</div></div>
<div id="progress" class="progress"></div>
</div>
\`;
}
function processCollectBattles() {
if (!loadStarted) {
collectBattles();
loadStarted = true;
document.getElementById("statbut").innerHTML = "Поиск боев...";
}
}
async function collectBattles() {
if (pageCount < maxPages) {
let doc = await (0, $aqxxv.doGet)(\`/pl_warlog.php?id=\${(0, $dIwPZ.pl_id)}&page=\${pageCount}\`, true);
pageCount++;
processResponse(doc);
}
}
function processResponse(doc) {
let arr = Array.from(doc.querySelectorAll(".global_a_hover")).slice(-1)[0].innerHTML.toString().split("\n");
arr = arr.slice(2, 42);
for(let i = 0; i < arr.length; i++){
let currwarid = arr[i].match(/warid=(\d{10})/)[1] - 0;
if (/--117--/.test(arr[i])) {
if (/<b>/.test(arr[i].split("vs")[1])) continue;
battleCount++;
document.getElementById("progress").innerHTML = "Найдено боев: " + battleCount.toString();
}
if (currwarid <= 1387305701) {
let wins = document.querySelector(".tj_hide_top_div > div > b:nth-child(6)").textContent - 0;
document.getElementById("progress").innerHTML = "Найдено боев: " + battleCount.toString() + " Осталось боев:" + (wins * 7 + 20 - battleCount).toString();
document.getElementById("statbut").remove();
return;
}
}
collectBattles();
}
}
});
parcelRequire.register("d44k3", function(module, exports) {
$parcel$export(module.exports, "default", () => $982f006e132d5185$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $ao0pt = parcelRequire("ao0pt");
var $6rIzz = parcelRequire("6rIzz");
var $8l3id = parcelRequire("8l3id");
var $aqxxv = parcelRequire("aqxxv");
var $eTbLz = parcelRequire("eTbLz");
var $jWJKf = parcelRequire("jWJKf");
var $afXBq = parcelRequire("afXBq");
function $982f006e132d5185$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("auto_send_ffa_event", "Send battles from the FFA event to the service automatically", "Отправлять бои из КБО ивента в сервис автоматически", "Відправляти бої з КБО Івенту в сервіс автоматично"));
texts.addText(new (0, $afXBq.LocalizedText)("only_clan_visibility", "My battles are only available to the clan", "Мои бои доступны только для клана", "Мої бої доступні лише для клану"));
texts.addText(new (0, $afXBq.LocalizedText)("collapse_event_desc", "Always collapse battle descriptions", "Всегда сворачивать описания боев", "Завжди згортати описи боїв"));
texts.addText(new (0, $afXBq.LocalizedText)("return_to_prev_level", "Return to an unfinished level", "Возвращать на незавершенный уровень", "Повертати на незавершений рівень"));
texts.addText(new (0, $afXBq.LocalizedText)("show_creature_calculator", "Show recruit count calculator", "Показывать калькулятор численности", "Показувати калькулятор чисельності"));
texts.addText(new (0, $afXBq.LocalizedText)("current_amount", "Current number of creatures (including additional %)", "Текущее количество существ (с учетом дополнительных % численности)", "Поточна кількість істот (з урахуванням додаткових % чисельності)"));
texts.addText(new (0, $afXBq.LocalizedText)("new_amount", "Number of creatures when added", "Количество существ при добавлении", "Кількість істот при додаванні"));
texts.addText(new (0, $afXBq.LocalizedText)("show_event_timer", "Show time until the end of the event", "Показывать время до конца ивента", "Показувати час до кінця івента"));
texts.addText(new (0, $afXBq.LocalizedText)("show_top_clan_attempts", "Show remaining attempts for TOP3 clans", "Показывать оставшиеся попытки у ТОП3 кланов", "Показувати спроби, що залишилися, у ТОП3 кланів"));
return texts;
}
let $982f006e132d5185$var$allTexts = $982f006e132d5185$var$getAllTexts();
async function $982f006e132d5185$export$2e2bcd8739ae039() {
if (/(ambush_single_event|map_hero_event)/.test(location.href)) {
(0, $jWJKf.eventHelperSettings)(document.querySelector("#map_event_stats"), (container)=>{
(0, $jWJKf.setSettings)("auto_send_ffa_event", $982f006e132d5185$var$allTexts.get("auto_send_ffa_event"), container);
(0, $jWJKf.setSettings)("only_clan_visibility", $982f006e132d5185$var$allTexts.get("only_clan_visibility"), container, false);
(0, $jWJKf.setSettings)("collapse_event_desc", $982f006e132d5185$var$allTexts.get("collapse_event_desc"), container, false);
(0, $jWJKf.setSettings)("return_to_prev_level", $982f006e132d5185$var$allTexts.get("return_to_prev_level"), container, false);
(0, $jWJKf.setSettings)("show_creature_calculator", $982f006e132d5185$var$allTexts.get("show_creature_calculator"), container);
(0, $jWJKf.setSettings)("show_top_clan_attempts", $982f006e132d5185$var$allTexts.get("show_top_clan_attempts"), container);
(0, $jWJKf.setSettings)("show_event_timer", $982f006e132d5185$var$allTexts.get("show_event_timer"), container);
}, "afterbegin");
(0, $dIwPZ.set)("eh_current_level", null);
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
(0, $ao0pt.collapseEventDesc)();
interceptButtons();
document.querySelector(".new_event_map").insertAdjacentHTML("afterend", \`<div id="battle_examples"></div>\`);
(0, $6rIzz.getEventBattles)((0, $dIwPZ.$)(\`battle_examples\`)).then((battles)=>{
trySetCreatureAmount(battles["AFS"]);
trySetCreatureAmount(battles["FFA"]);
});
(0, $8l3id.setLeaderboard)(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).children[0].getElementsByTagName("center")).at(-1));
if ((0, $dIwPZ.get)("show_top_clan_attempts", true)) (0, $8l3id.setTopClanAttempts)(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).getElementsByTagName("table")).at(-1));
showCalculator();
}
function interceptButtons() {
let buttons = Array.from(document.querySelectorAll("input[id^=ne_attack_button]"));
let available = buttons.filter((x)=>!x.disabled).length;
buttons.forEach((button, index)=>{
button.addEventListener("mousedown", ()=>{
(0, $dIwPZ.set)("event_battle_side", (button.parentElement.querySelector("[name='variant']").value - 1) % 2);
(0, $dIwPZ.set)("eh_current_level", [
(0, $ao0pt.getCurrentLevel)(),
available
]);
});
});
}
async function showCalculator() {
if ((0, $dIwPZ.get)("show_creature_calculator", true)) {
let doc = await (0, $aqxxv.doGet)(\`/pl_info.php?id=\${(0, $dIwPZ.pl_id)}\`, true);
let creaturesData = [];
Array.from(doc.getElementsByClassName("cre_creature72")).forEach((creature)=>{
let 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);
});
let creaturesMultiplier = Array.from(document.querySelectorAll("div.show_hint")).at(-1).querySelector("div > div:nth-child(2) > b").innerText;
creaturesMultiplier = creaturesMultiplier.match(/\d{1,3}/)[0] - 0;
document.querySelector("#map_event_stats").insertAdjacentHTML("beforeend", \`
<div id="ambush-creatures" style="display: flex; flex-direction: column; align-items: center">
<div>\${$982f006e132d5185$var$allTexts.get("current_amount")}</div><div id="current-ambush-creatures"></div><br>
<div>\${$982f006e132d5185$var$allTexts.get("new_amount")} +<input type="text" id="your-creatures-multiplier" style="width: 30px;" value="1">% <div class="btn-gradient blue" id="add_percent">+1%</div></div>
<div id="future-ambush-creatures"></div><br>
</div>\`);
(0, $dIwPZ.$)("add_percent").addEventListener("click", ()=>{
let currentMultiplierElement = (0, $dIwPZ.$)(\`your-creatures-multiplier\`);
let currentMultiplier = currentMultiplierElement.value - 0;
currentMultiplierElement.value = currentMultiplier + 1;
applyMultiplier(creaturesData, creaturesMultiplier);
});
creaturesData.forEach((creature)=>{
let defaultAmount = creature.amount;
(0, $dIwPZ.$)(\`current-ambush-creatures\`).insertAdjacentHTML("beforeend", (0, $eTbLz.getNewCreatureIcon)(creature.portrait, Math.round(defaultAmount * (1 + 0.01 * creaturesMultiplier))));
(0, $dIwPZ.$)(\`future-ambush-creatures\`).insertAdjacentHTML("beforeend", (0, $eTbLz.getNewCreatureIcon)(creature.portrait, Math.round(defaultAmount * (1 + 0.01 * (creaturesMultiplier + 1)))));
});
(0, $dIwPZ.$)(\`your-creatures-multiplier\`).addEventListener("input", ()=>{
applyMultiplier(creaturesData, creaturesMultiplier);
});
}
}
function applyMultiplier(creaturesData, creaturesMultiplier) {
(0, $dIwPZ.$)(\`future-ambush-creatures\`).innerHTML = "";
let newMultiplier = (0, $dIwPZ.$)(\`your-creatures-multiplier\`).value - 0;
creaturesData.forEach((creature)=>{
(0, $dIwPZ.$)(\`future-ambush-creatures\`).insertAdjacentHTML("beforeend", (0, $eTbLz.getNewCreatureIcon)(creature.portrait, Math.round(creature.amount * (1 + 0.01 * (creaturesMultiplier + newMultiplier)))));
});
}
function trySetCreatureAmount(battles) {}
}
});
parcelRequire.register("aXIev", function(module, exports) {
$parcel$export(module.exports, "default", () => $7fb1b9d69ac2df62$export$2e2bcd8739ae039);
var $jWJKf = parcelRequire("jWJKf");
var $ao0pt = parcelRequire("ao0pt");
var $dIwPZ = parcelRequire("dIwPZ");
var $aqxxv = parcelRequire("aqxxv");
function $7fb1b9d69ac2df62$export$2e2bcd8739ae039() {
let battles = [];
let currentHeroFaction;
let classCounter = 0;
let result = \`\`;
let isForStat = true;
if (location.href.includes("hunting_event")) {
(0, $jWJKf.eventHelperSettings)(document.querySelector(".new_event_map"), (container)=>{
(0, $jWJKf.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();
let huntlvlinfo = (0, $dIwPZ.get)("huntv2lvl" + (0, $ao0pt.getCurrentLevel)(), {});
if (huntlvlinfo && Date.now() - huntlvlinfo.time < 1209600000) {
result = huntlvlinfo.info;
updateHuntStatBody();
setShowExampleListeners();
(0, $dIwPZ.allClasses).forEach((clazz)=>{
document.getElementById(\`fc\${clazz[0]}-\${clazz[2]}\`).getElementsByTagName("img")[0].addEventListener("click", async ()=>{
isForStat = false;
await changeFactionAndClass(clazz[4]);
location.reload();
});
});
}
}
function setShowExampleListeners() {
Array.from(document.getElementsByClassName("faction-hunt-data")).forEach((enemy, index)=>{
let portraits = (0, $dIwPZ.findAll)(/portraits\/([a-zA-Z0-9_-]+)p33/, enemy.innerHTML).map((item)=>item[1]);
let amounts = Array.from(enemy.querySelectorAll("#add_now_count")).map((elem)=>parseInt(elem.innerText));
if (amounts.length < portraits.length) amounts.unshift(1);
portraits.sort((a, b)=>a.localeCompare(b));
amounts.sort((a, b)=>a - b);
enemy.insertAdjacentHTML("beforeend", \`
<div style="margin: 10px"><div id="load_examples_\${index}" class="home_button2 btn_hover2" style="padding: 2px 4px">Загрузить примеры</div></div>
\`);
(0, $dIwPZ.$)(\`load_examples_\${index}\`).addEventListener("click", async (e)=>{
e.target.remove();
let request = [
portraits.join("|"),
amounts.join("|")
].join("~");
const eventBattlesURL = \`getFactionEventBattles?enemy_id=\${encodeURIComponent(request)}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`;
battles = await (0, $aqxxv.doGet)(eventBattlesURL, false);
processFactionEventBattles(enemy);
});
});
}
function processFactionEventBattles(where = document.body) {
where.insertAdjacentHTML("afterend", \`<div>\${getBattlesTemplate(battles)}</div>\`);
}
function getBattlesTemplate(battles) {
let result = "";
result += \`<div style="text-align: center; font-size: 14px; margin-top: 10px"><b>Твой уровень</b></div>\`;
let my_lvl_battles = battles.filter((battle)=>battle["hero_lvl"] === (0, $dIwPZ.pl_lvl));
result += factionBattlesToHTML(my_lvl_battles);
result += \`<div style="text-align: center; font-size: 14px"><b>Другие уровни</b></div>\`;
let not_my_lvl_battles = battles.filter((battle)=>battle["hero_lvl"] !== (0, $dIwPZ.pl_lvl));
result += factionBattlesToHTML(not_my_lvl_battles);
return result;
}
function factionBattlesToHTML(battles) {
if (battles.length > 0) {
battles.sort((a, b)=>a.nickname.localeCompare(b.nickname));
return battles.reduce((prev, curr, index)=>{
return prev + \`
<div style="display: flex; justify-content: center; padding: 1px;">
<div>\${index + 1}. </div>
<div style="text-align: center"> \${curr["nickname"]} [\${curr["hero_lvl"]}]</div>
<div> <a target="_blank" href="/warlog.php?warid=\${curr["battle_id"]}&show_for_all=\${curr["battle_secret"]}">Бой</a></div>
<div> (\${curr["enemy_id"].split("~")[1]})</div>
</div>
\`;
}, "");
} else return \`<div style="text-align: center;"><b>пусто</b></div>\`;
}
async function getCurrentFaction() {
let plResponse = await (0, $aqxxv.doGet)(\`/pl_info.php?id=\${(0, $dIwPZ.pl_id)}\`, true);
let temp = currentHeroFaction;
let factionImg = null;
Array.from(plResponse.getElementsByTagName("img")).forEach((img)=>{
if (img.src.includes("i/f/")) factionImg = img.src;
});
for(let i = 0; i < (0, $dIwPZ.allClasses).length; i++)if (factionImg.indexOf((0, $dIwPZ.allClasses)[i][3]) > 0) {
currentHeroFaction = (0, $dIwPZ.allClasses)[i][4];
break;
}
if (!!temp) {
if (temp !== currentHeroFaction) {
currentHeroFaction = temp;
await changeFactionAndClass(temp);
getCurrentFaction();
} else location.reload();
}
}
function mainHuntEvent() {
Array.from(document.getElementsByClassName("new_event_map")).slice(-1)[0].insertAdjacentHTML("afterend", \`
<div class="wrapper">
<div style="width: 75%">
<div class="wrapperStat">
<div id="show_current_class_examples" class="home_button2 btn_hover2" style="width: 200px;">Загрузить примеры<br>текущего класса</div>
<div id="current_class_examples"></div>
<div id="statbut" class="home_button2 btn_hover2" style="width: 200px;">Посмотреть охоты<br>других классов</div>
<div id="progress" class="progress"></div>
</div>
<div id="statbody">
</div>
</div>
</div>
\`);
(0, $dIwPZ.$)(\`statbut\`).addEventListener("click", ()=>{
processCollectHunts();
});
(0, $dIwPZ.$)(\`show_current_class_examples\`).addEventListener("click", async (e)=>{
let enemy = document.querySelector(".hunt_result_attack > div:nth-child(2) > div > div > div:last-child > div:nth-child(4)");
let portraits = (0, $dIwPZ.findAll)(/portraits\/([a-zA-Z0-9_-]+)p33/, enemy.innerHTML).map((item)=>item[1]);
let amounts = Array.from(enemy.querySelectorAll("#add_now_count")).map((elem)=>parseInt(elem.innerText));
if (amounts.length < portraits.length) amounts.unshift(1);
portraits.sort((a, b)=>a.localeCompare(b));
amounts.sort((a, b)=>a - b);
e.target.remove();
let request = [
portraits.join("|"),
amounts.join("|")
].join("~");
const eventBattlesURL = \`getFactionEventBattles?enemy_id=\${encodeURIComponent(request)}&token=\${(0, $dIwPZ.get)("hwm_events_token", "")}\`;
battles = await (0, $aqxxv.doGet)(eventBattlesURL);
processFactionEventBattles((0, $dIwPZ.$)(\`current_class_examples\`));
});
}
function getFactionName(fr) {
for(let i = 0; i < (0, $dIwPZ.allClasses).length; i++){
if ((0, $dIwPZ.allClasses)[i][4] === fr) return (0, $dIwPZ.allClasses)[i][1];
}
}
async function changeFactionAndClass(fr) {
await (0, $aqxxv.doGet)(\`/castle.php?change_clr_to=\${fr}&sign=\${(0, $dIwPZ.my_sign)}\`, true);
}
function processCollectHunts() {
result = "";
getClassHuntData();
}
async function getClassHuntData() {
if (classCounter === (0, $dIwPZ.allClasses).length) {
classCounter = 0;
document.getElementById("statbut").innerHTML = "Done";
isForStat = false;
(0, $dIwPZ.set)("huntv2lvl" + (0, $ao0pt.getCurrentLevel)(), {
"time": Date.now(),
"info": result
});
await changeFactionAndClass(currentHeroFaction);
getCurrentFaction();
return;
}
document.getElementById("statbut").innerHTML = "Processing...";
document.getElementById("progress").innerHTML = "Текущая фракция - " + getFactionName((0, $dIwPZ.allClasses)[classCounter][4]);
await changeFactionAndClass((0, $dIwPZ.allClasses)[classCounter][4]);
let doc = await (0, $aqxxv.doGet)(\`/hunting_event.php?sel_level=\${(0, $ao0pt.getCurrentLevel)()}\`, true);
processHuntResponse(doc);
}
function processHuntResponse(doc) {
result += \`<div class="faction-hunt-data">
<div class="cre_creature" id="fc\${(0, $dIwPZ.allClasses)[classCounter][0]}-\${(0, $dIwPZ.allClasses)[classCounter][2]}">
<img style="padding: 10px 0; cursor:pointer;" src="https://\${0, $dIwPZ.cdnHost}/i/f/\${(0, $dIwPZ.allClasses)[classCounter][3]}?v=1.1" alt="">
</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((result, current)=>result + current.outerHTML, "") + \`</div><br>\`;
updateHuntStatBody();
window.scrollTo(0, document.body.scrollHeight);
classCounter++;
getClassHuntData();
}
function updateHuntStatBody() {
document.getElementById("statbody").innerHTML = result;
}
}
});
parcelRequire.register("bKNGT", function(module, exports) {
$parcel$export(module.exports, "default", () => $023554caf4f3eb55$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
function $023554caf4f3eb55$export$2e2bcd8739ae039() {
if (location.href.includes("war.") && ((0, $dIwPZ.get)("pirate_hunt_custom_ins", false) || (0, $dIwPZ.get)("village_custom_ins", false) || (0, $dIwPZ.get)("faction_custom_ins", false))) {
let loadId = setInterval(waitForBattleLoad, 200);
let startId;
function waitForBattleLoad() {
if (!stage[war_scr].setted_atb) return;
else window.clearInterval(loadId);
if (btype === 115 || btype === 119 || btype === 144) {
let customInsertion = (0, $dIwPZ.get)(\`insertionData_\${btype}\${btype === 144 ? defyn : ""}\`, null);
createSaveInsButton();
if (customInsertion) {
if ((0, $dIwPZ.get)("custom_ins_auto", false)) makeIns(customInsertion);
else createMakeInsButton(customInsertion);
}
startId = setInterval(waitForBattleStart, 200);
}
}
function waitForBattleStart() {
if (lastturn > -1) {
window.clearInterval(startId);
removeSaveInsButton();
removeMakeInsButton();
}
}
function createMakeInsButton(customInsertion) {
(0, $dIwPZ.$)("right_button").insertAdjacentHTML("beforeend", \`
<div id="custom_make_ins" class="toolbars_img" style="width: 47px;"><img src="https://\${(0, $dIwPZ.cdnHost)}/i/combat/btn_autoalignment.png?v=6" alt=""></div>
\`);
(0, $dIwPZ.$)("custom_make_ins").addEventListener("click", ()=>{
makeIns(customInsertion);
});
}
function makeIns(customInsertion) {
let currentCreatures = stekid.slice(1, stackcount + 1).filter((cre)=>cre !== 0);
let filteredInsertion = customInsertion.filter((cre)=>currentCreatures.includes(cre[0]));
currentCreatures.forEach((cre, index)=>{
if (!filteredInsertion.some((customInsCre)=>customInsCre[0] === cre)) filteredInsertion.push([
cre,
steknumber[index + 1],
1,
1
]);
});
let insStr = filteredInsertion.map((cre)=>cre.join("#")).join("^") + "^";
stage[war_scr].useinsertion_cre(insStr);
removeMakeInsButton();
}
function createSaveInsButton() {
(0, $dIwPZ.$)("right_button").insertAdjacentHTML("beforeend", \`
<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>
\`);
(0, $dIwPZ.$)("custom_save_ins").addEventListener("click", ()=>{
let insertionData = [];
for(let 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]
]);
(0, $dIwPZ.set)(\`insertionData_\${btype}\${btype === 144 ? defyn : ""}\`, insertionData);
(0, $dIwPZ.$)("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(()=>{
(0, $dIwPZ.$)("custom_save_ins").innerHTML = \`<img src="https://i.imgur.com/08mNun9.png" alt=""></div>\`;
}, 1000);
});
}
function removeSaveInsButton() {
let button = (0, $dIwPZ.$)("custom_save_ins");
if (button) button.remove();
}
function removeMakeInsButton() {
let button = (0, $dIwPZ.$)("custom_make_ins");
if (button) button.remove();
}
}
}
});
parcelRequire.register("lBuTJ", function(module, exports) {
$parcel$export(module.exports, "default", () => $fba50557318b4427$export$2e2bcd8739ae039);
var $jWJKf = parcelRequire("jWJKf");
var $dIwPZ = parcelRequire("dIwPZ");
function $fba50557318b4427$export$2e2bcd8739ae039() {
if (location.href.includes("pirate_hunt")) {
let globalTable = (0, $dIwPZ.$)(\`global_table_div4\`);
(0, $jWJKf.eventHelperSettings)(globalTable, (container)=>{
// setSettings("pirate_hunt_event_filter", "Только с напарником", container)
(0, $jWJKf.setSettings)("pirate_hunt_custom_ins", "Возможность автоматической расстановки", container, false);
(0, $jWJKf.setSettings)("custom_ins_auto", \`Автоматически применять сохраненную расстановку\`, 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()
// }
// })
// }
}
}
});
parcelRequire.register("ag9Ot", function(module, exports) {
$parcel$export(module.exports, "default", () => $778302ae508a9a72$export$2e2bcd8739ae039);
parcelRequire("dIwPZ");
function $778302ae508a9a72$export$2e2bcd8739ae039() {
// 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)
// })
// }
}
});
parcelRequire.register("2GRXP", function(module, exports) {
$parcel$export(module.exports, "default", () => $1f595d21b7013d0d$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $aqxxv = parcelRequire("aqxxv");
var $6rIzz = parcelRequire("6rIzz");
async function $1f595d21b7013d0d$export$2e2bcd8739ae039() {
if (location.href.includes("war.php") && ((0, $dIwPZ.get)("auto_send_lg", true) || (0, $dIwPZ.get)("auto_send_event_lg", true) || (0, $dIwPZ.get)("auto_send_ffa_event", true) || (0, $dIwPZ.get)("auto_send_faction_event_battles", true) || (0, $dIwPZ.get)("auto_send_rogues_event", true) || (0, $dIwPZ.get)("auto_send_reaping_event", true) || (0, $dIwPZ.get)("auto_send_hunt_event_battles", true))) {
let battleData = window.run_all.toString();
let battleType = battleData.match(/btype\|(\d{1,10})/)[1];
if ([
"133",
"135",
"138",
"139",
"140",
"142",
"143",
"144",
"147",
"148"
].includes(battleType)) {
let battle_id = new URLSearchParams(window.location.search).get("warid");
let battle_secret = new URLSearchParams(window.location.search).get("show_for_all");
if (battle_secret == null) {
let doc = await (0, $aqxxv.doGet)(\`/pl_info.php?id=\${(0, $dIwPZ.pl_id)}\`, true);
let match = doc.body.innerHTML.match(/show_for_all=(\w[0-9a-f]{10})/);
if (match) battle_secret = match[1];
}
let startId;
startId = setInterval(main, 10);
function main() {
if (typeof finished !== "undefined" && finished || typeof battle_ended !== "undefined" && battle_ended) {
window.clearInterval(startId);
if ((0, $dIwPZ.get)("return_to_prev_level")) {
let eh_current_level = (0, $dIwPZ.get)("eh_current_level");
if (eh_current_level) {
let leaveBattleButton = (0, $dIwPZ.$)("btn_continue_WatchBattle");
leaveBattleButton.removeEventListener("mouseup", btn_continue_WatchBattle_onRelease);
leaveBattleButton.addEventListener("mouseup", ()=>{
if (eh_current_level[1] === 2 && eh_current_level[0] < 51) location.href = \`\${document.referrer.split("?")[0]}?sel_level=\${eh_current_level[0]}\`;
else location.href = \`\${document.referrer.split("?")[0]}\`;
});
}
}
if (battleType === "135" && (0, $dIwPZ.get)("auto_send_lg", true)) (0, $6rIzz.sendBattle)(battle_id, battle_secret, "0");
else if ((battleType === "142" || battleType === "143" || battleType === "138" || battleType === "148") && (0, $dIwPZ.get)("auto_send_ffa_event", true)) {
let battle_side = (0, $dIwPZ.get)("event_battle_side", -1);
(0, $dIwPZ.set)("event_battle_side", -1);
(0, $6rIzz.sendBattle)(battle_id, battle_secret, "2", null, battle_side);
} else if (battleType === "139" && (0, $dIwPZ.get)("auto_send_event_lg", true)) (0, $6rIzz.sendBattle)(battle_id, battle_secret, "1");
else if (battleType === "144" && (0, $dIwPZ.get)("auto_send_faction_event_battles", true) || battleType === "140" && (0, $dIwPZ.get)("auto_send_hunt_event_battles", true)) (0, $6rIzz.sendBattle)(battle_id, battle_secret, "3");
else if (battleType === "133" && (0, $dIwPZ.get)("auto_send_rogues_event", true) || battleType === "147" && (0, $dIwPZ.get)("auto_send_reaping_event", true)) {
let battle_side = (0, $dIwPZ.get)("event_battle_side", -1);
(0, $dIwPZ.set)("event_battle_side", -1);
(0, $6rIzz.sendBattle)(battle_id, battle_secret, "4", null, battle_side);
}
}
}
}
}
}
});
parcelRequire.register("19fJa", function(module, exports) {
$parcel$export(module.exports, "default", () => $0d62d4d9ed1699bb$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $jWJKf = parcelRequire("jWJKf");
var $6rIzz = parcelRequire("6rIzz");
var $aqxxv = parcelRequire("aqxxv");
var $afXBq = parcelRequire("afXBq");
function $0d62d4d9ed1699bb$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("send_to_service", "send to service", "отправить в сервис", "відправити у сервіс"));
texts.addText(new (0, $afXBq.LocalizedText)("battle_info", "show battle info", "подробнее", "детальніше"));
return texts;
}
let $0d62d4d9ed1699bb$var$allTexts = $0d62d4d9ed1699bb$var$getAllTexts();
function $0d62d4d9ed1699bb$export$2e2bcd8739ae039() {
window.sendBattle = (0, $6rIzz.sendBattle);
window.getBattleInfo = getBattleInfo;
if (location.href.includes(\`pl_warlog.php?id=\`)) Array.from(document.getElementsByTagName("i")).filter((tag)=>(tag.innerText.includes("Враги экспедиции") || tag.innerText.includes("Enemies of the expedition")) && tag.innerText.match(/\((\d{1,3})/)[1] - 0 > 50 || (tag.innerText.includes("Противник Армии Тьмы") || tag.innerText.includes("Opponent of the Army of Darkness")) && tag.innerText.match(/\((\d{1,3})/)[1] - 0 > 50 || (tag.innerText.includes("Контрабандисты") || tag.innerText.includes("Smugglers")) && tag.innerText.match(/\((\d{1,3})/)[1] - 0 > 70 || (tag.innerText.includes("Бандиты пустошей") || tag.innerText.includes("Wasteland bandits")) && tag.innerText.match(/\((\d{1,3})/)[1] - 0 > 30).forEach((tag, index)=>{
let params = new URLSearchParams("?" + tag.previousElementSibling.previousElementSibling.href.split("?")[1]);
tag.insertAdjacentHTML("afterend", \` <span><a id="get_battle_info_\${index}" style="cursor: pointer; text-decoration: underline" onclick="getBattleInfo('\${params.get("warid")}', '\${index}')">\${$0d62d4d9ed1699bb$var$allTexts.get("battle_info")}</a></span>\`);
});
if (location.href.includes(\`pl_warlog.php?id=\${(0, $dIwPZ.pl_id)}\`)) {
(0, $jWJKf.eventHelperSettings)(document.querySelector(\`[class="global_container_block"]\`), (container)=>{
(0, $jWJKf.setSettings)("only_clan_visibility", "Мои бои доступны только для клана", container, false);
(0, $jWJKf.setSettings)("auto_send_rogues_event", "Отправлять бои из разбойничьего ивента в сервис автоматически", container);
(0, $jWJKf.setSettings)("auto_send_reaping_event", "Отправлять бои из ивента тьмы в сервис автоматически", container);
(0, $jWJKf.setSettings)("auto_send_ffa_event", "Отправлять бои из КБО ивента в сервис автоматически", container);
(0, $jWJKf.setSettings)("auto_send_event_lg", "Отправлять бои из ГЛ ивента в сервис автоматически", container);
(0, $jWJKf.setSettings)("auto_send_lg", "Отправлять бои с опасными бандитами в сервис автоматически", container);
(0, $jWJKf.setSettings)("auto_send_faction_event_battles", "Отправлять бои из фрак. ивента в сервис автоматически", container);
(0, $jWJKf.setSettings)("auto_send_hunt_event_battles", "Отправлять бои из сезона охоты в сервис автоматически", container);
});
Array.from(document.getElementsByTagName("i")).forEach((tag, index)=>{
let type;
let 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("Enemies of the 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") || tag.innerText.includes("Противник Армии Тьмы") || tag.innerText.includes("Opponent of the Army of Darkness")) {
type = "4";
isOk = true;
}
if (isOk) {
let maxTries = 5;
let sibling = tag.previousElementSibling;
for(let i = 0; i < maxTries; i++)if (sibling.tagName === "A" && sibling.href.includes("show_for_all")) {
let params = new URLSearchParams("?" + sibling.href.split("?")[1]);
if (!tag.innerHTML.includes("<b>")) tag.insertAdjacentHTML("afterend", \` <span><a id="send_battle_\${index}" style="cursor: pointer; text-decoration: underline" onclick="sendBattle('\${params.get("warid")}', '\${params.get("show_for_all")}', '\${type}', '\${index}')">\${$0d62d4d9ed1699bb$var$allTexts.get("send_to_service")}</a></span>\`);
break;
} else sibling = sibling.previousElementSibling;
}
});
}
async function getBattleInfo(battle_id, target_index) {
let response = await (0, $aqxxv.doGet)(\`getEventBattleInfo?battle_id=\${battle_id}\`);
let battleInfo = response.battle_info;
let data = battleInfo.split("|");
let result = "";
if (data.length > 1) {
let heroClassRaw = data[0];
let heroStatsRaw = data[1];
let heroArtsRaw = data[2];
let heroCreaturesRaw = data[3];
let heroPerksRaw = data[4];
let heroClassHTML = \`
<div class="battle_info_chip">
<img style="vertical-align: middle; height: 24px" src="https://\${(0, $dIwPZ.cdnHost)}/i/f/r\${heroClassRaw}.png?v=1.1" alt="">
</div>
\`;
let heroStatsValues = heroStatsRaw.split(",");
let heroStatsHTML = \`
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_attack.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[0]}
</div>
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_defense.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[1]}
</div>
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_magicpower.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[2]}
</div>
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_knowledge.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[3]}
</div>
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_fortune.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[4]}
</div>
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_morale.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[5]}
</div>
<div class="battle_info_chip">
<img alt="" src="https://\${(0, $dIwPZ.cdnHost)}/i/icons/attr_initiative.png?v=1" style="vertical-align: middle; height: 24px"> \${heroStatsValues[6]}
</div>
\`;
let heroArtsHTML = heroArtsRaw.split(",").reduce((prev, curr)=>{
let artInfoRaw = curr.split("~");
let artImgLink = artInfoRaw[0];
let artModsRaw = artInfoRaw[1];
// let artModsRaw = "D10:E10:A10:W10:F10"
let artModsValues = artModsRaw.split(":");
return prev + \`
<div class="battle_info_chip battle_art_chip">
<img src="https://\${0, $dIwPZ.cdnHost}/i/artifacts/\${artImgLink}" class="art_img">
\${artModsRaw === "" ? "" : \`
<div class="art_mods_container">
\${artModsValues.reduce((modResult, currMod)=>{
return modResult + \`
<img src="https://\${0, $dIwPZ.cdnHost}/i/mods_png/\${currMod}.png" style="height: 100%; float: left;" title="\${currMod}">
\`;
}, "")}
</div>
\`}
</div>
\`;
}, "");
let heroCreaturesHTML = heroCreaturesRaw.split(",").reduce((prev, curr)=>{
let creatureInfoRaw = curr.split(":");
let creatureId = creatureInfoRaw[0];
let creatureAmount = creatureInfoRaw[1];
return prev + \`
<div class="cre_creature battle_info_chip">
<img src="https://\${0, $dIwPZ.cdnHost}/i/portraits/\${creatureId}" style="border-radius: 10px; width: 60px;height: 50px;">
<div class="cre_amount" style="bottom: -3px;text-align: center;right: 3px;" id="add_now_count">\${creatureAmount}</div>
</div>
\`;
}, "");
let heroPerksHTML = heroPerksRaw.split(",").reduce((prev, curr)=>{
return prev + \`
<div class="">
<img src="https://\${0, $dIwPZ.cdnHost}/i/perks/2x\${curr}.png" class="" style="height: 50px">
</div>
\`;
}, "");
result = \`
<div style="display: flex; flex-wrap: wrap">
\${heroClassHTML}
\${heroStatsHTML}
</div>
<div style="display: flex; flex-wrap: wrap">
\${heroArtsHTML}
</div>
<div style="display: flex; flex-wrap: wrap">
\${heroCreaturesHTML}
</div>
<div style="display: flex; flex-wrap: wrap">
\${heroPerksHTML}
</div>
\`;
} else if (data[0] !== "") result = \`
<div style="display: flex;">
<div class="battle_info_chip">
<img style="vertical-align: middle; height: 24px" src="https://\${0, $dIwPZ.cdnHost}/i/f/r\${data[0]}.png?v=1.1" alt="">
</div>
</div>
\`;
let target = (0, $dIwPZ.$)(\`get_battle_info_\${target_index}\`);
target.parentElement.insertAdjacentHTML("afterend", \`
<div>
\${result}
</div>\`);
target.remove();
}
}
});
parcelRequire.register("1MCWa", function(module, exports) {
$parcel$export(module.exports, "default", () => $14c87a41ecbb7270$export$2e2bcd8739ae039);
var $dIwPZ = parcelRequire("dIwPZ");
var $8l3id = parcelRequire("8l3id");
var $jWJKf = parcelRequire("jWJKf");
function $14c87a41ecbb7270$export$2e2bcd8739ae039() {
if (/(village_def)/.test(location.href)) {
let villageElem = (0, $dIwPZ.$)(\`set_mobile_max_width\`);
villageElem.style.flexWrap = "nowrap";
if ((0, $dIwPZ.get)("village_remove_confirm", true)) Array.from(document.querySelectorAll("input[type=submit]")).forEach((input)=>input.onclick = ()=>{
return true;
});
if ((0, $dIwPZ.get)("village_auto_repair", false)) Array.from(document.querySelectorAll("input[type=submit]")).forEach((input)=>{
if (input.value.includes("Восстановить") || input.value.includes("Ремонт")) input.click();
});
// document.querySelector('#global_table_div3').parentElement.firstElementChild.remove()
(0, $8l3id.setLeaderboard)(document.querySelector("#global_table_div3"), "beforebegin");
(0, $jWJKf.eventHelperSettings)(document.querySelector("#global_table_div4"), (container)=>{
(0, $jWJKf.setSettings)("village_custom_ins", \`Возможность автоматической расстановки
<img src="https://hwm.events/battles/custom_ins.gif" height="400px" onclick='event.stopPropagation()'>
(будет работать после "закрепления" крестьян башнями)
\`, container, false);
(0, $jWJKf.setSettings)("village_remove_confirm", \`Убрать подтверждение постройки/улучшений\`, container);
(0, $jWJKf.setSettings)("custom_ins_auto", \`Автоматически применять сохраненную расстановку\`, container, false);
(0, $jWJKf.setSettings)("village_auto_repair", \`Автоматически ремонтировать постройки\`, container, false);
}, "afterend");
}
}
});
parcelRequire.register("douos", function(module, exports) {
$parcel$export(module.exports, "default", () => $9c0517c0824ec283$export$2e2bcd8739ae039);
var $aqxxv = parcelRequire("aqxxv");
var $dIwPZ = parcelRequire("dIwPZ");
var $ao0pt = parcelRequire("ao0pt");
async function $9c0517c0824ec283$export$2e2bcd8739ae039() {
if (/recruit_event/.test(location.href)) {
(0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
let annoyingPicture = document.querySelector(".global_inside_shadow");
if (annoyingPicture) annoyingPicture.remove();
let enemies = Array.from(document.querySelectorAll(".recruit_event_enemy_block"));
enemies.forEach((enemy)=>{
if (enemy.innerText.includes("обороняющихся")) {
let powerElem = enemy.querySelector("div:nth-child(3)>div:nth-child(3)");
let powerRaw = powerElem.innerText;
let powerParsedTransformed = Math.floor(parseInt(powerRaw.replaceAll(",", "")) * 0.8).toLocaleString();
powerElem.innerHTML = \`\${powerRaw} (<i style="cursor: pointer" title="При потере в бою">\${powerParsedTransformed}</i>)\`;
}
});
let topHeroes = await (0, $aqxxv.doGet)(\`heroes/dun_scores.json\`);
let heroesTable = document.querySelector(".recruit_event_loot_rating_inside").querySelector("table");
let heroesTableInfo = document.querySelector(".recruit_event_loot_rating_inside").querySelector("center");
heroesTableInfo.innerHTML = \`Кликни на жирные очки, чтобы увидеть график с прогрессией<br><br><br>Общий рейтинг\`;
let firstTr = heroesTable.querySelector("tr");
let highestPlace = parseInt(firstTr.querySelector("td").innerText);
let heroesToRenderCount = Math.min(20, highestPlace - 1);
let heroesToRender = topHeroes.slice(0, heroesToRenderCount);
firstTr.insertAdjacentHTML("beforebegin", heroesToRender.join(""));
let newScript = document.createElement("script");
newScript.setAttribute("src", "https://cdn.jsdelivr.net/npm/chart.js");
document.head.appendChild(newScript);
let 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", \`
<div id="chart_area"></div>
\`);
Array.from(heroesTable.querySelectorAll("tr")).forEach((tr, index)=>{
let clanMatch = tr.innerHTML.match(/clan_info\.php\?id=(\d{1,5})/);
if (clanMatch) {
let clanId = clanMatch[1];
if (CLANS.includes(clanId)) {
let hero_id = tr.innerHTML.match(/pl_info\.php\?id=(\d{1,10})/)[1];
let hero_nick = tr.querySelector("td:nth-child(2)").innerText;
let scoreTd = tr.querySelector("td:nth-child(3)");
scoreTd.innerHTML = \`
<b style="font-size: 10px; text-decoration: underline; cursor: pointer" id="top_hero\${index}">
\${scoreTd.innerText}
</b>
\`;
(0, $dIwPZ.$)(\`top_hero\${index}\`).addEventListener("click", async ()=>{
(0, $dIwPZ.$)(\`chart_area\`).innerHTML = \`
<div style="height: 165px; overflow: hidden">
<div>Прогрессия очков <b>\${hero_nick}</b></div>
<canvas id="chart\${index}" height="150" style="width: 100%"></canvas>
</div>
\`;
let heroData = await (0, $aqxxv.doGet)(\`getDunHeroData?pl_id=\${hero_id}\`);
const cumulativeSum = ((sum)=>(value)=>sum += value)(0);
const labels = heroData.map((entry)=>entry[0] + \` \${entry[1] > 0 ? "+" : ""}\${entry[1]}\`);
const data = {
labels: labels,
datasets: [
{
label: "Очки",
data: heroData.map((entry)=>entry[1]).map(cumulativeSum),
borderColor: "blue",
backgroundColor: "rgb(44,73,107)",
pointStyle: "circle",
pointRadius: 3,
pointHoverRadius: 4
}
]
};
const 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
}
}
};
const ctx = document.getElementById(\`chart\${index}\`).getContext("2d");
const myChart = new Chart(ctx, config);
});
}
}
});
}
}
});
parcelRequire.register("gJdWA", function(module, exports) {
$parcel$export(module.exports, "default", () => $c2dbaa4674b93b4f$export$2e2bcd8739ae039);
var $ao0pt = parcelRequire("ao0pt");
var $8l3id = parcelRequire("8l3id");
var $c2dbaa4674b93b4f$require$setLeaderboard = $8l3id.setLeaderboard;
function $c2dbaa4674b93b4f$export$2e2bcd8739ae039() {
if (/rogue_like_event\.php$/.test(location.href)) {
(0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
$c2dbaa4674b93b4f$require$setLeaderboard(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).getElementsByTagName("center")).at(-1));
}
}
});
parcelRequire.register("5Nw5f", function(module, exports) {
$parcel$export(module.exports, "default", () => $438a6a7a63069f00$export$2e2bcd8739ae039);
var $aqxxv = parcelRequire("aqxxv");
var $dIwPZ = parcelRequire("dIwPZ");
var $afXBq = parcelRequire("afXBq");
var $jWJKf = parcelRequire("jWJKf");
var $438a6a7a63069f00$require$eventHelperSettings = $jWJKf.eventHelperSettings;
var $438a6a7a63069f00$require$setSettings = $jWJKf.setSettings;
function $438a6a7a63069f00$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("show_event_attempts_left", "Show remaining attempts for players", "Показывать оставшиеся попытки у игроков", "Показувати спроби, які залишилися у гравців"));
texts.addText(new (0, $afXBq.LocalizedText)("show_sort", "Show buttons to sort players", "Показывать кнопки для сортировки игроков", "Показувати кнопки для сортування гравців"));
return texts;
}
let $438a6a7a63069f00$var$allTexts = $438a6a7a63069f00$var$getAllTexts();
async function $438a6a7a63069f00$export$2e2bcd8739ae039() {
if (/clan_info\.php/.test(location.href)) {
let heroesTable = Array.from(document.getElementsByTagName("table")).at(-1);
$438a6a7a63069f00$require$eventHelperSettings(heroesTable, (container)=>{
$438a6a7a63069f00$require$setSettings("show_event_attempts_left", $438a6a7a63069f00$var$allTexts.get("show_event_attempts_left"), container, false);
$438a6a7a63069f00$require$setSettings("show_sort", $438a6a7a63069f00$var$allTexts.get("show_sort"), container);
}, "beforebegin");
if ((0, $dIwPZ.get)("show_event_attempts_left", false)) {
let clanId = new URLSearchParams(window.location.search).get("id");
let heroesAttempts = await (0, $aqxxv.doGet)(\`getTopClanDetailedAttempts?clan_id=\${clanId}\`);
let heroes = heroesTable.querySelectorAll("tr");
if (heroes.length - 20 < Object.keys(heroesAttempts).length) heroes.forEach((heroElem)=>{
let heroId = heroElem.innerHTML.match(/id=(\d{1,8})/)[1];
let heroAttempts = heroesAttempts[heroId];
heroElem.insertAdjacentHTML("beforeend", \`
<td class="wbwhite">\${heroAttempts ? heroAttempts : 0}</td>
\`);
});
}
if ((0, $dIwPZ.get)("show_event_attempts_left", false) || (0, $dIwPZ.get)("show_sort", true)) $438a6a7a63069f00$var$replaceWithSortableTable(heroesTable);
}
}
function $438a6a7a63069f00$var$replaceWithSortableTable(heroesTable) {
let heroesData = [];
heroesTable.querySelectorAll("tr").forEach((heroTr, index)=>{
let tds = heroTr.querySelectorAll("td");
let heroData = {};
let tdIndex = 1;
heroData.order = index + 1;
if (tds[tdIndex].innerHTML.includes("i/clans/") || tds[tdIndex].innerText === "\xa0") {
let onlineMatch = tds[tdIndex++].innerHTML.match(/clans\/(.+)\.gif/);
if (onlineMatch) heroData.status = onlineMatch[1];
else heroData.status = "offline";
}
heroData.info = tds[tdIndex++].innerHTML;
heroData.cl = tds[tdIndex++].innerText - 0;
heroData.description = tds[tdIndex++].innerHTML;
if (tdIndex < tds.length) heroData.score = tds[tdIndex++].innerText.replaceAll("\xa0", "").match(/(\d{0,3},?\d{0,3},?\d{0,3})/)[1].replaceAll(",", "") - 0;
if (tdIndex === tds.length - 1) heroData.attemptsLeft = tds[tdIndex].innerText - 0;
heroesData.push(heroData);
});
let sortedHeroes = (0, $dIwPZ.sortByKey)([
...heroesData
], "score", -1);
let threshold = sortedHeroes.length > 100 ? (0, $dIwPZ.sortByKey)([
...heroesData
], "score", -1)[99].score : 0;
heroesTable.outerHTML = \`
<table class="wb" width="100%">
<thead>
<tr style="background-color: white">
\${Object.keys(heroesData[0]).reduce((prev, columnName)=>{
return prev + \`<th style="border: 1px solid"><div class="home_button2 btn_hover2" id="sort_\${columnName}" style="margin: 2px"><img height="20px" src="https://static.thenounproject.com/png/2509814-200.png" style="pointer-events: none"></div></th>\`;
}, "")}
</tr>
</thead>
<tbody id="table-content"></tbody>
</table>
\`;
const tableContent = document.getElementById("table-content");
const tableButtons = document.querySelectorAll("th div");
const getTableContent = (data)=>{
let tableHtml = data.reduce((prev, hero, index)=>{
let tdClass = hero.status === "offline" ? "wbwhite" : "wblight";
let result = \`<td class="\${tdClass}" width="\${hero.order === index + 1 ? 30 : 70}" style="text-align: center;">\${index + 1} \${hero.order === index + 1 ? "" : \`(\${hero.order})\`}</td>\`;
if (hero.hasOwnProperty("status")) result += \`<td class="\${tdClass}" width="15" style="text-align: center;"><img align="absmiddle" src="https://dcdn.heroeswm.ru/i/clans/\${hero.status}.gif" width="15" height="15" border="0"></td>\`;
result += \`<td class="\${tdClass}" width="150">\${hero.info}</td>\`;
result += \`<td class="\${tdClass}" width="10" align="center">\${hero.cl}</td>\`;
result += \`<td class="\${tdClass}">\${hero.description}</td>\`;
if (hero.hasOwnProperty("score")) result += \`<td class="\${tdClass}" width="30" style="text-align: center;">\${hero.score >= threshold ? \`<b style="color: blue">\${hero.score}</b>\` : hero.score}</td>\`;
if (hero.hasOwnProperty("attemptsLeft")) result += \`<td class="\${tdClass}" width="30" style="text-align: center;">\${hero.attemptsLeft}</td>\`;
return prev + \`<tr>\${result}</tr>\`;
}, "");
tableContent.insertAdjacentHTML("beforeend", tableHtml);
};
const sortData = (data, param, direction = "asc")=>{
tableContent.innerHTML = "";
const sortedData = direction === "asc" ? (0, $dIwPZ.sortByKey)([
...data
], param, -1) : (0, $dIwPZ.sortByKey)([
...data
], param);
getTableContent(sortedData);
};
const resetButtons = (event)=>{
[
...tableButtons
].map((button)=>{
if (button !== event.target) button.removeAttribute("data-dir");
});
};
getTableContent(heroesData);
[
...tableButtons
].map((button)=>{
button.addEventListener("click", (e)=>{
resetButtons(e);
if (e.target.getAttribute("data-dir") === "desc") {
sortData(heroesData, e.target.id.split("_")[1], "desc");
e.target.setAttribute("data-dir", "asc");
} else {
sortData(heroesData, e.target.id.split("_")[1], "asc");
e.target.setAttribute("data-dir", "desc");
}
});
});
}
});
parcelRequire.register("028DL", function(module, exports) {
$parcel$export(module.exports, "default", () => $0066e3d04e0e43e4$export$2e2bcd8739ae039);
var $8l3id = parcelRequire("8l3id");
var $dIwPZ = parcelRequire("dIwPZ");
var $jWJKf = parcelRequire("jWJKf");
var $ao0pt = parcelRequire("ao0pt");
var $6rIzz = parcelRequire("6rIzz");
var $afXBq = parcelRequire("afXBq");
var $aqxxv = parcelRequire("aqxxv");
function $0066e3d04e0e43e4$var$getAllTexts() {
let texts = new (0, $afXBq.LocalizedTextMap)();
texts.addText(new (0, $afXBq.LocalizedText)("auto_send_reaping_event", "Send battles from the event to the service automatically", "Отправлять бои из ивента в сервис автоматически", "Відправляти бої з івента у сервіс автоматично"));
texts.addText(new (0, $afXBq.LocalizedText)("only_clan_visibility", "My battles are only available to the clan", "Мои бои доступны только для клана", "Мої бої доступні лише для клану"));
texts.addText(new (0, $afXBq.LocalizedText)("collapse_event_desc", "Always collapse fight descriptions", "Всегда сворачивать описания боев", "Завжди згортати описи боїв"));
texts.addText(new (0, $afXBq.LocalizedText)("hide_rogues_event_enemies", "Show price statistics", "Показывать статистику цен", "Показувати статистику цін"));
texts.addText(new (0, $afXBq.LocalizedText)("bought", "bought", "куплено", "куплено"));
texts.addText(new (0, $afXBq.LocalizedText)("sold", "sold", "продано", "продано"));
texts.addText(new (0, $afXBq.LocalizedText)("trade_for", "for", "по", "по"));
texts.addText(new (0, $afXBq.LocalizedText)("trade_history", "Trade history", "История покупок и продаж", "Історія покупок та продажів"));
texts.addText(new (0, $afXBq.LocalizedText)("show_event_timer", "Show time until the end of the event", "Показывать время до конца ивента", "Показувати час до кінця івента"));
texts.addText(new (0, $afXBq.LocalizedText)("show_top_clan_attempts", "Show remaining attempts for TOP3 clans", "Показывать оставшиеся попытки у ТОП3 кланов", "Показувати спроби, що залишилися, у ТОП3 кланів"));
texts.addText(new (0, $afXBq.LocalizedText)("hire_hint", "Red means higher prices, while green means the opposite. At this event, the cost of a creature can only be within + -15% of the initial cost. Thus, if 115% is written next to the price, it will no longer rise upwards, and if the price is 85%, then it will no longer fall either.", "Красный цвет значит подорожание, а зеленый наоборот. На этом ивенте цена существа может находиться только в пределах +-15% от изначальной стоимости. Таким образом, если рядом с ценой написано 115%, она больше расти вверх не будет, а если цена 85%, то падать больше не будет тоже.", "Червоний колір означає подорожчання, а зелений – навпаки. На цьому івенті ціна істоти може бути лише в межах +-15% від початкової вартості. Таким чином, якщо поряд з ціною написано 115%, вона більше не зростатиме, а якщо ціна 85%, то падати більше не буде теж."));
return texts;
}
let $0066e3d04e0e43e4$var$allTexts = $0066e3d04e0e43e4$var$getAllTexts();
async function $0066e3d04e0e43e4$export$2e2bcd8739ae039() {
if (location.href.includes("reaping_event.")) {
(0, $8l3id.setLeaderboard)(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).getElementsByTagName("center")).at(-1));
if ((0, $dIwPZ.get)("show_top_clan_attempts", true)) (0, $8l3id.setTopClanAttempts)(Array.from(Array.from(document.querySelectorAll(".global_container_block")).at(-1).getElementsByTagName("table")).at(-1));
(0, $jWJKf.eventHelperSettings)(Array.from(document.querySelectorAll(".global_container_block")).at(-1).firstChild, (container)=>{
(0, $jWJKf.setSettings)("auto_send_reaping_event", $0066e3d04e0e43e4$var$allTexts.get("auto_send_reaping_event"), container);
(0, $jWJKf.setSettings)("only_clan_visibility", $0066e3d04e0e43e4$var$allTexts.get("only_clan_visibility"), container, false);
(0, $jWJKf.setSettings)("collapse_event_desc", $0066e3d04e0e43e4$var$allTexts.get("collapse_event_desc"), container, false);
(0, $jWJKf.setSettings)("hide_rogues_event_enemies", $0066e3d04e0e43e4$var$allTexts.get("hide_rogues_event_enemies"), container);
(0, $jWJKf.setSettings)("show_top_clan_attempts", $0066e3d04e0e43e4$var$allTexts.get("show_top_clan_attempts"), container);
(0, $jWJKf.setSettings)("show_event_timer", $0066e3d04e0e43e4$var$allTexts.get("show_event_timer"), container);
}, "afterbegin");
(0, $dIwPZ.set)("eh_current_level", null);
if ((0, $dIwPZ.get)("show_event_timer", true)) (0, $ao0pt.setTimer)(document.querySelector(".global_container_block_header"));
(0, $ao0pt.collapseEventDesc)();
(0, $ao0pt.setClickableLevels)();
(0, $6rIzz.getEventBattles)(Array.from(document.querySelectorAll(".global_container_block")).at(-2), "getRoguesEventBattles", 1);
let currentLevel = (0, $ao0pt.getCurrentLevel)();
let storedLevel = (0, $dIwPZ.get)("currentEventLevel", "0");
if (storedLevel !== currentLevel) {
await setEventCreaturesInfo();
(0, $dIwPZ.set)("currentEventLevel", currentLevel);
}
interceptButtons();
}
async function setEventCreaturesInfo() {
let doc = await (0, $aqxxv.doGet)("/reaping_event_set.php", true);
let creatureBlocks = doc.querySelectorAll("#ne_set_troops_on_market .hwm_event_set_stack_pic");
let creaturesInfo = {};
creatureBlocks.forEach((block)=>{
let creaturePriceMatch = block.innerHTML.match(/silver48\.png'\)"><b>(\d{0,3},?\d{0,3})/);
if (creaturePriceMatch) {
let price = creaturePriceMatch[1].replace(",", "") - 0;
let portrait = block.innerHTML.match(/portraits\/([a-zA-Z0-9_-]+)p33/)[1];
let id = block.querySelector("a").href.split("=")[1];
creaturesInfo[portrait] = [
id,
price
];
}
});
(0, $dIwPZ.set)("eventCreaturesInfo", creaturesInfo);
}
function interceptButtons() {
let buttons = Array.from(document.querySelectorAll("input[id^=ne_attack_button]"));
if (buttons.length === 2) {
let available = 2 - buttons.filter((x)=>x.disabled).length;
buttons.forEach((button, index)=>{
button.addEventListener("mousedown", ()=>{
(0, $dIwPZ.set)("event_battle_side", index % 2);
(0, $dIwPZ.set)("eh_current_level", [
(0, $ao0pt.getCurrentLevel)(),
available
]);
});
});
}
}
}
});
parcelRequire("85UD7");
//# sourceMappingURL=EventHelperV2.user.js.map
`;
let scriptData = {
script: scriptText,
time: Date.now()
}
set("EventHelper", scriptData)
return scriptData
}
set("EventHelperVersion", "16.0.4")
let scriptData = get("EventHelper", null)
if (!scriptData) {
scriptData = await saveScript()
}
// eval(scriptData.script)
let newScript = document.createElement('script');
newScript.innerHTML = scriptData.script
document.head.appendChild(newScript);
if (scriptData.time + 900 * 1000 < Date.now()) {
saveScript()
}
}
start()
function get(key, def) {
let result = JSON.parse(localStorage[key] === undefined ? null : localStorage[key]);
return result == null ? def : result;
}
function set(key, val) {
localStorage[key] = JSON.stringify(val);
}