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/location.ts
Views: 723
// Location Hacks12// BEGIN IMPORTS3import { category } from "../index"; // Import the Cheat GUI bases.4import Toggler from "../class/Toggler";5import Hack from "../class/Hack";6import { Input, NumberInput, Swal, Toast } from "../utils/swal"; // Import Swal, Toast, and NumberInput from swal7import { _, locations, prodigy, player } from "../utils/util"; // Import Prodigy typings8import { toHouse } from "../utils/hackify"; // Import toHouse9// END IMPORTS1011export var useWASD : boolean = true;1213// BEGIN LOCATION HACKS141516// WASD Phasing17new Toggler(category.location, "WASD Movement", "Allows you to walk through walls or on air with WASD movement in Prodigy.").setEnabled(async () => {18useWASD = true;19return Toast.fire("Enabled!", "WASD Movement is now enabled.", "success");20}).setDisabled(async () => {21useWASD = false;22return Toast.fire("Disabled!", "WASD Movement is now disabled.", "success");23}).status = true;242526// Begin Edit walkSpeed27new Hack(category.location, "Edit walkspeed", "Lets you set your walkspeed.").setClick(async () => {28const walkSpeed = await Input.fire("What do you want to set your walk speed to?");29if (!walkSpeed.value) return;30if (!player._playerContainer) {31const interval = setInterval(() => {32if (player._playerContainer) {33clearInterval(interval);34player._playerContainer.walkSpeed = parseFloat(walkSpeed.value);35}36}, 100);37} else player._playerContainer.walkSpeed = parseFloat(walkSpeed.value) || 1.5;38return Toast.fire("Success!", `Successfully made walk speed ${parseFloat(walkSpeed.value) || 1.5}!`, "success");39});40// End Edit walkSpeed414243444546// Begin Toggle Click Teleporting47let teleportingInterval = -1;4849new Toggler(category.location, "Toggle Click Teleporting").setEnabled(async () => {50teleportingInterval = setInterval(() => {51try {52player._playerContainer.walkSpeed = 500;53} catch (e) {54// "when switching between scenes, there's a brief moment when player._playerContainer.walkSpeed is inaccessible" - Mustan55}56});57return Toast.fire("Success!", "Successfully enabled teleport click.", "success");58}).setDisabled(async () => {59clearInterval(teleportingInterval);60player._playerContainer.walkSpeed = 1.5;61return Toast.fire("Success!", "Successfully disabled teleport click.", "success");62});63// End Toggle Click Teleporting64656667/*68const locomotionBackup = _.player._playerContainer.locomotion.screen.area;69// Disable Collision/Click phasing70new Toggler(category.location, "Disable Collision", "Allows you to walk through walls with click movement.").setEnabled(async () => {71// @ts-expect-error72_.player._playerContainer.locomotion.screen.area = _.player._playerContainer.locomotion.screen.area.map(e => e.fill(1))73return Toast.fire("Success!", "Collision was disable on this screen.", "success");74}).setDisabled(async () => {75_.player._playerContainer.locomotion.screen.area = locomotionBackup;76return Toast.fire("Success!", "Collision is back!", "success");77});78*/7980// Begin Teleport To Map (interactive)81new Hack(category.location, "Teleport To Map (interactive)").setClick(82async () => {83const radioPopup = Swal.mixin({84focusConfirm: false,85showCancelButton: true,86preConfirm: () => {87return document88.querySelector(".radioDiv[checked]")89?.getAttribute("zone");90}91});92const container = document.createElement("div");93container.classList.add("radioContainer");94for (const zone of Object.keys(prodigy.world.zones)) {95const radio = document.createElement("DIV");96radio.classList.add("radioDiv");97radio.setAttribute("zone", zone);98const locationURL = locations[zone as keyof typeof locations];99if (locationURL) {100radio.style.backgroundImage = `url(${locationURL})`;101} else radio.innerText = zone;102radio.onclick = () => {103document104.querySelectorAll(".radioDiv[checked]")105.forEach(x => x.removeAttribute("checked"));106radio.setAttribute("checked", "");107};108container.append(radio);109}110const zone = await radioPopup.fire({111title: "Teleport Zone",112html: container,113customClass: {114popup: "radioSwal"115}116});117if (!zone.value) return;118const mapList = Object.keys(119prodigy.world.zones[zone.value].maps120);121const area = await Swal.fire({122input: "select",123inputOptions: new Map(mapList.map(x => [x, x])),124title: "Map",125text: "Which map in the zone do you want to teleport to?"126});127if (!area.value) return;128129// fix #1158130const x = (await NumberInput.fire("Please enter the x to teleport to. (Try 500?)")).value || 500;131const y = (await NumberInput.fire("Please enter the y to teleport to. (Try 500?)")).value || 500;132133prodigy.world.zones[zone.value].teleport(area.value, x, y, {}, {})134return Toast.fire("Teleported", "You have been teleported!", "success");135});136// End Teleport To Map (interactive)137138139140141142143// Begin Teleport To House by userID144new Hack(category.location, "Teleport to house by userID").setClick(async () => {145const userID = (await NumberInput.fire("Please enter the userID.")).value;146if (!userID) return;147toHouse(userID);148return Toast.fire("Teleported!", "You have been teleported!", "success");149});150// End Teleport To House by userID151152153154155156// Begin Get Map Location157new Hack(category.location, "Get Map Location").setClick(async () => {158159160const Location: string = player.data.zone;161162navigator.clipboard.writeText(Location).then(async function() {163164console.log("Async: Copying to clipboard was successful!");165166return Swal.fire({167title: "Map Location",168html: `You are at <br> <code> ${Location} </code>. <br> You can save this to get to the same zone. <br> <br> Your location is has also been copied to your clipboard.`,169icon: "info"170});171172173}, async function (err) {174175console.error("Async: Could not copy text: ", err);176177return Swal.fire({178title: "Map Location",179html: `You are at <br> <code> ${Location} </code>. <br> You can save this to get to the same zone.`,180icon: "info"181});182183184});185186187});188// End Get Map Location189190191192// END LOCATION HACKS193194195/*196new Hack(category.location, "Teleport To Dark Tower Floor").setClick(197async () => {198const floor = await NumberInput.fire(199"Dark Tower Floor",200"What floor do you want to teleport to?",201"question"202);203if (floor.value === undefined) return;204prodigy.debugMisc.tpTowerFloor(+floor.value);205Toast.fire(206"Success!",207"You have been teleport to the requested floor."208);209}210);211212213214new Hack(215category.location,216"Unlock All Zones (school)",217"Unlocks all the zones that are locked in school."218).setClick(async () => {219prodigy.classModeController.lockedZones = 0;220Toast.fire("Success!", "All zones are now unlocked that were locked in school.", "success")221});222*/223224225