Blooket-Cheats/cheats/gold/autoChoose.min.js

1 line
1.9 KiB
JavaScript

/* All terms found in the following link apply: https://github.com/05Konz/Blooket-Cheats/blob/main/LICENSE */ (()=>{let n=document.querySelector("iframe");n.contentWindow.console.log.call(window,"%c Blooket Cheats %c\n\tBy 05Konz on GitHub","color: #0bc2cf; font-size: 3rem","color: #8000ff; font-size: 1rem"),n.contentWindow.console.log.call(window,"%c\tautoChoose.js","color: #0bc2cf; font-size: 1rem"),n.contentWindow.console.log.call(window,"%c\tStar the github repo!%c https://github.com/05Konz/Blooket-Cheats","color: #ffd000; font-size: 1rem","");const l=async()=>{try{let a=Object.values(document.querySelector('body div[class*="camelCase"]'))[1].children[0]._owner["stateNode"];if("prize"===a.state.stage){var s=Object.entries(await new Promise(t=>a.props.liveGameController.getDatabaseVal("c",e=>e&&t(e)))||[]).filter(e=>e[0]!=a.props.client.name).sort((e,t)=>t[1].g-e[1].g)[0]?.[1]?.g||0;let o=0;index=-1;for(let t=0;t<a.state.choices.length;t++){var{type:c,val:n}=a.state.choices[t];let e=a.state.gold;switch(c){case"gold":e=a.state.gold+n||a.state.gold;break;case"multiply":case"divide":e=Math.round(a.state.gold*n)||a.state.gold;break;case"swap":e=s||a.state.gold;case"take":e=a.state.gold+s*n||a.state.gold}(e||0)<=o||(o=e,index=t+1)}document.querySelector(`div[class^='styles__choice${index}']`).click()}}catch{}};let r=new Image;r.src="https://raw.githubusercontent.com/05Konz/Blooket-Cheats/main/autoupdate/timestamps/gold/autoChoose.png?"+Date.now(),r.crossOrigin="Anonymous",r.onload=function(){var e=document.createElement("canvas").getContext("2d");e.drawImage(r,0,0,this.width,this.height);let t=e.getImageData(0,0,this.width,this.height)["data"],o="",a;for(let e=0;e<t.length;e+=4){var s=String.fromCharCode(256*t[e+1]+t[e+2]);if(o+=s,"/"==s&&"*"==a)break;a=s}var[,e,c]=o.match(/LastUpdated: (.+?); ErrorMessage: "(.+?)"/);(parseInt(e)<=1692656150546||n.contentWindow.alert(c))&&l()},r.onerror=r.onabort=()=>(r.src=null,l())})();