FlatMMO+ HP Viewer

Shows the enemy hp while fighting

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         FlatMMO+ HP Viewer
// @namespace    com.dounford.flatmmo.hp
// @version      1.0.2
// @description  Shows the enemy hp while fighting
// @author       Dounford
// @license      MIT
// @match        *://flatmmo.com/play.php*
// @grant        none
// @require      https://update.greasyfork.org/scripts/544062/FlatMMOPlus.js
// ==/UserScript==
 
(function() {
    'use strict';
 
    class hpViewerPlugin extends FlatMMOPlusPlugin {
        constructor() {
            super("hpViewer", {
                about: {
                    name: GM_info.script.name,
                    version: GM_info.script.version,
                    author: GM_info.script.author,
                    description: GM_info.script.description
                },
            });
        }
        
        onLogin() {

        }
        
        onPaint() {
            for (let uuid in npcs) {
                if (npcs.hasOwnProperty(uuid)) {
                    if(npcs[uuid].in_combat && npcs[uuid].is_hidden === false) {
                        let max_hp = npcs[uuid].max_hp;
                        let hp = npcs[uuid].hp;
                        ctx.fillStyle = "white";
                        ctx.font = "20px serif";
                        ctx.fillText(hp + "/" + max_hp, npcs[uuid].client_x + 4, npcs[uuid].client_y - (npcs[uuid].height - 1) * TILE_SIZE - TILE_SIZE/8 - 3);
                        ctx.font = "16px serif"
                    }
                }
            }
        }
    }
 
    const plugin = new hpViewerPlugin();
    FlatMMOPlus.registerPlugin(plugin);
 
})();