gw2skills.net add fractal bonus attributes 碎层额外属性计算器

为 gw2skills.net 添加碎层额外属性。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         gw2skills.net add fractal bonus attributes 碎层额外属性计算器
// @namespace    https://greasyfork.org/scripts/412693
// @version      1.1
// @description  为 gw2skills.net 添加碎层额外属性。
// @icon         http://img.gw2skills.net/favicon.ico
// @author       Saber Lily 莉莉哩哩 Gay哩Gay气
// @run-at       document-end
// @match        http://*.gw2skills.net/*
// @grant        none
// @license      GPL-v3
// ==/UserScript==

// 作者简介
// Saber Lily.1960 Current in WSR EU Server
// 莉莉哩哩 Gay哩Gay气,一个天天划水的休闲 激战2 欧服玩家。
// 如果你觉得该脚本对你有所帮助,欢迎赞助我!

// 脚本原理
// 1. 略

// 版权申明
// 本脚本为 Saber Lily.1960 原创,未经作者授权禁止转载,禁止转载范围包括但不仅限于:贴吧、NGA论坛等。

var gridWindow = document.querySelector(".ui-grid_window");

function calcAttribute() {
    var agonyAttribute = document.getElementById("agonyAttribute");
        var agonyResistance = document.getElementById("agonyResistance");

        var toughness = (agonyResistance.value * 1.5).toFixed(2).toString();
        var precision = (agonyResistance.value * 1.5 / 21).toFixed(2).toString();
        var concentration = (agonyResistance.value * 1.5 / 15).toFixed(1).toString();
        agonyAttribute.textContent = `Precision ${precision}%, Concentration ${concentration}%, Toughness ${toughness}`;
}

if (gridWindow) {
    console.log('GW2 Skill Zh-CN more buff by Saber Lily 已启用!')

    var agonySummary = document.createElement("ul");
    agonySummary.innerHTML = '<div>Agony <input type="number" id="agonyResistance" value="150" min="0" max="500"></div><div id="agonyAttribute"></div>';
    agonySummary.className = "ui-grid ui-armor-summary";
    agonySummary.setAttribute("style", "font-size: 12px; left: 825px; width: 150px; height: 100px; line-height: 13px;");

    gridWindow.appendChild(agonySummary);
    calcAttribute();

    var agonyResistance = document.getElementById("agonyResistance");
    agonyResistance.addEventListener("input", (event) => {
        calcAttribute();
    });

}