Greasy Fork

Greasy Fork is available in English.

Incognito Mode

Stops sending updates about your position to the server

当前为 2025-10-09 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

'use strict'

!function() {
    // Pre-Installation
    const waitUntil = (probe, cb, t = 200) => {
        const id = setInterval(() => { try { if (probe()) { clearInterval(id); cb(); } } catch { } }, t);
    };
    waitUntil(
        () => OWOP?.net?.protocol?.sendUpdates &&
            OWOP.misc?.chatSendModifier &&
            OWOP.chat?.local &&
            OWOP.mouse?.tileX &&
            OWOP.mouse.tileY,
        install
    );

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

        // Command
        const oldSM = OWOP.misc.chatSendModifier;
        OWOP.misc.chatSendModifier = (msg) => {
            oldSM(msg);
            if (msg.toLowerCase().startsWith('/incog')) {
                let args = msg.toLowerCase().split(' ');
                if (args.length != 2 || !['true', 'false'].includes(args[1])) {
                    OWOP.chat.local('Usage: /incog true/false');
                    return '';
                } else {
                    incognitoMode = args[1] == 'true' ? true : false;
                    if (incognitoMode) { OWOP.chat.local(`Last recorded position: ${OWOP.mouse.tileX} ${OWOP.mouse.tileY}`); };
                    return '';
                }
            } else return msg;
        }
    }
}();