Orna Assess

Adiciona opção de avaliar o item no codex oficial do Orna/Aethric

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Orna Assess
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Adiciona opção de avaliar o item no codex oficial do Orna/Aethric
// @author       Azmuth
// @match        https://playorna.com/codex/items/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=playorna.com
// @grant        none
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    console.clear = () => {}

    const Swal = Sweetalert2

    let attribute
    let original
    let compare

    window._qualify = function(value, att) {
        compare = Number(prompt(`Digite o atributo ${att.toUpperCase()} do seu item:`))
        Swal.fire({
            title: `${Number(compare*100/value).toFixed(2)}%`,
            text: "Esta é a qualidade aproximada do seu item",
            icon: "success"
        });
    }

    $('.codex-stat').each(
        function(i, data) {
            attribute = /\D+(?=\:)/.exec(data.innerText)
            original  = /[\-0-9]+/.exec(data.innerText)

            if (/^(Ataque|Magia|Resistencia|Defesa|Guarda|HP|Mana|Destreza)/.test(data.innerText)) {
                data.innerHTML += `<button onclick="_qualify(${Number(original)}, '${attribute}')">Assess</button>`
            }
        }
    )
})();