Shell Shockers Sounds hacks

Change your weapon sounds - Shell Shockers

Versione datata 06/03/2025. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Shell Shockers Sounds hacks
// @description  Change your weapon sounds - Shell Shockers
// @license      GPL-3.0
// @version      1.3.6
// @author       wish?
// @match        *://*.shellshock.io/*
// @match        *://*.shell.onlypuppy7.online/*
// @match        *://*.algebra.best/*
// @match        *://*.algebra.vip/*
// @match        *://*.biologyclass.club/*
// @match        *://*.deadlyegg.com/*
// @match        *://*.deathegg.world/*
// @match        *://*.eggboy.club/*
// @match        *://*.eggboy.xyz/*
// @match        *://*.eggcombat.com/*
// @match        *://*.egg.dance/*
// @match        *://*.eggfacts.fun/*
// @match        *://*.egghead.institute/*
// @match        *://*.eggisthenewblack.com/*
// @match        *://*.eggsarecool.com/*
// @match        *://*.geometry.best/*
// @match        *://*.geometry.monster/*
// @match        *://*.geometry.pw/*
// @match        *://*.geometry.report/*
// @match        *://*.hardboiled.life/*
// @match        *://*.hardshell.life/*
// @match        *://*.humanorganising.org/*
// @match        *://*.mathactivity.xyz/*
// @match        *://*.mathactivity.club/*
// @match        *://*.mathdrills.info/*
// @match        *://*.mathdrills.life/*
// @match        *://*.mathfun.rocks/*
// @match        *://*.mathgames.world/*
// @match        *://*.math.international/*
// @match        *://*.mathlete.fun/*
// @match        *://*.mathlete.pro/*
// @match        *://*.overeasy.club/*
// @match        *://*.risenegg.com/*
// @match        *://*.scrambled.tech/*
// @match        *://*.scrambled.today/*
// @match        *://*.scrambled.us/*
// @match        *://*.scrambled.world/*
// @match        *://*.shellshockers.club/*
// @match        *://*.shellshockers.life/*
// @match        *://*.shellshockers.site/*
// @match        *://*.shellshockers.us/*
// @match        *://*.shellshockers.world/*
// @match        *://*.shellshockers.xyz/*
// @match        *://*.shellsocks.com/*
// @match        *://*.softboiled.club/*
// @match        *://*.urbanegger.com/*
// @match        *://*.violentegg.club/*
// @match        *://*.violentegg.fun/*
// @match        *://*.yolk.best/*
// @match        *://*.yolk.life/*
// @match        *://*.yolk.rocks/*
// @match        *://*.yolk.tech/*
// @match        *://*.yolk.quest/*
// @match        *://*.yolk.today/*
// @match        *://*.zygote.cafe/*
// @match        *://*.shellshockers.best/*
// @match        *://*.eggboy.me/*
// @grant        none
// @run-at       document-start
// @require      https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js
// @require     https://cdn.jsdelivr.net/npm/[email protected]/dist/tweakpane.min.js
// @require      https://cdn.jsdelivr.net/npm/@tweakpane/[email protected]/dist/tweakpane-plugin-essentials.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js
// @namespace https://greasyfork.org/users/1361048
// ==/UserScript==

