battle_damage

Показывает вражеские урон всех стеков по одному своему. Выбрать существо можно здесь на этой строчке кода снизу "const CREATURE = ...". Урон не корректен, так что нужно помнить про погрешность

目前為 2023-04-09 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         battle_damage
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Показывает вражеские урон всех стеков по одному своему. Выбрать существо можно здесь на этой строчке кода снизу "const CREATURE = ...". Урон не корректен, так что нужно помнить про погрешность
// @author       You
// @license      None
// @match       https://www.heroeswm.ru/war*
// @match       https://my.lordswm.com/war*
// @match       https://www.lordswm.com/war*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==
const CREATURE = "Высшие вампиры"
let outer_chat = document.getElementById("chat_format");
outer_chat.innerHTML+= '<button id = "dmg_list_refresh" style="background-color: #555; color: white; padding: 5px 10px; border: none; border-radius: 4px; font-size: 10px; cursor: pointer">Refresh</button>'
let chat = document.getElementById("chat_inside");
//chat_format
let info = "<style>.cont{position:relative;display:inline-block}.count {position: absolute;right: 0;bottom: 0;color: #f5c140;text-shadow: 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 3px #000;font-size: 1rem;font-weight: bold;}</style>";
info += "<b>Ass</b><BR>";
info+= "<div id = 'creature_dmg_list'> </div>"
let refresh_button = document.createElement("button");
refresh_button.innerHTML = "Обновить";
document.getElementById("dmg_list_refresh").onclick = refresh
//outer_chat.appendChild(refresh_button);


function get_dmg_info(cre1_id, cre2_id){
    cre1_id = (parseInt(cre1_id) + 1).toString()
    window.stage.pole.attackmonster(cre1_id, window.stage.pole.obj[cre1_id].x, window.stage.pole.obj[cre1_id].y, window.stage.pole.obj[cre2_id].x, window.stage.pole.obj[cre2_id].y, cre2_id)
    return {min: window.PhysicalDamage, max: window.PhysicalDamage2}
}

function refresh(){
    let cre_list = Object.values(window.stage.pole.obj);
    [...chat.children].forEach(child=>{
        if (child.tagName == "P") child.remove()
    })
    let defender_num = 0
    cre_list.forEach(creature => {
        if (creature.nametxt == CREATURE || (creature.side == 1 && creature.nownumber!=0)){
            defender_num = cre_list.indexOf(creature)
            return
        }
        else {
            if (creature.nametxt!=""&& creature.side == 1 && creature.nownumber!=0) defender_num = cre_list.indexOf(creature)
        }
    })
    cre_list.forEach(creature => {
        //console.log(`${cre_list.indexOf(creature)} ${creature.nametxt} [${creature.nownumber}]`)
        if (creature.side == -1) {
            if (creature.nownumber == 0 || creature.nametxt == "") return
            let data = get_dmg_info(cre_list.indexOf(creature), defender_num)
            let hp = cre_list[defender_num].maxhealth
            let row = `<p>${creature.nametxt} [${creature.nownumber}] --> ${cre_list[defender_num].nametxt} [${cre_list[defender_num].nownumber}] : <b>${Math.round(data.min/hp)}-${Math.round(data.max/hp)} существ</b> (${data.min}-${data.max}) </p>`;
            //console.log(`${creature.nametxt} [${creature.nownumber}]`)
            chat.innerHTML = chat.innerHTML + row;
        }
    })
}