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