(function () {
	let originalReplace = String.prototype.replace;

	String.prototype.originalReplace = function () {
		return originalReplace.apply(this, arguments);
	};

	const originalXHROpen = XMLHttpRequest.prototype.open;
	const originalXHRGetResponse = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, "response");
	let shellshockjs;
	XMLHttpRequest.prototype.open = function (...args) {
		const url = args[1];
		if (url && url.includes("js/shellshock.js")) {
			shellshockjs = this;
		}
		originalXHROpen.apply(this, args);
	};
	Object.defineProperty(XMLHttpRequest.prototype, "response", {
		get: function () {
			if (this === shellshockjs) {
				return applyLibertyMutual(originalXHRGetResponse.get.call(this));
			}
			return originalXHRGetResponse.get.call(this);
		},
	});
	//VAR STUFF
	let F = [];
	let H = {};
	let functionNames = [];
	let sounds = {};
  let keyRetrieved = false;
  let weaponKey;
  let updatedKey;
  let myWeapon;

  //TWEAKPANE VARIABLES
  const tp = {
	soundsFolder: {
		crackshot: "default",
		"egg-k": "default",
		scrambler: "default",
		"free-ranger": "default",
		rpegg: "default",
		whipper: "default",
		"tri-hard": "default",
		pistol: "default",
	},
    meleeSounds: {
      melee: 'default'
    },
    bindsFolder: {
      hidePanel: localStorage.getItem('tp-hidePanel') || 'h',
      refreshSounds: localStorage.getItem('tp-refreshSounds') || 'g',
    }
};

  const savedFolder = JSON.parse(localStorage.getItem('customSounds'));
  if (savedFolder) {
    tp.soundsFolder = savedFolder
  }

  let updatedNeeded = false;

	//scrambled... geddit????
	const getScrambled = function () {
		return Array.from({ length: 10 }, () => String.fromCharCode(97 + Math.floor(Math.random() * 26))).join("");
	};
	const createAnonFunction = function (name, func) {
		const funcName = getScrambled();
		window[funcName] = func;
		F[name] = window[funcName];
		functionNames[name] = funcName;
	};

	const findKeyWithProperty = function (obj, propertyToFind) {
		for (const key in obj) {
			if (obj.hasOwnProperty(key)) {
				if (key === propertyToFind) {
					return [key];
				} else if (typeof obj[key] === "object" && obj[key] !== null && obj[key].hasOwnProperty(propertyToFind)) {
					return key;
				}
			}
		}
		// Property not found
		return null;
	};
	const fetchTextContent = function (url) {
		var xhr = new XMLHttpRequest();
		xhr.open("GET", url, false); // Make the request synchronous
		xhr.send();
		if (xhr.status === 200) {
			return xhr.responseText;
		} else {
			console.error("Error fetching text content. Status:", xhr.status);
			return null;
		}
	};


	const applyLibertyMutual = function (js) {
		let hash = CryptoJS.SHA256(js).toString(CryptoJS.enc.Hex);
		let clientKeys;
		onlineClientKeys = fetchTextContent("https://raw.githubusercontent.com/StateFarmNetwork/client-keys/main/statefarm_" + hash + ".json"); //credit: me :D

		clientKeys = JSON.parse(onlineClientKeys);

		H = clientKeys.vars;

		let injectionString = "";

		const modifyJS = function (find, replace) {
			let oldJS = js;
			js = js.originalReplace(find, replace);
			if (oldJS !== js) {
				console.log(
					"%cReplacement successful! Injected code: " + replace,
					"color: green; font-weight: bold; font-size: 0.6em; text-decoration: italic;"
				);
			} else {
				console.log(
					"%cReplacement failed! Attempted to replace " + find + " with: " + replace,
					"color: red; font-weight: bold; font-size: 0.6em; text-decoration: italic;"
				);
			}
		};

		console.log("%cATTEMPTING TO START SOUNDS", "color: magenta; font-weight: bold; font-size: 1.5em; text-decoration: underline;");
		const variableNameRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
		for (let name in H) {
			deobf = H[name];
			if (variableNameRegex.test(deobf)) {
				injectionString = `${injectionString}${name}:  (() => { let variable = "value_undefined"; try { eval("variable = ${deobf};"); } catch (error) { return "value_undefined"; }; return variable; })(),`;
			}
		}
		const f = function (varName) {
			return varName.replace("$", "\\$");
		};
		const FUNCTIONPARAM = new RegExp("function " + f(H._connectFail) + "\\(([a-zA-Z$_]+)\\)").exec(js)[1];
		console.log(injectionString);
		console.log(
			"%cSOUNDS INJECTION: INJECT VAR RETRIEVAL FUNCTION AND MAIN LOOP",
			"color: yellow; font-weight: bold; font-size: 1.2em; text-decoration: underline;"
		);

		modifyJS(H.SCENE + ".render", `window["${functionNames.retrieveFunctions}"]({${injectionString}},true)||${H.SCENE}.render`);

		console.log(H);
		return js;
	};

	createAnonFunction("retrieveFunctions", function (vars) {
		ss = vars;
		window.globalSS = ss;
		F.SOUNDS();
	});



createAnonFunction("SOUNDS", function () {
	ss.PLAYERS.forEach((PLAYER) => {
		if (PLAYER.hasOwnProperty("ws")) {
			ss.MYPLAYER = PLAYER;
		}

    if (ss.MYPLAYER) {

		const myWeapon = window.globalSS.MYPLAYER.weapon;



    if (!keyRetrieved) {
          Object.keys(myWeapon).forEach((key)=>{
        const thing = myWeapon[key];
        if (thing?.fireSound) {
          weaponKey = thing;
          updatedKey = key;
          window.globalKey = updatedKey;
        }

    });
    }


		if (updatedNeeded) {
      if (weaponKey.standardMeshName === 'gun_m24') {
      weaponKey.fireSound = `gun_m24_${tp.soundsFolder.crackshot}`
      }
      if (weaponKey.standardMeshName === 'gun_eggk47') {
      weaponKey.fireSound = `gun_eggk47_${tp.soundsFolder['egg-k']}`;
      }
      if (weaponKey.standardMeshName === 'gun_dozenGauge') {
      weaponKey.fireSound = `gun_dozenGauge_${tp.soundsFolder['scrambler']}`;
      }
      if (weaponKey.standardMeshName === 'gun_csg1') {
      weaponKey.fireSound = `gun_csg1_${tp.soundsFolder['free-ranger']}`;
      }
      if (weaponKey.standardMeshName === 'gun_rpegg') {
      weaponKey.fireSound = `gun_rpegg_${tp.soundsFolder['rpegg']}`;
      }
      if (weaponKey.standardMeshName === 'gun_smg') {
      weaponKey.fireSound = `gun_smg_${tp.soundsFolder['whipper']}`;
      }
      if (weaponKey.standardMeshName === 'gun_aug') {
      weaponKey.fireSound = `gun_aug_${tp.soundsFolder['tri-hard']}`;
      }

      // MELEE
      globalSS.MYPLAYER.meleeWeapon[updatedKey].swingSounds = tp.meleeSounds['melee'];

      // PISTOL
      globalSS.MYPLAYER.weapons[1][updatedKey].fireSound = `gun_cluck9mm_${tp.soundsFolder['pistol']}`;
      updatedNeeded = false;
		}
    }
	});

	H.actor = findKeyWithProperty(ss.MYPLAYER, H.mesh);
});


  // MAKE ELEMENT DRAGGABLE
  const makeDraggable = function (element, notMenu) {
		if (element) {
			let offsetX, offsetY;
			element.addEventListener("mousedown", function (e) {
				const dragElement = function (e) {
					const x = ((e.clientX - offsetX) / unsafeWindow.innerWidth) * 100;
					const y = ((e.clientY - offsetY) / unsafeWindow.innerHeight) * 100;
					const maxX = 100 - (element.offsetWidth / unsafeWindow.innerWidth) * 100;
					const maxY = 100 - (element.offsetHeight / unsafeWindow.innerHeight) * 100;
					element.style.left = `${Math.max(0, Math.min(x, maxX))}%`;
					element.style.top = `${Math.max(0, Math.min(y, maxY))}%`;
				};
				if (notMenu || e.target.classList.contains("tp-rotv_t")) {
					offsetX = e.clientX - element.getBoundingClientRect().left;
					offsetY = e.clientY - element.getBoundingClientRect().top;
					document.addEventListener("mousemove", dragElement);
					document.addEventListener("mouseup", function () {
						document.removeEventListener("mousemove", dragElement);
					});
					e.preventDefault(); // Prevent text selection during drag
				}
			});
		}
	};



  //TWEAKPANE CODE
    const Tweakpane = window.Tweakpane;
	const pane = new Tweakpane.Pane({
		title: "WISH",
		expanded: true,
	});
	const paneEl = document.querySelector("div.tp-dfwv");
	paneEl.style.zIndex = 100000;
	paneEl.style.width = "300px";
  makeDraggable(document.querySelector(".tp-dfwv"));

  //FUNCTION TO CREATE FOLDERS
  function createFolders(NFolder) {
		let test = pane.addFolder({
			title: NFolder,
			expanded: false,
		});
    return test
	}

  // CREATE FOLDERS
  const soundsFolder = createFolders('Sounds');
  const addSettings = createFolders('Additional Settings');
  const bindsFolder = createFolders('Binds');

  // ADD BLADES
soundsFolder.addInput(tp.soundsFolder, "crackshot", {
  label: 'Crackshot',
	options: {
		Default: "fire",
		Valkyrie: "Valkyrie_fire",
    Chess: 'Chess_fire',
    Retro: 'Retro_fire',
    BadEgg: 'Badegg_fire',
    Cyborg: 'Cyborg_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Infernal: 'Infernal_fire',
    Quack: 'Quackshot_fire',
    Scavenger: 'Scavenger_fire',
    '8bit': 'fire_m24_8bit',
    'Silenced (Fake)': '',
	},
});

soundsFolder.addInput(tp.soundsFolder, "egg-k", {
  label: 'Egg-k',
	options: {
		Default: "fire",
		Alien: "Alien_fire",
    Retro: 'Retro_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Infernal: 'Infernal_fire',
    Steambot: 'Steambot_fire',
    Valkyrie: 'Valkyrie_fire',
    Chocolate: 'Chocolate_fire',
    'Infernal-2': 'Infernal2_fire'
	},
});

  soundsFolder.addInput(tp.soundsFolder, "scrambler", {
  label: 'Scrambler',
	options: {
		Default: "fire",
		Irish: "Irish_fire",
    Retro: 'Retro_fire',
    Clouds: 'Clouds_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Fantasy: 'Fantasy_fire',
    Octopus: 'Octopus_fire',
    Infernal: 'Infernal_fire',
    Steambot: 'Steambot_fire',
    Valkyrie: 'Valkyrie_fire',
    Basketball: 'Basketball_fire',
	},
});

    soundsFolder.addInput(tp.soundsFolder, "free-ranger", {
  label: 'Free-Ranger',
	options: {
		Default: "fire",
    Retro: 'Retro_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Infernal: 'Infernal_fire',
    'Space-Egg': 'spaceEgg_fire',
    Steambot: 'Steambot_fire',
    Valkyrie: 'Valkyrie_fire',
    Shellpreme: 'Shellpreme_fire',
    RubberChicken: 'RubberChicken_fire',
	},
});

      soundsFolder.addInput(tp.soundsFolder, "rpegg", {
  label: 'Rpegg',
	options: {
		Default: "fire",
    Retro: 'Retro_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Infernal: 'Infernal_fire',
    'Skeleton': 'Skeleton_fire',
    Valkyrie: 'Valkyrie_fire',
    Christmas: 'Christmas_fire'
	},
});

  soundsFolder.addInput(tp.soundsFolder, "whipper", {
  label: 'Whipper',
	options: {
		Default: "fire",
    Retro: 'Retro_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Pumpkin: 'Pumpkin_fire',
    Infernal: 'Infernal_fire',
    Valkyrie: 'Valkyrie_fire',
    'Special-Turkey': 'SpecialTurkey_fire',
	},
});

  soundsFolder.addInput(tp.soundsFolder, "tri-hard", {
  label: 'Tri-Hard',
	options: {
		Default: "fire",
    Cupid: 'Cupid_fire',
    Fusion: 'Fusion_fire',
    Retro: 'Retro_fire',
    Infernal: 'Infernal_fire',
    'Techno': 'Techno_fire_a',
    'Techno-B': 'Techno_fire_b',
    Valkyrie: 'Valkyrie_fire',
    Pumpkinpie: 'Pumpkinpie_fire',
	},
});

  soundsFolder.addInput(tp.meleeSounds, "melee", {
  label: 'Melee',
	options: {
		Default: ["melee_whisk_a"],
    Carver: ['melee_carver'],
    Cup: ['melee_cup_a', 'melee_cup_b'],
    Eggpan: ['melee_eggpan'],
    Elf: ['melee_elf_a', 'melee_elf_b'],
    Fish: ['melee_gfish_a', 'melee_gfish_b'],
    Harrison: ['melee_harrison'],
    Infernal: ['melee_infernal'],
    Keytar: ['melee_keytar'],
    Mayan: ['melee_mayan'],
    Nutcracker: ['melee_nutcracker'],
    Pickleball: ['melee_pickleball'],
    Plunger: ['melee_plunger'],
    'Proper-Fish (idk)': ['melee_properfish_a', 'melee_properfish_b'],
    Retro: ['melee_retro'],
    Rock: ['melee_rock'],
    Steambot: ['melee_steambot'],
    Techno: ['melee_techno'],
    Valkyrie: ['melee_valkyrie'],
    Zombie: ['melee_zombie']
	},
});

  soundsFolder.addInput(tp.soundsFolder, "pistol", {
  label: 'Pistol',
	options: {
		Default: "fire",
    Retro: 'Retro_fire',
    Camera: 'Camera_fire',
    Clouds: 'Clouds_fire',
    Fusion: 'Fusion_fire',
    Techno: 'Techno_fire',
    Infernal: 'Infernal_fire',
    'Space-Egg': 'spaceEgg_fire',
    Steambot: 'Steambot_fire',
    Valkyrie: 'Valkyrie_fire',
    Megaphone: 'Megaphone_fire',
    'Cubic-Castle': 'CubicCastles_fire'
	},
});

  function refreshSounds() {
    updatedNeeded = true; // this updates the weapons

    keyRetrieved = false; // this will grab the key necessary
  }

  soundsFolder.on('change', (value) => {
    // console.log('Selected sound:', value);
    // console.log(tp.soundsFolder);
    refreshSounds()
    // Handle the sound change logic here
    localStorage.setItem('customSounds', JSON.stringify(tp.soundsFolder))
});

  addSettings.addButton({
    title: `Click if sounds didn\'t update`,
  }).on('click', () => {
    updatedNeeded = true;
    keyRetrieved = false;
  });

  // BINDS FOLDER
  function addInputWithValidation(folder, obj, property, label) {
    folder.addInput(obj, property, { label: label }).on('change', (value) => {
        if (value.value.length > 1) {
            value.value = 'Enter toggle';
            value.target.controller_.binding.value.rawValue_ = 'Enter toggle';
            window.alert('Please enter a single key');
        }  else {

          const store = (value.value).replace(/"/g,'')
          localStorage.setItem(`tp-${property}`, store)
        }
    });
};
  addInputWithValidation(bindsFolder, tp.bindsFolder, 'hidePanel', 'Hide Panel');
addInputWithValidation(bindsFolder, tp.bindsFolder, 'refreshSounds', 'Refresh Sounds');

  document.addEventListener("keydown", (e) => {
		if (e.key === tp.bindsFolder.hidePanel) {
			paneEl.style.display = paneEl.style.display === "block" ? "none" : "block";
		}
    if (e.key === tp.bindsFolder.refreshSounds) {
      refreshSounds()
    }
	});


})();