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/player.ts
Views: 723
1
// Player Hacks ⬛️🟧
2
3
4
// BEGIN IMPORTS
5
import { Swal, Toast, NumberInput, Input, Confirm } from "../utils/swal"; // Import Swal, Toast, Confirm, Input, and NumberInput from swal
6
import { category } from "../index"; // Import the Cheat GUI bases.
7
import Toggler from "../class/Toggler";
8
import Hack from "../class/Hack";
9
import { _, getItem, VERY_LARGE_NUMBER, prodigy, saveCharacter, player} from "../utils/util"; // Import Prodigy typings and VERY_LARGE_NUMBER
10
import { getMemberModule, ids, itemify } from "../utils/hackify"; // Import useful arrays and functions
11
import openChat from "../utils/chat";
12
13
// END IMPORTS
14
15
16
17
18
19
// BEGIN PLAYER HACKS
20
21
22
// Begin open chat
23
new Hack(category.player, "Open ProdigyPNP Chat", "Opens a chat for ProdigyPNP users").setClick(async () => {
24
return openChat();
25
});
26
// end open chat
27
28
29
30
// Begin Max Account
31
new Hack(category.player, "Max Account").setClick(async () => {
32
// max account made by gemsvidø
33
34
// ============================================
35
// PRE MAXING PROCESS
36
37
38
39
if (!(await Confirm.fire("Are you sure that you want to max your account?", "We recommend doing this on an alt.")).value) {
40
return console.log("Cancelled");
41
}
42
43
44
45
// PRE MAXING PROCESS
46
// ============================================
47
// ============================================
48
// PLAYER HACKS
49
50
// Set the players gold to 09900000
51
player.data.gold = 9900000;
52
console.log("Set player gold to 9900000.")
53
54
55
// Set the players level to 100
56
const level = 100;
57
// @ts-expect-error
58
const h = level.value - 2;
59
const xpConstant = 1.042;
60
player.data.stars = Math.round((1 - Math.pow(xpConstant, h)) / (1 - xpConstant) * 20 + 10);
61
player.data.level = 100;
62
player.getLevel = () => {
63
return player.data.level;
64
};
65
console.log("Set player level to 100");
66
67
68
// Set the players bounty points to 100 (max)
69
player.data.bountyScore = 100;
70
console.log("Set player's bounty points to 100.");
71
72
73
// Set the players conjure cubes to 100 (max)
74
for (let i = 0; i < Math.min(99, 100); i++) {
75
prodigy.giftBoxController.receiveGiftBox(null, getItem("giftBox", 1));
76
}
77
console.log("Obtained 100 conjure cubes.");
78
79
80
81
82
// Get all achievements
83
for (var i = 0; i < 100; i++) {
84
player.achievements.data.progress[i] = 10;
85
}
86
console.log("Obtained all achievements.");
87
88
// Set the players dark tower floor to 100
89
player.data.tower = 100;
90
console.log("Set tower floor to 100.");
91
92
// PLAYER HACKS
93
// ============================================
94
// ============================================
95
// INVENTORY HACKS
96
97
98
// Get 1 of all items
99
const num : number = 1;
100
101
ids.forEach(id => {
102
// @ts-expect-error
103
player.backpack.data[id] = itemify(_.gameData[id].filter(l => id === "follow" ? ![125, 126, 127, 128, 129, 134, 135, 136, 137].includes(l.ID) : l), num.value);
104
});
105
// @ts-expect-error
106
_.gameData.dorm.forEach(x =>
107
// @ts-expect-error
108
player.house.data.items[x.ID] = { A: [], N: num.value });
109
110
// Remove bounty notes
111
// @ts-expect-error
112
const bountyIndex = () => player.backpack.data.item.findIndex(v => v.ID === 84 || v.ID === 85 || v.ID === 86);
113
while (bountyIndex() > -1) player.backpack.data.item.splice(bountyIndex(), 1);
114
Toast.fire("Success!", "All items added!", "success");
115
116
console.log("All items added!");
117
118
119
120
// Get all Mounts
121
player.backpack.data.mount = itemify(_.gameData.mount, 1);
122
console.log("Added all mounts.");
123
124
125
// INVENTORY HACKS
126
// ============================================
127
// ============================================
128
// GET 6,969,420 OF ALL CURRENCIES
129
130
const id : string = "currency";
131
const amt : number = 6969420;
132
// @ts-expect-error
133
player.backpack.data[id] = itemify(_.gameData[id].filter(a => {
134
return id === 'follow' ? ![125, 126, 127, 128, 129, 134, 135, 136, 137].includes(a.ID) : a
135
}), amt);
136
137
138
139
// GET 6,969,420 OF ALL CURRENCIES
140
// ============================================
141
// ============================================
142
// PET HACKS
143
144
145
// Get All Pets
146
147
// add pets
148
// @ts-expect-error
149
_.gameData.pet.forEach(x => {
150
player.kennel.addPet(x.ID.toString(), VERY_LARGE_NUMBER, 26376, 100);
151
});
152
153
// add encounter info
154
player.kennel._encounterInfo._data.pets = [];
155
_.gameData.pet.map((pet: {
156
ID: number
157
}) => {
158
player.kennel._encounterInfo._data.pets.push({
159
firstSeenDate: Date.now(),
160
ID: pet.ID,
161
timesBattled: 1,
162
timesRescued: 1
163
});
164
});
165
// Fix broken pets
166
// @ts-expect-error
167
player.kennel.petTeam.forEach(v => {
168
if (v && (v as any).assignRandomSpells)(v as any).assignRandomSpells();
169
});
170
console.log("Added all pets.");
171
172
173
174
175
// PET HACKS
176
// ============================================
177
// ============================================
178
// EQUIP CELESTIAL GEAR
179
180
181
182
player.equipment.setHat(200);
183
player.equipment.setBoots(93);
184
player.equipment.setOutfit(161);
185
player.equipment.setWeapon(196);
186
187
188
189
190
// EQUIP CELESTIAL GEAR
191
// ============================================
192
// ============================================
193
// POST MAXING PROCESS
194
195
196
197
// Refresh the players appearance
198
player.appearanceChanged = true;
199
console.log("Appearance Refreshed.");
200
201
202
// Save
203
saveCharacter();
204
console.log("Character Saved.");
205
206
207
// POST MAXING PROCESS
208
// ============================================
209
console.log("Max Account Successful.");
210
211
return Toast.fire("Maxed!", `Check your backpack!`, "success");
212
});
213
// End Max Account
214
215
216
217
218
219
220
// Begin Set Gold
221
new Hack(category.player, "Set Gold").setClick(async () => {
222
const gold = await NumberInput.fire("Gold Amount", "What number do you want to set your gold to?", "question");
223
if (gold.value === undefined) return;
224
if (gold.value > 10000000) return Toast.fire("Error", "Cannot have more than 10,000,000 gold.", "error");
225
player.data.gold = +gold.value;
226
return Toast.fire("Success!", `You now have ${gold.value} gold.`, "success");
227
});
228
// End Set Gold
229
230
231
232
233
234
235
// Begin Set Level
236
new Hack(category.player, "Set Level").setClick(async () => {
237
const level = await NumberInput.fire("Level", "What number do you want to set your level to?", "question");
238
if (level.value === undefined) return;
239
240
// calculate how many stars the level *should* have
241
// from 3-16-1.js:8382
242
if (level.value === 1) return 0;
243
const i = level.value - 2;
244
// xpConstant from 3-16-1.js:8528
245
const xpConstant = 1.042;
246
player.data.stars = Math.round((1 - Math.pow(xpConstant, i)) / (1 - xpConstant) * 20 + 10);
247
player.data.level = +level.value;
248
player.getLevel = () => {
249
return player.data.level;
250
};
251
252
return Toast.fire("Success!", `You are now level ${level.value}.`, "success");
253
});
254
// End Set Level
255
256
257
258
259
260
261
// Begin Get member stars
262
new Hack(category.player, "Get member stars").setClick(async () => {
263
const amount = await NumberInput.fire("Stars", "How many member stars do you want?", "question");
264
if (amount.value === undefined) return;
265
player.data.storedMemberStars = amount.value;
266
return Toast.fire("Success!", `You have set your member stars to ${amount.value}.`, "success");
267
});
268
// End Get member stars
269
270
271
272
273
274
275
276
// Begin Set bounty points
277
new Hack(category.player, "Set Bounty Points").setClick(async () => {
278
const points = await NumberInput.fire(
279
"Bounty Points",
280
"What number do you want to set your bounty points to? (Max is 100)",
281
"question"
282
);
283
if (points.value === undefined) return;
284
player.data.bountyScore = Math.min(+points.value, 100);
285
return Toast.fire("Success!", `You now have ${player.data.bountyScore} bounty point${player.data.bountyScore != 1 ? "s" : ""}.`, "success");
286
});
287
// End Set bounty points
288
289
290
291
292
293
294
// Begin Obtain Conjure Cubes
295
new Hack(category.player, "Obtain Conjure Cubes").setClick(async () => {
296
const cubes = await NumberInput.fire("Conjure Cubes", "How many conjure cubes do you want to get? (Max 99)", "question");
297
if (cubes.value === undefined) return;
298
for (let i = 0; i < Math.min(99, +cubes.value); i++) {
299
prodigy.giftBoxController.receiveGiftBox(null, getItem("giftBox", 1));
300
}
301
return Toast.fire("Success!", `You have gained ${cubes.value} conjure cube${cubes.value != 1 ? "s" : ""}.`, "success");
302
});
303
// End Obtain Conjure Cubes
304
305
306
307
308
309
310
// Begin Set Wins
311
new Hack(category.player, "Set Wins").setClick(async () => {
312
const amount = await NumberInput.fire("Wins", "What number do you want to set your wins to?", "question");
313
if (amount.value === undefined) return;
314
player.data.win = +amount.value;
315
return Toast.fire("Success!", `You have set your win${amount.value != 1 ? "s" : ""} to ${amount.value}.`, "success");
316
});
317
// End Set Wins
318
319
320
321
322
323
324
// Begin Set Losses
325
new Hack(category.player, "Set Losses").setClick(async () => {
326
const amount = await NumberInput.fire("Losses", "What number do you want to set your losses to?", "question");
327
if (amount.value === undefined) return;
328
player.data.loss = +amount.value;
329
return Toast.fire("Success!", `You have set your loss${amount.value != 1 ? "es" : ""} to ${amount.value}.`, "success");
330
});
331
// End Set Losses
332
333
334
335
336
337
338
// Begin Toggle membership
339
new Toggler(category.player, "Toggle membership").setEnabled(async () => {
340
_.instance.prodigy.gameContainer.get(getMemberModule()).data.membership.active = true;
341
player.appearanceChanged = true;
342
return Toast.fire("Success!", "You now have Prodigy membership!", "success");
343
}).setDisabled(() => {
344
_.instance.prodigy.gameContainer.get(getMemberModule()).data.membership.active = false;
345
player.appearanceChanged = true;
346
return Toast.fire("Success!", "You no longer have Prodigy membership!", "success");
347
});
348
// End Toggle membership
349
350
351
352
353
354
355
// Begin Set Name (Client Side only)
356
new Hack(category.player, "Set name (Client side only)").setClick(async () => {
357
const name = await Input.fire("What would you like to set your name to?");
358
if (!name.value) return;
359
player.getName = () => {
360
return name.value;
361
};
362
player.appearanceChanged = true;
363
return Toast.fire("Changed!", "Your name was changed.");
364
});
365
// End Set Name (Client Side only)
366
367
368
369
370
371
372
// Begin Change Name
373
new Hack(category.player, "Change Name", "Change the name of your wizard.").setClick(async () => {
374
const names = _.gameData.name;
375
const div = document.createElement("div");
376
const createSelect = (arr: Map < string, string > , equalityFunc: (str: string) => boolean) => {
377
const select = document.createElement("select");
378
select.classList.add("selectName");
379
for (const opt of arr.entries()) {
380
const optt = document.createElement("option");
381
[optt.value, optt.innerText] = opt;
382
383
if (equalityFunc(optt.value)) optt.selected = true;
384
select.options.add(optt);
385
}
386
return select;
387
};
388
const nameSelect = (type: number, equalityFunc: (num: number) => boolean) =>
389
createSelect(new Map(
390
// @ts-expect-error
391
names.filter(x => x.data.type === type).map(x => [x.ID.toString(), x.name])),
392
val => equalityFunc(+val)
393
);
394
div.append(nameSelect(0, x => x === player.name.data.firstName));
395
div.append(nameSelect(1, x => x === player.name.data.middleName));
396
div.append(nameSelect(2, x => x === player.name.data.lastName));
397
div.append(
398
createSelect(
399
new Map(
400
401
[
402
["null", "[none]"]
403
// @ts-expect-error
404
].concat(_.gameData.nickname.map(x => [x.ID.toString(), x.name])) as[
405
string,
406
string
407
][]
408
),
409
x => +x === player.name.data.nickname || String(player.name.data.nickname) === x
410
)
411
);
412
const name = await Swal.fire({
413
title: "Set Player Name",
414
focusConfirm: false,
415
showCancelButton: true,
416
html: div,
417
preConfirm: () => {
418
return Array.prototype.slice
419
.call(document.querySelectorAll(".selectName"))
420
.map((x: HTMLSelectElement) => x.options[x.selectedIndex].value);
421
}
422
});
423
if (name.value === undefined) return;
424
if (name.value[3] === "null") name.value[3] = null;
425
[
426
player.name.data.firstName,
427
player.name.data.middleName,
428
player.name.data.lastName,
429
player.name.data.nickname
430
] = (name.value as string[]).map(x => ((x as unknown) as number) && +x);
431
player.appearanceChanged = true;
432
return Toast.fire("Name Changed!", "Your name was successfully changed.", "success");
433
});
434
// End Change Name
435
436
437
438
// Begin Uncap player level
439
new Hack(category.player, "Uncap player level (client side only)").setClick(async () => {
440
const level = await NumberInput.fire("Level", "What would you like to set your level to? (Can be >100)", "question");
441
if (!level.value) return;
442
localStorage.setItem("level", level.value);
443
eval(`player.getLevel = () => {return ${level.value}}`);
444
return Toast.fire("Updated!", "Your level has been successfully updated", "success");
445
});
446
// End Uncap player level
447
448
449
450
451
452
// Begin get all achievements
453
new Hack(category.player, "Get all achievements").setClick(async () => {
454
for (var i = 0; i < 100; i++) {
455
player.achievements.data.progress[i] = 10;
456
}
457
458
return Toast.fire("Success!", "Obtained all achievements!", "success");
459
});
460
// End get all achievements
461
462
463
464
465
466
// Begin Fix Morph Crash
467
new Hack(category.player, "Fix Morph Crash").setClick(async () => {
468
player.getPlayerData().playerTransformation = undefined;
469
player.appearanceChanged = true;
470
471
return Toast.fire("Success!", "Fixed morph crash bug.", "success");
472
});
473
// End Fix Morph Crash
474
475
476
477
478
479
// Begin Permanent Morph
480
new Hack(category.player, "Permanent Morph", "Makes Your Current Morph Last Forever.").setClick(async () => {
481
if (!player.data.playerTransformation) {
482
return Swal.fire("No Morph Active", "Please use a Morph Marble and try again.", "error");
483
}
484
player.data.playerTransformation.maxTime = Infinity;
485
player.data.playerTransformation.timeRemaining = Infinity;
486
return Toast.fire("Success!", "You're morph will last forever!", "success");
487
});
488
// End Permanent Morph
489
490
491
492
493
494
// Begin Complete Current Task in Quest
495
new Hack(category.player, "Complete Current Task In Quest", "Completes current task in quest. (Use this button a lot to complete a quest.)").setClick(async () => {
496
const zones = {};
497
Object.keys(_.instance.prodigy.world.zones).forEach(element => {
498
// @ts-expect-error
499
zones[element] = _.instance.prodigy.world.zones[element].name;
500
});
501
const questName = (await Input.fire({
502
title: "What Quest Do You Want To Complete?",
503
input: "select",
504
inputOptions: zones
505
})).value;
506
if (!questName) return;
507
const questID = _.instance.prodigy.world.zones[questName].getCurrentQuestID();
508
if (_.instance.prodigy.world.zones[questName].completeQuest(questID)) {
509
_.instance.prodigy.world.goToZoneHub(questName);
510
return Toast.fire("Success!", `Completed current task in the ${_.instance.prodigy.world.zones[questName].name} quest successfully!`, "success");
511
} else {
512
return Toast.fire("Could Not Complete Current Task In Quest.", "There was an error completing the quest. Did you already complete it?", "error");
513
}
514
});
515
// End Complete Current Task in Quest
516
517
518
519
520
521
// Begin Set Dark Tower Floor
522
new Hack(category.player, "Set Dark Tower Floor").setClick(async () => {
523
// @ts-expect-error
524
const floor = await NumberInput.fire({
525
title: "What floor do you want to be on, in the dark tower.",
526
icon: "question",
527
// @ts-expect-error
528
inputValidator: (res) => (res > 100 || res < 1) ? `You can only be on floors from 1-100 not ${res}` : false
529
});
530
if (!floor.value) return;
531
player.data.tower = parseInt(floor.value);
532
return Toast.fire("Success!", `Successfully set dark tower floor to ${floor}!`, "success");
533
});
534
// End Set Dark Tower Floor
535
536
537
538
539
540
// Begin Get UserID
541
new Hack(category.player, "Get UserID").setClick(async () => {
542
543
const UserID: number = player.userID;
544
navigator.clipboard.writeText(UserID.toString()).then(function() {
545
546
547
console.log("Async: Copying to clipboard was successful!");
548
549
return Swal.fire({
550
title: "User ID",
551
html: `Here is your User ID: <br> <code> ${UserID} </code> <br> You can use this for copying your account. <br> <br> Your UserID is has also been copied to your clipboard.`,
552
icon: "info"
553
});
554
555
556
}, function(err) {
557
558
console.error("Async: Could not copy text: ", err);
559
560
return Swal.fire({
561
title: "User ID",
562
html: `Here is your User ID: <br> <code> ${UserID} </code> <br> You can use this for copying your account.`,
563
icon: "info"
564
});
565
566
567
});
568
569
});
570
// End Get UserID
571
572
573
574
575
576
// Begin Copy Account
577
new Hack(category.player, "Copy Account", "Copy Account From userID").setClick(async () => {
578
const userID = (await NumberInput.fire("What is the userID of the account you want to copy?", undefined, "question")).value;
579
if (!userID) return;
580
if (!(await Confirm.fire("Are you sure you want to copy the account?", "This will replace all data on your account with the account your copying."))) return;
581
const playerData = await (await fetch(`https://api.prodigygame.com/game-api/v2/characters/${userID}?fields=inventory%2Cdata%2CisMember%2Ctutorial%2Cpets%2Cencounters%2Cquests%2Cappearance%2Cequipment%2Chouse%2Cachievements%2Cstate&userID=${userID}`, {
582
headers: {
583
Authorization: localStorage.JWT_TOKEN
584
}
585
})).json();
586
await fetch(`https://api.prodigygame.com/game-api/v3/characters/${userID}`, {
587
headers: {
588
"Content-Type": "application/json",
589
Authorization: localStorage.JWT_TOKEN
590
},
591
body: JSON.stringify({
592
data: JSON.stringify(playerData[userID]),
593
userID: player.userID
594
}),
595
method: "POST"
596
});
597
return Toast.fire("Success!", "Copied Account Successfully! Please reload.", "success");
598
});
599
// End Copy Account
600
601
602
603
604
605
// Begin Set Grade
606
new Hack(category.player, "Set Grade").setClick(async () => {
607
const grade = await NumberInput.fire("What number do you want to set your grade to?");
608
if (!grade.value) return;
609
player.grade = parseInt(grade.value);
610
return Toast.fire("Success", `Successfully changed grade to ${grade}!`, "success");
611
});
612
// End Set Grade
613
614
615
616
617
// END PLAYER HACKS
618
619