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/utils/hackify.ts
Views: 723
import { TODO } from "../../../typings/util"; // Import Prodigy Util typings1import { _ } from "../utils/util"; // Import Prodigy typings and VERY_LARGE_NUMBER2import { Swal, Toast } from "../utils/swal"; // Import Swal, Toast, Confirm, Input, and NumberInput from swal34567// Exports8910// Item Categories11export const names : string[] = ["Boots", "Buddies", "Fossils", "Hats", "Items", "Key Items", "Tower Town Frames", "Tower Town Interiors", "Mounts", "Outfits", "Relics", "Weapons", "Currencies"];121314// Item Category IDs15export const ids : string[] = ["boots", "follow", "fossil", "hat", "item", "key", "mathTownFrame", "mathTownInterior", "mount", "outfit", "spellRelic", "weapon", "currency"];161718// Convert item to Item ID map19// @ts-expect-error20export const itemify = (item: Item[], amount: number) =>21item.map(x => ({22ID: x.ID,23N: amount24})).filter(v => v !== undefined);252627// Convert rune to Rune ID map28// @ts-expect-error29export const runeify = (item, amount) =>30// @ts-expect-error31item.map(x => ({32ID: x.ID,33quantity: amount34// @ts-expect-error35})).filter(v => v !== undefined);363738// Get member module39export function getMemberModule () {40return _.player.hasMembership.toString().split("\"")[1];41}424344454647// Begin toHouse function48export function toHouse (userID: number) {49if (_.player.userID !== userID) {50const friendCount = _.instance.prodigy.friendsListNetworkHandler.friendsList.length;51const classMates = _.instance.prodigy.friendsListNetworkHandler.classList.length;5253_.instance.prodigy.gameContainer.get("2e1-e659")54.create("house-visit", "click", "hub", friendCount, classMates, null, null, userID)55.broadcast();56}57const zone = _.instance.prodigy.world.getZone(_.instance.prodigy.world.getCurrentZone());58if (!zone) return Swal.fire({ title: "Error", text: "You are not in a zone!", icon: "error" });59return zone.handleLeaving(2, () => teleportToHouse(userID));60}61// End toHouse function626364656667// Begin teleportToHouse function68export function teleportToHouse (userID: number) {69_.instance.prodigy.loading(true);7071const responseCallback = (data: any) => {72const playerData = data !== null && data !== undefined ? data[userID] : null;7374if (playerData !== null && playerData.house !== undefined && playerData.house !== null) {75_.instance.prodigy.loading(false);76const house = _.cloneDeep(_.player.house);77house.setItems(playerData.house);78if (!(playerData.data.allowsHouseVisitors !== undefined && playerData.data.allowsHouseVisitors !== null ? playerData.data.allowsHouseVisitors : false)) {79return Swal.fire(`Teleporting to ${userID} is not allowed.`, "Try another user.", "error");80}81return _.instance.prodigy.world._("house", null, null, { house, getAllowsHouseVisitors: () => playerData.data.allowsHouseVisitors !== undefined && playerData.data.allowsHouseVisitors !== null ? playerData.data.allowsHouseVisitors : false, setAllowsHouseVisitors: (v: boolean) => { playerData.data.allowsHouseVisitors = v; } });82}83};8485_.network.getCharData(userID.toString(), ["house", "data"], responseCallback, responseCallback);86return Toast.fire("Teleported to house", "You have been teleported to the house!", "success");87}88// End teleportToHouse function8990919293// Get pet from GUI popup94export const getPet = async (text: string): Promise<number | undefined> => {95const pet = await Swal.fire({96input: "select",97inputOptions: new Map(98_.player.kennel.data.map((x: TODO, i: number) => [99i.toString(),100// @ts-expect-error101`Level ${x.level} - ${x.nickname ?? _.gameData.pet.find(y => +y.ID === +x.ID)?.data.name ?? "Unknown"}`102]) as [string, string][]103),104title: "Choose Pet",105text: text106});107return pet.value;108};109110