Greasy Fork is available in English.

Shell Shockers Hitbox Modifier

Adjust the hitbox size in Shell Shockers (for educational purposes only)

// ==UserScript==
// @name         Shell Shockers Hitbox Modifier
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adjust the hitbox size in Shell Shockers (for educational purposes only)
// @author       Your Name
// @match        https://www.shellshock.io/
// @grant        none
// @license      MIT
// ==/UserScript==
const keys = {};
 
const StringReplace = String.prototype.replace;
 
function log( msg, ...args ) {
 
	console.log( '%c' + msg, 'color: red; background: black; font-size: 2em;', ...args );
 
}
 
window.XMLHttpRequest = class extends window.XMLHttpRequest {
 
	open( method, url ) {
 
		if ( url.indexOf( 'shellshock.js' ) > - 1 && ! isNaN( value ) ) {
 
			this.isScript = true;
 
		}
 
		return super.open( ...arguments );
 
	}
 
	get response() {
 
		if ( this.isScript && ! isNaN( value ) ) {
 
			let code = super.response;
 
			let babylonVarName,
				playersVarName,
				myPlayerVarName,
				sceneVarName,
				cullFuncName;
 
			const extractors = { 
				BracketSingleQuote() {
 
					const matches = /([a-zA-Z_$0-9]+)\['([^']+)'\]\['([^']+)'\]\("[^"]+",{si/.exec( code );
 
					babylonVarName = matches[ 1 ];
					playersVarName = /[a-zA-Z_$0-9]+\['[^']+'\]\),!([a-zA-Z_$0-9]+)\[/.exec( code )[ 1 ];
					myPlayerVarName = /document\.pointerLockElement&&([^&]+)&&/.exec( code )[ 1 ];
					sceneVarName = /if\([a-zA-Z_$0-9]+\['[^']+'\]\(([a-zA-Z_$0-9]+),[a-zA-Z_$0-9]+,[a-zA-Z_$0-9]+,null/.exec( code )[ 1 ];
					cullFuncName = /=([a-zA-Z_$0-9]+)\(this\['([^']+)'\],\.[0-9]+\)/.exec( code )[ 1 ];
 
					keys.MeshBuilder = matches[ 2 ];
					keys.CreateBox = matches[ 3 ];
					keys.CreateLines = /\['([^']+)'\]\("",{po/.exec( code )[ 1 ];
					keys.Vector3 = /new [a-zA-Z_$0-9]+\['([^']+)'\]\(\.5,\.5,\.5\),/.exec( code )[ 1 ];
					keys.actor = /this\['([^']+)'\]\['([^']+)'\]\.position,!/.exec( code )[ 1 ];
					keys.playing = /OPEN&&[a-zA-Z_$0-9]+\['([^']+)'\]/.exec( code )[ 1 ];
 
					keys.yaw = /\*=[a-zA-Z_$0-9]+,[a-zA-Z_$0-9]+\['([^']+)'\]=Math\.r/.exec( code )[ 1 ];
					keys.pitch = /\),[a-zA-Z_$0-9]+\['([^']+)'\]=Math\.max\(Math\.min/.exec( code )[ 1 ];
					keys.mesh = /,\.[0-9]+\);this\['([^']+)'\]\['([^']+)'\]\(/.exec( code )[ 1 ];
 
				},
				BracketDoubleQuote() { // might not be needed but just in case
 
					const matches = /([a-zA-Z_$0-9]+)\["([^"]+)"\]\["([^"]+)"\]\("[^"]+",{si/.exec( code );
 
					babylonVarName = matches[ 1 ];
					playersVarName = /[a-zA-Z_$0-9]+\["[^"]+"\]\),!([a-zA-Z_$0-9]+)\[/.exec( code )[ 1 ];
					myPlayerVarName = /document\.pointerLockElement&&([^&]+)&&/.exec( code )[ 1 ];
					sceneVarName = /if\([a-zA-Z_$0-9]+\["[^"]+"\]\(([a-zA-Z_$0-9]+),[a-zA-Z_$0-9]+,[a-zA-Z_$0-9]+,null/.exec( code )[ 1 ];
					cullFuncName = /=([a-zA-Z_$0-9]+)\(this\["([^"]+)"\],\.[0-9]+\)/.exec( code )[ 1 ];
 
					keys.MeshBuilder = matches[ 2 ];
					keys.CreateBox = matches[ 3 ];
					keys.CreateLines = /\["([^"]+)"\]\("",{po/.exec( code )[ 1 ];
					keys.Vector3 = /new [a-zA-Z_$0-9]+\["([^"]+)"\]\(\.5,\.5,\.5\),/.exec( code )[ 1 ];
					keys.actor = /this\["([^"]+)"\]\["([^"]+)"\]\.position,!/.exec( code )[ 1 ];
					keys.playing = /OPEN&&[a-zA-Z_$0-9]+\["([^"]+)"\]/.exec( code )[ 1 ];
 
					keys.yaw = /\*=[a-zA-Z_$0-9]+,[a-zA-Z_$0-9]+\["([^"]+)"\]=Math\.r/.exec( code )[ 1 ];
					keys.pitch = /\),[a-zA-Z_$0-9]+\["([^"]+)"\]=Math\.max\(Math\.min/.exec( code )[ 1 ];
					keys.mesh = /,\.[0-9]+\);this\["([^"]+)"\]\["([^"]+)"\]\(/.exec( code )[ 1 ];
 
				}, 
				Dot() { // in case the shellshock devs revert back to dot syntax :skull:
 
					const matches = /([a-zA-Z_$0-9]+)\.([a-zA-Z_$0-9]+)\.([a-zA-Z_$0-9]+)\("[^"]+",{si/.exec( code );
 
					babylonVarName = matches[ 1 ];
					playersVarName = /[a-zA-Z_$0-9]+\.[a-zA-Z_$0-9]+\),!([a-zA-Z_$0-9]+)\[/.exec( code )[ 1 ];
					myPlayerVarName = /document\.pointerLockElement&&([^&]+)&&/.exec( code )[ 1 ];
					sceneVarName = /if\([a-zA-Z_$0-9]+\.[a-zA-Z_$0-9]+\(([a-zA-Z_$0-9]+),[a-zA-Z_$0-9]+,[a-zA-Z_$0-9]+,null/.exec( code )[ 1 ];
					cullFuncName = /=([a-zA-Z_$0-9]+)\(this\.([a-zA-Z_$0-9]+),\.[0-9]+\)/.exec( code )[ 1 ];
	 
					keys.MeshBuilder = matches[ 2 ];
					keys.CreateBox = matches[ 3 ];
					keys.CreateLines = /\.([a-zA-Z_$0-9]+)\("",{po/.exec( code )[ 1 ];
					keys.Vector3 = /new [a-zA-Z_$0-9]+\.([a-zA-Z_$0-9]+)\(\.5,/.exec( code )[ 1 ];
					keys.actor = /this\.([a-zA-Z_$0-9]+)\.[a-zA-Z_$0-9]+\.position,!/.exec( code )[ 1 ];
					keys.playing = /OPEN&&[a-zA-Z_$0-9]+\.([a-zA-Z_$0-9]+)/.exec( code )[ 1 ];
	 
					keys.yaw = /\*=[a-zA-Z_$0-9]+,[a-zA-Z_$0-9]+\.([a-zA-Z_$0-9]+)=Math\.r/.exec( code )[ 1 ];
					keys.pitch = /\),[a-zA-Z_$0-9]+\.([a-zA-Z_$0-9]+)=Math\.max\(Math\.min/.exec( code )[ 1 ];
					keys.mesh = /,\.[0-9]+\);this\.([a-zA-Z_$0-9]+)\.[a-zA-Z_$0-9]+\(/.exec( code )[ 1 ];
 
				}
			};
 
			const numExtractors = Object.keys( extractors ).length;
			let failures = 0;
 
			for ( const name in extractors ) {
 
				try {
 
					extractors[ name ]();
 
					log( `SUCCESS: ${name} passed!` );
					break;
 
				} catch ( error ) {
 
					log( `WARNING: ${name} extractor failed!` );
 
					failures ++;
					if ( failures >= numExtractors ) {
 
						log( `FATAL: Script failed to inject.`, getVars() );
						alert( 'Script failed to inject. Report the issue to the script developer.\n' + JSON.stringify( getVars(), undefined, 2 ) );
						return code;
 
					}
 
				}
 
			}
 
			function getVars() {
 
				return {
					babylonVarName,
					playersVarName,
					myPlayerVarName,
					playersVarName,
					sceneVarName,
					cullFuncName,
					keys
				};
 
			}
 
			log( 'Injecting code', getVars() );
 
			code = StringReplace.call( code, sceneVarName + '.render()', `
 
				window[ '${onUpdateFuncName}' ]( 
					${babylonVarName}, 
					${playersVarName}, 
					${myPlayerVarName}
				);
 
			${sceneVarName}.render()` );
			code = StringReplace.call( code, `function ${cullFuncName}`, `
 
				function ${cullFuncName}() {
 
					return true;
 
				}
 
			function someFunctionWhichWillNeverBeUsedNow` );
 
			return code;
 
		}
 
		return super.response;
 
	}
 
};
 
(function() {
    'use strict';

    // Function to click on a certain position on the screen
    function click(x, y) {
        var evt = new MouseEvent('click', {
            bubbles: true,
            cancelable: true,
            view: window,
            clientX: x,
            clientY: y
        });
        document.elementFromPoint(x, y).dispatchEvent(evt);
    }

    // Function to adjust hitbox size
    function adjustHitbox() {
        // Example: Locate the "Settings" button and click
        var settingsButton = document.querySelector('.settings-button');
        settingsButton.click();

        // Example: Locate the "Hitbox" setting and click to increase size
        var hitboxSetting = document.querySelector('.hitbox-setting');
        hitboxSetting.click();
    }

    // Main function
    function main() {
        console.log("Adjusting hitbox size...");
        adjustHitbox();
        console.log("Hitbox size adjusted successfully.");
    }

    // Call the main function when the page is fully loaded
    window.onload = main;

})();