CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
ProdigyPNP

CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.

GitHub Repository: ProdigyPNP/ProdigyMathGameHacking
Path: blob/master/cheatGUI/src/index.ts
Views: 720
1
// @ts-nocheck
2
// Prodigy Cheat GUI
3
4
import { io } from "socket.io-client"; // Import socket.io-client
5
import "./style.scss"; // Import SCSS style
6
import { _ } from "./utils/util"; // Import Prodigy typings
7
import { statusMessage } from "./utils/status"; // Import status message
8
import Swal from "sweetalert2"; // Import Swal
9
import { License, NoLicense } from "./utils/swal";
10
import openChat from "./utils/chat";
11
12
export const menu = document.createElement("div"); // Create cheat menu element
13
export const wrapper = document.getElementById("game-wrapper"); // Create game wrapper
14
15
document.getElementById("cheat-menu")?.remove(); // Remove any existing menu if present
16
document.getElementById("menu-toggler")?.remove(); // Remove any existing menu togglers if present
17
menu.id = "cheat-menu"; // Set menu ID to cheat-menu
18
19
20
menu.style = "position: fixed;top: -10%;left: 10%;right: 10%;width: 80%;height: 80%;z-index: 2;background-color: rgba(0, 0, 0, 0.5);backdrop-filter: blur(5px);"; // Set menu style
21
22
wrapper?.prepend(menu);
23
24
export const toggler = document.createElement("button"); // Create menu toggler
25
toggler.id = "menu-toggler";
26
27
28
let visible = false;
29
wrapper?.prepend(toggler);
30
toggler.onclick = () => {
31
visible = !visible;
32
33
if (visible) {
34
toggler.innerText = "▼";
35
menu.style.top = "-100vh";
36
} else {
37
toggler.innerText = "▲";
38
menu.style.top = "10%";
39
}
40
};
41
toggler.onclick({} as any);
42
43
const menuleft = document.createElement("DIV");
44
menuleft.classList.add("menu-left");
45
menu.append(menuleft);
46
47
let firstCategory = true;
48
function addArea (title: string) {
49
const area = document.createElement("div");
50
51
if (firstCategory == false) {
52
area.append(document.createElement("br"));
53
area.append(document.createElement("br"));
54
} else {
55
firstCategory = false;
56
}
57
58
59
area.classList.add("menu-area");
60
area.style.textAlign = "center";
61
menuleft.append(area);
62
63
const header = document.createElement("h1");
64
header.innerText = title;
65
header.style.textAlign = "center";
66
header.style.color = "white";
67
68
area.append(header);
69
return area;
70
};
71
72
const title = document.createElement("h1");
73
title.classList.add("menu-title");
74
title.innerText = "Prodigy Hacks";
75
title.style.textAlign = "center";
76
menuleft.append(title);
77
78
const disc = document.createElement("h2");
79
disc.style.fontSize = "25px";
80
disc.style.color = "white";
81
disc.innerHTML = "<br>Press SHIFT to show/hide the menu. Scroll down in the menu for more hacks.";
82
menuleft.append(disc);
83
84
const subtitle = document.createElement("h3");
85
subtitle.style.fontSize = "20px";
86
subtitle.innerHTML = `
87
<p>Join our Discord <a href='https://dsc.gg/ProdigyPNP'>https://dsc.gg/ProdigyPNP</a>!</p>
88
89
<hr>
90
`;
91
subtitle.style.color = "white";
92
menuleft.append(subtitle);
93
94
95
96
export const category = {
97
player: addArea("Player Hacks"),
98
inventory: addArea("Inventory Hacks"),
99
location: addArea("Location Hacks"),
100
pets: addArea("Pet Hacks"),
101
battle: addArea("Battle Hacks"),
102
minigames: addArea("Minigame Hacks"),
103
misc: addArea("Miscellaneous Hacks"),
104
utility: addArea("Utility Hacks"),
105
beta: addArea("Beta Testing | Beta Hacks may damage your account"),
106
patched : addArea("Patched Hacks")
107
};
108
109
110
111
// If an item called hasTip is defined in the localStorage
112
if (!localStorage.hasTip) {
113
(async () => {
114
await Swal.fire({
115
title: 'Welcome!',
116
html: `To get started with the hacks, click this dropdown!`,
117
icon: 'info',
118
backdrop: `
119
url("https://i.imgur.com/CdV9piu.png")
120
left top
121
no-repeat
122
`
123
});
124
})();
125
localStorage.hasTip = true;
126
console.log("Player was shown the tip.");
127
} else {
128
console.log("Player already has tip.");
129
};
130
131
132
// If an item called "level" is defined in the localStorage
133
if (localStorage.getItem("level")) {
134
// Then, override _.player.getLevel with the value in localStorage.
135
_.player.getLevel = () => localStorage.getItem("level");
136
137
console.log("Loaded menu from localStorage.");
138
}
139
140
141
let shownMenu : boolean = true;
142
document.addEventListener("keydown", function (event) {
143
if (event.key == "Shift") {
144
145
console.log("Shift key was pressed.");
146
147
if (shownMenu == true) {
148
// Cheats are shown, so let's hide them.
149
console.log("Hiding cheat menu...");
150
document.getElementById("cheat-menu").style.display = "none";
151
document.getElementById("menu-toggler").style.display = "none";
152
shownMenu = false;
153
console.log("Hidden cheat menu.");
154
} else {
155
// Cheats are hidden, so let's show them.
156
console.log("Showing cheat menu...");
157
document.getElementById("cheat-menu").style.display = "block";
158
document.getElementById("menu-toggler").style.display = "block";
159
shownMenu = true;
160
console.log("Shown cheat menu.");
161
}
162
}
163
});
164
165
166
if (process.env.NODE_ENV === "development") {
167
const socket = io("http://localhost:3001");
168
let used = false;
169
socket.on("update", data => {
170
if (used) return;
171
used = true;
172
socket.disconnect();
173
document.getElementById("cheat-menu")?.remove();
174
document.getElementById("menu-toggler")?.remove();
175
eval(data);
176
});
177
}
178
179
180
181
182
// LICENSE POPUPS
183
(async () => {
184
185
186
187
if (!(await License.fire("ProdigyPNP", `
188
<p>
189
<a href="https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/README.md">This is free and open-source software</a>.
190
If you paid for this or accessed this behind a paywall/AdFly link, demand a refund. If you sell this software, or otherwise make a commercial advantage from it, you are violating
191
<a href = "https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/LICENSE.txt">our license</a>.
192
</p>
193
`)).value) {
194
195
if (!(await NoLicense.fire("ProdigyPNP License", `
196
<p>
197
<strong>You need to agree to our license to use our hacks. If you changed your mind and now agree to our license, reload Prodigy.</strong>
198
</p>
199
`)).value) {
200
201
// Play Prodigy without hacks
202
document.getElementById("cheat-menu")?.remove(); // Remove any existing menu if present
203
document.getElementById("menu-toggler")?.remove(); // Remove any existing menu togglers if present
204
205
} else {
206
207
// Reload Prodigy
208
document.location = "";
209
}
210
211
212
} else {
213
214
215
// Display status message.
216
await statusMessage();
217
}
218
219
})();
220