CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Shploop

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: Shploop/Blooket-Cheats
Path: blob/main/cheats/global/simulatePack.js
Views: 1236
1
/**
2
* @license StewartPrivateLicense-2.0.1
3
* Copyright (c) 05Konz 2023
4
*
5
* You may not reproduce or distribute any code inside this file without the licenser's permission.
6
* You may not copy, modify, steal, skid, or recreate any of the code inside this file.
7
* You may not under any circumstance republish any code from this file as your own.
8
*
9
* ALL TERMS STATED IN THE LINK BELOW APPLY ASWELL
10
* https://github.com/05Konz/Blooket-Cheats/blob/main/LICENSE
11
*/
12
13
/* THE UPDATE CHECKER IS ADDED DURING COMMIT PREP, THERE MAY BE REDUNDANT CODE, DO NOT TOUCH */
14
15
(() => {
16
const cheat = (async () => {
17
let i = document.createElement('iframe');
18
document.body.append(i);
19
window.alert = i.contentWindow.alert.bind(window);
20
window.prompt = i.contentWindow.prompt.bind(window);
21
i.remove();
22
let { webpack } = webpackJsonp.push([[], { ['1234']: (_, a, b) => { a.webpack = b }, }, [['1234']]]);
23
let { stateNode } = Object.values((function react(r = document.querySelector("body>div")) { return Object.values(r)[1]?.children?.[0]?._owner.stateNode ? r : react(r.querySelector(":scope>div")) })())[1].children[0]._owner;
24
let packs = webpack('fGzD');
25
packs = Object.keys(packs.a).reduce((obj, pack) => (obj.packs.includes(pack) && (obj.data[pack] = Object.fromEntries(packs.b(pack))), obj), { packs: Array.from(document.querySelectorAll('[class*="packShadow"]')).map(x => x.alt), data: {} }).data;
26
let box = prompt("Which box do you want to simulate? (ex: \"Ice Monster\")").split(' ').map(str => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()).join(' ');
27
if (packs[box]) {
28
function weighted(pack) {
29
const weight = 0;
30
for (const item in packs[pack]) weight += packs[pack][item];
31
const choice = Math.random() * weight;
32
let weightCount = 0;
33
for (const item in packs[pack]) {
34
weightCount += packs[pack][item];
35
if (weightCount >= choice) return item;
36
}
37
}
38
function weighted(pack) {
39
let weights = [];
40
const items = Object.keys(packs[pack]);
41
for (const key of items) weights.push(packs[pack][key] + (weights[items.indexOf(key) - 1] || 0));
42
const choice = weights[weights.length - 1] * Math.random();
43
return items[weights.findIndex(w => w >= choice)];
44
}
45
const blook = weighted(box);
46
let phaser = Object.values(webpack.c).find(x => x.exports?.Class).exports;
47
let scene = {};
48
49
class Particles extends phaser.Scene {
50
constructor(rarity) {
51
super();
52
this.rarity = rarity.toLowerCase();
53
}
54
preload() {
55
switch (this.rarity) {
56
case "uncommon":
57
this.load.svg("uncommon-1", "https://media.blooket.com/image/upload/v1658567787/Media/market/particles/square_green.svg", { width: 25, height: 25 });
58
this.load.svg("uncommon-2", "https://media.blooket.com/image/upload/v1658567787/Media/market/particles/square_light_green.svg", { width: 25, height: 25 });
59
this.load.svg("uncommon-3", "https://media.blooket.com/image/upload/v1658567785/Media/market/particles/circle_dark_green.svg", { width: 25, height: 25 });
60
this.load.svg("uncommon-4", "https://media.blooket.com/image/upload/v1658567785/Media/market/particles/serpentine_dark_green.svg", { width: 30, height: 30 });
61
this.load.svg("uncommon-5", "https://media.blooket.com/image/upload/v1658567785/Media/market/particles/triangle_light_green.svg", { width: 30, height: 30 });
62
this.load.svg("uncommon-6", "https://media.blooket.com/image/upload/v1658567785/Media/market/particles/serpentine_light_green.svg", { width: 30, height: 30 });
63
this.load.svg("uncommon-7", "https://media.blooket.com/image/upload/v1658567785/Media/market/particles/triangle_green.svg", { width: 30, height: 30 });
64
break;
65
case "rare":
66
this.load.svg("rare-1", "https://media.blooket.com/image/upload/v1658567765/Media/market/particles/square_light_blue.svg", { width: 25, height: 25 });
67
this.load.svg("rare-2", "https://media.blooket.com/image/upload/v1658567765/Media/market/particles/square_dark_blue.svg", { width: 25, height: 25 });
68
this.load.svg("rare-3", "https://media.blooket.com/image/upload/v1658567763/Media/market/particles/triangle_blue.svg", { width: 30, height: 30 });
69
this.load.svg("rare-4", "https://media.blooket.com/image/upload/v1658567763/Media/market/particles/serpentine_blue.svg", { width: 30, height: 30 });
70
this.load.svg("rare-5", "https://media.blooket.com/image/upload/v1658567763/Media/market/particles/triangle_light_blue.svg", { width: 30, height: 30 });
71
this.load.svg("rare-6", "https://media.blooket.com/image/upload/v1658567763/Media/market/particles/serpentine_light_blue.svg", { width: 30, height: 30 });
72
this.load.svg("rare-7", "https://media.blooket.com/image/upload/v1658567763/Media/market/particles/circle_dark_blue.svg", { width: 25, height: 25 });
73
break;
74
case "epic":
75
this.load.svg("epic-1", "https://media.blooket.com/image/upload/v1658790239/Media/market/particles/red.svg", { width: 25, height: 25 });
76
this.load.svg("epic-2", "https://media.blooket.com/image/upload/v1658790237/Media/market/particles/light_red.svg", { width: 25, height: 25 });
77
this.load.svg("epic-3", "https://media.blooket.com/image/upload/v1658790239/Media/market/particles/serpentine_red.svg", { width: 30, height: 30 });
78
this.load.svg("epic-4", "https://media.blooket.com/image/upload/v1658790239/Media/market/particles/serpentine_dark_red.svg", { width: 30, height: 30 });
79
this.load.svg("epic-5", "https://media.blooket.com/image/upload/v1658790237/Media/market/particles/triangle_red.svg", { width: 30, height: 30 });
80
this.load.svg("epic-6", "https://media.blooket.com/image/upload/v1658790237/Media/market/particles/triangle_light_red.svg", { width: 30, height: 30 });
81
this.load.svg("epic-7", "https://media.blooket.com/image/upload/v1658790237/Media/market/particles/circle_dark_red.svg", { width: 25, height: 25 });
82
break;
83
case "legendary":
84
this.load.svg("legendary-1", "https://media.blooket.com/image/upload/v1658567740/Media/market/particles/square_orange.svg", { width: 25, height: 25 });
85
this.load.svg("legendary-2", "https://media.blooket.com/image/upload/v1658567740/Media/market/particles/square_light_orange.svg", { width: 25, height: 25 });
86
this.load.svg("legendary-3", "https://media.blooket.com/image/upload/v1658567738/Media/market/particles/circle_orange.svg", { width: 25, height: 25 });
87
this.load.svg("legendary-4", "https://media.blooket.com/image/upload/v1658567738/Media/market/particles/serpentine_orange.svg", { width: 30, height: 30 });
88
this.load.svg("legendary-5", "https://media.blooket.com/image/upload/v1658567738/Media/market/particles/serpentine_light_orange.svg", { width: 30, height: 30 });
89
this.load.svg("legendary-6", "https://media.blooket.com/image/upload/v1658567738/Media/market/particles/circle_dark_orange.svg", { width: 25, height: 25 });
90
this.load.svg("legendary-7", "https://media.blooket.com/image/upload/v1658567738/Media/market/particles/triangle_dark_orange.svg", { width: 30, height: 30 });
91
break;
92
case "chroma":
93
this.load.svg("chroma-1", "https://media.blooket.com/image/upload/v1658790246/Media/market/particles/square_turquoise.svg", { width: 25, height: 25 });
94
this.load.svg("chroma-2", "https://media.blooket.com/image/upload/v1658790246/Media/market/particles/square_light_turquoise.svg", { width: 25, height: 25 });
95
this.load.svg("chroma-3", "https://media.blooket.com/image/upload/v1658790244/Media/market/particles/serpentine_dark_turquoise.svg", { width: 30, height: 30 });
96
this.load.svg("chroma-4", "https://media.blooket.com/image/upload/v1658790244/Media/market/particles/serpentine_turquoise.svg", { width: 30, height: 30 });
97
this.load.svg("chroma-5", "https://media.blooket.com/image/upload/v1658790244/Media/market/particles/triangle_turquoise.svg", { width: 30, height: 30 });
98
this.load.svg("chroma-6", "https://media.blooket.com/image/upload/v1658790244/Media/market/particles/triangle_light_turquoise.svg", { width: 30, height: 30 });
99
this.load.svg("chroma-7", "https://media.blooket.com/image/upload/v1658790244/Media/market/particles/circle_dark_turquoise.svg", { width: 25, height: 25 });
100
}
101
}
102
create() {
103
scene.scene = this;
104
scene.rarity = "";
105
scene.particles = this.physics.add.group({
106
classType: new phaser.Class({
107
Extends: phaser.GameObjects.Image,
108
initialize: function () {
109
phaser.GameObjects.Image.call(this, scene.scene, 0, 0, "uncommon-1");
110
this.setDepth(3);
111
this.lifespan = 0;
112
},
113
spawn: function (x, y, scale, velAngle, velSpeed, gravity, angle, lifespan, texture) {
114
this.setTexture(texture);
115
this.setActive(true);
116
this.setVisible(true);
117
this.setPosition(x, y);
118
this.setScale(scale);
119
this.targets = [];
120
scene.scene.physics.velocityFromAngle(velAngle, velSpeed, this.body.velocity);
121
this.body.setGravityY(gravity);
122
this.body.setAngularVelocity(angle);
123
this.lifespan = lifespan;
124
},
125
update: function (t, s) {
126
this.lifespan -= s;
127
if (this.lifespan > 0) return;
128
this.setActive(!1);
129
this.setVisible(!1);
130
}
131
}),
132
runChildUpdate: !0
133
});
134
this.nextParticle = 0;
135
this.numExplosions = 0;
136
this.game.events.on("start-particles", (t) => {
137
scene.rarity = t;
138
this.numExplosions = "Uncommon" === t ? 75 : "Rare" === t ? 100 : -1;
139
});
140
}
141
update(e, t) {
142
const I = webpack("74sb");
143
let Z = function (e) {
144
switch (e) {
145
case "center": {
146
var t = Object(I.l)(-115, -65);
147
return {
148
x: scene.scene.cameras.main.worldView.width / 2,
149
y: scene.scene.cameras.main.worldView.height / 2,
150
scale: Object(I.l)(.7, 1),
151
angle: t,
152
velocity: Object(I.l)(600, 750),
153
gravity: 700,
154
angVelocity: (t > -90 ? 1 : -1) * Object(I.l)(125, 175),
155
lifespan: 2500
156
}
157
}
158
case "right-bottom": return {
159
x: scene.scene.cameras.main.worldView.width,
160
y: scene.scene.cameras.main.worldView.height,
161
scale: Object(I.l)(.7, 1),
162
angle: Object(I.l)(-160, -110),
163
velocity: Object(I.l)(600, 750),
164
gravity: 500,
165
angVelocity: Object(I.l)(-175, -125),
166
lifespan: 2500
167
};
168
case "left-bottom": return {
169
x: 0,
170
y: scene.scene.cameras.main.worldView.height,
171
scale: Object(I.l)(.7, 1),
172
angle: Object(I.l)(-70, -20),
173
velocity: Object(I.l)(600, 750),
174
gravity: 500,
175
angVelocity: Object(I.l)(125, 175),
176
lifespan: 2500
177
};
178
case "top": return {
179
x: Object(I.l)(0, scene.scene.cameras.main.worldView.width),
180
y: -50,
181
scale: Object(I.l)(.7, 1),
182
angle: 90,
183
velocity: Object(I.l)(0, 50),
184
gravity: 700,
185
angVelocity: Object(I.l)(-150, 150),
186
lifespan: 2500
187
};
188
case "right-shower": return {
189
x: scene.scene.cameras.main.worldView.width,
190
y: Object(I.l)(0, scene.scene.cameras.main.worldView.height),
191
scale: Object(I.l)(.7, 1),
192
angle: Object(I.l)(-180, -130),
193
velocity: Object(I.l)(600, 750),
194
gravity: 500,
195
angVelocity: Object(I.l)(-175, -125),
196
lifespan: 2500
197
};
198
case "left-shower": return {
199
x: 0,
200
y: Object(I.l)(0, scene.scene.cameras.main.worldView.height),
201
scale: Object(I.l)(.7, 1),
202
angle: Object(I.l)(-50, 0),
203
velocity: Object(I.l)(600, 750),
204
gravity: 500,
205
angVelocity: Object(I.l)(125, 175),
206
lifespan: 2500
207
};
208
case "right-diamond": {
209
var a = Object(I.l)(0, scene.scene.cameras.main.worldView.height);
210
return {
211
x: scene.scene.cameras.main.worldView.width,
212
y: a,
213
scale: Object(I.l)(.7, 1),
214
angle: a > scene.scene.cameras.main.worldView.height / 2 ? -150 : -210,
215
velocity: Object(I.l)(600, 750),
216
gravity: 0,
217
angVelocity: Object(I.l)(-175, -125),
218
lifespan: 2500
219
}
220
}
221
case "left-diamond": {
222
var n = Object(I.l)(0, scene.scene.cameras.main.worldView.height);
223
return {
224
x: 0,
225
y: n,
226
scale: Object(I.l)(.7, 1),
227
angle: n > scene.scene.cameras.main.worldView.height / 2 ? -30 : 30,
228
velocity: Object(I.l)(600, 750),
229
gravity: 0,
230
angVelocity: Object(I.l)(125, 175),
231
lifespan: 2500
232
}
233
}
234
default: return {};
235
}
236
};
237
if (scene.rarity && 0 !== this.numExplosions && (this.nextParticle -= t, this.nextParticle <= 0)) {
238
switch (scene.rarity) {
239
case "Uncommon": {
240
for (let i = 0; i < 2; i++) {
241
let n = scene.particles.get();
242
n && n.spawn.apply(n, Object.values(Z("center")).concat(`uncommon-${Object(I.m)(1, 8)}`))
243
}
244
break;
245
}
246
case "Rare": {
247
for (var o = 0; o < 2; o++) {
248
var r = scene.particles.get();
249
r && r.spawn.apply(r, Object.values(Z(o % 2 == 0 ? "left-bottom" : "right-bottom")).concat(`rare-${Object(I.m)(1, 8)}`))
250
}
251
break;
252
}
253
case "Epic": {
254
for (var s = 0; s < 2; s++) {
255
var i = scene.particles.get();
256
i && i.spawn.apply(i, Object.values(Z(s % 2 == 0 ? "left-shower" : "right-shower")).concat(`epic-${Object(I.m)(1, 8)}`))
257
}
258
break;
259
}
260
case "Legendary": {
261
for (var l = 0; l < 3; l++) {
262
var c = scene.particles.get();
263
c && c.spawn.apply(c, Object.values(Z("top")).concat(`legendary-${Object(I.m)(1, 8)}`))
264
}
265
break;
266
}
267
case "Chroma": {
268
for (var u = 0; u < 3; u++) {
269
var d = scene.particles.get();
270
d && d.spawn.apply(d, Object.values(Z(u % 2 == 0 ? "left-diamond" : "right-diamond")).concat(`chroma-${Object(I.m)(1, 8)}`))
271
}
272
break;
273
}
274
}
275
this.nextParticle = 20;
276
this.numExplosions > 0 && (this.numExplosions = Math.max(this.numExplosions - 1, 0));
277
}
278
}
279
}
280
const allBlooks = Object.values(webpack.c).find(x => x.exports?.a?.Elephant).exports.a;
281
stateNode.setState({
282
loadingPack: false,
283
openPack: true,
284
unlockedBlook: blook,
285
tokens: stateNode.state.tokens,
286
newUnlock: true,
287
game: {
288
type: phaser.WEBGL,
289
parent: "phaser-market",
290
width: "100%",
291
height: "100%",
292
scale: { mode: phaser.Scale.NONE, autoCenter: phaser.Scale.CENTER_BOTH },
293
transparent: true,
294
physics: { default: "arcade" },
295
scene: new Particles(allBlooks[blook].rarity)
296
},
297
canOpen: true
298
});
299
} else alert("I couldn't find that box!");
300
});
301
let img = new Image;
302
img.src = "https://raw.githubusercontent.com/05Konz/Blooket-Cheats/main/autoupdate/timestamps/global/simulatePack.png?" + Date.now();
303
img.crossOrigin = "Anonymous";
304
img.onload = function() {
305
const c = document.createElement("canvas");
306
const ctx = c.getContext("2d");
307
ctx.drawImage(img, 0, 0, this.width, this.height);
308
let { data } = ctx.getImageData(0, 0, this.width, this.height), decode = "", last;
309
for (let i = 0; i < data.length; i += 4) {
310
let char = String.fromCharCode(data[i + 1] * 256 + data[i + 2]);
311
decode += char;
312
if (char == "/" && last == "*") break;
313
last = char;
314
}
315
let iframe = document.querySelector("iframe");
316
const [_, time, error] = decode.match(/LastUpdated: (.+?); ErrorMessage: "(.+?)"/);
317
if (parseInt(time) <= 1693429947425 || iframe.contentWindow.confirm(error)) cheat();
318
}
319
img.onerror = img.onabort = () => (img.src = null, cheat());
320
})();
321