CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
ProdigyPNP

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: ProdigyPNP/ProdigyMathGameHacking
Path: blob/master/cheatGUI/src/utils/util.ts
Views: 723
1
// @ts-nocheck
2
3
import { GameItemKey } from "../../../typings/_.gameData";
4
import { gameData as GameData } from "../../../typings/gameData";
5
import { Item } from "../../../typings/item";
6
import { Prodigy } from "../../../typings/prodigy";
7
import { Game } from "../../../typings/game";
8
9
/** The hack variable. */
10
export const _ = window._;
11
12
/** The player variable */
13
export const player = _.player;
14
15
/** The alternate hack variable. */
16
export const current = window.Boot.prototype.game._state._current;
17
18
const base: { game: Game, prodigy: Prodigy } = _.instance;
19
20
/** game */
21
export const game = base.game;
22
23
/** prodigy */
24
export const prodigy = base.prodigy;
25
26
/** gameData */
27
export const gameData: GameData = _.instance.game.state.states.get("Boot").gameData;
28
29
/** getItem */
30
export const getItem = <T extends GameItemKey>(type: T, id: number): Item<T> | null =>
31
(_.gameData[type].find(x => x.ID === id) as null | Item<any>) ?? null;
32
33
/** 9000000000 */
34
export const VERY_LARGE_NUMBER = 9e9;
35
36
/** */
37
export const states = Object.fromEntries(_.instance.game.state.states);
38
39
/** Attempts to force the charecter to save. */
40
export const saveCharacter = () => {
41
_.network.processPlayer = true;
42
_.player.forceSaveCharacter();
43
};
44
45
/** The URL to the assets directory */
46
export const assetURL = "https://raw.githubusercontent.com/ProdigyPNP/ProdigyMathGameHacking/master/cheatGUI/src/assets/";
47
48
/** Gets the full URL of an asset */
49
export const joinAsset = (asset: string) => `${assetURL}${asset}`;
50
51
/** Location images */
52
export const locations = {
53
academy: joinAsset("academy.png"),
54
bonfire_spire: joinAsset("bonfire_spire.png"),
55
forest: joinAsset("forest.png"),
56
shipwreck_shore: joinAsset("shipwreck_shore.png"),
57
shiverchill: joinAsset("shiverchill.png"),
58
skywatch: joinAsset("skywatch.png"),
59
dyno: joinAsset("dyno.png"),
60
elemental_guardian: joinAsset("elemental_guardian.png"),
61
darktower: joinAsset("darktower.png"),
62
earthtower: joinAsset("earthtower.png"),
63
crystal_caverns: joinAsset("crystal_caverns.png"),
64
archives: joinAsset("archives.png"),
65
house: joinAsset("house.png"),
66
toyzone: joinAsset("toyzone.png"),
67
tower_town: joinAsset("tower_town.png"),
68
lamplight: joinAsset("lamplight.png")
69
};
70
71
/** rando */
72
export const pickRandom = <T>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)];
73
74