// ==UserScript==
// @name Crosshair for Shell Shock (FINAL)
// @namespace Violentmonkey Scripts
// @grant none
// @version 3.5
// @author https://greasyfork.org/en/users/1361048-wish
// @description 9/16/2024, 8:34:24 PM
// @require https://unpkg.com/guify@0.12.0/lib/guify.min.js
// @license MIT; https://opensource.org/licenses/MIT
// @match *://eggshooter.best/*
// @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/*
// ==/UserScript==
(function () {
"use strict";
let color = localStorage.getItem("crosshairColor") || "#FFFFFF";
let height = parseFloat(localStorage.getItem("crosshairHeight")) || 0.8;
let width = parseFloat(localStorage.getItem("crosshairWidth")) || 0.3;
let centerDot = parseFloat(localStorage.getItem("centerDotSize")) || 0.3;
let round = localStorage.getItem("roundCenterDot") === "true" || false;
let list = {};
list.color = color;
list.height = height;
list.width = width;
list.centerDot = centerDot;
list.round = round;
let middleCrosshair = JSON.parse(localStorage.getItem('middleCrosshair')) || {color: 'black',length:20, thickness: 5};
let panelWidth = parseFloat(localStorage.getItem('panelWidth')) || 10;
let style = `
#lmao {
color: white;
}
`;
// Create a new style element
const styleElement = document.createElement("style");
// Append the styles to the style element
styleElement.innerHTML = style;
document.head.appendChild(styleElement);
const addScript = (color, height, width, centerDot, round = false) => {
const previousStyle = document.getElementById("custom-styles");
if (previousStyle) {
previousStyle.remove();
}
const prevMiddleCH = document.getElementById("custom-middle-styles");
if (prevMiddleCH) {
prevMiddleCH.remove();
}
// Create a new stylesheet
const style = document.createElement("style");
style.id = "custom-styles";
style.innerHTML = `
/* your styles here */
#maskmiddle#maskmiddle {
background: url("../img/scope.webp") center center no-repeat;
background-size: contain;
width: 100vh;
height: 100vh;
}
.crosshair.crosshair {
position: absolute;
transform-origin: 50% top;
top: 50%;
border: solid 0.05em black;
height: ${height}em;
opacity: 0.7;
}
.crosshair.crosshair.normal.normal {
left: calc(50% - ${width / 2}em);
background: ${color};
width: ${width}em;
}
.crosshair.crosshair.powerful.powerful {
left: calc(50% - ${width / 2}em);
background: red;
width: ${width}em;
}
#reticleDot#reticleDot {
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
background: ${color};
border: solid 0.05em black;
width: ${centerDot}em;
height: ${centerDot}em;
opacity: 0.7;
${round ? "border-radius: 100%;" : ""}
}
#redDotReticle#redDotReticle {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: var(--ss-yolk);
width: 0.7em;
height: 0.7em;
border-radius: 100%;
}
#shotReticleContainer#shotReticleContainer {
position: absolute;
text-align: center;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
opacity: 0.7;
overflow-x: hidden;
}
#reticleContainer#reticleContainer {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#crosshairContainer#crosshairContainer {
position: absolute;
left: 50%;
top: 50%;
transform: perspective(0);
}
.shotReticle.shotReticle {
box-sizing: border-box;
position: absolute;
left: 50%;
transform-origin: center;
background: 0 0;
border: solid;
border-radius: 30%;
}
.shotReticle.shotReticle:nth-child(odd) {
transform: translate(-50%, 33%) rotate(0);
width: 4em;
height: 60%;
}
.shotReticle.shotReticle:nth-child(2n) {
transform: translateX(-50%) rotate(90deg);
width: 2.5em;
height: 100%;
}
.shotReticle.shotReticle.fill.normal.normal {
border-color: ${color};
border-left: solid transparent;
border-right: solid transparent;
border-width: 0.18em;
padding: 0.18em;
}
.shotReticle.shotReticle.fill.powerful.powerful {
border-color: white;
border-left: solid transparent;
border-right: solid transparent;
border-width: 0.3em;
padding: 0.1em;
}
.shotReticle.shotReticle.border.normal.normal {
border-color: #000;
border-left: solid transparent;
border-right: solid transparent;
border-width: 0.2em;
}
.shotReticle.shotReticle.border.powerful.powerful {
border-color: #000;
border-left: solid transparent;
border-right: solid transparent;
border-width: 0.4em;
}
`;
document.head.appendChild(style);
};
const changeMiddleCH = (color, length, thickness) => {
const previousStyle = document.getElementById("custom-middle-styles");
if (previousStyle) {
previousStyle.remove();
}
// Create a new stylesheet
const style = document.createElement("style");
style.id = "custom-middle-styles";
style.innerHTML = `
/* Styles for the plus symbol */
#reticleDot#reticleDot {
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
opacity: 1;
width: 1px;
height: 1px;
}
#reticleDot#reticleDot .horizontal {
background-color: ${color};
height: ${thickness}px;
width: ${length}px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#reticleDot#reticleDot .vertical {
background-color: ${color};
width: ${thickness}px;
height: ${length}px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
`;
document.head.appendChild(style);
// Create the reticleDot element if it doesn't exist
let reticleDot = document.getElementById("reticleDot");
reticleDot.classList.add('hideme')
if (!reticleDot) {
reticleDot = document.createElement("div");
reticleDot.id = "reticleDot";
document.body.appendChild(reticleDot);
}
// Clear existing child elements
reticleDot.innerHTML = `
<div class="horizontal"></div>
<div class="vertical"></div>
`;
};
function waitForElement(selector) {
return new Promise((resolve) => {
const intervalId = setInterval(() => {
const element = document.querySelector(selector);
if (element) {
clearInterval(intervalId);
resolve(element);
}
}, 100);
});
};
// CHANGE SG CROSSHAIR
let oldCrosshair;
let isToggled = false; // Flag to track the current state
let old; // To store the original HTML
let eventNeeded = false;
function changeSG() {
// Function to wait for the element to be present
function waitForElement(selector) {
return new Promise((resolve) => {
const intervalId = setInterval(() => {
const element = document.querySelector(selector);
if (element) {
clearInterval(intervalId);
resolve(element);
}
}, 100);
});
}
// Main logic to change the crosshair
waitForElement("#shotReticleContainer")
.then((element) => {
oldCrosshair = element;
if (!isToggled) {
// Store the original HTML only the first time
old = oldCrosshair.innerHTML; // Store the original HTML
console.log(old, "old");
const newHTML = `
<div id="crosshair0" class="crosshair normal" style="transform: rotate(0deg) translateY(calc(0.12em + 1vh))"></div>
<div id="crosshair1" class="crosshair normal" style="transform: rotate(90deg) translateY(calc(0.12em + 1vh))"></div>
<div id="crosshair2" class="crosshair normal" style="transform: rotate(180deg) translateY(calc(0.12em + 1vh))"></div>
<div id="crosshair3" class="crosshair normal" style="transform: rotate(270deg) translateY(calc(0.12em + 1vh))"></div>`;
eventNeeded = true;
oldCrosshair.innerHTML = newHTML; // Set new HTML
console.log("Set new crosshair");
} else {
oldCrosshair.innerHTML = old; // Restore original HTML
console.log("Restored original crosshair");
}
isToggled = !isToggled; // Toggle the flag
})
.catch((error) => {
console.error("Error in changeSG:", error);
});
}
document.body.addEventListener("click", () => {
if (eventNeeded) {
waitForElement(".home-menu-item").then((button) => {
button.addEventListener("click", (e) => {
// Reset the crosshair every time the button is clicked
try {
if (oldCrosshair) {
oldCrosshair.innerHTML = old; // Restore original HTML
console.log("Crosshair reset on button click");
}
} catch (error) {
console.error("Error resetting crosshair:", error);
}
});
});
}
});
function resetCrosshair() {
localStorage.removeItem("crosshairColor");
localStorage.removeItem("crosshairHeight");
localStorage.removeItem("centerDotSize");
localStorage.removeItem("roundCenterDot");
const defaults = {
color: "#FFFFFF",
height: 0.8,
width: 0.3,
centerDot: 0.3,
round: false,
};
Object.assign(list, defaults);
addScript(list.color, list.height, list.width, list.centerDot, list.round);
}
// button.textContent = 'huh';
// CREATE INSTANCE OF GUIFY
const gui = new guify({
title: "WISH",
theme: "dark",
align: "left",
width: 300,
barMode: "none",
opacity: 0.95,
root: document.body,
open: false,
// panelOverflowBehavior: "overflow",
});
// CREATE FOLDER FOR CROSSHAIR SETTINGS
gui.Register({
type: "folder",
label: "Change Crosshair Settings",
property: "folder",
});
// CREATE FOLDER TO CONTAIN MIDDLE CROSSHAIR STUFF
gui.Register({
type: "folder",
label: "Middle Crosshair",
property: "folder",
});
//FOLDER FOR WIDTH OF PANEL
gui.Register({
type: 'folder',
label: 'Panel Settings'
});
// ADD STUFF IN THE FOLDER
gui.Register({
folder: 'Panel Settings',
label: 'Panel Width',
type: 'range',
min: 10,
max: 100,
precision: 0.1,
onInitialize: () => {
const element = document.querySelector('.guify-panel-container_39NJay');
element.style.width = `${panelWidth}%`;
},
onChange: (data) => {
panelWidth = data;
localStorage.setItem('panelWidth', JSON.stringify(panelWidth));
}
});
gui.Register({
type: 'button',
label: 'apply settings',
folder: 'Panel Settings',
action: () => {
const element = document.querySelector('.guify-panel-container_39NJay');
element.style.width = `${panelWidth}%`;
}
})
gui.Register({
type: "color",
label: "Crosshair Color",
format: "hex",
folder: "Change Crosshair Settings",
object: list,
property: "color",
onInitialize: () => {
list.color = localStorage.getItem("crosshairColor") || "white";
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
onChange: (color1) => {
list.color = color1;
localStorage.setItem("crosshairColor", list.color);
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
});
gui.Register({
type: "range",
label: "Height of Crosshair",
min: 0,
max: 10,
step: 0.1,
folder: "Change Crosshair Settings",
object: list,
property: "height",
onInitialize: () => {
list.height = localStorage.getItem("crosshairHeight") || 0.8;
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
onChange: (data) => {
list.height = data;
localStorage.setItem("crosshairHeight", data);
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
});
gui.Register({
type: "range",
label: "Width of Crosshair",
min: 0,
max: 2,
step: 0.001,
folder: "Change Crosshair Settings",
object: list,
property: "width",
onInitialize: () => {
list.width = localStorage.getItem("crosshairWidth") || 0.8;
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
onChange: (data) => {
list.width = data;
localStorage.setItem("crosshairWidth", data);
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
});
gui.Register({
type: "range",
label: "Size of center dot",
min: 0,
max: 2,
step: 0.01,
folder: "Change Crosshair Settings",
object: list,
property: "centerDot",
onChange: (data) => {
list.centerDot = data;
localStorage.setItem("centerDotSize", data);
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
});
gui.Register({
type: "checkbox",
label: "Round Center Dot",
object: list,
property: "round",
folder: "Change Crosshair Settings",
onChange: (value) => {
list.round = value;
localStorage.setItem("roundCenterDot", round);
addScript(list.color, list.height, list.width, list.centerDot, list.round);
},
});
gui.Register({
type: "color",
label: "Crosshair Color",
format: "hex",
folder: "Middle Crosshair",
object: middleCrosshair,
property: "color",
onInitialize: () => {
middleCrosshair.color = JSON.parse(localStorage.getItem("middleCrosshair")).color || "black";
changeMiddleCH(middleCrosshair.color, middleCrosshair.length, middleCrosshair.thickness);
},
onChange: (color1) => {
middleCrosshair.color = color1;
localStorage.setItem("middleCrosshair", JSON.stringify(middleCrosshair));
changeMiddleCH(middleCrosshair.color, middleCrosshair.length, middleCrosshair.thickness);
},
});
gui.Register({
type: "range",
label: "Length of Crosshair",
min: 0,
max: 40,
step: 0.1,
folder: "Middle Crosshair",
object: middleCrosshair,
property: "length",
onInitialize: () => {
middleCrosshair.length = JSON.parse(localStorage.getItem("middleCrosshair")).length || 20;
changeMiddleCH(middleCrosshair.color, middleCrosshair.length, middleCrosshair.thickness);
},
onChange: (data) => {
middleCrosshair.length = data;
localStorage.setItem("middleCrosshair", JSON.stringify(middleCrosshair));
changeMiddleCH(middleCrosshair.color, middleCrosshair.length, middleCrosshair.thickness);
},
});
gui.Register({
type: "range",
label: "Thickness of Crosshair",
min: 0,
max: 10,
step: 0.1,
folder: "Middle Crosshair",
object: middleCrosshair,
property: "thickness",
onChange: (data) => {
middleCrosshair.thickness = data;
localStorage.setItem("middleCrosshair", JSON.stringify(middleCrosshair));
changeMiddleCH(middleCrosshair.color, middleCrosshair.length, middleCrosshair.thickness);
},
});
gui.Register({
type: "button",
label: "Reset Crosshair",
action: () => {
resetCrosshair();
},
});
})();