CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.
CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.
Path: blob/master/cheatGUI/src/index.ts
Views: 720
// @ts-nocheck1// Prodigy Cheat GUI23import { io } from "socket.io-client"; // Import socket.io-client4import "./style.scss"; // Import SCSS style5import { _ } from "./utils/util"; // Import Prodigy typings6import { statusMessage } from "./utils/status"; // Import status message7import Swal from "sweetalert2"; // Import Swal8import { License, NoLicense } from "./utils/swal";9import openChat from "./utils/chat";1011export const menu = document.createElement("div"); // Create cheat menu element12export const wrapper = document.getElementById("game-wrapper"); // Create game wrapper1314document.getElementById("cheat-menu")?.remove(); // Remove any existing menu if present15document.getElementById("menu-toggler")?.remove(); // Remove any existing menu togglers if present16menu.id = "cheat-menu"; // Set menu ID to cheat-menu171819menu.style = "position: fixed;top: -10%;left: 10%;right: 10%;width: 80%;height: 80%;z-index: 2;background-color: rgba(0, 0, 0, 0.5);backdrop-filter: blur(5px);"; // Set menu style2021wrapper?.prepend(menu);2223export const toggler = document.createElement("button"); // Create menu toggler24toggler.id = "menu-toggler";252627let visible = false;28wrapper?.prepend(toggler);29toggler.onclick = () => {30visible = !visible;3132if (visible) {33toggler.innerText = "▼";34menu.style.top = "-100vh";35} else {36toggler.innerText = "▲";37menu.style.top = "10%";38}39};40toggler.onclick({} as any);4142const menuleft = document.createElement("DIV");43menuleft.classList.add("menu-left");44menu.append(menuleft);4546let firstCategory = true;47function addArea (title: string) {48const area = document.createElement("div");4950if (firstCategory == false) {51area.append(document.createElement("br"));52area.append(document.createElement("br"));53} else {54firstCategory = false;55}565758area.classList.add("menu-area");59area.style.textAlign = "center";60menuleft.append(area);6162const header = document.createElement("h1");63header.innerText = title;64header.style.textAlign = "center";65header.style.color = "white";6667area.append(header);68return area;69};7071const title = document.createElement("h1");72title.classList.add("menu-title");73title.innerText = "Prodigy Hacks";74title.style.textAlign = "center";75menuleft.append(title);7677const disc = document.createElement("h2");78disc.style.fontSize = "25px";79disc.style.color = "white";80disc.innerHTML = "<br>Press SHIFT to show/hide the menu. Scroll down in the menu for more hacks.";81menuleft.append(disc);8283const subtitle = document.createElement("h3");84subtitle.style.fontSize = "20px";85subtitle.innerHTML = `86<p>Join our Discord <a href='https://dsc.gg/ProdigyPNP'>https://dsc.gg/ProdigyPNP</a>!</p>8788<hr>89`;90subtitle.style.color = "white";91menuleft.append(subtitle);92939495export const category = {96player: addArea("Player Hacks"),97inventory: addArea("Inventory Hacks"),98location: addArea("Location Hacks"),99pets: addArea("Pet Hacks"),100battle: addArea("Battle Hacks"),101minigames: addArea("Minigame Hacks"),102misc: addArea("Miscellaneous Hacks"),103utility: addArea("Utility Hacks"),104beta: addArea("Beta Testing | Beta Hacks may damage your account"),105patched : addArea("Patched Hacks")106};107108109110// If an item called hasTip is defined in the localStorage111if (!localStorage.hasTip) {112(async () => {113await Swal.fire({114title: 'Welcome!',115html: `To get started with the hacks, click this dropdown!`,116icon: 'info',117backdrop: `118url("https://i.imgur.com/CdV9piu.png")119left top120no-repeat121`122});123})();124localStorage.hasTip = true;125console.log("Player was shown the tip.");126} else {127console.log("Player already has tip.");128};129130131// If an item called "level" is defined in the localStorage132if (localStorage.getItem("level")) {133// Then, override _.player.getLevel with the value in localStorage.134_.player.getLevel = () => localStorage.getItem("level");135136console.log("Loaded menu from localStorage.");137}138139140let shownMenu : boolean = true;141document.addEventListener("keydown", function (event) {142if (event.key == "Shift") {143144console.log("Shift key was pressed.");145146if (shownMenu == true) {147// Cheats are shown, so let's hide them.148console.log("Hiding cheat menu...");149document.getElementById("cheat-menu").style.display = "none";150document.getElementById("menu-toggler").style.display = "none";151shownMenu = false;152console.log("Hidden cheat menu.");153} else {154// Cheats are hidden, so let's show them.155console.log("Showing cheat menu...");156document.getElementById("cheat-menu").style.display = "block";157document.getElementById("menu-toggler").style.display = "block";158shownMenu = true;159console.log("Shown cheat menu.");160}161}162});163164165if (process.env.NODE_ENV === "development") {166const socket = io("http://localhost:3001");167let used = false;168socket.on("update", data => {169if (used) return;170used = true;171socket.disconnect();172document.getElementById("cheat-menu")?.remove();173document.getElementById("menu-toggler")?.remove();174eval(data);175});176}177178179180181// LICENSE POPUPS182(async () => {183184185186if (!(await License.fire("ProdigyPNP", `187<p>188<a href="https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/README.md">This is free and open-source software</a>.189If you paid for this or accessed this behind a paywall/AdFly link, demand a refund. If you sell this software, or otherwise make a commercial advantage from it, you are violating190<a href = "https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/LICENSE.txt">our license</a>.191</p>192`)).value) {193194if (!(await NoLicense.fire("ProdigyPNP License", `195<p>196<strong>You need to agree to our license to use our hacks. If you changed your mind and now agree to our license, reload Prodigy.</strong>197</p>198`)).value) {199200// Play Prodigy without hacks201document.getElementById("cheat-menu")?.remove(); // Remove any existing menu if present202document.getElementById("menu-toggler")?.remove(); // Remove any existing menu togglers if present203204} else {205206// Reload Prodigy207document.location = "";208}209210211} else {212213214// Display status message.215await statusMessage();216}217218})();219220