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/hacks/utility.ts
Views: 723
1
// Utility Hacks
2
3
4
// BEGIN IMPORTS
5
import { Toast, Input, Confirm, Swal } from "../utils/swal"; // Import Toast and Input from swal
6
import { category } from "../index"; // Import the Cheat GUI bases and the dimensions to resize the menu
7
import Toggler from "../class/Toggler";
8
import Hack from "../class/Hack";
9
import { _, saveCharacter, current, player } from "../utils/util"; // Import Prodigy typings
10
// END IMPORTS
11
12
13
// BEGIN UTILITY HACKS
14
15
16
17
18
// Begin Close all Popups
19
new Hack(category.utility, "Close all popups", "Closes all popups in Prodigy.").setClick(async () => {
20
_.instance.prodigy.open.menuCloseAll();
21
return Toast.fire("Closed!", "All open popups were closed.", "success");
22
});
23
// End Close all Popups
24
25
26
new 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 () => {
27
const users : object = current.playerList;
28
if (Object.keys(users).length === 0) {
29
return Toast.fire("No players found.", "There are no other players on the screen.", "error");
30
} else {
31
32
let contents : string = "";
33
let i : number = 0;
34
35
await Object.keys(users).map((user : string) => {
36
const name : string = Object.entries(users)[i][1].nameText.textSource.source;
37
contents += `<li>uID: ${user} - ${name}</li>`;
38
i++;
39
});
40
41
return Swal.fire({title: "All players on the screen:", html: contents, icon: "info" });
42
}
43
});
44
45
46
47
48
// Begin Save Character Locally
49
new Hack(category.utility, "Save Character Locally [Local]", "Saves your character locally.").setClick(async () => {
50
localStorage.setItem("playerData", JSON.stringify(player.getUpdatedData(true)));
51
return Toast.fire("Success!", "Note: Load Character will only work on this device.", "success");
52
});
53
// End Save Character Locally
54
55
56
57
58
59
60
// Begin Load local Character
61
new Hack(category.utility, "Load local character [Local]", "Loads your character locally.").setClick(async () => {
62
if (!localStorage.getItem("playerData")) {
63
return Toast.fire("Error", "No saved character.", "error");
64
} else {
65
const playerData = localStorage.getItem("playerData");
66
const req = await fetch(`https://api.prodigygame.com/game-api/v3/characters/${player.userID}`, {
67
headers: {
68
accept: "*/*",
69
"accept-language": "en-US,en;q=0.9",
70
authorization: localStorage.JWT_TOKEN,
71
"content-type": "application/json",
72
"sec-ch-ua": "\" Not;A Brand\";v=\"99\", \"Google Chrome\";v=\"91\", \"Chromium\";v=\"91\"",
73
"sec-ch-ua-mobile": "?0",
74
"sec-fetch-dest": "empty",
75
"sec-fetch-mode": "cors",
76
"sec-fetch-site": "same-site"
77
},
78
referrer: "https://play.prodigygame.com/",
79
referrerPolicy: "strict-origin-when-cross-origin",
80
body: JSON.stringify({
81
data: playerData,
82
userID: player.userID
83
}),
84
method: "POST",
85
mode: "cors"
86
});
87
if (!req.ok) return Toast.fire("Request failed.", `An error occurred while loading the character. Error code: ${req.status}`, "error");
88
return Toast.fire("Success!", "Character has been successfully loaded. Reload for the changes to take effect.", "success");
89
}
90
});
91
// End Load local Character
92
93
94
95
96
97
// Begin Save Character
98
new Hack(category.utility, "Save Character", "Helps fix bugs where not all hacks save.").setClick(async () => {
99
saveCharacter();
100
return Toast.fire("Success!", "Your character has been saved!", "success");
101
});
102
// End Save Character
103
104
105
106
107
108
// Begin Update menu
109
new Hack(category.utility, "Update menu", "Updates menu to the latest version without needing to reload.").setClick(async () => {
110
document.getElementById("cheat-menu")?.remove();
111
document.getElementById("menu-toggler")?.remove();
112
(async () => {
113
eval(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 version
114
})();
115
return Toast.fire("Updated!", "Cheat menu was updated.", "success");
116
});
117
// End Update menu
118
119
120
121
122
// Begin Disable Inactivity Kick
123
new Hack(category.utility, "Disable inactivity kick", "Keeps you from being logged out for inactivity.").setClick(async () => {
124
_.constants.constants["GameConstants.Inactivity.LOG_OUT_TIMER_SECONDS"] = 0;
125
return Toast.fire("Success!", "You now will never be logged out!", "success");
126
});
127
// End Disable Inactivity Kick
128
129
130
131
132
133
134
// Begin Enable menu resize drag
135
new Toggler(category.utility, "Enable menu resize", "Allows you to resize the menu via dragging the bottom right corner.").setEnabled(async () => {
136
// @ts-expect-error
137
document.getElementById("cheat-menu").style.resize = "both";
138
return Toast.fire("Success!", "Drag the bottom right corner of the menu to resize it.", "success");
139
}).setDisabled(() => {
140
// @ts-expect-error
141
document.getElementById("cheat-menu").style.resize = "none";
142
// document.getElementById("cheat-menu").style.height = dimensions.height;
143
// document.getElementById("cheat-menu").style.width = dimensions.width;
144
return Toast.fire("Success!", "The menu position is now locked.", "success");
145
});
146
// End Enable menu resize drag
147
148
149
150
151
152
// Begin Edit walkSpeed
153
new Hack(category.utility, "Edit walkspeed", "Lets you set your walkspeed.").setClick(async () => {
154
const walkSpeed = await Input.fire("What do you want to set your walk speed to?");
155
if (!walkSpeed.value) return;
156
if (!player._playerContainer) {
157
const interval = setInterval(() => {
158
if (player._playerContainer) {
159
clearInterval(interval);
160
player._playerContainer.walkSpeed = parseFloat(walkSpeed.value);
161
}
162
}, 100);
163
} else player._playerContainer.walkSpeed = parseFloat(walkSpeed.value) || 1.5;
164
return Toast.fire("Success!", `Successfully made walk speed ${parseFloat(walkSpeed.value) || 1.5}!`, "success");
165
});
166
// End Edit walkSpeed
167
168
169
170
171
172
// Begin Toggle Click Teleporting
173
let teleportingInterval = -1;
174
175
new Toggler(category.utility, "Toggle Click Teleporting").setEnabled(async () => {
176
teleportingInterval = setInterval(() => {
177
try {
178
player._playerContainer.walkSpeed = 500;
179
} catch (e) {
180
// "when switching between scenes, there's a brief moment when player._playerContainer.walkSpeed is inaccessible" - Mustan
181
}
182
});
183
return Toast.fire("Success!", "Successfully enabled teleport click.", "success");
184
}).setDisabled(async () => {
185
clearInterval(teleportingInterval);
186
player._playerContainer.walkSpeed = 1.5;
187
return Toast.fire("Success!", "Successfully disabled teleport click.", "success");
188
});
189
// End Toggle Click Teleporting
190
191
192
193
// Begin Pause Game
194
new Toggler(category.utility, "Pause Game").setEnabled(async () => {
195
_.network.game._paused = true;
196
return Toast.fire("Success!", "Successfully paused Prodigy.", "success");
197
}).setDisabled(async () => {
198
_.network.game._paused = false;
199
return Toast.fire("Success!", "Successfully resumed Prodigy.", "success");
200
});
201
// End Pause Game
202
203
204
205
206
207
// Begin Eval Console
208
new Hack(category.utility, "Eval Console", "Evaluate JavaScript code without opening F12").setClick(async () => {
209
210
211
if (!(await Confirm.fire({
212
title: "Important",
213
html: "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?",
214
icon: "warning"
215
})).value) {
216
return console.log("Cancelled.");
217
}
218
219
220
221
const code = await Input.fire("Code:", "Enter the code you want to evaluate.");
222
if (!code.value) return;
223
try {
224
eval(code.value);
225
} catch (err) {
226
227
if (err) {
228
return Swal.fire({
229
title: "Error",
230
html: `Oops! There was an error with the code! <br> <code>&nbsp;${err}&nbsp;</code>`,
231
icon: "error"
232
});
233
}
234
}
235
236
return Toast.fire("Evaluated!", "Code was evaluated.", "success");
237
});
238
// End Eval Console
239
240
241
242
243
// END UTILITY HACKS
244
245