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/util.ts
Views: 723
// @ts-nocheck12import { GameItemKey } from "../../../typings/_.gameData";3import { gameData as GameData } from "../../../typings/gameData";4import { Item } from "../../../typings/item";5import { Prodigy } from "../../../typings/prodigy";6import { Game } from "../../../typings/game";78/** The hack variable. */9export const _ = window._;1011/** The player variable */12export const player = _.player;1314/** The alternate hack variable. */15export const current = window.Boot.prototype.game._state._current;1617const base: { game: Game, prodigy: Prodigy } = _.instance;1819/** game */20export const game = base.game;2122/** prodigy */23export const prodigy = base.prodigy;2425/** gameData */26export const gameData: GameData = _.instance.game.state.states.get("Boot").gameData;2728/** getItem */29export const getItem = <T extends GameItemKey>(type: T, id: number): Item<T> | null =>30(_.gameData[type].find(x => x.ID === id) as null | Item<any>) ?? null;3132/** 9000000000 */33export const VERY_LARGE_NUMBER = 9e9;3435/** */36export const states = Object.fromEntries(_.instance.game.state.states);3738/** Attempts to force the charecter to save. */39export const saveCharacter = () => {40_.network.processPlayer = true;41_.player.forceSaveCharacter();42};4344/** The URL to the assets directory */45export const assetURL = "https://raw.githubusercontent.com/ProdigyPNP/ProdigyMathGameHacking/master/cheatGUI/src/assets/";4647/** Gets the full URL of an asset */48export const joinAsset = (asset: string) => `${assetURL}${asset}`;4950/** Location images */51export const locations = {52academy: joinAsset("academy.png"),53bonfire_spire: joinAsset("bonfire_spire.png"),54forest: joinAsset("forest.png"),55shipwreck_shore: joinAsset("shipwreck_shore.png"),56shiverchill: joinAsset("shiverchill.png"),57skywatch: joinAsset("skywatch.png"),58dyno: joinAsset("dyno.png"),59elemental_guardian: joinAsset("elemental_guardian.png"),60darktower: joinAsset("darktower.png"),61earthtower: joinAsset("earthtower.png"),62crystal_caverns: joinAsset("crystal_caverns.png"),63archives: joinAsset("archives.png"),64house: joinAsset("house.png"),65toyzone: joinAsset("toyzone.png"),66tower_town: joinAsset("tower_town.png"),67lamplight: joinAsset("lamplight.png")68};6970/** rando */71export const pickRandom = <T>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)];727374