Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/cheatGUI/src/hacks/utility.ts
Views: 723
// Utility Hacks123// BEGIN IMPORTS4import { Toast, Input, Confirm, Swal } from "../utils/swal"; // Import Toast and Input from swal5import { category } from "../index"; // Import the Cheat GUI bases and the dimensions to resize the menu6import Toggler from "../class/Toggler";7import Hack from "../class/Hack";8import { _, saveCharacter, current, player } from "../utils/util"; // Import Prodigy typings9// END IMPORTS101112// BEGIN UTILITY HACKS1314151617// Begin Close all Popups18new Hack(category.utility, "Close all popups", "Closes all popups in Prodigy.").setClick(async () => {19_.instance.prodigy.open.menuCloseAll();20return Toast.fire("Closed!", "All open popups were closed.", "success");21});22// End Close all Popups232425new Hack(category.utility, "Grab UserID of all players on screen", "Shows you the UserID and name of every player currently shown on the screen.").setClick(async () => {26const users : object = current.playerList;27if (Object.keys(users).length === 0) {28return Toast.fire("No players found.", "There are no other players on the screen.", "error");29} else {3031let contents : string = "";32let i : number = 0;3334await Object.keys(users).map((user : string) => {35const name : string = Object.entries(users)[i][1].nameText.textSource.source;36contents += `<li>uID: ${user} - ${name}</li>`;37i++;38});3940return Swal.fire({title: "All players on the screen:", html: contents, icon: "info" });41}42});4344454647// Begin Save Character Locally48new Hack(category.utility, "Save Character Locally [Local]", "Saves your character locally.").setClick(async () => {49localStorage.setItem("playerData", JSON.stringify(player.getUpdatedData(true)));50return Toast.fire("Success!", "Note: Load Character will only work on this device.", "success");51});52// End Save Character Locally53545556575859// Begin Load local Character60new Hack(category.utility, "Load local character [Local]", "Loads your character locally.").setClick(async () => {61if (!localStorage.getItem("playerData")) {62return Toast.fire("Error", "No saved character.", "error");63} else {64const playerData = localStorage.getItem("playerData");65const req = await fetch(`https://api.prodigygame.com/game-api/v3/characters/${player.userID}`, {66headers: {67accept: "*/*",68"accept-language": "en-US,en;q=0.9",69authorization: localStorage.JWT_TOKEN,70"content-type": "application/json",71"sec-ch-ua": "\" Not;A Brand\";v=\"99\", \"Google Chrome\";v=\"91\", \"Chromium\";v=\"91\"",72"sec-ch-ua-mobile": "?0",73"sec-fetch-dest": "empty",74"sec-fetch-mode": "cors",75"sec-fetch-site": "same-site"76},77referrer: "https://play.prodigygame.com/",78referrerPolicy: "strict-origin-when-cross-origin",79body: JSON.stringify({80data: playerData,81userID: player.userID82}),83method: "POST",84mode: "cors"85});86if (!req.ok) return Toast.fire("Request failed.", `An error occurred while loading the character. Error code: ${req.status}`, "error");87return Toast.fire("Success!", "Character has been successfully loaded. Reload for the changes to take effect.", "success");88}89});90// End Load local Character919293949596// Begin Save Character97new Hack(category.utility, "Save Character", "Helps fix bugs where not all hacks save.").setClick(async () => {98saveCharacter();99return Toast.fire("Success!", "Your character has been saved!", "success");100});101// End Save Character102103104105106107// Begin Update menu108new Hack(category.utility, "Update menu", "Updates menu to the latest version without needing to reload.").setClick(async () => {109document.getElementById("cheat-menu")?.remove();110document.getElementById("menu-toggler")?.remove();111(async () => {112eval(await (await fetch(`https://raw.githubusercontent.com/ProdigyPNP/ProdigyMathGameHacking/master/cheatGUI/dist/bundle.js?updated=${Date.now()}`)).text()); // updated parameter is so browser ignores cached version113})();114return Toast.fire("Updated!", "Cheat menu was updated.", "success");115});116// End Update menu117118119120121// Begin Disable Inactivity Kick122new Hack(category.utility, "Disable inactivity kick", "Keeps you from being logged out for inactivity.").setClick(async () => {123_.constants.constants["GameConstants.Inactivity.LOG_OUT_TIMER_SECONDS"] = 0;124return Toast.fire("Success!", "You now will never be logged out!", "success");125});126// End Disable Inactivity Kick127128129130131132133// Begin Enable menu resize drag134new Toggler(category.utility, "Enable menu resize", "Allows you to resize the menu via dragging the bottom right corner.").setEnabled(async () => {135// @ts-expect-error136document.getElementById("cheat-menu").style.resize = "both";137return Toast.fire("Success!", "Drag the bottom right corner of the menu to resize it.", "success");138}).setDisabled(() => {139// @ts-expect-error140document.getElementById("cheat-menu").style.resize = "none";141// document.getElementById("cheat-menu").style.height = dimensions.height;142// document.getElementById("cheat-menu").style.width = dimensions.width;143return Toast.fire("Success!", "The menu position is now locked.", "success");144});145// End Enable menu resize drag146147148149150151// Begin Edit walkSpeed152new Hack(category.utility, "Edit walkspeed", "Lets you set your walkspeed.").setClick(async () => {153const walkSpeed = await Input.fire("What do you want to set your walk speed to?");154if (!walkSpeed.value) return;155if (!player._playerContainer) {156const interval = setInterval(() => {157if (player._playerContainer) {158clearInterval(interval);159player._playerContainer.walkSpeed = parseFloat(walkSpeed.value);160}161}, 100);162} else player._playerContainer.walkSpeed = parseFloat(walkSpeed.value) || 1.5;163return Toast.fire("Success!", `Successfully made walk speed ${parseFloat(walkSpeed.value) || 1.5}!`, "success");164});165// End Edit walkSpeed166167168169170171// Begin Toggle Click Teleporting172let teleportingInterval = -1;173174new Toggler(category.utility, "Toggle Click Teleporting").setEnabled(async () => {175teleportingInterval = setInterval(() => {176try {177player._playerContainer.walkSpeed = 500;178} catch (e) {179// "when switching between scenes, there's a brief moment when player._playerContainer.walkSpeed is inaccessible" - Mustan180}181});182return Toast.fire("Success!", "Successfully enabled teleport click.", "success");183}).setDisabled(async () => {184clearInterval(teleportingInterval);185player._playerContainer.walkSpeed = 1.5;186return Toast.fire("Success!", "Successfully disabled teleport click.", "success");187});188// End Toggle Click Teleporting189190191192// Begin Pause Game193new Toggler(category.utility, "Pause Game").setEnabled(async () => {194_.network.game._paused = true;195return Toast.fire("Success!", "Successfully paused Prodigy.", "success");196}).setDisabled(async () => {197_.network.game._paused = false;198return Toast.fire("Success!", "Successfully resumed Prodigy.", "success");199});200// End Pause Game201202203204205206// Begin Eval Console207new Hack(category.utility, "Eval Console", "Evaluate JavaScript code without opening F12").setClick(async () => {208209210if (!(await Confirm.fire({211title: "Important",212html: "This hack is potentially dangerous, as it evaluates plain JavaScript code, with access to Prodigy's typings. <strong>Please do not paste code from random people on the internet here, that may be dangerous.</strong><br><br>Proceed?",213icon: "warning"214})).value) {215return console.log("Cancelled.");216}217218219220const code = await Input.fire("Code:", "Enter the code you want to evaluate.");221if (!code.value) return;222try {223eval(code.value);224} catch (err) {225226if (err) {227return Swal.fire({228title: "Error",229html: `Oops! There was an error with the code! <br> <code> ${err} </code>`,230icon: "error"231});232}233}234235return Toast.fire("Evaluated!", "Code was evaluated.", "success");236});237// End Eval Console238239240241242// END UTILITY HACKS243244245