Greasy Fork

Greasy Fork is available in English.

Vortex Forge Web Client V1.2

Vortex Forge Web Client with Sniper Mode

当前为 2025-01-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Vortex Forge Web Client V1.2
// @namespace    http://tampermonkey.net/
// @version      2.2
// @description  Vortex Forge Web Client with Sniper Mode
// @author       NOOB
// @match        https://deadshot.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    let featuresEnabled = true;
    let sniperModeEnabled = false;
    let fireworkInterval = null;
    let kKeyInterval = null;
    let isRightMousePressed = false;
    let spacebarLockEnabled = false;

    const newSettingsContent = `
    <div class="setting toggle" style="margin-top: 30px; padding: 9px 30px;">
        <p style="font-size: 21px;">Sniper Mode</p>
        <label>
            <input id="vfSniperMode" class="checkbox" type="checkbox">
            <span></span>
        </label>
    </div>
    <div class="setting toggle" style="padding: 9px 30px; background-color: rgba(255, 255, 255, 0.03);">
        <p style="font-size: 21px;">Vortex Forge Mode</p>
        <label>
            <input id="vfsettings" class="checkbox" type="checkbox" checked="">
            <span></span>
        </label>
    </div>`;

    //For new updates,lock spacebar option toggle
    function showToast(message) {
        const toast = document.createElement('div');
        toast.innerText = message;
        toast.style.position = 'fixed';
        toast.style.bottom = '20px';
        toast.style.right = '20px';
        toast.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
        toast.style.color = 'white';
        toast.style.padding = '10px 20px';
        toast.style.borderRadius = '5px';
        toast.style.fontSize = '14px';
        toast.style.zIndex = '10000';
        toast.style.opacity = '0';
        toast.style.transition = 'opacity 0.5s';

        document.body.appendChild(toast);

        setTimeout(() => (toast.style.opacity = '1'), 50);
        setTimeout(() => {
            toast.style.opacity = '0';
            setTimeout(() => toast.remove(), 500);
        }, 2000);
    }

    document.addEventListener('keydown', (e) => {
        if (e.key === 'Control') {
            spacebarLockEnabled = !spacebarLockEnabled;
            if (spacebarLockEnabled) {
                showToast('Spacebar lock is ON');
            } else {
                showToast('Spacebar lock is OFF');
            }
        }
    });

    document.addEventListener('keydown', (e) => {
        if (spacebarLockEnabled && (e.key === ' ' || e.code === 'Space')) {
            e.stopPropagation();

            const isTyping = e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA';
            if (!isTyping) {
                e.preventDefault();
            }
        }
    });

    //Make space by removing left handed mode(rubbish)
    function removeLeftHandedSetting() {
        const leftHandedDiv = document.querySelector('.setting.toggle input#lefthand')?.closest('.setting.toggle');
        if (leftHandedDiv) {
            leftHandedDiv.remove();
            console.log("Left-Handed setting removed.");
        }
    }

    function addCustomSettingsToTop() {
        const settingsDiv = document.getElementById('settingsDiv');
        if (settingsDiv && !document.getElementById('vfSniperMode')) {
            const customDiv = document.createElement('div');
            customDiv.innerHTML = newSettingsContent;

            settingsDiv.insertBefore(customDiv, settingsDiv.firstChild);
        }
    }

    function waitForSettingsDiv() {
        const retryInterval = setInterval(() => {
            const settingsDiv = document.getElementById('settingsDiv');
            if (settingsDiv) {
                removeLeftHandedSetting();
                addCustomSettingsToTop();
                setupSniperModeToggle();
                setupVortexForgeModeToggle();
                clearInterval(retryInterval);
            }
        }, 500);
    }

    function setupSniperModeToggle() {
        const sniperModeCheckbox = document.getElementById('vfSniperMode');
        if (sniperModeCheckbox) {
            sniperModeCheckbox.addEventListener('change', (event) => {
                sniperModeEnabled = event.target.checked;
            });
        }
    }

    function setupVortexForgeModeToggle() {
        const vfCheckbox = document.getElementById('vfsettings');
        if (vfCheckbox) {
            vfCheckbox.addEventListener('change', (event) => {
                featuresEnabled = event.target.checked;
                toggleFeatures(featuresEnabled);
            });
        }
    }

    function toggleFeatures(enabled) {
        if (!enabled) {
            stopKKeyPress();
            isRightMousePressed = false;
        }
    }

    function startKKeyPress() {
        if (!kKeyInterval) {
            kKeyInterval = setInterval(() => {
                const kKeyEvent = new KeyboardEvent('keydown', {
                    key: 'K',
                    code: 'KeyK',
                    keyCode: 75,
                    which: 75,
                    bubbles: true,
                    cancelable: true,
                });
                document.dispatchEvent(kKeyEvent);
            }, 100);
        }
    }

     function stopKKeyPress() {
        if (kKeyInterval) {
            clearInterval(kKeyInterval);
            kKeyInterval = null;

            const kKeyUpEvent = new KeyboardEvent('keyup', {
                key: 'K',
                code: 'KeyK',
                keyCode: 75,
                which: 75,
                bubbles: true,
                cancelable: true,
            });
            document.dispatchEvent(kKeyUpEvent);
        }
    }

    function startShooting() {
        const shootKeyEvent = new KeyboardEvent('keydown', {
            key: 'K',
            code: 'KeyK',
            keyCode: 75,
            which: 75,
            bubbles: true,
            cancelable: true,
        });
        document.dispatchEvent(shootKeyEvent);

        const shootKeyUpEvent = new KeyboardEvent('keyup', {
            key: 'K',
            code: 'KeyK',
            keyCode: 75,
            which: 75,
            bubbles: true,
            cancelable: true,
        });
        document.dispatchEvent(shootKeyUpEvent);
    }

    document.addEventListener('mousedown', (e) => {
        if (!featuresEnabled) return;

        if (e.button === 2) { 
            if (!isRightMousePressed) {
                isRightMousePressed = true;

                if (!sniperModeEnabled) {
                    startKKeyPress();
                }
            }
        }
    });

    document.addEventListener('mouseup', (e) => {
        if (e.button === 2) { 
            if (sniperModeEnabled) {
                startShooting();
            }else{
                stopKKeyPress();
            }

            isRightMousePressed = false;
        }
    });

    window.addEventListener('load', () => {
        waitForSettingsDiv();
    });
})();