Greasy Fork is available in English.
Stops sending updates about your position to the server
当前为
// ==UserScript==
// @name OWOP Incognito Mode
// @namespace http://tampermonkey.net/
// @version 1.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;
}
}
}();