Blooket Hacks GUI

script ported over from https://github.com/therealgliz/blooket-hacks

  1. // ==UserScript==
  2. // @name Blooket Hacks GUI
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-05-04
  5. // @description script ported over from https://github.com/therealgliz/blooket-hacks
  6. // @author You
  7. // @match https://*.blooket.com/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. (() => {
  15. let n = document.createElement('iframe');
  16. document.body.append(n);
  17. window.alert = n.contentWindow.alert.bind(window);
  18. window.prompt = n.contentWindow.prompt.bind(window);
  19. window.confirm = n.contentWindow.confirm.bind(window);
  20. n.remove();
  21. })();
  22. (() => {
  23. let style = document.createElement('style');
  24. style.innerHTML = (`details > summary {
  25. cursor: pointer;
  26. transition: 0.15s;
  27. list-style: none;
  28. }
  29. details > summary:hover {
  30. color: hsl(0, 0%, 50%)
  31. }
  32. details > summary::-webkit-details-marker {
  33. display: none;
  34. }
  35. details summary ~ * {
  36. animation: sweep .5s ease-in-out;
  37. }
  38.  
  39. @keyframes sweep {
  40. 0% {opacity: 0; transform: translateY(-10px)}
  41. 100% {opacity: 1; transform: translateY(0)}
  42. }
  43. .cheat {
  44. border: none;
  45. background: hsl(0, 0%, 20%);
  46. padding: 5px;
  47. margin: 3px;
  48. width: 60%;
  49. color: hsl(0, 0%, 100%);
  50. transition: 0.2s;
  51. border-radius: 5px;
  52. cursor: pointer;
  53. }
  54. .cheat:hover {
  55. background: hsl(0, 0%, 30%);
  56. }`);
  57.  
  58. const GUI = document.createElement('div');
  59. GUI.appendChild(style);
  60. GUI.style.width = '400px';
  61. //GUI.style.height = '500px';
  62. GUI.style.background = 'hsl(0, 0%, 10%)';
  63. GUI.style.borderRadius = '10px';
  64. GUI.style.position = 'absolute';
  65. GUI.style.textAlign = 'center';
  66. GUI.style.fontFamily = 'Nunito';
  67. GUI.style.color = 'white';
  68. GUI.style.overflow = 'hidden';
  69. GUI.style.top = '50px';
  70. GUI.style.left = '50px';
  71.  
  72. var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  73. GUI.onmousedown = ((e = window.event) => {
  74. e.preventDefault();
  75. pos3 = e.clientX;
  76. pos4 = e.clientY;
  77. document.onmouseup = (() => {
  78. document.onmouseup = null;
  79. document.onmousemove = null;
  80. });
  81. document.onmousemove = ((e) => {
  82. e = e || window.event;
  83. e.preventDefault();
  84. pos1 = pos3 - e.clientX;
  85. pos2 = pos4 - e.clientY;
  86. pos3 = e.clientX;
  87. pos4 = e.clientY;
  88. GUI.style.top = (GUI.offsetTop - pos2) + "px";
  89. GUI.style.left = (GUI.offsetLeft - pos1) + "px";
  90. });
  91. });
  92.  
  93. let header = document.createElement('div');
  94. GUI.appendChild(header);
  95. header.style.width = '100%';
  96. header.style.height = '35px';
  97. header.style.paddingTop = '2px';
  98. header.style.fontSize = '1.5rem';
  99. header.style.textAlign = 'center'
  100. header.innerHTML = `Blooket Cheats <span style="font-size: 0.75rem">v4.10.22</span>`;
  101.  
  102. let loop;
  103.  
  104. let close = document.createElement('button');
  105. header.appendChild(close);
  106. close.style.background = 'red';
  107. close.style.height = '45px';
  108. close.style.width = '45px';
  109. close.style.border = 'none';
  110. close.style.cursor = 'pointer';
  111. close.style.position = 'absolute';
  112. close.style.top = '-10px';
  113. close.style.right = '-10px';
  114. close.style.fontSize = '1.5rem';
  115. close.style.borderRadius = '10px';
  116. close.style.fontFamily = 'Nunito';
  117. close.style.fontWeight = 'bolder';
  118. close.style.paddingTop = '10px';
  119. close.style.paddingRight = '15px';
  120. close.innerText = 'X';
  121. close.onclick = () => {
  122. GUI.remove();
  123. clearInterval(loop);
  124. removeEventListener('keypress', toggleHidden)
  125. }
  126.  
  127. let minimize = document.createElement('button');
  128. header.appendChild(minimize);
  129. minimize.style.background = '#444444';
  130. minimize.style.height = '45px';
  131. minimize.style.width = '45px';
  132. minimize.style.border = 'none';
  133. minimize.style.cursor = 'pointer';
  134. minimize.style.position = 'absolute';
  135. minimize.style.top = '-10px';
  136. minimize.style.left = '-10px';
  137. minimize.style.fontSize = '1.5rem';
  138. minimize.style.borderRadius = '10px';
  139. minimize.style.fontFamily = 'Nunito';
  140. minimize.style.fontWeight = 'bolder';
  141. minimize.style.paddingTop = '10px';
  142. minimize.style.paddingLeft = '15px';
  143. minimize.innerText = '-';
  144. minimize.onclick = () => {
  145. bodyDiv.hidden = !bodyDiv.hidden;
  146. }
  147. let bodyDiv = document.createElement('div');
  148. let body = document.createElement('div');
  149. bodyDiv.appendChild(body);
  150. GUI.appendChild(bodyDiv);
  151.  
  152. body.innerHTML = (`<span id="curPageEl">${getSite(true) ? `Current gamemode: ${getSite(true)}` : 'No game detected'}</span><br><span>(Press E to hide)</span><br>`);
  153. body.style.display = 'block';
  154. body.style.margin = '10px';
  155. //body.style.background = 'white';
  156. body.style.minHeight = '70px';
  157.  
  158. let activeCheats = document.createElement('span');
  159. body.appendChild(activeCheats);
  160.  
  161. document.body.append(GUI);
  162.  
  163. let footer = document.createElement('div');
  164. bodyDiv.appendChild(footer);
  165. footer.style.fontSize = '0.9rem';
  166. footer.style.paddingBottom = '5px';
  167. footer.innerHTML = (`<span>GUI by OneMinesraft2#5394<br>Cheats by <a style="color: lightblue" href="https://twitter.com/glizuwu">gliz</a></span>`);
  168.  
  169. var getValues = () => new Promise((e, t) => {
  170. try {
  171. let n = window.webpackJsonp.map(e => Object.keys(e[1]).map(t => e[1][t])).reduce((e, t) => [...e, ...t], []).find(e => /\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/.test(e.toString()) && /\(new TextEncoder\)\.encode\(\"(.+?)\"\)/.test(e.toString())).toString();
  172. e({
  173. blooketBuild: n.match(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/)[0],
  174. secret: n.match(/\(new TextEncoder\)\.encode\(\"(.+?)\"\)/)[1]
  175. })
  176. } catch {
  177. t("Could not fetch auth details")
  178. }
  179. })
  180. var encodeValues = async (e, t) => {
  181. let d = window.crypto.getRandomValues(new Uint8Array(12));
  182. return window.btoa(Array.from(d).map(e => String.fromCharCode(e)).join("") + Array.from(new Uint8Array(await window.crypto.subtle.encrypt({
  183. name: "AES-GCM",
  184. iv: d
  185. }, await window.crypto.subtle.importKey("raw", await window.crypto.subtle.digest("SHA-256", (new TextEncoder).encode(t)), {
  186. name: "AES-GCM"
  187. }, !1, ["encrypt"]), (new TextEncoder).encode(JSON.stringify(e))))).map(e => String.fromCharCode(e)).join(""))
  188. };
  189.  
  190. function reactHandler() {
  191. return Object.values(document.querySelector('#app > div > div'))[1].children[1]._owner;
  192. }
  193.  
  194. let autoAnswer, highlightAnswers, choiceESP, autoPassword, chestESP;
  195.  
  196. let cheats = {
  197. global: {
  198. 'Get Daily Rewards': () => {
  199. fetch("https://api.blooket.com/api/users", { credentials: "include" }).then(x => x.json()).then(x => {
  200. getValues().then(async e => {
  201. fetch("https://api.blooket.com/api/users/add-rewards", {
  202. method: "put",
  203. credentials: "include",
  204. headers: {
  205. "content-type": "application/json",
  206. "X-Blooket-Build": e.blooketBuild
  207. },
  208. body: await encodeValues({
  209. name: x.name,
  210. addedTokens: 250,
  211. addedXp: 300
  212. }, e.secret)
  213. });
  214. fetch("https://api.blooket.com/api/users/add-rewards", {
  215. method: "put",
  216. credentials: "include",
  217. headers: {
  218. "content-type": "application/json",
  219. "X-Blooket-Build": e.blooketBuild
  220. },
  221. body: await encodeValues({
  222. name: x.name,
  223. addedTokens: 250,
  224. addedXp: 300
  225. }, e.secret)
  226. }).then(() => alert('Added daily rewawrds!')).catch(() => alert('There was an error when adding rewards!'));;
  227. }).catch(() => alert('There was an error encoding requests!'));
  228. }).catch(() => alert('There was an error getting username!'));
  229. },
  230. 'Spoof Blooks': () => {
  231. if (!window.location.pathname.split('/').includes('lobby')) return alert('You must be in a game lobby! (e.g. https://www.blooket.com/play/lobby)');
  232. reactHandler().stateNode.setState({ lockedBlooks: [], takenBlooks: [] });
  233. },
  234. 'Toggle Auto Answer': () => { autoAnswer = !autoAnswer },
  235. 'Toggle Highlight Answers': () => { highlightAnswers = !highlightAnswers },
  236. 'Spam Open Boxes': () => {
  237. let box = prompt(`Which box do you want to open? (e.g. Space)`);
  238. let boxes = {
  239. safari: 25,
  240. aquatic: 20,
  241. bot: 20,
  242. space: 20,
  243. breakfast: 15,
  244. medieval: 15,
  245. wonderland: 15
  246. }
  247. if (!Object.keys(boxes).includes(box.toLowerCase())) return alert('I could not find that box!');
  248. let amount = prompt('How many boxes do you want to open?');
  249. fetch("https://api.blooket.com/api/users", { credentials: "include" }).then(x => x.json()).then(x => {
  250. if (x.tokens < boxes[box.toLowerCase()] * amount) amount = Math.floor(x.tokens / boxes[box.toLowerCase()]);
  251. if (!amount) return alert('You do not have enough tokens!');
  252. let wait = ms => new Promise(r => setTimeout(r, ms));
  253. getValues().then(async e => {
  254. let error = false,
  255. blooks = [];
  256. for (let i = 0; i < amount; i++) {
  257. fetch("https://api.blooket.com/api/users/unlockblook", {
  258. method: "put",
  259. credentials: "include",
  260. headers: {
  261. "content-type": "application/json",
  262. "X-Blooket-Build": e.blooketBuild
  263. },
  264. body: await encodeValues({
  265. name: x.name,
  266. box: box.charAt(0).toUpperCase() + box.slice(1).toLowerCase()
  267. }, e.secret)
  268. }).then(async x => {
  269. let blook = await x.json();
  270. blooks.push(blook.unlockedBlook);
  271. alert(`${blook.unlockedBlook} (${i + 1}/${amount})`);
  272. }).catch(() => { error = true });
  273. await wait(750);
  274. if (error) break;
  275. }
  276. let count = {};
  277. blooks.forEach(blook => { count[blook] = (count[blook] || 0) + 1 });
  278. alert(`Results:\n` + Object.entries(count).map((x) => ` ${x[1]} ${x[0]}`).join(`\n`));
  279. }).catch(() => alert('There was an error encoding requests!'));
  280. }).catch(() => alert('There was an error getting username!'));
  281. },
  282. 'Auto Sell Dupes': () => {
  283. fetch("https://api.blooket.com/api/users", { credentials: "include" }).then(x => x.json()).then(x => {
  284. let blooks = Object.entries(x.unlocks).map(x => [x[0], x[1] - 1]).filter(x => x[1] > 0);
  285. let wait = ms => new Promise(r => setTimeout(r, ms));
  286. getValues().then(async e => {
  287. let error = false;
  288. alert('Selling duplicate blooks, please wait');
  289. for (let [blook, numSold] of blooks) {
  290. fetch("https://api.blooket.com/api/users/sellblook", {
  291. method: "put",
  292. credentials: "include",
  293. headers: {
  294. "content-type": "application/json",
  295. "X-Blooket-Build": e.blooketBuild
  296. },
  297. body: await encodeValues({
  298. name: x.name,
  299. blook,
  300. numSold
  301. }, e.secret)
  302. }).catch(() => { error = true });
  303. await wait(750);
  304. if (error) break;
  305. }
  306. alert(`Results:\n` + blooks.map((x) => ` ${x[1]} ${x[0]}`).join(`\n`));
  307. }).catch(() => alert('There was an error encoding requests!'));
  308. }).catch(() => alert('There was an error getting user data!'));
  309. }
  310. },
  311. cafe: {
  312. 'Infinite Food': () => {
  313. if (document.location.pathname != "/cafe") return alert("This cheat doesn't work in the shop!");
  314. reactHandler().stateNode.state.foods.forEach(e => e.stock = 99999);
  315. reactHandler().stateNode.forceUpdate();
  316. },
  317. 'Max Levels': () => {
  318. if (document.location.pathname != "/cafe/shop") return alert("This cheat only works in the shop!");
  319. Object.keys(reactHandler().stateNode.state.items).forEach(x => reactHandler().stateNode.state.items[x] = 5);
  320. reactHandler().stateNode.forceUpdate();
  321. },
  322. 'Set Cash': () => {
  323. reactHandler().stateNode.setState({ cafeCash: Number(parseFloat(prompt('How much cash would you like?'))) });
  324. },
  325. 'Reset Abilities': () => {
  326. Object.keys(reactHandler().stateNode.state.abilities).forEach(x => reactHandler().stateNode.state.abilities[x] = 5);
  327. reactHandler().stateNode.forceUpdate();
  328. }
  329. },
  330. kingdom: {
  331. 'Choice ESP': () => { choiceESP = !choiceESP },
  332. 'Max Stats': () => {
  333. reactHandler().stateNode.setState({ materials: 100, people: 100, happiness: 100, gold: 100 });
  334. },
  335. 'Disable Toucan': () => {
  336. reactHandler().stateNode.taxCounter = Number.MAX_VALUE;
  337. },
  338. 'Set Guests': () => {
  339. let guestScore = Number(parseFloat(prompt('How many guests do you want?')));
  340. reactHandler().stateNode.setState({ guestScore });
  341. },
  342. 'Skip Guest': () => {
  343. reactHandler().stateNode.nextGuest();
  344. }
  345. },
  346. crypto: {
  347. 'Auto Hack': () => { autoPassword = !autoPassword },
  348. 'Set Crypto': () => {
  349. let amount = Number(parseFloat(prompt('How much crypto do you want?')));
  350. reactHandler().stateNode.setState({ crypto2: amount, crypto: amount });
  351. },
  352. 'Custom Password': () => {
  353. let password = Number(parseFloat(prompt('What do you want to set your password to?')));
  354. reactHandler().stateNode.setState({ password });
  355. },
  356. 'Remove Hack': () => {
  357. reactHandler().stateNode.setState({ hack: '' })
  358. },
  359. 'Reset Player\'s Crypto': () => {
  360. let target = prompt("Name of player");
  361. let e = reactHandler();
  362. !target || e.memoizedProps.firebase.getDatabaseVal(e.memoizedProps.client.hostId, "c", (...o) => {
  363. let data = Object.keys(o[0]);
  364. if (data.some(e => e == target)) data.forEach(player => {
  365. if (player == target) {
  366. e.memoizedProps.firebase.setVal({
  367. id: e.memoizedProps.client.hostId,
  368. path: "c/" + e.memoizedProps.client.name,
  369. val: {
  370. p: e.stateNode.state.password,
  371. b: e.memoizedProps.client.blook,
  372. cr: e.stateNode.state.crypto,
  373. tat: player + ":" + (o[0][player].cr || 0)
  374. }
  375. }); alert('Reset player\'s crypto')
  376. };
  377. });
  378. else alert("Player does not exist");
  379. })
  380. }
  381. },
  382. factory: {
  383. 'All Mega Bot': () => {
  384. let blooks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0].fill({ name: "Mega Bot", color: "#d71f27", class: "🤖", rarity: "Legendary", cash: [80000, 430000, 4200000, 62000000, 1000000000], time: [5, 5, 3, 3, 3], price: [7000000, 120000000, 1900000000, 35000000000], active: false, level: 4, bonus: 5.5 })
  385. reactHandler().stateNode.setState({ blooks });
  386. },
  387. 'Remove Glitches': () => {
  388. reactHandler().stateNode.setState({
  389. glitch: "",
  390. bites: 0,
  391. ads: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  392. hazards: ["", "", "", "", ""],
  393. lol: false,
  394. joke: false,
  395. slow: false,
  396. dance: false,
  397. popUpAmount: 0,
  398. });
  399. },
  400. 'Max Blooks': () => {
  401. reactHandler().stateNode.state.blooks.forEach(blook => { blook.level = 4 });
  402. },
  403. 'Set Cash': () => {
  404. let cash = Number(parseFloat(prompt('How much cash do you want?')));
  405. reactHandler().stateNode.setState({ cash });
  406. },
  407. },
  408. fishing: {
  409. 'Set Weight': () => {
  410. let weight = Number(parseFloat(prompt('How much weight do you want?')));
  411. reactHandler().stateNode.setState({ weight2: weight, weight });
  412. },
  413. 'Set Lure': () => {
  414. let lure = Number(parseFloat(prompt('What do you want to set your lure to? (1 - 5)'))) - 1;
  415. reactHandler().stateNode.setState({ lure: lure < 0 ? 0 : lure > 4 ? 4 : lure });
  416. }
  417. },
  418. gold: {
  419. 'Set Gold': () => {
  420. let gold = Number(parseFloat(prompt('How much gold do you want?')));
  421. reactHandler().stateNode.setState({ gold2: gold, gold });
  422. },
  423. 'Chest ESP': () => { chestESP = !chestESP },
  424. "Set Player's Gold": () => {
  425. let e = reactHandler(),
  426. player = prompt("Player to set gold"),
  427. amount = Number(parseFloat(prompt("Amount to set gold to")));
  428. e.memoizedProps.firebase.setVal({
  429. id: e.memoizedProps.client.hostId,
  430. path: "c/" + e.memoizedProps.client.name,
  431. val: {
  432. b: e.memoizedProps.client.blook,
  433. g: e.stateNode.state.gold,
  434. tat: player + ":swap:" + amount
  435. }
  436. })
  437. }
  438. },
  439. racing: {
  440. 'Instant Win': () => {
  441. reactHandler().stateNode.setState({ progress: reactHandler().stateNode.state.goalAmount });
  442. setTimeout(() => {
  443. try {
  444. Array.from(document.body.querySelectorAll('div[class*="answerText"]')).filter(t => t.firstChild.innerHTML == reactHandler().memoizedState.question.correctAnswers[0])[0].click();
  445. } catch {
  446. try {
  447. Array.from(document.body.querySelectorAll('div[class*="answerText"]')).filter(t => t.firstChild.innerHTML == reactHandler().memoizedProps.client.question.correctAnswers[0])[0].click();
  448. } catch { };
  449. };
  450. }, 100);
  451. }
  452. },
  453. defense: {
  454. 'Clear Enemies': () => {
  455. reactHandler().stateNode.enemies = [];
  456. },
  457. 'Max Towers': () => {
  458. reactHandler().stateNode.towers.forEach(tower => {
  459. tower.damage = 99999999;
  460. tower.range = 99999999;
  461. tower.fullCd = 0;
  462. });
  463. },
  464. 'Remove Ducks': () => {
  465. data = reactHandler().stateNode;
  466. data.ducks.forEach(x => { data.tiles[x.y][x.x] = 0; });
  467. data.ducks.length = 0;
  468. },
  469. 'Place Towers Anywhere': () => {
  470. reactHandler().stateNode.tiles = reactHandler().stateNode.tiles.map(x => x.map(e => e == 2 ? 0 : e));
  471. },
  472. 'Set Damage': () => {
  473. let dmg = Number(parseFloat(prompt('How much damage do you want?')));
  474. reactHandler().stateNode.dmg = dmg;
  475. },
  476. 'Set Round': () => {
  477. let round = Number(parseFloat(prompt('What round do you want to set it to?')));
  478. reactHandler().stateNode.setState({ round });
  479. },
  480. 'Set Tokens': () => {
  481. let tokens = Number(parseFloat(prompt('How many tokens do you want?')));
  482. reactHandler().stateNode.setState({ tokens });
  483. }
  484. },
  485. doom: {
  486. 'Set Coins': () => {
  487. try {
  488. reactHandler().stateNode.props.setTowerCoins(Number(parseFloat(prompt('How many coins do you want?'))));
  489. } catch { }
  490. },
  491. 'Lower Enemy Stats': () => {
  492. let data = reactHandler().stateNode.state;
  493. if (data.phase != 'select') return alert('You must be on the attribute selection page!');
  494. reactHandler().stateNode.setState({ enemyCard: { ...data.enemyCard, strength: 0, charisma: 0, wisdom: 0 } })
  495. },
  496. 'Max Player Stats': () => {
  497. let data = reactHandler().stateNode.state;
  498. if (data.phase != 'select') return alert('You must be on the attribute selection page!');
  499. reactHandler().stateNode.setState({ myCard: { ...data.myCard, strength: 20, charisma: 20, wisdom: 20 } })
  500. },
  501. 'Heal Player': () => {
  502. reactHandler().stateNode.setState({ myLife: 100 });
  503. }
  504. },
  505. rush: {
  506. 'Set Defense': () => {
  507. let e = reactHandler();
  508. e.stateNode.props.firebase.setVal({
  509. id: e.stateNode.props.client.hostId,
  510. path: 'c/' + e.stateNode.props.client.name + '/d',
  511. val: Number(parseFloat(prompt('How much defense do you want?')))
  512. });
  513. },
  514. 'Set Blooks': () => {
  515. let e = reactHandler();
  516. e.stateNode.props.firebase.setVal({
  517. id: e.stateNode.props.client.hostId,
  518. path: 'c/' + e.stateNode.props.client.name + '/bs',
  519. val: Number(parseFloat(prompt('How many blooks do you want?')))
  520. });
  521. }
  522. }
  523. };
  524.  
  525. let global = document.createElement('details');
  526. global.innerHTML = (`<summary style="padding: 10px; font-size: 1.5em; font-weight: bolder">Global</summary>`);
  527. for (var i = 0; i < Object.keys(cheats.global).length; i++) {
  528. let cheat = createButton(Object.keys(cheats.global)[i]);
  529. cheat.onclick = cheats.global[Object.keys(cheats.global)[i]];
  530. global.appendChild(cheat);
  531. }
  532. global.open = true;
  533. global.style.paddingBottom = '10px';
  534. body.appendChild(global);
  535.  
  536. let cheatDiv = document.createElement('div');
  537. body.appendChild(cheatDiv);
  538.  
  539. loop = setInterval(() => {
  540. if (curPage != getSite()) {
  541. curPage = getSite();
  542. curPageEl.innerText = getSite(true) ? `Current gamemode: ${getSite(true)}` : 'No game detected'
  543. Array.from(cheatDiv.children).forEach(x => x.remove());
  544. if (curPage && cheats[curPage]) Object.keys(cheats[curPage]).forEach(cheat => {
  545. let button = createButton(cheat);
  546. button.onclick = cheats[curPage][cheat];
  547. cheatDiv.appendChild(button);
  548. cheatDiv.appendChild(document.createElement('br'));
  549. })
  550. };
  551. let activeCheatsText = (`Auto Answer: ${autoAnswer ? 'Enabled' : 'Disabled'}\nHighlight Answers: ${highlightAnswers ? 'Enabled' : 'Disabled'}${curPage == 'kingdom' ? `\nChoice ESP: ${choiceESP ? 'Enabled' : 'Disabled'}` : curPage == 'crypto' ? `\nAuto Hack: ${autoPassword ? 'Enabled' : 'Disabled'}` : curPage == 'gold' ? `\nChest ESP: ${chestESP ? 'Enabled' : 'Disabled'}` : ''}`);
  552. activeCheats.innerText != activeCheatsText && (activeCheats.innerText = activeCheatsText);
  553. if (autoAnswer) {
  554. try {
  555. Array.from(document.body.querySelectorAll('div[class*="answerText"]')).filter(t => t.firstChild.innerHTML == reactHandler().memoizedState.question.correctAnswers[0])[0].click();
  556. } catch {
  557. try {
  558. Array.from(document.body.querySelectorAll('div[class*="answerText"]')).filter(t => t.firstChild.innerHTML == reactHandler().memoizedProps.client.question.correctAnswers[0])[0].click();
  559. } catch { };
  560. };
  561. };
  562. if (highlightAnswers) {
  563. try {
  564. Array.from(document.querySelector('div[class*="answersHolder"').children).forEach(x => {
  565. if (reactHandler().memoizedState.question.correctAnswers.includes(x.innerText) || reactHandler().memoizedProps.client.question.correctAnswers.includes(x.innerText)) x.firstChild.style = 'background-color: rgb(0, 207, 119);';
  566. else x.firstChild.style = 'background-color: rgb(225, 40, 33);';
  567. });
  568. } catch { }
  569. };
  570. if (curPage == 'kingdom') {
  571. Array.from(document.getElementsByClassName('choiceESP')).forEach(x => x.remove())
  572. if (choiceESP) {
  573. try {
  574. let elements = {
  575. materials: Array.from(document.querySelectorAll('div')).find(x => Array.from(x.children).find(e => e.className.includes('tree'))),
  576. people: Array.from(document.querySelectorAll('div')).find(x => Array.from(x.children).find(e => e.className.includes('users') && e.parentElement.className.includes('statContainer'))),
  577. happiness: Array.from(document.querySelectorAll('div')).find(x => Array.from(x.children).find(e => e.className.includes('grin'))),
  578. gold: Array.from(document.querySelectorAll('div')).find(x => Array.from(x.children).find(e => e.className.includes('coins')))
  579. }
  580. let data = reactHandler().stateNode.state.guest;
  581. Object.entries(data.yes).forEach(x => {
  582. if (x[0] == 'msg') return;
  583. let element = document.createElement('div');
  584. element.className = 'choiceESP';
  585. element.style = 'font-size: 24px; color: rgb(75, 194, 46); font-weight: bolder;';
  586. element.innerText = String(x[1])
  587. elements[x[0]].appendChild(element);
  588. })
  589. Object.entries(data.no).forEach(x => {
  590. if (x[0] == 'msg') return;
  591. let element = document.createElement('div');
  592. element.className = 'choiceESP';
  593. element.style = 'font-size: 24px; color: darkred; font-weight: bolder;';
  594. element.innerText = String(x[1])
  595. elements[x[0]].appendChild(element);
  596. })
  597. } catch (e) { }
  598. };
  599. }
  600. if (curPage == 'crypto' && autoPassword) {
  601. let { stage, correctPassword } = Object.values(document.querySelector('#app > div > div'))[1].children[1]._owner.stateNode.state;
  602. if (stage == "hack") Array.from(document.querySelectorAll('div')).filter(x => x.innerHTML == correctPassword)[0].click();
  603. };
  604. if (curPage == 'gold' && chestESP) {
  605. try {
  606. if (reactHandler().stateNode.state.stage == 'prize') {
  607. let { choices } = reactHandler().stateNode.state;
  608. let div = document.querySelector("div[class*='regularBody']").children[1];
  609. if (div) {
  610. if (!document.querySelectorAll(".chest-esp").length) choices.forEach((box, i) => {
  611. textElement = document.createElement('p');
  612. textElement.className = "chest-esp";
  613. textElement.innerText = box.text;
  614. textElement.style = `text-align: center;
  615. font-size: 30px;
  616. color: white;
  617. font-family:Titan One;
  618. sans-serif;
  619. border-color: black;
  620. margin-top: 200px;`
  621. try { div.children[i].appendChild(textElement); } catch (e) { console.log(e) }
  622. });
  623. else choices.forEach((box, i) => {
  624. if (div.children.length == 3 && div.children[i].children[1].innerText != box.text) div.children[i].children[1].innerText = box.text;
  625. })
  626. }
  627. }
  628. } catch (e) { console.log(e) }
  629. };
  630. });
  631.  
  632. let curPage = getSite();
  633. if (curPage && cheats[curPage]) Object.keys(cheats[curPage]).forEach(cheat => {
  634. let button = createButton(cheat);
  635. button.onclick = cheats[curPage][cheat];
  636. cheatDiv.appendChild(button);
  637. cheatDiv.appendChild(document.createElement('br'));
  638. })
  639.  
  640. function createButton(cheat) {
  641. let button = document.createElement('button');
  642. button.classList.add('cheat');
  643. button.innerText = cheat;
  644. return button
  645. }
  646. function getSite(capitalize) {
  647. switch (window.location.pathname.split('/')[2]) {
  648. case 'rush': return capitalize ? 'Blook Rush' : 'rush';
  649. case 'gold': return capitalize ? 'Gold Quest' : 'gold';
  650. case 'fishing': return capitalize ? 'Fishing Frenzy' : 'fishing';
  651. case 'hack': return capitalize ? 'Crypto Hack' : 'crypto';
  652. case 'battle-royale': return capitalize ? 'Battle Royale' : 'royale';
  653. case 'factory': return capitalize ? 'Factory' : 'factory';
  654. case 'racing': return capitalize ? 'Racing' : 'racing';
  655. case 'classic': return capitalize ? 'Classic' : 'classic';
  656. default: switch (window.location.pathname.split('/')[1]) {
  657. case 'defense': return capitalize ? 'Tower Defense' : 'defense';
  658. case 'cafe': return capitalize ? 'Café' : 'cafe';
  659. case 'tower': return capitalize ? 'Tower of Doom' : 'doom';
  660. case 'kingdom': return capitalize ? 'Crazy Kingdom' : 'kingdom';
  661. default: return false;
  662. }
  663. };
  664. };
  665. function toggleHidden(e) {
  666. e.code == 'KeyE' && (GUI.hidden = !GUI.hidden)
  667. };
  668. addEventListener('keypress', toggleHidden);
  669. })()
  670. })();