This repository has been archived by the owner on Aug 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ai-dungeon-farmer.min.js
3 lines (2 loc) · 4.11 KB
/
ai-dungeon-farmer.min.js
1
2
3
var EnableFastMode = false;
console.log("<[>AI Dungeon Farmer<]>");var e=!1,n=null,t=null,a=null,o=null,r=null;function i(e,n){return{operationName:"EventHookSendUserEvent",variables:{input:{eventName:e,variation:"web",clientInfo:n}},query:"mutation EventHookSendUserEvent($input: EventInput) {\n sendUserEvent(input: $input)\n}\n"}}async function s(e){return await(await _aidfuck_fetch("https://api.aidungeon.io/graphql",{method:"POST",body:JSON.stringify(e),headers:{authorization:o,"content-type":"application/json",accept:"*/*"}})).json()}async function d(o,d){if(console.log("Pre-init routine complete."),e)for(;;){var u=1;try{u=Number.parseInt(await prompt("How much actions to add * 10?"))}catch{}for(var l={os:"web",model:r,version:"unknown"},c=i("ad_reward_button_press",l),p=i("ad_rewarded_reward_earned",l),m={operationName:"IncreaseAdCounterAdContext",variables:{},query:"mutation IncreaseAdCounterAdContext($addActions: Int) {\n increaseAdCountdown(addActions: $addActions)\n}\n"},w={operationName:"UserContextGetAdCountdown",variables:{},query:"query UserContextGetAdCountdown {\n adCountdown {\n id\n currentCount\n enforceAds\n shouldAutoplayAds\n __typename\n }\n}\n"},f=0;f<u;f++)EnableFastMode?(s(c),s(p),s(m)):(await s(c),await s(p),await s(m)),console.log("Now you have "+(await s(w)).data.adCountdown.currentCount+" actions."+(EnableFastMode?" Info may be outdated due to Fast Mode.":""))}else setTimeout((e=>{console.log(e),e("[style='align-items: center; display: flex; height: auto; justify-content: center; -webkit-box-align: center; -webkit-box-pack: center;']").parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.remove()}),200,o),n.innerHTML="<center><b>Refresh</b> the page after you're done farming.<br><i><small>Powered by catgirl supremacy</small></i></center>",t.innerText="+10 ACTIONS",o("#root").removeEventListener("click",d(o("#root")).click[0].listener),_backup=async function(){t.parentElement.parentElement.onclick=null,t.innerText="PLEASE WAIT...";var e={os:"web",model:navigator.userAgent.toLowerCase(),version:"unknown"},n=i("ad_reward_button_press",e),o=i("ad_rewarded_reward_earned",e),r={operationName:"IncreaseAdCounterAdContext",variables:{},query:"mutation IncreaseAdCounterAdContext($addActions: Int) {\n increaseAdCountdown(addActions: $addActions)\n}\n"};EnableFastMode?(s(n),s(o),s(r)):(await s(n),await s(o),await s(r)),a.innerHTML="You have "+(await s({operationName:"UserContextGetAdCountdown",variables:{},query:"query UserContextGetAdCountdown {\n adCountdown {\n id\n currentCount\n enforceAds\n shouldAutoplayAds\n __typename\n }\n}\n"})).data.adCountdown.currentCount+" Actions"+(EnableFastMode?"<br>Fast mode enabled: Info may be outdated.":""),t.parentElement.parentElement.onclick=_backup,t.innerText="+10 ACTIONS"},t.parentElement.parentElement.onclick=_backup}(async()=>{var i=!1;try{i=!!require}catch{i=!1}if(i)console.log("Running in Node.js environment."),_aidfuck_fetch=require("node-fetch"),rl=require("readline").createInterface(process.stdin,process.stdout),prompt=async e=>await new Promise((n=>rl.question(e,n))),o=process.argv[2]||await prompt("Enter your authtoken: "),r=process.argv[3]||(await prompt("Enter your useragent: ")).toLowerCase(),e=!0,d();else{if(console.log("Running in DevTools environment."),n=$('[style="color: rgb(153, 153, 153); font-family: HelveticaNeue-Light, Helvetica, sans-serif, Classic, alegreya_regular; font-size: 20px;"]'),t=$$("div[dir=auto]").find((e=>"WATCH AN AD"==e.innerText)),a=$$("div[dir=auto]").find((e=>e.innerText.startsWith("You have"))),!n||!t||!a)throw"Couldn't find a required HTML element.";n.innerHTML="<center>Welcome to AI Dungeon Farmer!<br>Made in a few boring hours by Alluseri<br><i><small>Ads were such a bad idea...<br>Now everyone gets to enjoy the ad-free experience.</small></i></center>",n.parentElement.style.alignSelf="center",t.innerText="INITIALIZE FARMER",_aidfuck_fetch=fetch,fetch=async function(e,n){var t=n.headers?.authorization;t&&!o&&(o=t)};var s=function(e,n){o?d(e,n):setTimeout(s,1e3,e,n)};(s=function(e,n){o?d(e,n):setTimeout(s,1e3,e,n)})($,getEventListeners)}})();