opensource MiniGiants.io

cool script with alot of futures and fun things to try.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Advertisement:

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

Advertisement:

// ==UserScript==
// @name         opensource MiniGiants.io
// @namespace    http://tampermonkey.net/
// @version      2.2
// @description  cool script with alot of futures and fun things to try.
// @author       You
// @match        *://*/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Inject CSS for the animated rainbow effect smoothly into the document head
    const style = document.createElement('style');
    style.innerHTML = `
        @keyframes rainbowText {
            0% { color: #ff6b6b; }
            20% { color: #fcca46; }
            40% { color: #a1c181; }
            60% { color: #61afef; }
            80% { color: #c678dd; }
            100% { color: #ff6b6b; }
        }
        .opensource-rainbow-title {
            animation: rainbowText 4s linear infinite;
            font-weight: bold;
            font-size: 14px;
            letter-spacing: 1px;
        }
    `;
    document.head.appendChild(style);

    const checkRuntime = setInterval(() => {
        if (typeof cr_getC2Runtime !== "undefined") {
            clearInterval(checkRuntime);
            createInspectorUI();
        }
    }, 1000);

    function createInspectorUI() {
        const container = document.createElement("div");
        container.id = "opensource-inspector-panel";
        container.style = "position: fixed; top: 20px; right: 20px; width: 310px; background: #1e222a; color: #abb2bf; font-family: monospace; font-size: 11px; border: 2px solid #3e4452; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 999999; padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 85vh;";

        container.innerHTML = `
            <div id="ins-header" style="border-bottom: 1px solid #3e4452; padding-bottom: 6px; cursor: move; user-select: none; display: flex; align-items: center; justify-content: space-between;">
                <button id="ins-drop-btn" style="background: #e06c75; color: white; border: none; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 10px; display: none;">STOP</button>
                <div class="opensource-rainbow-title" style="flex-grow: 1; text-align: center; margin-left: 20px;">OPENSOURCE</div>
                <button id="ins-toggle" style="background: #3e4452; color: #eceff4; border: none; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-weight: bold;">[ - ]</button>
            </div>

            <div id="ins-body" style="display: flex; flex-direction: column; gap: 8px; height: 100%;">

                <div style="background: #282c34; padding: 8px; border-radius: 4px; display: flex; flex-direction: column; gap: 4px; border: 1px dashed #e5c07b;">
                    <span style="font-weight: bold; color: #e5c07b;">⚡ Custom Bulk Overwrite Engine:</span>
                    <div style="display: flex; gap: 4px; align-items: center;">
                        <input type="text" id="bulk-value-input" value="99999" placeholder="Target Number" style="flex: 1; background: #1e222a; color: white; border: 1px solid #5c6370; padding: 3px; font-family: monospace;">
                        <button id="btn-bulk-bot" style="background: #e06c75; color: white; border: none; padding: 4px 6px; border-radius: 3px; cursor: pointer; font-weight: bold; font-size: 10px;">All Bots</button>
                        <button id="btn-bulk-player" style="background: #98c379; color: black; border: none; padding: 4px 6px; border-radius: 3px; cursor: pointer; font-weight: bold; font-size: 10px;">All Player</button>
                    </div>
                </div>

                <div style="display: flex; gap: 4px;">
                    <button id="btn-load-bot" style="flex: 1; background: #4c566a; color: white; border: none; padding: 6px; border-radius: 3px; cursor: pointer; font-weight: bold;">Load Bots</button>
                    <button id="btn-show-player" style="flex: 1; background: #4c566a; color: white; border: none; padding: 6px; border-radius: 3px; cursor: pointer; font-weight: bold;">Manual Player</button>
                </div>

                <div id="ins-list" style="overflow-y: auto; max-height: 50vh; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; background: #282c34; padding: 6px; border-radius: 4px;">
                    <span style="color: #5c6370; font-style: italic; text-align: center; padding: 10px;">Choose a dataset to process...</span>
                </div>
            </div>
        `;
        document.body.appendChild(container);

        const listContainer = document.getElementById("ins-list");
        const body = document.getElementById("ins-body");
        const toggleBtn = document.getElementById("ins-toggle");

        // UI Collapsible State Toggles
        let collapsed = false;
        toggleBtn.onclick = () => {
            collapsed = !collapsed;
            body.style.display = collapsed ? "none" : "flex";
            toggleBtn.textContent = collapsed ? "[ + ]" : "[ - ]";
        };

        // Header Panel Drag Logic Handles
        const dropBtn = document.getElementById("ins-drop-btn");
        let dragging = false, oX = 0, oY = 0;
        document.getElementById("ins-header").addEventListener('mousedown', (e) => {
            if (e.target.tagName === "BUTTON" || e.target.tagName === "INPUT") return;
            dragging = true;
            oX = e.clientX - container.getBoundingClientRect().left;
            oY = e.clientY - container.getBoundingClientRect().top;
            dropBtn.style.display = "inline-block";
            e.preventDefault();
        });
        window.addEventListener('mousemove', (e) => {
            if (!dragging) return;
            container.style.left = (e.clientX - oX) + 'px';
            container.style.top = (e.clientY - oY) + 'px';
            container.style.right = 'auto';
        });
        window.addEventListener('mouseup', () => { dragging = false; dropBtn.style.display = "none"; });
        dropBtn.onclick = (e) => { dragging = false; dropBtn.style.display = "none"; e.stopPropagation(); };

        // Prevent typing leakage out of the main bulk input slot explicitly
        document.getElementById("bulk-value-input").addEventListener('mousedown', (e) => e.stopPropagation());
        document.getElementById("bulk-value-input").addEventListener('click', (e) => e.stopPropagation());
        document.getElementById("bulk-value-input").addEventListener('keydown', (e) => e.stopPropagation());

        // --- CORE BULK OVERWRITE INJECTION ACTIONS ---

        document.getElementById("btn-bulk-bot").onclick = () => {
            const rawInput = document.getElementById("bulk-value-input").value;
            const customNum = isNaN(rawInput) ? rawInput : Number(rawInput);
            try {
                const rt = cr_getC2Runtime();
                const botType = rt.types_by_index.find(t => t.name === "t101");
                botType.instances.forEach(inst => {
                    if (inst.instance_vars) {
                        for (let i = 0; i < inst.instance_vars.length; i++) {
                            if (typeof inst.instance_vars[i] === "number") {
                                inst.instance_vars[i] = customNum;
                                const activeBox = document.getElementById(`bot-input-${i}`);
                                if (activeBox) activeBox.value = customNum;
                            }
                        }
                    }
                });
            } catch(e) { console.log("Bulk Bot failure", e); }
        };

        document.getElementById("btn-bulk-player").onclick = () => {
            const rawInput = document.getElementById("bulk-value-input").value;
            const customNum = isNaN(rawInput) ? rawInput : Number(rawInput);
            try {
                const rt = cr_getC2Runtime();
                const botType = rt.types_by_index.find(t => t.name === "t101");
                botType.instances.forEach(inst => {
                    const p = inst.instance_vars[81];
                    if (p) {
                        const targetArray = p.instance_vars || p.data;
                        if (targetArray) {
                            for (let i = 0; i < targetArray.length; i++) {
                                if (typeof targetArray[i] === "number") {
                                    targetArray[i] = customNum;
                                    const activeBox = document.getElementById(`player-input-${i}`);
                                    if (activeBox) activeBox.value = customNum;
                                }
                            }
                        }
                    }
                });
            } catch(e) { console.log("Bulk Player failure", e); }
        };

        // --- DYNAMIC SELECTION RENDERING ---

        document.getElementById("btn-load-bot").onclick = () => {
            try {
                const rt = cr_getC2Runtime();
                const botType = rt.types_by_index.find(t => t.name === "t101");
                const sample = botType.instances[0];
                listContainer.innerHTML = "";

                sample.instance_vars.forEach((currentValue, idx) => {
                    if (typeof currentValue === 'object' && currentValue !== null) return;
                    const row = document.createElement("div");
                    row.style = "display: flex; justify-content: space-between; align-items: center; background: #1e222a; padding: 4px; border-radius: 3px; gap: 4px;";
                    row.innerHTML = `
                        <span style="color: #e06c75; min-width: 50px;">B[${idx}]</span>
                        <input type="text" id="bot-input-${idx}" value="${currentValue}" style="flex: 1; background: #282c34; color: #fff; border: 1px solid #5c6370; padding: 2px; font-size: 10px; max-width: 140px;">
                        <button id="bot-set-${idx}" style="background: #4c566a; color: white; border: none; padding: 2px 4px; border-radius: 2px; cursor: pointer;">Set</button>
                    `;
                    listContainer.appendChild(row);

                    // Isolate events on each newly rendered text box explicitly
                    const targetedBox = document.getElementById(`bot-input-${idx}`);
                    ['mousedown', 'click', 'keydown', 'keyup', 'keypress'].forEach(evt => {
                        targetedBox.addEventListener(evt, (e) => e.stopPropagation());
                    });

                    document.getElementById(`bot-set-${idx}`).onclick = () => {
                        const val = targetedBox.value;
                        const parsed = isNaN(val) ? val : Number(val);
                        const freshRt = cr_getC2Runtime();
                        const freshBotType = freshRt.types_by_index.find(t => t.name === "t101");
                        freshBotType.instances.forEach(inst => { if (inst.instance_vars) inst.instance_vars[idx] = parsed; });
                    };
                });
            } catch(err) { listContainer.innerHTML = `<span style="color:#e06c75; text-align:center;">Spawn into match first.</span>`; }
        };

        document.getElementById("btn-show-player").onclick = () => {
            listContainer.innerHTML = "";
            const commonPlayerIndices = [0, 1, 2, 3, 4, 5, 10, 15, 20, 25, 30, 32, 50, 80, 81, 100];

            commonPlayerIndices.forEach((idx) => {
                let currentLiveVal = "";
                try {
                    const rt = cr_getC2Runtime();
                    const botType = rt.types_by_index.find(t => t.name === "t101");
                    const p = botType.instances[0].instance_vars[81];
                    const targetArray = p.instance_vars || p.data;
                    if (targetArray && targetArray[idx] !== undefined) currentLiveVal = targetArray[idx];
                } catch(e) {}

                const row = document.createElement("div");
                row.style = "display: flex; justify-content: space-between; align-items: center; background: #1e222a; padding: 4px; border-radius: 3px; gap: 4px;";
                row.innerHTML = `
                    <span style="color: #98c379; min-width: 50px;">P[${idx}]</span>
                    <input type="text" id="player-input-${idx}" value="${currentLiveVal}" placeholder="Val" style="flex: 1; background: #282c34; color: #fff; border: 1px solid #5c6370; padding: 2px; font-size: 10px; max-width: 140px;">
                    <button id="player-set-${idx}" style="background: #4c566a; color: white; border: none; padding: 2px 4px; border-radius: 2px; cursor: pointer;">Set</button>
                `;
                listContainer.appendChild(row);

                // Isolate events on each newly rendered text box explicitly
                const targetedBox = document.getElementById(`player-input-${idx}`);
                ['mousedown', 'click', 'keydown', 'keyup', 'keypress'].forEach(evt => {
                    targetedBox.addEventListener(evt, (e) => e.stopPropagation());
                });

                document.getElementById(`player-set-${idx}`).onclick = () => {
                    const val = targetedBox.value;
                    const parsed = isNaN(val) ? val : Number(val);
                    try {
                        const freshRt = cr_getC2Runtime();
                        const freshBotType = freshRt.types_by_index.find(t => t.name === "t101");
                        freshBotType.instances.forEach(inst => {
                            const p = inst.instance_vars[81];
                            if (p) {
                                const targetArray = p.instance_vars || p.data;
                                if (targetArray) targetArray[idx] = parsed;
                            }
                        });
                    } catch(e) {}
                };
            });
        };
    }
})();