// ==UserScript==
// @name HWM_Resources
// @namespace http://tampermonkey.net/
// @version 1.5
// @description Библиотека всякой мелочевки, для совместной работы других скриптов
// @author Tags
// @include /^https{0,1}:\/\/(www\.heroeswm\.ru|178\.248\.235\.15|my\.lordswm\.com)\/(pl_info.php*)/
// @icon https://www.google.com/s2/favicons?sz=64&domain=heroeswm.ru
// @grant none
// @license CC BY-NC-SA 4.0
// ==/UserScript==
this.MercenaryElements = {
"абразив":{
id: "EL_42",
art_type: "abrasive"
}, "змеиный яд":{
id: "EL_43",
art_type: "snake_poison"
}, "клык тигра":{
id: "EL_46",
art_type: "tiger_tusk"
}, "ледяной кристалл":{
id: "EL_44",
art_type: "ice_crystal"
}, "лунный камень":{
id: "EL_45",
art_type: "moon_stone"
}, "огненный кристалл":{
id: "EL_40",
art_type: "fire_crystal"
}, "осколок метеорита":{
id: "EL_37",
art_type: "meteorit"
}, "цветок ведьм":{
id: "EL_41",
art_type: "witch_flower"
}, "цветок ветров":{
id: "EL_39",
art_type: "wind_flower"
}, "цветок папоротника":{
id: "EL_78",
art_type: "fern_flower"
}, "ядовитый гриб":{
id: "EL_38",
art_type: "badgrib"
},};
this.ItemCollection ={
"item_template": {
stats: { //параметры
attr_attack: 2, //значение атаки
attr_defense: 2, //значение защиты
attr_magicpower: 1, //значение силы магии
attr_knowledge: 1, //значение знаний
attr_initiative: 1, //значение инициативы
attr_fortune: 0, //значение удачи
attr_morale: 0, //значение морали
attr_oa: 7, //значение очков аммуниции
additional_stats:["параметр_1","параметр_2"] //дополнительные эффекты
},
required_level: 15, //требуемый уррвень
base_durability: 0, //базовая прочность
repair_price: 20000, //цена ремонта
is_hunting_item: false, //добывается ли предмет на охоте
is_event_item: true, //ивентовый предмет
is_set_part: true, //часть сета
is_shop_item: false, //предмет из магазина
is_shop_status:false, //предмет со статусом "из магазина"
shop_price: 0, //цена в магазине
},
"ocean_eye1": {
repair_price: 20000,
stats: {
attr_attack: 2,
attr_defense: 2,
attr_magicpower: 1,
attr_knowledge: 1,
attr_initiative: 1,
attr_fortune: 0,
attr_morale: 0,
attr_oa: 7
},
required_level: 15,
base_durability: 0,
is_hunting_item: false,
is_event_item: true,
is_set_part: true,
is_shop_item: false,
is_shop_status:false,
shop_price: 0,
},
};
(function() {
'use strict';
if(!window.location.href.includes('pl_info'))
return;
const tables = Array.from(document.getElementsByClassName('wb'));
const resourceTable = tables[tables.indexOf(tables.filter(e=>e.innerText=="Ресурсы")[0])+3]
if(resourceTable.hasAttribute("done")){
console.log("already processed");
return;}
//Вытаскиваем все доступные элементы и превращаем в объекты.
const items = resourceTable.innerHTML.split(/ /).filter(e => e !== "").map(s => s.replaceAll("<b>", "").replaceAll("<br>", "").replaceAll("</b>", "")).map(e => ({
name: e.split(':')[0],
value: e.split(':')[1],
isMercenary: window.MercenaryElements[e.split(':')[0]]!==undefined,
}));
const parts = items.filter(e=>!e.isMercenary);
const mercenary = items.filter(e=>e.isMercenary);
//Чистим табличку
resourceTable.innerHTML = "";
//Записываем новую разметку
for (let item of parts) {
const div = Object.assign(
document.createElement('div'), {
innerHTML: `<div> <b>${item.name}</b>: ${item.value}</div>`,
});;
div.setAttribute('ismercenary', item.isMercenary);
div.setAttribute('name', item.name);
resourceTable.appendChild(div);
}
const splitter = Object.assign(
document.createElement('div'), {
innerHTML: `<div name="splitter"><br></div>`,
});;
if(parts.length>0){
resourceTable.appendChild(splitter);
}
for (let item of mercenary) {
const div = Object.assign(
document.createElement('div'), {
innerHTML: `<div"> <b>${item.name}</b>: ${item.value}</div>`,
});;
div.setAttribute('ismercenary', item.isMercenary);
div.setAttribute('name', item.name);
resourceTable.appendChild(div);
}
resourceTable.setAttribute("done","true")
})();