Smokin Hacks

Killaura + Auto-Spike

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         Smokin Hacks
// @namespace    https://bloxd.io
// @version      1.4
// @description  Killaura + Auto-Spike
// @license      No where
// @match        https://bloxd.io/*
// @match        https://staging.bloxd.io/*
// @match        https://www.bloxd.com/*
// @match        https://bloxd.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(() => {
    'use strict';

    const attempt = (fn, fb=null) => { try { return fn(); } catch(_) { return fb; } };
    const vals = o => Object.values(o ?? {});
    const ks   = o => Object.keys(o ?? {});

    const bloxd = {
        noa: null,
        _req: null,

        init() {
            const descs = Object.getOwnPropertyDescriptors(window);
            const ckey  = ks(descs).find(k => descs[k]?.set?.toString().includes('++'));
            if (!ckey || typeof window[ckey]?.push !== 'function') return;

            window[ckey].push([[Math.floor(Math.random() * 90000) + 10000], {}, req => {
                this._req = req;
                const mkeys = ks(req.m);
                for (let i = 0; i < mkeys.length; i++) {
                    try {
                        if (!req.m[mkeys[i]].toString().includes('nonBlocksClient:')) continue;
                        const mod   = req(mkeys[i]);
                        const props = vals(mod).find(e => e && typeof e === 'object');
                        const noa   = props && vals(props).find(e => e?.entities);
                        if (noa) { this.noa = noa; window.noa = noa; }
                        break;
                    } catch(_) {}
                }
            }]);
        }
    };

    const game = {
        _held: null,

        inGame()      { return !!(bloxd.noa?.bloxd?.client?.msgHandler); },
        getPos(id)    { return attempt(() => bloxd.noa.entities.getState(id, 'position').position); },
        getIds()      { return attempt(() => bloxd.noa?.bloxd?.getPlayerIds?.() ?? {}, {}); },

        getHeld(id=1) {
            if (!bloxd.noa) return null;
            if (!this._held) this._held = vals(bloxd.noa.entities).find(fn => {
                if (typeof fn !== 'function' || fn.length !== 1) return false;
                const s = fn.toString();
                return s.length < 80 && s.includes(').') && !s.includes('opWrapper');
            });
            return attempt(() => this._held?.(id));
        },

        doAttack(id) {
            attempt(() => {
                const item = this.getHeld(1);
                const fn   = item?.doAttack ?? item?.breakingItem?.doAttack;
                if (fn) fn.call(item, [0, 0, 0], id.toString(), 'HeadMesh');
            });
        },

        fireInput(action, down) {
            attempt(() => {
                const inp = bloxd.noa?.inputs; if (!inp) return;
                (down ? inp.down : inp.up)._events?.[action]?.(0);
            });
        },

        sendMsg(msg, color='#c084fc') {
            attempt(() => bloxd.noa?.bloxd?.client?.clientApi?.sendMessage?.(1, msg, { color }));
        }
    };

    class Mod {
        constructor(name, key) { this.name=name; this.key=key; this.enabled=false; this.btn=null; }
        toggle() {
            this.enabled = !this.enabled;
            this.onToggle(this.enabled);
            if (this.btn) {
                this.btn.classList.toggle('on', this.enabled);
            }
        }
        onToggle(_) {} onTick() {}
    }

    const modules = {
        killaura: new class extends Mod {
            constructor() {
                super('Killaura', 'KeyJ');
                this._last = 0;
                this.delay = 1;
                this.range = 7;
                this.multi = true;
            }
            onTick() {
                if (!game.inGame() || Date.now() - this._last < this.delay) return;
                const self = game.getPos(1); if (!self) return;

                for (const id of vals(game.getIds())) {
                    if (id == 1) continue;
                    const p = game.getPos(id); if (!p) continue;
                    if (Math.hypot(p[0]-self[0], p[1]-self[1], p[2]-self[2]) < this.range) {
                        this._last = Date.now();
                        game.doAttack(id);
                        if (!this.multi) break;
                    }
                }
            }
            onToggle(enabled) {
                if (enabled) {
                    game.sendMsg('⚡ Killaura enabled');
                } else {
                    game.sendMsg('⚡ Killaura disabled');
                }
            }
        }(),
        autoSpike: new class extends Mod {
            constructor() {
                super('Auto-Spike', 'KeyK');
                this._lastPlace = 0;
                this.placeDelay = 300;
                this.webFirst = true;
            }
            onTick() {
                if (!game.inGame() || Date.now() - this._lastPlace < this.placeDelay) return;
                const self = game.getPos(1); if (!self) return;

                const nearbyEnemies = vals(game.getIds()).filter(id => {
                    if (id == 1) return false;
                    const p = game.getPos(id);
                    if (!p) return false;
                    const dist = Math.hypot(p[0]-self[0], p[1]-self[1], p[2]-self[2]);
                    return dist < 15;
                });

                if (nearbyEnemies.length > 0) {
                    this._lastPlace = Date.now();

                    if (this.webFirst) {
                        game.fireInput('3', true);
                        setTimeout(() => game.fireInput('3', false), 50);
                    } else {
                        game.fireInput('4', true);
                        setTimeout(() => game.fireInput('4', false), 50);
                    }
                    this.webFirst = !this.webFirst;

                    setTimeout(() => {
                        game.fireInput('place', true);
                        setTimeout(() => game.fireInput('place', false), 50);
                    }, 100);
                }
            }
            onToggle(enabled) {
                if (enabled) {
                    game.sendMsg('🕷️ Auto-Spike enabled');
                } else {
                    game.sendMsg('🕷️ Auto-Spike disabled');
                }
            }
        }()
    };

    function buildUI() {
        if (document.getElementById('ch-root')) return;

        const css = document.createElement('style');
        css.textContent = `
            @import url('https://fonts.googleapis.com/css2?family=Teko:wght@700&family=Special+Elite&display=swap');

            #ch-root {
                position: fixed;
                top: 8px;
                left: 50%;
                transform: translateX(-50%);
                height: 42px;
                display: flex;
                align-items: center;
                gap: 0;
                background: #08001488;
                border: 1px solid #7c3aed;
                border-radius: 22px;
                font-family: 'Special Elite', monospace;
                font-size: 12px;
                color: #e2d9f3;
                z-index: 99999;
                box-shadow: 0 0 18px #7c3aed66, 0 2px 24px #00000088;
                user-select: none;
                transition: opacity .25s, transform .25s;
                backdrop-filter: blur(8px);
                padding: 0 12px;
                white-space: nowrap;
                overflow: visible;
                min-width: 920px;
            }
            #ch-root.hidden {
                opacity: 0;
                pointer-events: none;
                transform: translateX(-50%) translateY(-60px);
            }

            #ch-title {
                font-family: 'Teko', sans-serif;
                font-size: 17px;
                color: #c084fc;
                text-shadow: 0 0 10px #a855f7, 0 0 22px #7c3aed88;
                padding: 0 14px 0 10px;
                border-right: 1px solid #7c3aed55;
                letter-spacing: 1px;
            }

            .ch-div {
                width: 1px;
                height: 22px;
                background: #7c3aed44;
                margin: 0 4px;
            }

            .ch-btn {
                display: flex;
                align-items: center;
                gap: 6px;
                padding: 6px 14px;
                border-radius: 16px;
                border: 1px solid transparent;
                background: transparent;
                color: #6b7280;
                font-family: 'Special Elite', monospace;
                font-size: 12px;
                cursor: pointer;
                transition: all .18s;
                letter-spacing: 0.5px;
            }
            .ch-btn:hover {
                background: #3b076422;
                color: #c084fc;
                border-color: #7c3aed55;
            }
            .ch-btn.on {
                background: linear-gradient(135deg, #581c87aa, #3b0764aa);
                border-color: #a855f7;
                color: #f0abfc;
                box-shadow: 0 0 12px #a855f755;
            }
            .ch-key {
                font-size: 9px;
                color: #6d28d9;
                background: #0a0010;
                border: 1px solid #4c1d9577;
                border-radius: 4px;
                padding: 1px 5px;
                font-family: 'Special Elite', monospace;
            }
            .ch-btn.on .ch-key { color: #e879f9; border-color: #a855f7; }

            .ch-range-wrap {
                display: flex;
                align-items: center;
                gap: 6px;
                padding: 0 10px;
                color: #7c3aed;
                font-size: 11px;
                letter-spacing: 1px;
            }
            .ch-inp {
                background: #0d001a;
                border: 1px solid #4c1d95;
                border-radius: 8px;
                color: #e9d5ff;
                font-family: 'Special Elite', monospace;
                font-size: 11px;
                width: 46px;
                padding: 3px 6px;
                text-align: center;
                transition: all .15s;
            }
            .ch-inp:focus {
                outline: none;
                border-color: #a855f7;
                box-shadow: 0 0 8px #7c3aed66;
                color: #f0abfc;
            }

            .ch-chk {
                display: flex;
                align-items: center;
                gap: 5px;
                font-size: 11px;
                color: #7c3aed;
                cursor: pointer;
                padding: 0 10px;
            }
            .ch-chk input { accent-color: #a855f7; cursor: pointer; }
            .ch-chk:hover { color: #c084fc; }

            #ch-status {
                font-family: 'Special Elite', monospace;
                font-size: 10px;
                color: #3b0764;
                padding: 0 12px;
                letter-spacing: 1px;
                flex: 1;
                text-align: center;
            }
            #ch-status.on {
                color: #e879f9;
                text-shadow: 0 0 8px #a855f7;
            }

            .ch-hbtn {
                background: transparent;
                border: 1px solid #4c1d9566;
                color: #6d28d9;
                border-radius: 50%;
                width: 24px;
                height: 24px;
                cursor: pointer;
                font-size: 11px;
                display: flex;
                align-items: center;
                justify-content: center;
                transition: all .15s;
                padding: 0;
                font-family: monospace;
                flex-shrink: 0;
            }
            .ch-hbtn:hover {
                background: #7c3aed33;
                color: #e9d5ff;
                border-color: #a855f7;
                box-shadow: 0 0 8px #7c3aed88;
            }

            @keyframes glitch {
                0%,60%,100% { text-shadow: 0 0 10px #a855f7, 0 0 22px #7c3aed88; }
                20% { text-shadow: -2px 0 #f0abfc, 2px 0 #818cf8; }
                40% { text-shadow: 2px 0 #f0abfc, -2px 0 #818cf8; }
            }
            #ch-title:hover { animation: glitch .4s steps(1); cursor: default; }
        `;
        document.head.appendChild(css);

        const root = document.createElement('div');
        root.id = 'ch-root';
        root.innerHTML = `
            <span id="ch-title">👾 Smokin Hacks</span>
            <div class="ch-div"></div>
            <button class="ch-btn" id="ch-killaura">
                <span>Killaura</span>
                <span class="ch-key">J</span>
            </button>
            <div class="ch-div"></div>
            <button class="ch-btn" id="ch-autospike">
                <span>Auto-Spike</span>
                <span class="ch-key">K</span>
            </button>
            <div class="ch-div"></div>
            <div class="ch-range-wrap">
                <span>Range</span>
                <input class="ch-inp" id="ch-krange" type="number" min="1" max="20" step="0.5" value="7">
            </div>
            <div class="ch-div"></div>
            <label class="ch-chk">
                <input type="checkbox" id="ch-kmulti" checked> Multi
            </label>
            <div class="ch-div"></div>
            <span id="ch-status">waiting…</span>
            <div class="ch-div"></div>
            <button class="ch-hbtn" id="ch-hide" title="Hide (ShiftRight)">✕</button>
        `;
        document.body.appendChild(root);

        const kBtn = document.getElementById('ch-killaura');
        modules.killaura.btn = kBtn;
        kBtn.addEventListener('click', () => modules.killaura.toggle());

        const asBtn = document.getElementById('ch-autospike');
        modules.autoSpike.btn = asBtn;
        asBtn.addEventListener('click', () => modules.autoSpike.toggle());

        const bindInput = (id, cb) => {
            const el = document.getElementById(id);
            el.addEventListener('change', e => cb(+e.target.value || 0));
            el.addEventListener('focus',  () => attempt(() => { if (bloxd.noa?.inputs) bloxd.noa.inputs._paused = true; }));
            el.addEventListener('blur',   () => attempt(() => { if (bloxd.noa?.inputs) bloxd.noa.inputs._paused = false; }));
            el.addEventListener('keydown', e => e.stopPropagation(), true);
            el.addEventListener('keyup',   e => e.stopPropagation(), true);
        };
        bindInput('ch-krange', v => modules.killaura.range = Math.max(1, v));
        document.getElementById('ch-kmulti').addEventListener('change', e => modules.killaura.multi = e.target.checked);

        let visible = true;
        document.getElementById('ch-hide').addEventListener('click', () => {
            visible = false;
            root.classList.add('hidden');
        });

        document.addEventListener('keydown', e => {
            switch (e.code) {
                case 'ShiftRight': visible=!visible; root.classList.toggle('hidden', !visible); return;
                case 'KeyJ': modules.killaura.toggle(); return;
                case 'KeyK': modules.autoSpike.toggle(); return;
            }
        }, true);
    }

    function setStatus(msg, on) {
        const el = document.getElementById('ch-status'); if (!el) return;
        el.textContent = msg; el.className = on ? 'on' : '';
    }

    let inGame = false, announced = false;

    function rafLoop() {
        requestAnimationFrame(rafLoop);
        if (!inGame) return;
        attempt(() => vals(modules).forEach(m => { if (m.enabled) m.onTick(); }));
    }

    function watchGame() {
        setInterval(() => {
            const now = game.inGame();
            if (now && !inGame) {
                inGame = true; setStatus('● ONLINE', true);
                if (!announced) { game.sendMsg('👾 Smokin Hacks v1.4 — J=Killaura | K=Auto-Spike'); announced = true; }
            } else if (!now && inGame) {
                inGame = false; setStatus('awaiting game…', false);
            }
        }, 500);
    }

    let uiBuilt = false;

    function tryInit() {
        if (!window.noa) { bloxd.init(); return; }
        if (!uiBuilt) {
            uiBuilt = true;
            buildUI();
            watchGame();
            rafLoop();
        }
    }

    bloxd.init();

    const poll = setInterval(() => {
        tryInit();
        if (uiBuilt) clearInterval(poll);
    }, 250);

})();