IdlePixel Color Blind

Adds in functionality for different things if color blind

// ==UserScript==
// @name         IdlePixel Color Blind
// @namespace    com.anwinity.idlepixel
// @version      1.1.0
// @description  Adds in functionality for different things if color blind
// @author       GodofNades
// @license      MIT
// @match        *://idle-pixel.com/login/play*
// @grant        none
// @require      https://greasyfork.org/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
// ==/UserScript==

(function() {
    class ColorBlindPlugin extends IdlePixelPlusPlugin {
        constructor() {
            super("ColorBlindPlugin", {
                about: {
                    name: GM_info.script.name + " (ver: " + GM_info.script.version + ")",
                    version: GM_info.script.version,
                    author: GM_info.script.author,
                    description: GM_info.script.description
                }
            });
        }

        onMessageReceived(data) {
            const monsterName = IdlePixelPlus.getVarOrDefault("monster_name", "", "string");
            if (data.startsWith("ANIMATE_MONSTER_SPRITE") && monsterName.startsWith("guardian")) {
                const guardianName = document.getElementById("fighting-monster-label");
                data = data.replaceAll("ANIMATE_MONSTER_SPRITE=", "")
                    .replaceAll("_animation~true", "")
                    .replaceAll("_animation~false", "");

                const animationMap = {
                    // Guardian One Animations
                    "green": "COLOR: GREEN",
                    "red": "COLOR: RED",
                    "blue": "COLOR: BLUE",
                    //Guardian Three Animations
                    "red_arrow": "ARROW: RED",
                    "green_arrow": "ARROW: GREEN",
                    "blue_arrow": "ARROW: BLUE",
                    "black_arrow": "ARROW: BLACK"
                };

                if (animationMap[data]) {
                    guardianName.innerHTML = animationMap[data];
                }
            }
        }
    }

    const plugin = new ColorBlindPlugin();
    IdlePixelPlus.registerPlugin(plugin);
})();