TerriX Executor v2.5.1

Full Stack Hook for Territorial.io. Fixed Auto-Colonizer and SpeedHack. Added Pro-Client Redirect.

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         TerriX Executor v2.5.1
// @namespace    http://tampermonkey.net/
// @version      2.5.1
// @description  Full Stack Hook for Territorial.io. Fixed Auto-Colonizer and SpeedHack. Added Pro-Client Redirect.
// @author       Assistant
// @match        *://territorial.io/*
// @match        *://everythingtt.github.io/TerriX-Client/*
// @match        file:///*/*.html
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const CLIENT_URL = "https://everythingtt.github.io/TerriX-Client/Territorial.io.html";
    const isOfficialSite = window.location.hostname === "territorial.io";

    // --- 1. THE FULL STACK TRAP (IIFE PIERCER) ---
    let trap = { ag: null, aD: null, b8: null, bf: null, al: null };

    // This captures the core objects by watching for their unique internal property assignments
    const createTrap = (prop, name) => {
        Object.defineProperty(Object.prototype, prop, {
            set: function(v) {
                this["_" + prop] = v;
                if (!trap[name]) {
                    trap[name] = this;
                    console.log(`TerriX: Captured System Object [${name}]`);
                }
            },
            get: function() { return this["_" + prop]; },
            configurable: true
        });
    };

    createTrap('h7', 'ag'); // Player Data
    createTrap('ep', 'aD'); // Game Config
    createTrap('hV', 'b8'); // Command Handler (Fixes Auto-Colonizer)
    createTrap('aCP', 'bf'); // Engine Clock (Fixes SpeedHack)
    createTrap('kw', 'al'); // Live Player List

    // --- 2. SCRIPT LIBRARY ---
    const SCRIPT_LIB = {
        AutoColonize: `/* Auto-Colonizer: Perfect for Openings */
if(!window.tx_loop) {
    window.tx_loop = setInterval(() => {
        const G = window.G;
        if (!G || !G.b8 || !G.b8.hV) return;
        const myId = G.aD.ep;
        if (G.ag.h7[myId] > 1000 && G.ag.mz[myId] !== 0) {
            G.b8.hV.hc(300, G.aD.f2); // 30% attack on neutral
        }
    }, 1000);
    alert("Auto-Colonizer: ON");
} else { clearInterval(window.tx_loop); window.tx_loop = null; alert("Auto-Colonizer: OFF"); }`,

        FullESP: `/* Full ESP: Console Data Dump */
const G = window.G;
console.log("--- LIVE WAR INTELLIGENCE ---");
for(let i=0; i<G.aD.f2; i++) {
    if(G.ag.mz[i] !== 0) {
        console.log(\`Rank: \${i} | Name: \${G.ag.zU[i]} | Troops: \${Math.floor(G.ag.h7[i])}\`);
    }
}
alert("Check Console (F12) for player data.");`,

        SpeedHack: `/* Tick Speed Hack (Single Player) */
const speed = prompt("Tick Speed (Default 56, Pro 10):", "10");
if(window.G.bf) window.G.bf.aCP = parseInt(speed);`
    };

    // --- 3. UI STYLES (Territorial Aesthetic) ---
    const style = document.createElement('style');
    style.innerHTML = `
        #tx-wrapper { position: fixed; top: 0; left: 0; width: 0; height: 0; z-index: 2147483647; font-family: 'system-ui', sans-serif; }
        #tx-gui {
            position: fixed; top: 100px; left: 100px; width: 620px; height: 450px;
            background: rgba(0, 0, 0, 0.92); border: 1.8px solid white; 
            display: none; flex-direction: column; color: white; box-shadow: 10px 10px 0px rgba(0,0,0,0.5);
        }
        #tx-header { padding: 10px 15px; background: rgba(40, 40, 40, 1); display: flex; justify-content: space-between; cursor: move; border-bottom: 1.8px solid white; font-weight: bold; }
        #tx-body { display: flex; flex: 1; overflow: hidden; }
        #tx-sidebar { width: 150px; background: rgba(20, 20, 20, 1); border-right: 1.8px solid white; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
        #tx-main { flex: 1; display: flex; flex-direction: column; padding: 12px; background: black; }
        #tx-editor { flex: 1; background: #050505; color: #00ff00; border: 1.8px solid #444; padding: 10px; font-family: monospace; resize: none; outline: none; font-size: 12px; }
        .tx-btn { padding: 6px; background: rgba(60, 60, 60, 0.85); border: 1.8px solid white; color: white; cursor: pointer; font-size: 10px; font-weight: bold; }
        .tx-btn:hover { background: rgba(100, 100, 100, 1); }
        .tx-btn.active { background: rgb(0, 100, 0); }
        .tx-btn.hook-btn { background: rgb(70, 50, 20); margin-top: auto; }
        .tx-btn.client-btn { background: #3a47ff; color: white; border-color: #fff; animation: tx_pulse 2s infinite; }
        @keyframes tx_pulse { 0% { opacity: 0.8; } 50% { opacity: 1; } 100% { opacity: 0.8; } }

        #tx-toggle { position: fixed; top: 0; left: 50%; transform: translateX(-50%); padding: 4px 20px; background: rgba(0, 80, 0, 1); color: white; border: 1.8px solid white; border-top: none; border-radius: 0 0 5px 5px; cursor: pointer; font-weight: bold; z-index: 1000002; }

        #tx-chart, #tx-scripts { display: none; flex: 1; flex-direction: column; gap: 4px; overflow-y: auto; }
        .script-card { background: #111; border: 1.8px solid white; padding: 8px; margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }
        
        .bar-row { display: flex; align-items: center; gap: 8px; height: 24px; width: 100%; flex-shrink: 0; }
        .bar-rank { width: 30px; font-size: 11px; color: #aaa; text-align: right; }
        .bar-name { width: 120px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .bar-track { flex: 1; background: #222; height: 14px; border: 1px solid #444; position: relative; }
        .bar-fill { height: 100%; width: 0%; background: #228B22; transition: width 0.3s ease; }
        .bar-val { position: absolute; right: 5px; top: 0px; font-size: 9px; color: white; line-height: 14px; font-weight: bold;}
        .me-row { color: #ffd700; font-weight: bold; }
        .me-row .bar-fill { background: #ffd700; border: 1px solid white; }
    `;
    document.documentElement.appendChild(style);

    // --- 4. UI CONSTRUCTION ---
    const wrapper = document.createElement('div');
    wrapper.id = 'tx-wrapper';
    document.documentElement.appendChild(wrapper);

    const render = () => {
        wrapper.innerHTML = `
            <div id="tx-toggle">TERRIX MENU</div>
            <div id="tx-gui">
                <div id="tx-header"><span>TERRIX <span style="color:#228B22">SYSTEM</span></span> <span id="tx-close" style="cursor:pointer">✕</span></div>
                <div id="tx-body">
                    <div id="tx-sidebar">
                        <button class="tx-btn active" id="nav-editor">EDITOR</button>
                        <button class="tx-btn" id="nav-chart">POWER INDEX</button>
                        <button class="tx-btn" id="nav-scripts">SCRIPTS</button>
                        ${isOfficialSite ? `<button class="tx-btn client-btn" onclick="window.open('${CLIENT_URL}')">🚀 TERRIX CLIENT</button>` : ''}
                        <button class="tx-btn hook-btn" id="tx-hook">INJECT HOOK</button>
                    </div>
                    <div id="tx-main">
                        <textarea id="tx-editor" spellcheck="false">/* TerriX 2.5 */</textarea>
                        <div id="tx-chart"></div>
                        <div id="tx-scripts">
                            <div class="script-card"><span>Auto-Colonizer</span><button class="tx-btn" onclick="tx_load('AutoColonize')">LOAD</button></div>
                            <div class="script-card"><span>Fog-of-War ESP</span><button class="tx-btn" onclick="tx_load('FullESP')">LOAD</button></div>
                            <div class="script-card"><span>Speed Hack</span><button class="tx-btn" onclick="tx_load('SpeedHack')">LOAD</button></div>
                        </div>
                    </div>
                </div>
                <div style="padding: 10px 20px; background: #111; display: flex; justify-content: space-between; border-top: 1.8px solid white;">
                    <button class="tx-btn" style="background:rgb(0,80,0); padding: 5px 15px;" id="tx-execute">EXECUTE</button>
                    <div style="font-size: 10px; color: #888;">STATUS: <span id="tx-stat" style="color:#f33">DISCONNECTED</span></div>
                </div>
            </div>
        `;
        setupLogic();
    };

    window.tx_load = (k) => { document.getElementById('tx-editor').value = SCRIPT_LIB[k]; document.getElementById('nav-editor').click(); };

    const setupLogic = () => {
        const gui = document.getElementById('tx-gui');
        const editor = document.getElementById('tx-editor');
        const chart = document.getElementById('tx-chart');
        const scriptTab = document.getElementById('tx-scripts');
        const hookBtn = document.getElementById('tx-hook');
        const stat = document.getElementById('tx-stat');

        document.getElementById('tx-toggle').onclick = () => gui.style.display = gui.style.display === 'flex' ? 'none' : 'flex';
        document.getElementById('tx-close').onclick = () => gui.style.display = 'none';

        const nav = (idx) => {
            [editor, chart, scriptTab].forEach((el, i) => el.style.display = i === idx ? (i === 0 ? 'block' : 'flex') : 'none');
            ['nav-editor', 'nav-chart', 'nav-scripts'].forEach((id, i) => document.getElementById(id).classList.toggle('active', i === idx));
        };
        document.getElementById('nav-editor').onclick = () => nav(0);
        document.getElementById('nav-chart').onclick = () => nav(1);
        document.getElementById('nav-scripts').onclick = () => nav(2);

        hookBtn.onclick = function() {
            if (window.G || (trap.ag && trap.aD)) {
                window.G = window.G || { ...trap, b8: trap.b8 || window.b8, bf: trap.bf || window.bf };
                this.innerText = "HOOKED";
                this.style.background = "#228B22";
                stat.innerText = isOfficialSite ? "INJECTED (LIMITED)" : "CONNECTED (FULL)";
                stat.style.color = "#00ff00";
                if(isOfficialSite) alert("Limited Hook on Official Site. For full exploits (Speed/Auto), use the TerriX Client button.");
            } else {
                alert("Engine not found. Expand territory once then try again.");
            }
        };

        document.getElementById('tx-execute').onclick = () => {
            if(!window.G) return alert("Hook First");
            try { new Function(editor.value)(); } catch(e) { alert(e); }
        };

        let d = false, x, y;
        document.getElementById('tx-header').onmousedown = (e) => { d = true; x = e.clientX - gui.offsetLeft; y = e.clientY - gui.offsetTop; };
        window.onmousemove = (e) => { if (d) { gui.style.left = (e.clientX - x) + 'px'; gui.style.top = (e.clientY - y) + 'px'; } };
        window.onmouseup = () => d = false;
    };

    render();

    // --- 5. PERMANENT CHART ENGINE ---
    const barCache = {};
    setInterval(() => {
        const chart = document.getElementById('tx-chart');
        if (!chart || chart.style.display !== 'flex' || !window.G) return;
        const { ag, aD } = window.G;
        const myId = aD ? aD.ep : -1;

        let players = [];
        for (let i = 0; i < 512; i++) {
            if (ag.gt[i] > 0) {
                const score = (ag.gt[i] * 10) + (ag.h7[i] / 50);
                players.push({ id: i, name: ag.zU[i] || "Bot", val: score, isMe: i === myId });
            }
        }
        players.sort((a, b) => b.val - a.val);
        const top = players.slice(0, 15);
        const max = top[0]?.val || 1;

        top.forEach((p, idx) => {
            if (!barCache[p.id]) {
                const row = document.createElement('div');
                row.className = 'bar-row';
                row.innerHTML = `<div class="bar-rank"></div><div class="bar-name"></div><div class="bar-track"><div class="bar-fill"></div><span class="bar-val"></span></div>`;
                chart.appendChild(row);
                barCache[p.id] = row;
            }
            const row = barCache[p.id];
            row.style.display = 'flex';
            row.style.order = idx;
            row.className = p.isMe ? 'bar-row me-row' : 'bar-row';
            row.querySelector('.bar-rank').innerText = `#${idx + 1}`;
            row.querySelector('.bar-name').innerText = p.name;
            row.querySelector('.bar-fill').style.width = (p.val / max * 100) + '%';
            row.querySelector('.bar-val').innerText = Math.floor(p.val).toLocaleString();
        });
        Object.keys(barCache).forEach(id => { if (!top.find(p => p.id == id)) barCache[id].style.display = 'none'; });
    }, 500);

})();