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/location.ts
Views: 723
1
// Location Hacks
2
3
// BEGIN IMPORTS
4
import { category } from "../index"; // Import the Cheat GUI bases.
5
import Toggler from "../class/Toggler";
6
import Hack from "../class/Hack";
7
import { Input, NumberInput, Swal, Toast } from "../utils/swal"; // Import Swal, Toast, and NumberInput from swal
8
import { _, locations, prodigy, player } from "../utils/util"; // Import Prodigy typings
9
import { toHouse } from "../utils/hackify"; // Import toHouse
10
// END IMPORTS
11
12
export var useWASD : boolean = true;
13
14
// BEGIN LOCATION HACKS
15
16
17
// WASD Phasing
18
new Toggler(category.location, "WASD Movement", "Allows you to walk through walls or on air with WASD movement in Prodigy.").setEnabled(async () => {
19
useWASD = true;
20
return Toast.fire("Enabled!", "WASD Movement is now enabled.", "success");
21
}).setDisabled(async () => {
22
useWASD = false;
23
return Toast.fire("Disabled!", "WASD Movement is now disabled.", "success");
24
}).status = true;
25
26
27
// Begin Edit walkSpeed
28
new Hack(category.location, "Edit walkspeed", "Lets you set your walkspeed.").setClick(async () => {
29
const walkSpeed = await Input.fire("What do you want to set your walk speed to?");
30
if (!walkSpeed.value) return;
31
if (!player._playerContainer) {
32
const interval = setInterval(() => {
33
if (player._playerContainer) {
34
clearInterval(interval);
35
player._playerContainer.walkSpeed = parseFloat(walkSpeed.value);
36
}
37
}, 100);
38
} else player._playerContainer.walkSpeed = parseFloat(walkSpeed.value) || 1.5;
39
return Toast.fire("Success!", `Successfully made walk speed ${parseFloat(walkSpeed.value) || 1.5}!`, "success");
40
});
41
// End Edit walkSpeed
42
43
44
45
46
47
// Begin Toggle Click Teleporting
48
let teleportingInterval = -1;
49
50
new Toggler(category.location, "Toggle Click Teleporting").setEnabled(async () => {
51
teleportingInterval = setInterval(() => {
52
try {
53
player._playerContainer.walkSpeed = 500;
54
} catch (e) {
55
// "when switching between scenes, there's a brief moment when player._playerContainer.walkSpeed is inaccessible" - Mustan
56
}
57
});
58
return Toast.fire("Success!", "Successfully enabled teleport click.", "success");
59
}).setDisabled(async () => {
60
clearInterval(teleportingInterval);
61
player._playerContainer.walkSpeed = 1.5;
62
return Toast.fire("Success!", "Successfully disabled teleport click.", "success");
63
});
64
// End Toggle Click Teleporting
65
66
67
68
/*
69
const locomotionBackup = _.player._playerContainer.locomotion.screen.area;
70
// Disable Collision/Click phasing
71
new Toggler(category.location, "Disable Collision", "Allows you to walk through walls with click movement.").setEnabled(async () => {
72
// @ts-expect-error
73
_.player._playerContainer.locomotion.screen.area = _.player._playerContainer.locomotion.screen.area.map(e => e.fill(1))
74
return Toast.fire("Success!", "Collision was disable on this screen.", "success");
75
}).setDisabled(async () => {
76
_.player._playerContainer.locomotion.screen.area = locomotionBackup;
77
return Toast.fire("Success!", "Collision is back!", "success");
78
});
79
*/
80
81
// Begin Teleport To Map (interactive)
82
new Hack(category.location, "Teleport To Map (interactive)").setClick(
83
async () => {
84
const radioPopup = Swal.mixin({
85
focusConfirm: false,
86
showCancelButton: true,
87
preConfirm: () => {
88
return document
89
.querySelector(".radioDiv[checked]")
90
?.getAttribute("zone");
91
}
92
});
93
const container = document.createElement("div");
94
container.classList.add("radioContainer");
95
for (const zone of Object.keys(prodigy.world.zones)) {
96
const radio = document.createElement("DIV");
97
radio.classList.add("radioDiv");
98
radio.setAttribute("zone", zone);
99
const locationURL = locations[zone as keyof typeof locations];
100
if (locationURL) {
101
radio.style.backgroundImage = `url(${locationURL})`;
102
} else radio.innerText = zone;
103
radio.onclick = () => {
104
document
105
.querySelectorAll(".radioDiv[checked]")
106
.forEach(x => x.removeAttribute("checked"));
107
radio.setAttribute("checked", "");
108
};
109
container.append(radio);
110
}
111
const zone = await radioPopup.fire({
112
title: "Teleport Zone",
113
html: container,
114
customClass: {
115
popup: "radioSwal"
116
}
117
});
118
if (!zone.value) return;
119
const mapList = Object.keys(
120
prodigy.world.zones[zone.value].maps
121
);
122
const area = await Swal.fire({
123
input: "select",
124
inputOptions: new Map(mapList.map(x => [x, x])),
125
title: "Map",
126
text: "Which map in the zone do you want to teleport to?"
127
});
128
if (!area.value) return;
129
130
// fix #1158
131
const x = (await NumberInput.fire("Please enter the x to teleport to. (Try 500?)")).value || 500;
132
const y = (await NumberInput.fire("Please enter the y to teleport to. (Try 500?)")).value || 500;
133
134
prodigy.world.zones[zone.value].teleport(area.value, x, y, {}, {})
135
return Toast.fire("Teleported", "You have been teleported!", "success");
136
});
137
// End Teleport To Map (interactive)
138
139
140
141
142
143
144
// Begin Teleport To House by userID
145
new Hack(category.location, "Teleport to house by userID").setClick(async () => {
146
const userID = (await NumberInput.fire("Please enter the userID.")).value;
147
if (!userID) return;
148
toHouse(userID);
149
return Toast.fire("Teleported!", "You have been teleported!", "success");
150
});
151
// End Teleport To House by userID
152
153
154
155
156
157
// Begin Get Map Location
158
new Hack(category.location, "Get Map Location").setClick(async () => {
159
160
161
const Location: string = player.data.zone;
162
163
navigator.clipboard.writeText(Location).then(async function() {
164
165
console.log("Async: Copying to clipboard was successful!");
166
167
return Swal.fire({
168
title: "Map Location",
169
html: `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.`,
170
icon: "info"
171
});
172
173
174
}, async function (err) {
175
176
console.error("Async: Could not copy text: ", err);
177
178
return Swal.fire({
179
title: "Map Location",
180
html: `You are at <br> <code> ${Location} </code>. <br> You can save this to get to the same zone.`,
181
icon: "info"
182
});
183
184
185
});
186
187
188
});
189
// End Get Map Location
190
191
192
193
// END LOCATION HACKS
194
195
196
/*
197
new Hack(category.location, "Teleport To Dark Tower Floor").setClick(
198
async () => {
199
const floor = await NumberInput.fire(
200
"Dark Tower Floor",
201
"What floor do you want to teleport to?",
202
"question"
203
);
204
if (floor.value === undefined) return;
205
prodigy.debugMisc.tpTowerFloor(+floor.value);
206
Toast.fire(
207
"Success!",
208
"You have been teleport to the requested floor."
209
);
210
}
211
);
212
213
214
215
new Hack(
216
category.location,
217
"Unlock All Zones (school)",
218
"Unlocks all the zones that are locked in school."
219
).setClick(async () => {
220
prodigy.classModeController.lockedZones = 0;
221
Toast.fire("Success!", "All zones are now unlocked that were locked in school.", "success")
222
});
223
*/
224
225