Greasy Fork

来自缓存

Greasy Fork is available in English.

OWOP Stealth Mode

Stops sending updates about your position to the server

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         OWOP Stealth Mode
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Stops sending updates about your position to the server
// @author       NothingHere7759 & thisisks
// @match        https://ourworldofpixels.com/*
// @match        https://pre.ourworldofpixels.com/*
// @exclude      https://ourworldofpixels.com/api/*
// @exclude      https://pre.ourworldofpixels.com/api/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

'use strict'

!function() {

    function install() {
        // The actual script
        window.stealthMode = false;
        const oldSendUpdate = OWOP.net.protocol.sendUpdates;
        OWOP.net.protocol.sendUpdates = function () {
            if (!stealthMode) { oldSendUpdate.apply(OWOP.net.protocol, []) } else { return; }
        }

        // Command
        const oldSM = OWOP.misc.chatSendModifier;
        OWOP.misc.chatSendModifier = (msg) => {
            oldSM(msg);
            if (msg.toLowerCase().startsWith('/stealth')) {
                let args = msg.toLowerCase().split(' ');
                if (args.length != 2 || !['true', 'false'].includes(args[1])) {
                    OWOP.chat.local('Usage: /stealth true/false');
                    return '';
                } else {
                    stealthMode = args[1] == 'true' ? true : false;
                    if (stealthMode) { OWOP.chat.local(`Last recorded position: ${OWOP.mouse.tileX} ${OWOP.mouse.tileY}`); };
                    return '';
                }
            } else return msg;
        }
    }
    const waitUntil = (probe, cb, t = 200) => {
        const id = setInterval(() => { try { if (probe()) { clearInterval(id); cb(); } } catch { } }, t);
    };

function init() {
    if (document.getElementById("load-scr")?.style?.transform && OWOP?.player?.tool) {
        install();
    } else {
        setTimeout(init, 1e2);
    }
}

init();
}();