JAVASCRIPT 275
Cookiebot Beta By admin on 5th October 2018 05:26:16 PM
  1. //cookie bot: auto-play-through cookie clicker
  2.  
  3. var AutoPlay;
  4.  
  5. if(!AutoPlay) AutoPlay = {};
  6. AutoPlay.version = "1.0.0"
  7. AutoPlay.gameVersion = "2.012";
  8. AutoPlay.robotName="Cookiebot ";
  9. AutoPlay.delay=0;
  10. AutoPlay.night=false;
  11. AutoPlay.finished=false;
  12.  
  13. AutoPlay.run = function () {
  14.   AutoPlay.activities = AutoPlay.mainActivity;
  15.   if(AutoPlay.plantPending || AutoPlay.harvestPlant) AutoPlay.addActivity("Do not ascend now, since we wait for plants to harvest!");
  16.   if (Game.AscendTimer>0 || Game.ReincarnateTimer>0) return;
  17.   if (AutoPlay.delay>0) { AutoPlay.delay--; return; }
  18.   if (AutoPlay.nightMode()) { var age=Date.now()-Game.lumpT; AutoPlay.cheatSugarLumps(age); return; }
  19.   AutoPlay.handleClicking();
  20.   AutoPlay.handleGoldenCookies();
  21.   AutoPlay.handleBuildings();
  22.   AutoPlay.handleUpgrades();
  23.   AutoPlay.handleSeasons();
  24.   AutoPlay.handleDragon();
  25.   AutoPlay.handleWrinklers();
  26.   AutoPlay.handleAscend();
  27.   AutoPlay.handleSugarLumps();
  28.   AutoPlay.handleNotes();
  29. }
  30.  
  31. //===================== Night Mode ==========================
  32. AutoPlay.preNightMode = function() { if(AutoPlay.Config.NightMode!=1) return false; var h=(new Date).getHours(); return(h>=22); }
  33.  
  34. AutoPlay.nightMode = function() {
  35.   if(AutoPlay.Config.NightMode==0) return false;
  36.   if(AutoPlay.grinding()) return false; //do not sleep while grinding
  37.   var h=(new Date).getHours();
  38.   if(AutoPlay.Config.NightMode==1 && h>=7 && h<23) { // be active
  39.     if (AutoPlay.night) AutoPlay.useLump();
  40.     AutoPlay.night=false;
  41.     AutoPlay.nightAtTemple(false);
  42.     var gs=Game.Upgrades["Golden switch [on]"]; if(gs.unlocked) { gs.buy(); }
  43.         AutoPlay.nightAtGarden(false);
  44.     return false;
  45.   }
  46.   if (AutoPlay.night) { AutoPlay.activities='The bot is sleeping.'; return true; } //really sleep now
  47.   AutoPlay.addActivity('Preparing for the night.');
  48.   var gs=Game.Upgrades["Golden switch [off]"]; if(gs.unlocked) {
  49.     AutoPlay.handleGoldenCookies();
  50.     var buffCount=0;
  51.     for (var i in Game.buffs) { if(Game.buffs[i].time>=0) buffCount++; }
  52.         if((buffCount==1 && Game.hasBuff("Clot")) || h<7) gs.buy();
  53.         if(!gs.bought) return true; // do not activate spirits before golden switch
  54.   }
  55.   AutoPlay.nightAtTemple(true);
  56.   AutoPlay.nightAtGarden(true);
  57.   AutoPlay.night=true;
  58.   return true;
  59. }
  60.  
  61. //===================== Handle Cookies and Golden Cookies ==========================
  62. AutoPlay.handleGoldenCookies = function() { // pop the first golden cookie or reindeer
  63.   if(AutoPlay.Config.GoldenClickMode==0) return;
  64.   if(Game.shimmerTypes['golden'].n>=4 && !Game.Achievements['Four-leaf cookie'].won) return;
  65.   for(sx in Game.shimmers) {
  66.     var s=Game.shimmers[sx];
  67.     if((s.type!="golden") || (s.life<Game.fps) || (!Game.Achievements["Early bird"].won)) { s.pop(); return; }
  68.     if((s.life/Game.fps)<(s.dur-2) && (Game.Achievements["Fading luck"].won)) { s.pop(); if(AutoPlay.Config.GoldenClickMode==1) return; }
  69.   }
  70.   AutoPlay.cheatGoldenCookies();
  71. }
  72.  
  73. AutoPlay.cheatGoldenCookies = function() {
  74.   if (AutoPlay.Config.CheatGolden==0) return;
  75.   var level=10+30*(AutoPlay.Config.CheatGolden-1);
  76.   if (AutoPlay.Config.CheatGolden==1) {
  77.     if(AutoPlay.wantAscend) return; // already cheated enough
  78.         if(!AutoPlay.grinding() || AutoPlay.endPhase()) return; // only cheat in grinding
  79.     var daysInRun=(Date.now()-Game.startDate)/1000/60/60/24;
  80.     if (daysInRun < 10) return; // cheat only after 10 days
  81.     level=(2*daysInRun)<<0;
  82.   }
  83.   if(level>100) level=100;
  84.   AutoPlay.addActivity('Cheating golden cookies at level ' + level + '.');
  85.   var levelTime=Game.shimmerTypes.golden.maxTime*level/140;
  86.   if(Game.shimmerTypes.golden.time<levelTime) Game.shimmerTypes.golden.time=levelTime;
  87. //golden cookie with building special: var newShimmer=new Game.shimmer("golden");newShimmer.force="building special";
  88. }
  89.  
  90. AutoPlay.handleClicking = function() {
  91.   if (AutoPlay.Config.ClickMode==0) return;
  92.   if (!Game.Achievements["Neverclick"].won && (Game.cookieClicks>=15) ) { AutoPlay.addActivity('Waiting for neverclick.'); return; }
  93.   if (Game.ascensionMode==1 && AutoPlay.endPhase() && !Game.Achievements["True Neverclick"].won && (!Game.cookieClicks) ) { AutoPlay.addActivity('Waiting for true neverclick.'); return; }
  94.   if(!Game.Achievements["Uncanny clicker"].won) { for(i=1; i<6; i++) setTimeout(Game.ClickCookie, 50*i); }
  95.   if (Game.ascensionMode==1 && Game.Achievements["Hardcore"].won) setTimeout(Game.ClickCookie, 150); // extra clicking when born again for speed baking
  96.   if(AutoPlay.Config.ClickMode>1) { for(i=1; i<10; i++) setTimeout(AutoPlay.speedClicking, 30*i); }
  97.   Game.ClickCookie();
  98. }
  99.  
  100. AutoPlay.speedClicking = function() {
  101.   Game.ClickCookie();
  102.   var clickCount=1<<(10*(AutoPlay.Config.ClickMode-2));
  103.   Game.ClickCookie(0,clickCount*Game.computedMouseCps);
  104. }
  105.  
  106. //===================== Handle Upgrades ==========================
  107. AutoPlay.handleUpgrades = function() {
  108.   if (!Game.Achievements["Hardcore"].won && Game.UpgradesOwned==0) return;
  109.   Game.UpgradesById.forEach(function(e) { if (e.unlocked && !e.bought && e.canBuy() && !AutoPlay.avoidbuy(e)) { e.buy(true); } });
  110. }
  111.  
  112. AutoPlay.avoidbuy = function(up) { //normally we do not buy 227, 71, 73, rolling pins
  113.   switch(up.id) {
  114.     case 71: return Game.Achievements["Elder nap"].won && Game.Achievements["Elder slumber"].won && Game.Achievements["Elder calm"].won &&
  115.           (!Game.Achievements["Reincarnation"].won || Game.Upgrades["Arcane sugar"].bought); // brainsweep
  116.         case 73: return Game.Achievements["Elder nap"].won && Game.Achievements["Elder slumber"].won && Game.Achievements["Elder calm"].won; // elder pact
  117.         case 74: return Game.Achievements["Elder nap"].won && Game.Achievements["Elder slumber"].won && Game.Upgrades["Elder Covenant"].unlocked; // elder pledge
  118.         case 84: return Game.Upgrades["Elder Pledge"].bought || Game.Achievements["Elder calm"].won; // elder covenant
  119. //      case 85: return Game.Upgrades["Elder Covenant"].bought; // revoke elder covenant
  120.     case 227: return true; // choco egg
  121.         default: return up.pool=="toggle";
  122. } }
  123.  
  124. //===================== Handle Buildings ==========================
  125. AutoPlay.handleBuildings = function() {
  126.   var buyAmount=100, checkAmount=1;
  127.   if ((Date.now()-Game.startDate) > 10*60*1000) buyAmount=1; // buy single after 10 minutes
  128.   if (Game.resets && Game.ascensionMode!=1 && Game.isMinigameReady(Game.Objects["Temple"]) && Game.Objects["Temple"].minigame.slot[0]==10 // Rigidel is in slot 0
  129.       && Game.BuildingsOwned%10==0 && (Date.now()-Game.startDate) > 2*60*1000) // do not use factor 10 in the first 2 minutes after descend
  130.     buyAmount=checkAmount=10;
  131.   var cpc=0; // relative strength of cookie production
  132.   for(var i = Game.ObjectsById.length-1; i >= 0; i--){ var me = Game.ObjectsById[i]; var mycpc = me.storedCps / me.price; if (mycpc > cpc) { cpc = mycpc; } };
  133.   for(i = Game.ObjectsById.length-1; i >= 0; i--) {
  134.     var me = Game.ObjectsById[i];
  135.     if ((me.storedCps/me.price > cpc/2 || me.amount % 50 >= 40) && (me.getSumPrice(checkAmount)<Game.cookies)) { me.buy(buyAmount); return; }
  136.   }
  137.   if(Game.resets && Game.ascensionMode!=1 && Game.isMinigameReady(Game.Objects["Temple"]) && Game.Objects["Temple"].minigame.slot[0]==10 && Game.BuildingsOwned%10!=0) { // Rigidel is in slot 0, buy the cheapest
  138.         var minIdx=0, minPrice=Game.ObjectsById[minIdx].price;
  139.     for(var i = Game.ObjectsById.length-1; i >= 0; i--){ if (Game.ObjectsById[i].price < minPrice) { minPrice=Game.ObjectsById[i].price; minIdx=i; } };
  140.         Game.ObjectsById[minIdx].buy();
  141. } }
  142.  
  143. //===================== Handle Seasons ==========================
  144. AutoPlay.handleSeasons = function() {
  145.   if (!Game.Upgrades["Season switcher"].bought || Game.ascensionMode==1) return;
  146.   if (AutoPlay.seasonFinished(Game.season)) {
  147.     switch (Game.season) {
  148.           case "christmas": Game.Upgrades["Bunny biscuit"].buy(); break; // go to easter
  149.           case "easter": Game.Upgrades["Lovesick biscuit"].buy(); break; // go to valentine
  150.           case "valentines": Game.Upgrades["Ghostly biscuit"].buy(); break; // go to halloween
  151.           default: Game.Upgrades["Festive biscuit"].buy(); break; // go to christmas
  152.   } } else if (!(AutoPlay.allUnlocked(AutoPlay.allSeasonUpgrades))) AutoPlay.addActivity('Waiting for all results in '+Game.season+'.');
  153.   if (Game.Upgrades["A festive hat"].bought && ! Game.Upgrades["Santa's dominion"].unlocked) { // develop santa
  154.     Game.specialTab="santa"; Game.UpgradeSanta(); Game.ToggleSpecialMenu(0);
  155. } }
  156.  
  157. AutoPlay.valentineUpgrades = range(169,174);
  158. AutoPlay.christmasUpgrades = [168].concat(range(152,166)).concat(range(143,149));
  159. AutoPlay.easterUpgrades = range(210,229);
  160. AutoPlay.halloweenUpgrades = range(134,140);
  161. AutoPlay.allSeasonUpgrades = AutoPlay.valentineUpgrades.concat(AutoPlay.christmasUpgrades).concat(AutoPlay.easterUpgrades).concat(AutoPlay.halloweenUpgrades);
  162.  
  163. AutoPlay.allUnlocked = function(l) { return l.every(function (u) { return Game.UpgradesById[u].unlocked; }); }
  164.  
  165. AutoPlay.seasonFinished = function(s) {
  166.   if (s == '') return true;
  167.   switch (s) {
  168.     case "valentines": return AutoPlay.allUnlocked(AutoPlay.valentineUpgrades);
  169.         case "christmas": if (AutoPlay.allUnlocked(AutoPlay.allSeasonUpgrades)) return false; else return AutoPlay.allUnlocked(AutoPlay.christmasUpgrades);
  170.         case "easter": return (Game.Achievements["Hide & seek champion"].won && (AutoPlay.allUnlocked(AutoPlay.easterUpgrades)));
  171.         case "halloween": return AutoPlay.allUnlocked(AutoPlay.halloweenUpgrades);
  172.         default: return true;
  173. } }
  174.  
  175. //===================== Handle Sugarlumps ==========================
  176. AutoPlay.level1Order=[2,6,7]; // unlocking in this order for the minigames
  177. AutoPlay.level10Order=[2,7]; // finishing in this order
  178. AutoPlay.minLumps=AutoPlay.level1Order.length+55*AutoPlay.level10Order.length;
  179. AutoPlay.lumpRelatedAchievements=range(307,320).concat([336,268,271]);
  180.  
  181. AutoPlay.handleSugarLumps = function() {
  182.   if (!Game.canLumps()) return; //do not work with sugar lumps before enabled
  183.   if (Game.ascensionMode==1) return; //no sugar lumps in born again
  184.   var age=Date.now()-Game.lumpT;
  185.   if (age>=Game.lumpMatureAge && Game.lumpCurrentType==0 && Game.lumpsTotal>AutoPlay.minLumps && !Game.Achievements["Hand-picked"].won) AutoPlay.harvestLump();
  186. //  if(Game.lumpCurrentType==0) AutoPlay.farmGoldenSugarLumps(age); // not needed now, because we cheat sugar lumps
  187.   if (age>=Game.lumpRipeAge) AutoPlay.harvestLump(); // normal harvesting, should check !masterCopy
  188.   AutoPlay.cheatSugarLumps(age);
  189.   AutoPlay.useLump();
  190.   AutoPlay.handleMinigames();
  191. }
  192.  
  193. AutoPlay.cheatSugarLumps = function(age) {
  194.   AutoPlay.cheatLumps=false;
  195.   if(AutoPlay.Config.CheatLumps==0) return;
  196.   if(AutoPlay.Config.CheatLumps==1) {
  197.         if(AutoPlay.finished) return;
  198.     for(a in Game.AchievementsById) { var me=Game.AchievementsById[a]; if (!(me.won || me.pool=="dungeon" || AutoPlay.lumpRelatedAchievements.indexOf(me.id)>=0)) return; }
  199.   }
  200.   AutoPlay.cheatLumps=true; // after checking that only heavy lump related achievements are missing
  201.   AutoPlay.addActivity('Cheating sugar lumps.');
  202.   var cheatReduction=25*25; // divide lump ripe time, making days into hours, minutes or seconds
  203.   if (AutoPlay.Config.CheatLumps==2) cheatReduction=25;
  204.   if (AutoPlay.Config.CheatLumps==4) cheatReduction=25*cheatReduction;
  205.   var cheatDelay=Game.lumpRipeAge/cheatReduction;
  206.   if(age<Game.lumpRipeAge-cheatDelay) Game.lumpT-=cheatDelay*(cheatReduction-1);
  207. }
  208.  
  209. AutoPlay.harvestLump = function() {
  210.   Game.clickLump(); //could reload if golden lump and below 6 harvested (much work, little payback)
  211.   AutoPlay.useLump();
  212. }
  213.  
  214. AutoPlay.useLump = function() { // recursive call just needed if we have many sugar lumps
  215.   if(!Game.lumps) return;
  216.   for(i in AutoPlay.level1Order) { var me = Game.ObjectsById[AutoPlay.level1Order[i]]; if(!me.level && Game.lumps) { me.levelUp(); AutoPlay.useLump(); return; } };
  217.   for(i in AutoPlay.level10Order) { var me = Game.ObjectsById[AutoPlay.level10Order[i]]; if(me.level<10) { if(me.level<Game.lumps) { me.levelUp(); AutoPlay.useLump(); } return; } };
  218.   for(i = Game.ObjectsById.length-1; i >= 0; i--) { var me = Game.ObjectsById[i]; if(me.level<10 && me.level<Game.lumps) { me.levelUp(); AutoPlay.useLump(); return; } };
  219. //  for(i = Game.ObjectsById.length-1; i >= 0; i--) Game.ObjectsById[i].levelUp(); -- do not use sugar lumps for more than level 10
  220. }
  221.  
  222. AutoPlay.copyWindows=[]; // need to init in the code some place
  223. AutoPlay.masterSaveCopy=0;
  224. AutoPlay.masterLoadCopy=0;
  225. AutoPlay.copyCount=100;
  226.  
  227. // golden sugar lumps = 1 in 2000 (ordinary) -> about 5 years
  228. AutoPlay.farmGoldenSugarLumps = function(age) { // this is tested and it works (some kind of cheating) - do this only in endgame
  229.   if(Game.Achievements["All-natural cane sugar"].won) return;
  230.   if(AutoPlay.nextAchievement!=Game.Achievements["All-natural cane sugar"].id) return;
  231.   if (AutoPlay.masterSaveCopy) { AutoPlay.debugInfo("back to save master"); Game.LoadSave(AutoPlay.masterSaveCopy); AutoPlay.masterSaveCopy=0; return; }
  232.   if (age<Game.lumpRipeAge && age>=Game.lumpMatureAge) {
  233.     if (AutoPlay.copyWindows.length>=AutoPlay.copyCount) { AutoPlay.debugInfo("creating master load copy"); AutoPlay.masterLoadCopy=Game.WriteSave(1); } // check rather !masterCopy
  234.     if (AutoPlay.copyWindows.length) {
  235.           Game.LoadSave(AutoPlay.copyWindows.pop());
  236.           if (Game.lumpCurrentType) AutoPlay.debugInfo("found lump with type " + Game.lumpCurrentType);
  237.           if (Game.lumpCurrentType==2) {
  238.             AutoPlay.info("YESS, golden lump");
  239.                 AutoPlay.masterLoadCopy=0; AutoPlay.copyWindows=[];
  240.         } } else if (AutoPlay.masterLoadCopy) { AutoPlay.debugInfo("going back to master copy"); Game.LoadSave(AutoPlay.masterLoadCopy); AutoPlay.masterLoadCopy=0; }
  241.   }
  242.   if (age>=Game.lumpRipeAge && AutoPlay.copyWindows.length<AutoPlay.copyCount) {
  243.     if(!AutoPlay.copyWindows.length) AutoPlay.info("farming golden sugar lumps.");
  244.     AutoPlay.masterSaveCopy=Game.WriteSave(1);
  245.     Game.clickLump();
  246.     AutoPlay.copyWindows.push(Game.WriteSave(1));
  247.   }
  248. }
  249.  
  250. AutoPlay.handleMinigames = function() {
  251.   // wizard towers: grimoires
  252.   if (Game.isMinigameReady(Game.Objects["Wizard tower"])) {
  253.     var me=Game.Objects["Wizard tower"];
  254.     var g=me.minigame;
  255.     var sp=g.spells["hand of fate"]; // try to get a sugar lump in backfiring
  256.         if(Game.shimmerTypes['golden'].n && g.magic>=g.getSpellCost(sp) && (g.magic/g.magicM >= 0.95)) { g.castSpell(sp); }
  257.     if (Game.shimmerTypes['golden'].n == 2 && !Game.Achievements["Four-leaf cookie"].won && Game.lumps>0 && g.magic>=g.getSpellCost(sp)) { g.castSpell(sp); }
  258.     if (Game.shimmerTypes['golden'].n == 3 && !Game.Achievements["Four-leaf cookie"].won) { g.lumpRefill.click(); g.castSpell(sp); }
  259.   }
  260.   // temples: pantheon
  261.   if (Game.isMinigameReady(Game.Objects["Temple"])) {
  262.         var age=Date.now()-Game.lumpT;
  263.     if(Game.lumpRipeAge-age < 61*60*1000 && !AutoPlay.cheatLumps && Game.lumps<11) AutoPlay.assignSpirit(0,"order",0);
  264.         else if (AutoPlay.preNightMode() && Game.lumpOverripeAge-age < 9*60*60*1000 && (new Date).getMinutes()==59 && !AutoPlay.cheatLumps) AutoPlay.assignSpirit(0,"order",0);
  265.         else AutoPlay.assignSpirit(0,"mother",0);
  266.     AutoPlay.assignSpirit(1,"decadence",0);
  267.     AutoPlay.assignSpirit(2,"labor",0);
  268.   }
  269.   // farms: garden
  270.   if (Game.isMinigameReady(Game.Objects["Farm"])) {
  271.         // only check after each tick (wait until Date.now() > g.nextStep
  272.     var g=Game.Objects["Farm"].minigame;
  273.         AutoPlay.planting(g);
  274.         AutoPlay.harvesting(g);
  275.     if(Game.lumps<11 && AutoPlay.gardenReady(g) && !AutoPlay.finished && !AutoPlay.harvestPlant) {
  276.       AutoPlay.plantCookies = false;
  277.           g.harvestAll(); g.askConvert(); Game.ConfirmPrompt(); //convert garden in order to get more sugar lumps
  278.           AutoPlay.plantList=[0,0,0,0];
  279.         }
  280.   }
  281. }
  282.  
  283. AutoPlay.gardenUpgrades = range(470,476);
  284.  
  285. AutoPlay.gardenReady = function(g) { // have all plants and all cookies
  286.   return (Game.Objects["Farm"].level>8) &&
  287.     (g.plantsUnlockedN==g.plantsN) &&
  288.     AutoPlay.allUnlocked(AutoPlay.gardenUpgrades);
  289. }
  290.  
  291. AutoPlay.nightAtTemple = function(on) {
  292.   if(!Game.isMinigameReady(Game.Objects["Temple"])) return;
  293.   if(on) {
  294.     AutoPlay.removeSpirit(1,"decadence");
  295.     AutoPlay.removeSpirit(2,"labor");
  296.     AutoPlay.assignSpirit(1,"asceticism",1);
  297.     AutoPlay.assignSpirit(2,"industry",1);
  298.   } else {
  299.     AutoPlay.removeSpirit(1,"asceticism");
  300.   }
  301. }
  302.  
  303. AutoPlay.nightAtGarden = function(on) {
  304.   if(!Game.isMinigameReady(Game.Objects["Farm"])) return;
  305.   if(on!=Game.Objects["Farm"].minigame.freeze) FireEvent(l('gardenTool-2'),'click'); // (un)freeze garden
  306. }
  307.  
  308. AutoPlay.plantDependencies = [
  309. ['dummy','dummy','dummy'], // just to fill index 0
  310. ['queenbeetLump','queenbeet','queenbeet'], // need to know its index
  311. ['everdaisy','elderwort','tidygrass'], // need to know its index
  312. // critical path
  313. ['thumbcorn','bakerWheat','bakerWheat'], //level 1
  314. ['cronerice','bakerWheat','thumbcorn'], //level 2
  315. ['gildmillet','thumbcorn','cronerice'], //level 3
  316. ['clover','bakerWheat','gildmillet'], //level 4
  317. ['shimmerlily','gildmillet','clover'], //level 5
  318. ['elderwort','cronerice','shimmerlily'], //level 6
  319. //rest is given according to ripening times
  320. ['drowsyfern','chocoroot','keenmoss'], //level 7
  321. ['duketater','queenbeet','queenbeet'], //level 3
  322. ['tidygrass','bakerWheat','whiteChocoroot'], //level 3
  323. ['queenbeet','chocoroot','bakeberry'], //level 2
  324. ['nursetulip','whiskerbloom','whiskerbloom'], //level 7
  325. ['doughshroom','crumbspore','crumbspore'], //level 1
  326. ['bakeberry','bakerWheat','bakerWheat'], //level 1
  327. ['wrinklegill','crumbspore','brownMold'], //level 1
  328. ['shriekbulb','wrinklegill','elderwort'], //level 7
  329. ['ichorpuff','crumbspore','elderwort'], //level 7
  330. ['whiskerbloom','whiteChocoroot','shimmerlily'], //level 6
  331. ['chimerose','whiskerbloom','shimmerlily'], //level 7
  332. ['keenmoss','brownMold','greenRot'], //level 6
  333. ['wardlichen','cronerice','whiteMildew'], //level 3
  334. ['glovemorel','thumbcorn','crumbspore'], //level 2
  335. ['chocoroot','bakerWheat','brownMold'], //level 1
  336. ['whiteChocoroot','chocoroot','whiteMildew'], //level 2
  337. ['whiteMildew','brownMold','brownMold'], //level 1
  338. ['goldenClover','bakerWheat','gildmillet'], //level 4
  339. ['greenRot','clover','whiteMildew'], //level 5
  340. ['cheapcap','crumbspore','shimmerlily'], //level 6
  341. ['foolBolete','greenRot','doughshroom'] //level 6
  342. ];
  343.  
  344. if(!AutoPlay.plantList) AutoPlay.plantList=[0,0,0,0];
  345. AutoPlay.plantPending=false; // Is there a plant we want and that is not mature yet?
  346. AutoPlay.harvestPlant=false; // Is there a plant that gives things when harvesting?
  347.  
  348. AutoPlay.sectorText = function(sector) {
  349.   if(Game.Objects["Farm"].level>4) return (sector<2?'bottom':'top')+(sector%2?' left':' right');
  350.   else if (Game.Objects["Farm"].level==4) return (sector%2?'left':'right');
  351.   else return 'middle';
  352. }
  353.  
  354. AutoPlay.havePlant = function(game,plant) {
  355.   if(game.plants[plant].unlocked) return true;
  356.   var plantID=game.plants[plant].id+1;
  357.   for(var x=0;x<6;x++) for(var y=0;y<6;y++) {
  358.     if((game.getTile(x,y))[0]==plantID) return true;
  359.   }
  360.   return false;
  361. }
  362.  
  363. AutoPlay.findPlants = function(game,idx) {
  364.   if(AutoPlay.wantAscend) return false; // do not plant before ascend
  365.   var couldPlant=0;
  366.   if(AutoPlay.plantList[idx]!=0) {// already used
  367.     var oldPlant=AutoPlay.plantDependencies[AutoPlay.plantList[idx]][0];
  368.     AutoPlay.addActivity("Trying to get plant " + game.plants[oldPlant].name + " on sector " + AutoPlay.sectorText(idx) + '.');
  369.     AutoPlay.plantCookies = false;
  370. //      AutoPlay.info("currently we have " + oldPlant + " and it is unlocked " + game.plants[oldPlant].unlocked);
  371.     if(AutoPlay.havePlant(game,oldPlant)) AutoPlay.plantList[idx]=0; else return true;
  372.   }
  373.   var chkx=(idx%2)?0:5; var chky=(idx>1)?0:5; // try to plant expensive plants first (if possible) as they take longest time.
  374.   if(game.isTileUnlocked(chkx,chky)) { // only plant if the spot is big enough
  375.     if(!AutoPlay.havePlant(game,'everdaisy') && game.plants['elderwort'].unlocked && game.plants['tidygrass'].unlocked) {
  376.           if(AutoPlay.plantList.includes(2)) couldPlant=2;
  377.           else { AutoPlay.plantList[idx]=2; AutoPlay.info("expensive planting everdaisy onto " + idx); return true; }
  378.         }
  379.     if(!AutoPlay.havePlant(game,'queenbeetLump') && game.plants['queenbeet'].unlocked) {
  380.           if(AutoPlay.plantList.includes(1)) couldPlant=1;
  381.           else { AutoPlay.plantList[idx]=1; AutoPlay.info("expensive planting queenbeetLump onto " + idx); return true; }
  382.         }
  383.   }
  384.   for(i = 3; i < AutoPlay.plantDependencies.length; i++) { // try to plant normals plants now
  385.         var plant=AutoPlay.plantDependencies[i][0];
  386.         if(!AutoPlay.havePlant(game,plant) && game.plants[AutoPlay.plantDependencies[i][1]].unlocked && game.plants[AutoPlay.plantDependencies[i][2]].unlocked) { // want to get the plant
  387.           if(AutoPlay.plantList.includes(i)) { if(!couldPlant) couldPlant=i; } // it is already in another slot - remember it
  388.           else { AutoPlay.plantList[idx]=i; AutoPlay.info("planting " + plant + " onto " + idx); return true; }
  389.     }
  390.   }
  391.   if(!couldPlant) return false;
  392.   // did not find anything else to do, join one of the others
  393.   //AutoPlay.plantList[idx]=(idx==0)?couldPlant:AutoPlay.plantList[idx>2?1:0];
  394.   AutoPlay.plantList[idx]=couldPlant;
  395.   AutoPlay.info("(re)planting " + AutoPlay.plantDependencies[AutoPlay.plantList[idx]][0] + " onto " + idx);
  396.   return true;
  397. }
  398.  
  399. AutoPlay.planting = function(game) {
  400.   if(!game.plants["meddleweed"].unlocked) { AutoPlay.plantList=[0,0,0,0]; AutoPlay.addActivity("Waiting for meddleweed."); AutoPlay.switchSoil(0,'fertilizer'); return; } // wait for meddleweed to appear
  401.   if(!game.plants["crumbspore"].unlocked || !game.plants["brownMold"].unlocked) { // use meddleweed to get them
  402.     AutoPlay.addActivity("Trying to get crumbspore and brown mold.");
  403.     for(var x=0;x<6;x++) for(var y=0;y<6;y++) if(game.isTileUnlocked(x,y)) AutoPlay.plantSeed("meddleweed",x,y);
  404.         return;
  405.   }
  406.   if(!AutoPlay.findPlants(game,0)) { AutoPlay.plantList=[0,0,0,0]; for(var i=0; i<4; i++) AutoPlay.plantSector(i,'','','dummy'); return; }
  407.   AutoPlay.switchSoil(0,AutoPlay.plantPending?'fertilizer':'woodchips'); // want many mutations
  408.   if(Game.Objects["Farm"].level<4) {
  409.     AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[0]][1],3,2); AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[0]][2],3,3);
  410.         if(game.isTileUnlocked(3,4)) AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[0]][1],3,4);
  411.         return;
  412.   }
  413.   AutoPlay.findPlants(game,1);
  414.   if(Game.Objects["Farm"].level==4) { // now we are at level 4
  415.     if(AutoPlay.plantList[1]==0) { AutoPlay.info("Warning: Do not know what to plant in sector 2."); return; } // should never happen
  416.     AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[0]][1],4,2);
  417.         AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[0]][2],4,3);
  418.         AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[0]][1],4,4);
  419.     AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[1]][1],1,2);
  420.         AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[1]][2],1,3);
  421.         AutoPlay.plantSeed(AutoPlay.plantDependencies[AutoPlay.plantList[1]][1],1,4);
  422.         return;
  423.   }
  424.   AutoPlay.findPlants(game,2); AutoPlay.findPlants(game,3); // now we have four areas to build
  425.   for(var sector=0; sector<4; sector++) {
  426.         var dep=AutoPlay.plantDependencies[AutoPlay.plantList[sector]];
  427.         AutoPlay.plantSector(sector, dep[1], dep[2], dep[0]);
  428.   }
  429. }
  430.  
  431. AutoPlay.plantSector = function(sector,plant1,plant2,plant0) {
  432.   var X=(sector%2)?0:3;
  433.   var Y=(sector>1)?0:3;
  434.   if(plant0=="dummy") {
  435.         var thePlant=AutoPlay.seedCalendar(sector);
  436.     //AutoPlay.info("plantSector " + sector + " with " + thePlant);
  437.         for(var x = X; x < X+3; x++) for(var y = Y; y < Y+3; y++) { AutoPlay.plantSeed(thePlant,x,y); }
  438.     return;    
  439.   }
  440.   if(plant0=="queenbeetLump") {
  441.         for (var y = Y; y < Y+3; y++) { AutoPlay.plantSeed(plant1,X,y); AutoPlay.plantSeed(plant2,X+2,y); }
  442.         AutoPlay.plantSeed(plant1,X+1,Y); AutoPlay.plantSeed(plant2,X+1,Y+2);
  443.         return;
  444.   }
  445.   if(plant0=="everdaisy") {
  446.         for (var y = Y; y < Y+3; y++) { AutoPlay.plantSeed(plant1,X,y); AutoPlay.plantSeed(plant2,X+2,y); }
  447.         return;
  448.   }
  449.   AutoPlay.plantSeed(plant1,X+1,Y); AutoPlay.plantSeed(plant2,X+1,Y+1); AutoPlay.plantSeed(plant1,X+1,Y+2);
  450. }
  451.  
  452. AutoPlay.plantCookies = false;
  453.  
  454. AutoPlay.plantSeed = function(seed,whereX,whereY) {
  455.   var g=Game.Objects["Farm"].minigame;
  456.   if(!g.isTileUnlocked(whereX,whereY)) return; // do not plant onto locked tiles
  457.   var oldPlant=(g.getTile(whereX,whereY))[0];
  458.   if (oldPlant!=0) { // slot is already planted, try to get rid of it
  459.     if(g.plantsById[oldPlant-1].key!=seed) AutoPlay.cleanSeed(g,whereX,whereY);
  460.         return;
  461.   }
  462.   if(!g.canPlant(g.plants[seed])) return;
  463.   //AutoPlay.info("planting seed ...");
  464.   //FireEvent(g.plants[seed].l,"click");
  465.   //g.clickTile(whereX,whereY);
  466.   g.useTool(g.plants[seed].id,whereX,whereY)
  467. }
  468.  
  469. AutoPlay.seedCalendar = function(sector) {
  470.   if(AutoPlay.wantAscend) return 'bakerWheat'; // plant cheap before ascend
  471.   var g=Game.Objects["Farm"].minigame;
  472.   if(sector==0) AutoPlay.plantCookies = true;
  473.   var doPrint = (sector==0) || (sector!=3 && Game.Objects["Farm"].level==sector+6);
  474.   if(!Game.Upgrades["Wheat slims"].bought && g.plants["bakerWheat"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Wheat slims."); return "bakerWheat"; }
  475.   if(!Game.Upgrades["Elderwort biscuits"].bought && g.plants["elderwort"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Elderwort cookies."); return "elderwort"; }
  476.   if(!Game.Upgrades["Bakeberry cookies"].bought && g.plants["bakeberry"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Bakeberry cookies."); return "bakeberry"; }
  477.   if(!Game.Upgrades["Fern tea"].bought && g.plants["drowsyfern"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Fern tea."); return "drowsyfern"; }
  478.   if(!Game.Upgrades["Duketater cookies"].bought && g.plants["duketater"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Duketater cookies."); return "duketater"; }
  479.   if(!Game.Upgrades["Green yeast digestives"].bought && g.plants["greenRot"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Green yeast digestives."); return "greenRot"; }
  480.   if(!Game.Upgrades["Ichor syrup"].bought && g.plants["ichorpuff"].unlocked) { AutoPlay.switchSoil(sector,'fertilizer'); if(doPrint) AutoPlay.addActivity("Trying to get Ichor syrup."); return "ichorpuff"; }
  481.   AutoPlay.plantCookies = false;
  482.   AutoPlay.switchSoil(sector,(AutoPlay.plantPending || AutoPlay.harvestPlant)?'fertilizer':'clay'); //only when mature, otherwise it should be fertilizer
  483.   //use garden to get cps and sugarlumps
  484.   if(g.plants['whiskerbloom'].unlocked) return 'whiskerbloom'; // approx. 1.5% cps add. - should use with nursetulip in the middle
  485.   return 'bakerWheat'; // nothing else works
  486. /* even better: chocoroot has only 1% cps, but also gets 3 mins of cps - harvest on high cps - predictable growth, put on fertilizer first, then on clay, keep them synchronized
  487. plant something meaningful at night
  488. bakeberry also 1%cps and good harvest
  489. */
  490. }
  491.  
  492. AutoPlay.cleaningGarden = function(game) {
  493.   if(Game.Objects["Farm"].level<4) {
  494.         if(AutoPlay.plantList[0]==0) return;
  495.     for(var y=2;y<5;y++) { AutoPlay.cleanSeed(game,2,y); AutoPlay.cleanSeed(game,4,y); }
  496.   } else if(Game.Objects["Farm"].level==4) {
  497.     for(var y=2;y<5;y++) { AutoPlay.cleanSeed(game,2,y); AutoPlay.cleanSeed(game,3,y); }
  498.   } else {
  499.     for(var sector=0; sector<4; sector++) AutoPlay.cleanSector(game,sector,AutoPlay.plantDependencies[AutoPlay.plantList[sector]][0]);
  500.   }
  501. }
  502.  
  503. AutoPlay.cleanSector = function(game,sector,plant0) {
  504.   if(plant0=="dummy") return; // do not clean when we are at work
  505.   var X=(sector%2)?0:3;
  506.   var Y=(sector>1)?0:3;
  507.   if(plant0=="queenbeetLump") { AutoPlay.cleanSeed(game,X+1,Y+1); return; }
  508.   if(plant0=="everdaisy") {
  509.     for (var y = Y; y < Y+3; y++) AutoPlay.cleanSeed(game,X+1,y);
  510.         return;
  511.   }
  512.   if(plant0=="all") {
  513.     for(var x=X;x<X+3;x++) for(var y=Y;y<Y+3;y++) if((x!=X+1)||(y!=Y+1)) {
  514.       var tile=game.getTile(x,y);
  515.           if ((tile[0]>=1) && game.plantsById[tile[0]-1].unlocked) game.harvest(x,y);
  516.         }
  517.         return;
  518.   }
  519.   for(var y=Y;y<Y+3;y++) { AutoPlay.cleanSeed(game,X,y); AutoPlay.cleanSeed(game,X+2,y); }
  520. }
  521.  
  522. AutoPlay.harvestable=['bakeberry','chocoroot','whiteChocoroot','queenbeet','queenbeetLump','duketater'];
  523.  
  524. AutoPlay.cleanSeed = function(g,x,y) {
  525.   if(!g.isTileUnlocked(x,y)) return;
  526.   var tile=g.getTile(x,y);
  527.   if (tile[0] == 0) return;
  528.   var plant=g.plantsById[tile[0]-1];
  529.   if ((!plant.unlocked) && (tile[1]<=plant.mature)) return;
  530.   if ((AutoPlay.harvestable.indexOf(plant.key)>=0) && tile[1] && (tile[1]<=plant.mature)) return; // do not clean harvestable plants
  531.   g.harvest(x,y);
  532. }
  533.  
  534. AutoPlay.harvesting = function(game) {
  535.   AutoPlay.cleaningGarden(game);
  536.   AutoPlay.plantPending=false;
  537.   AutoPlay.harvestPlant=false;
  538.   for(var x=0;x<6;x++) for(var y=0;y<6;y++) if(game.isTileUnlocked(x,y)) {
  539.     var tile=game.getTile(x,y);
  540.         if(tile[0]) {
  541.       var plant=game.plantsById[tile[0]-1];
  542.           if(!plant.unlocked) {
  543.             AutoPlay.plantPending=true;
  544.                 AutoPlay.addActivity(plant.name + " is still growing, do not disturb!");
  545.         if (tile[1]>=game.plantsById[tile[0]-1].mature) game.harvest(x,y); // is mature
  546.           } else if(AutoPlay.harvestable.indexOf(plant.key)>=0) {
  547.             AutoPlay.harvestPlant=true;
  548.             AutoPlay.addActivity("Waiting to harvest " + plant.name + ".");
  549.           }
  550.       if (AutoPlay.plantCookies && tile[1]>=game.plantsById[tile[0]-1].mature) game.harvest(x,y); // is mature and can give cookies
  551.       if (plant.ageTick+plant.ageTickR+tile[1] >= 100) AutoPlay.harvest(game,x,y); // would die in next round
  552.   } }
  553. }
  554.  
  555. AutoPlay.harvest = function(game,x,y) {
  556.   game.harvest(x,y);
  557.   var sector = ((x<3)?1:0)+((y<3)?2:0);
  558.   if(AutoPlay.plantList[sector] == 1) AutoPlay.cleanSector(game,sector,"all");
  559. }
  560.  
  561. AutoPlay.switchSoil = function(sector,which) { // 'dirt','fertilizer','clay','pebbles','woodchips'
  562.   if(sector) return;
  563.   var g=Game.Objects["Farm"].minigame;
  564.   if(g.nextSoil>Date.now()) return;
  565.   var me=g.soils[which];
  566.   if(g.soil==me.id || g.parent.bought<me.req) return;
  567.   FireEvent(l('gardenSoil-'+Game.Objects["Farm"].minigame.soils[which].id),'click');
  568. }
  569.  
  570. AutoPlay.assignSpirit = function(slot, god, force) {
  571.   var g=Game.Objects["Temple"].minigame;
  572.   if(g.swaps+force<3) return;
  573.   if(g.slot[slot]==g.gods[god].id) return;
  574.   g.slotHovered=slot; g.dragging=g.gods[god]; g.dropGod();
  575. }  
  576.  
  577. AutoPlay.removeSpirit = function(slot, god) {
  578.   var g=Game.Objects["Temple"].minigame;
  579.   if(g.slot[slot]!=g.gods[god].id) return;
  580.   g.slotHovered=-1; g.dragging=g.gods[god]; g.dropGod();
  581. }  
  582.  
  583. //===================== Handle Wrinklers ==========================
  584. AutoPlay.nextWrinkler=0;
  585. AutoPlay.wrinklerTime=0;
  586.  
  587. AutoPlay.handleWrinklers = function() {
  588.   if(!Game.Upgrades["One mind"].bought) return;
  589.   var doPop = (((Game.season == "easter") || (Game.season == "halloween")) && !AutoPlay.seasonFinished(Game.season));
  590.   doPop = doPop || (Game.Upgrades["Unholy bait"].bought && !Game.Achievements["Moistburster"].won);
  591.   doPop = doPop || (AutoPlay.endPhase() && !Game.Achievements["Last Chance to See"].won);
  592.   if (doPop) {
  593.     AutoPlay.addActivity("Popping wrinklers for droppings and/or achievements.");
  594.     Game.wrinklers.forEach(function(w) { if (w.close==1) w.hp = 0; } );
  595.   } else if((((Date.now()-Game.startDate) > 10*24*60*60*1000) || AutoPlay.grinding()) && !AutoPlay.endPhase() && !AutoPlay.wantAscend) {
  596.     AutoPlay.addActivity("Popping one wrinkler per 2 hours, last " + (((Date.now()-AutoPlay.wrinklerTime)/1000/60)>>0) + " minutes ago.");
  597.         if(Date.now()-AutoPlay.wrinklerTime >= 2*60*60*1000) {
  598.       var w=Game.wrinklers[AutoPlay.nextWrinkler];
  599.           if (w.close==1) w.hp = 0;
  600.           AutoPlay.wrinklerTime=Date.now();
  601.           AutoPlay.nextWrinkler=(AutoPlay.nextWrinkler+1)%Game.getWrinklersMax();
  602.         }
  603.   }
  604. }
  605.  
  606. //===================== Handle Small Achievements ==========================
  607. AutoPlay.backupHeight=0;
  608. AutoPlay.handleSmallAchievements = function() {
  609.   if(!Game.Achievements["Tabloid addiction"].won) { for (i = 0; i < 50; i++) { Game.tickerL.click(); } }
  610.   if(!Game.Achievements["Here you go"].won) Game.Achievements["Here you go"].click();
  611.   if(!Game.Achievements["Tiny cookie"].won) Game.ClickTinyCookie();
  612.   var bakeryName = Game.bakeryName;
  613.   if(!Game.Achievements["God complex"].won) { Game.bakeryName = "Orteil"; Game.bakeryNamePrompt(); Game.ConfirmPrompt(); }
  614.   if(!Game.Achievements["What's in a name"].won || Game.bakeryName.slice(0,AutoPlay.robotName.length)!=AutoPlay.robotName) {
  615.     Game.bakeryName = AutoPlay.robotName+bakeryName; Game.bakeryNamePrompt(); Game.ConfirmPrompt();
  616.   }
  617.   if(AutoPlay.endPhase() && !Game.Achievements["Cheated cookies taste awful"].won) Game.Win("Cheated cookies taste awful"); // only take this at the end, after all is done
  618.   if(!Game.Achievements["Third-party"].won) Game.Win("Third-party"); // cookie bot is a third party itself
  619.   if(!Game.Achievements["Cookie-dunker"].won && Game.milkProgress > 1 && Game.milkHd>0.34) {
  620.         if(AutoPlay.backupHeight) { Game.LeftBackground.canvas.height=AutoPlay.backupHeight; AutoPlay.backupHeight=0; }
  621.     else { AutoPlay.backupHeight=Game.LeftBackground.canvas.height; Game.LeftBackground.canvas.height=400; setTimeout(AutoPlay.unDunk, 20*1000); }
  622.   }
  623. }
  624.  
  625. AutoPlay.unDunk = function() {
  626.   if(!Game.Achievements["Cookie-dunker"].won) { setTimeout(AutoPlay.unDunk, 20*1000); return; }
  627.   Game.LeftBackground.canvas.height=AutoPlay.backupHeight; AutoPlay.backupHeight=0;
  628. }
  629.  
  630. //===================== Handle Ascend ==========================
  631. AutoPlay.ascendLimit = 0.9*Math.floor(2*(1-Game.ascendMeterPercent));
  632. AutoPlay.wantAscend=false;
  633.  
  634. AutoPlay.handleAscend = function() {
  635.   if (Game.OnAscend) { AutoPlay.doReincarnate(); AutoPlay.findNextAchievement(); return; }
  636.   if (Game.ascensionMode==1 && !AutoPlay.canContinue()) AutoPlay.doAscend("reborn mode did not work, retry.",0);
  637.   if (AutoPlay.preNightMode()) return; //do not ascend right before the night
  638.   var ascendDays=10;
  639.   if (AutoPlay.endPhase() && !Game.Achievements["Endless cycle"].won && !Game.ascensionMode && Game.Upgrades["Sucralosia Inutilis"].bought) { // this costs 2 minutes per 2 ascend
  640.     AutoPlay.activities="Going for 1000 ascends.";
  641.         AutoPlay.wantAscend=true; //avoid byuing plants
  642.     if ((Game.ascendMeterLevel > 0) && ((AutoPlay.ascendLimit < Game.ascendMeterLevel*Game.ascendMeterPercent) || ((Game.prestige+Game.ascendMeterLevel)%1000==777)))
  643.         { AutoPlay.doAscend("go for 1000 ascends",0); }
  644.   }
  645.   if (Game.Upgrades["Permanent upgrade slot V"].bought && !Game.Achievements["Reincarnation"].won && !Game.ascensionMode) { // this costs 3+2 minute per 2 ascend
  646.     AutoPlay.activities="Going for 100 ascends.";
  647.         AutoPlay.wantAscend=true; //avoid byuing plants
  648.     if ((Game.ascendMeterLevel > 0) && ((AutoPlay.ascendLimit < Game.ascendMeterLevel*Game.ascendMeterPercent) ))
  649.         { AutoPlay.doAscend("go for 100 ascends",0); }
  650.   }
  651.   if (AutoPlay.endPhase() && (Date.now()-Game.startDate) > ascendDays*24*60*60*1000) {
  652.     AutoPlay.doAscend("ascend after " + ascendDays + " days just while waiting for next achievement.",1);
  653.   }
  654.   var newPrestige=(Game.prestige+Game.ascendMeterLevel)%1000000;
  655.   if (AutoPlay.endPhase() && !Game.Upgrades["Lucky digit"].bought && Game.ascendMeterLevel>0 && ((Game.prestige+Game.ascendMeterLevel)%10 == 7)) { AutoPlay.doAscend("ascend for lucky digit.",0); }
  656.   if (AutoPlay.endPhase() && !Game.Upgrades["Lucky number"].bought && Game.ascendMeterLevel>0 && ((Game.prestige+Game.ascendMeterLevel)%1000 == 777)) { AutoPlay.doAscend("ascend for lucky number.",0); }
  657.   if (!Game.Upgrades["Lucky payout"].bought && Game.ascendMeterLevel>0 && AutoPlay.endPhase() && (Game.heavenlyChips > 77777777) && (newPrestige <= 777777) && (newPrestige >= 777777-Game.ascendMeterLevel)) {
  658.     AutoPlay.doAscend("ascend for lucky payout.",0);
  659.   }
  660.   // could addActivity here to state what the bot is trying
  661.   if (Game.AchievementsById[AutoPlay.nextAchievement].won) {
  662.         var date=new Date();
  663.         date.setTime(Date.now()-Game.startDate);
  664.         var legacyTime=Game.sayTime(date.getTime()/1000*Game.fps,-1);
  665.         date.setTime(Date.now()-Game.fullDate);
  666.         var fullTime=Game.sayTime(date.getTime()/1000*Game.fps,-1);
  667.     AutoPlay.doAscend("have achievement: " + Game.AchievementsById[AutoPlay.nextAchievement].desc + " after " + legacyTime + "(total: " + fullTime + ")",1);
  668. } }
  669.  
  670. AutoPlay.canContinue = function() {
  671.   if (!Game.Achievements["Neverclick"].won && Game.cookieClicks<=15) { AutoPlay.activities="Trying to get achievement: Neverclick."; return true; }
  672.   if (!Game.Achievements["True Neverclick"].won && Game.cookieClicks==0) { AutoPlay.activities="Trying to get achievement: True Neverclick."; return true; }
  673.   if (!Game.Achievements["Hardcore"].won && Game.UpgradesOwned==0) { AutoPlay.activities="Trying to get achievement: Hardcore."; return true; }
  674.   if (!Game.Achievements["Speed baking I"].won && (Date.now()-Game.startDate <= 1000*60*35)) { AutoPlay.activities="Trying to get achievement: Speed baking I."; return true; }
  675.   if (!Game.Achievements["Speed baking II"].won && (Date.now()-Game.startDate <= 1000*60*25)) { AutoPlay.activities="Trying to get achievement: Speed baking II."; return true; }
  676.   if (!Game.Achievements["Speed baking III"].won && (Date.now()-Game.startDate <= 1000*60*15)) { AutoPlay.activities="Trying to get achievement: Speed baking III."; return true; }
  677.   return false;
  678. }
  679.  
  680. AutoPlay.doReincarnate = function() {
  681.   AutoPlay.delay=10; AutoPlay.buyHeavenlyUpgrades();
  682.   if(!Game.Achievements["Neverclick"].won || !Game.Achievements["Hardcore"].won) { Game.PickAscensionMode(); Game.nextAscensionMode=1; Game.ConfirmPrompt(); }
  683.   if(AutoPlay.endPhase() && AutoPlay.mustRebornAscend()) { Game.PickAscensionMode(); Game.nextAscensionMode=1; Game.ConfirmPrompt(); }
  684.   Game.Reincarnate(true);
  685.   if (AutoPlay.loggingInfo) setTimeout(AutoPlay.logging, 20*1000);
  686.   AutoPlay.ascendLimit = 0.9*Math.floor(2*(1-Game.ascendMeterPercent));
  687. }
  688.  
  689. AutoPlay.mustRebornAscend = function() { return !([78,93,94,95].every(function(a) { return Game.AchievementsById[a].won; })); }
  690.  
  691. AutoPlay.doAscend = function(str,log) {
  692.   AutoPlay.wantAscend=AutoPlay.plantPending || AutoPlay.harvestPlant;
  693.   AutoPlay.addActivity("Preparing to ascend.");
  694.   if (AutoPlay.wantAscend) return; // do not ascend when we wait for a plant to mature
  695.   // for (var i in Game.buffs) { if(Game.buffs[i].time>=0) return; } // do not ascend while we have buffs - does not work well with cheating golden
  696.   AutoPlay.debugInfo(str);
  697.   AutoPlay.loggingInfo=log?str:0;
  698. //  if(AutoPlay.checkAllAchievementsOK(false)) { AutoPlay.logging(); return; } // do not ascend when we are finished
  699.   if(Game.wrinklers.some(function(w) { return w.close; } )) AutoPlay.assignSpirit(0,"scorn",1);
  700.   Game.wrinklers.forEach(function(w) { if (w.close==1) w.hp=0; } ); // pop all wrinklers
  701.   if (Game.isMinigameReady(Game.Objects["Farm"])) Game.Objects["Farm"].minigame.harvestAll(); // harvest garden
  702.   if (Game.Upgrades["Chocolate egg"].unlocked && !Game.Upgrades["Chocolate egg"].bought) {
  703.     if (Game.dragonLevel>=9) { // setting first aura to earth shatterer
  704.       Game.specialTab="dragon"; Game.SetDragonAura(5,0);
  705.       Game.ConfirmPrompt(); Game.ToggleSpecialMenu(0);
  706.         }
  707.         Game.ObjectsById.forEach(function(e) { e.sell(e.amount); } );
  708.     Game.Upgrades["Chocolate egg"].buy();
  709.   } else { AutoPlay.delay=10; Game.Ascend(true); }
  710. }
  711.  
  712. //===================== Handle Achievements ==========================
  713. AutoPlay.wantedAchievements = [82, 89, 108, 225, 227, 229, 279, 280, 372, 373, 374, 375, 390, 391, 389, 395];
  714. AutoPlay.nextAchievement=AutoPlay.wantedAchievements[0];
  715.  
  716. AutoPlay.endPhase = function() { return AutoPlay.wantedAchievements.indexOf(AutoPlay.nextAchievement)<0; }
  717.  
  718. AutoPlay.grinding = function() { return Game.AchievementsById[373].won /*&& !Game.AchievementsById[391].won*/; }
  719.  
  720. AutoPlay.mainActivity="Doing nothing in particular.";
  721.  
  722. AutoPlay.setMainActivity = function(str) {
  723.   AutoPlay.mainActivity=str;
  724.   AutoPlay.debugInfo(str);
  725. }
  726.  
  727. AutoPlay.findNextAchievement = function() {
  728.   AutoPlay.wantAscend=false;
  729.   AutoPlay.handleSmallAchievements();
  730.   for(i = 0; i < AutoPlay.wantedAchievements.length; i++) {
  731.     if (!(Game.AchievementsById[AutoPlay.wantedAchievements[i]].won)) {
  732.           AutoPlay.nextAchievement = AutoPlay.wantedAchievements[i];
  733.           AutoPlay.setMainActivity("Trying to get achievement: " + Game.AchievementsById[AutoPlay.nextAchievement].desc);
  734.           return;
  735.         }
  736.   }
  737.   AutoPlay.checkAllAchievementsOK(true);
  738. }
  739.  
  740. AutoPlay.checkAllAchievementsOK = function(log) { // could remove the parameter ...
  741.   for (var i in Game.Achievements) {
  742.     var me=Game.Achievements[i];
  743.     if (!me.won && me.pool!="dungeon" && me.id!=367) { // missing achievement, but do not stop for legacy of one year
  744.       if(log) AutoPlay.setMainActivity("Missing achievement #" + me.id + ": " + me.desc + ", try to get it now.");
  745.           if(log) AutoPlay.nextAchievement=me.id;
  746.           return false;
  747.   } }
  748.   for (var i in Game.Upgrades) {
  749.     var me=Game.Upgrades[i];
  750.     if (me.pool=='prestige' && !me.bought) { // we have not all prestige upgrades yet
  751.       if(log) AutoPlay.nextAchievement=AutoPlay.wantedAchievements[AutoPlay.wantedAchievements.length-1];
  752.       if(log) AutoPlay.setMainActivity("Prestige upgrade " + me.name + " is missing, waiting to buy it.");
  753.           if(log) Game.RemoveAchiev(Game.AchievementsById[AutoPlay.nextAchievement].name);
  754.           return false;
  755.   } }
  756.   if(!Game.Achievements["So much to do so much to see"].won) { //wait until the end of the year - achievement 367
  757.     var me=Game.Achievements["So much to do so much to see"];
  758.     if(log) AutoPlay.setMainActivity("Missing achievement #" + me.id + ": " + me.desc + ", try to get it now.");
  759.         if(log) AutoPlay.nextAchievement=me.id;
  760.         return false;
  761.   }
  762.   // finished with playing: idle further
  763.   AutoPlay.finished=true;
  764.   if(log) AutoPlay.setMainActivity("My job is done here, have a nice day. I am still idling along.");
  765.   if(log) AutoPlay.nextAchievement=99; // follow the white rabbit (from dungeons)
  766.   return false;
  767. }
  768.  
  769. AutoPlay.leaveGame = function() {
  770.   clearInterval(AutoPlay.autoPlayer); //stop autoplay:
  771.   AutoPlay.info("My job is done here, have a nice day.");
  772.   if(Game.bakeryName.slice(0,AutoPlay.robotName.length)==AutoPlay.robotName) {
  773.     Game.bakeryName = Game.bakeryName.slice(AutoPlay.robotName.length); Game.bakeryNamePrompt(); Game.ConfirmPrompt();
  774.   }
  775.   return true;
  776. }
  777.  
  778. AutoPlay.findMissingAchievements = function() { // just for testing purposes
  779.   for (var i in Game.Achievements) {
  780.     var me=Game.Achievements[i];
  781.     if (!me.won && me.pool!="dungeon") { // missing achievement
  782.       AutoPlay.debugInfo("missing achievement #" + me.id + ": " + me.desc);
  783.   } }
  784.   for (var i in Game.Upgrades) {
  785.     var me=Game.Upgrades[i];
  786.     if (me.pool=='prestige' && !me.bought) { // we have not all prestige upgrades yet
  787.       AutoPlay.debugInfo("prestige upgrade " + me.name + " is missing.");
  788. } } }
  789.  
  790. //===================== Handle Heavenly Upgrades ==========================
  791. AutoPlay.prioUpgrades = [363,323,411,412,413,264,265,266,267,268,181,282,283,284,291,393,394]; // legacy, dragon, lucky upgrades, permanent slots, season switcher, better golden cookies, kittens, synergies
  792. AutoPlay.kittens = [31,32,54,108,187,320,321,322,425,442,462,494];
  793. AutoPlay.cursors = [0,1,2,3,4,5,6,43,82,109,188,189];
  794. AutoPlay.chancemakers = [416,417,418,419,420,421,422,423,441,493];
  795. AutoPlay.butterBiscuits = [334,335,336,337,400,477,478,479,497];
  796.  
  797. AutoPlay.buyHeavenlyUpgrades = function() {
  798.   AutoPlay.prioUpgrades.forEach(function(id) { var e=Game.UpgradesById[id]; if (e.canBePurchased && !e.bought && e.buy(true)) { AutoPlay.info("buying "+e.name); } });
  799.   Game.UpgradesById.forEach(function(e) { if (e.canBePurchased && !e.bought && e.buy(true)) { AutoPlay.info("buying "+e.name); } });
  800.   AutoPlay.assignPermanentSlot(1,AutoPlay.kittens);
  801.   AutoPlay.assignPermanentSlot(2,AutoPlay.chancemakers);
  802.   if(!Game.Achievements["Reincarnation"].won) { // for many ascends
  803.     AutoPlay.assignPermanentSlot(0,AutoPlay.cursors);
  804.     AutoPlay.assignPermanentSlot(3,[52]); // lucky day
  805.     AutoPlay.assignPermanentSlot(4,[53]); // serendipity
  806.   } else { //collect rare things
  807.     AutoPlay.assignPermanentSlot(0,AutoPlay.butterBiscuits);
  808.     AutoPlay.assignPermanentSlot(3,[226]); // omelette
  809.         if(Game.Achievements["Elder nap"].won && Game.Achievements["Elder slumber"].won && Game.Achievements["Elder calm"].won)
  810.       AutoPlay.assignPermanentSlot(4,[72]); // arcane sugar
  811.         else AutoPlay.assignPermanentSlot(4,[53]); // serendipity
  812.   }
  813. }
  814.  
  815. AutoPlay.assignPermanentSlot = function(slot,options) {
  816.   if (!Game.UpgradesById[264+slot].bought) return;
  817.   Game.AssignPermanentSlot(slot);
  818.   for (var i=options.length-1; i>=0; i--) { if(Game.UpgradesById[options[i]].bought) { Game.PutUpgradeInPermanentSlot(options[i],slot); break; } }
  819.   Game.ConfirmPrompt();
  820. }
  821.  
  822. //===================== Handle Dragon ==========================
  823. AutoPlay.handleDragon = function() {
  824.   if (Game.Upgrades["A crumbly egg"].unlocked) {
  825.     if (Game.dragonLevel<Game.dragonLevels.length-1 && Game.dragonLevels[Game.dragonLevel].cost()) {
  826.       Game.specialTab="dragon"; Game.UpgradeDragon(); Game.ToggleSpecialMenu(0);
  827.   } }
  828.   if ((Game.dragonAura==0) && (Game.dragonLevel>=5)) { // set first aura to kitten (breath of milk)
  829.     Game.specialTab="dragon"; Game.SetDragonAura(1,0);
  830.     Game.ConfirmPrompt(); Game.ToggleSpecialMenu(0);
  831.   }
  832.   if ((Game.dragonAura==1) && (Game.dragonLevel>=19)) { // set first aura to prism (radiant appetite)
  833.     Game.specialTab="dragon"; Game.SetDragonAura(15,0);
  834.     Game.ConfirmPrompt(); Game.ToggleSpecialMenu(0);
  835.   }
  836.   if ((Game.dragonAura2==0) && (Game.dragonLevel>=Game.dragonLevels.length-1)) { // set second aura to kitten (breath of milk)
  837.     Game.specialTab="dragon"; Game.SetDragonAura(1,1);
  838.     Game.ConfirmPrompt(); Game.ToggleSpecialMenu(0);
  839. } }
  840.  
  841. //===================== Menu ==========================
  842. //somehow the toggle off goes away after some short period.
  843.  
  844. if(!AutoPlay.Backup) AutoPlay.Backup = {};
  845. AutoPlay.Config = {};
  846. AutoPlay.ConfigData = {};
  847. AutoPlay.Disp = {};
  848.  
  849. AutoPlay.ConfigPrefix = 'autoplayConfig';
  850.  
  851. AutoPlay.SaveConfig = function(config) {
  852.         localStorage.setItem(AutoPlay.ConfigPrefix, JSON.stringify(config));
  853. }
  854.  
  855. AutoPlay.LoadConfig = function() {
  856.         if (localStorage.getItem(AutoPlay.ConfigPrefix) != null) {
  857.                 AutoPlay.Config = JSON.parse(localStorage.getItem(AutoPlay.ConfigPrefix));
  858.  
  859.                 // Check values
  860.                 var mod = false;
  861.                 for (var i in AutoPlay.ConfigDefault) {
  862.                         if (typeof AutoPlay.Config[i] === 'undefined' || AutoPlay.Config[i] < 0 || AutoPlay.Config[i] >= AutoPlay.ConfigData[i].label.length) {
  863.                                 mod = true;
  864.                                 AutoPlay.Config[i] = AutoPlay.ConfigDefault[i];
  865.                         }
  866.                 }
  867.                 if (mod) AutoPlay.SaveConfig(AutoPlay.Config);
  868.         }
  869.         else { // Default values
  870.                 AutoPlay.RestoreDefault();
  871.         }
  872. }
  873.  
  874. AutoPlay.RestoreDefault = function() {
  875.         AutoPlay.Config = {};
  876.         AutoPlay.SaveConfig(AutoPlay.ConfigDefault);
  877.         AutoPlay.LoadConfig();
  878.         Game.UpdateMenu();
  879. }
  880.  
  881. AutoPlay.ToggleConfig = function(config) {
  882.         AutoPlay.ToggleConfigUp(config);
  883.         if (AutoPlay.Config[config] == 0) {
  884.                 l(AutoPlay.ConfigPrefix + config).className = 'option off';
  885.         }
  886.         else {
  887.                 l(AutoPlay.ConfigPrefix + config).className = 'option';
  888.         }
  889. }
  890.  
  891. AutoPlay.WaitConfig = function(config) {
  892. }
  893.  
  894. AutoPlay.ToggleConfigUp = function(config) {
  895.         AutoPlay.Config[config]++;
  896.         if (AutoPlay.Config[config] == AutoPlay.ConfigData[config].label.length) {
  897.                 AutoPlay.Config[config] = 0;
  898.         }
  899.         l(AutoPlay.ConfigPrefix + config).innerHTML = AutoPlay.Disp.GetConfigDisplay(config);
  900.         AutoPlay.SaveConfig(AutoPlay.Config);
  901. }
  902.  
  903. AutoPlay.ConfigData.NightMode = {label: ['OFF', 'AUTO', 'ON'], desc: 'Handling of night mode'};
  904. AutoPlay.ConfigData.ClickMode = {label: ['OFF', 'AUTO', 'LIGHT SPEED', 'RIDICULOUS SPEED', 'LUDICROUS SPEED'], desc: 'Clicking speed'};
  905. AutoPlay.ConfigData.GoldenClickMode = {label: ['OFF', 'AUTO', 'ALL'], desc: 'Golden Cookie clicking mode'};
  906. AutoPlay.ConfigData.CheatLumps = {label: ['OFF', 'AUTO', 'LITTLE', 'MEDIUM', 'MUCH'], desc: 'Cheating of sugar lumps'};
  907. AutoPlay.ConfigData.CheatGolden = {label: ['OFF', 'AUTO', 'LITTLE', 'MEDIUM', 'MUCH'], desc: 'Cheating of golden cookies'};
  908. AutoPlay.ConfigData.CleanLog = {label: ['Clean Log'], desc: 'Cleaning the log'};
  909. AutoPlay.ConfigData.ShowLog = {label: ['Show Log'], desc: 'Showing the log'};
  910.  
  911. AutoPlay.ConfigDefault = {NightMode: 1, ClickMode: 1, GoldenClickMode: 1, CheatLumps: 1, CheatGolden: 1, CleanLog: 0, ShowLog: 0}; // default
  912.  
  913. AutoPlay.LoadConfig();
  914.  
  915. AutoPlay.Disp.GetConfigDisplay = function(config) {
  916.         return AutoPlay.ConfigData[config].label[AutoPlay.Config[config]];
  917. }
  918.  
  919. AutoPlay.Disp.AddMenuPref = function() {
  920.         var header = function(text) {
  921.                 var div = document.createElement('div');
  922.                 div.className = 'listing';
  923.                 div.style.padding = '5px 16px';
  924.                 div.style.opacity = '0.7';
  925.                 div.style.fontSize = '17px';
  926.                 div.style.fontFamily = '\"Kavoon\", Georgia, serif';
  927.                 div.textContent = text;
  928.                 return div;
  929.         }
  930.  
  931.         var frag = document.createDocumentFragment();
  932.  
  933.         var div = document.createElement('div');
  934.         div.className = 'title ' + AutoPlay.Disp.colorTextPre + AutoPlay.Disp.colorBlue;
  935.         div.textContent = 'Cookiebot Options';
  936.        
  937.         frag.appendChild(div);
  938.  
  939.         var listing = function(config,clickFunc) {
  940.                 var div = document.createElement('div');
  941.                 div.className = 'listing';
  942.                 var a = document.createElement('a');
  943.                 a.className = 'option';
  944.                 if (AutoPlay.ConfigData[config].toggle && AutoPlay.Config[config] == 0) a.className = 'option off';
  945.                 a.id = AutoPlay.ConfigPrefix + config;
  946.                 a.onclick = function() { AutoPlay.ToggleConfig(config); };
  947.                 if(clickFunc) a.onclick = clickFunc;
  948.                 a.textContent = AutoPlay.Disp.GetConfigDisplay(config);
  949.                 div.appendChild(a);
  950.                 var label = document.createElement('label');
  951.                 label.textContent = AutoPlay.ConfigData[config].desc;
  952.                 div.appendChild(label);
  953.                 return div;
  954.         }
  955.  
  956.         frag.appendChild(listing('NightMode',null));
  957.         frag.appendChild(listing('ClickMode',null));
  958.         frag.appendChild(listing('GoldenClickMode',null));
  959.         frag.appendChild(header('Cheating'));
  960.         frag.appendChild(listing('CheatLumps',null));
  961.         frag.appendChild(listing('CheatGolden',null));
  962.         frag.appendChild(header('Logging'));
  963.         frag.appendChild(listing('CleanLog',AutoPlay.cleanLog));
  964.         frag.appendChild(listing('ShowLog',AutoPlay.showLog));
  965.  
  966.         l('menu').childNodes[2].insertBefore(frag, l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1]);
  967. }
  968.  
  969. if(!AutoPlay.Backup.UpdateMenu) { console.log("new update menu"); AutoPlay.Backup.UpdateMenu = Game.UpdateMenu; }
  970.  
  971. Game.UpdateMenu = function() {
  972.         AutoPlay.Backup.UpdateMenu();
  973.         if (Game.onMenu == 'prefs') {
  974.                 AutoPlay.Disp.AddMenuPref();
  975.         }
  976. }
  977.  
  978. //===================== Auxiliary ==========================
  979.  
  980. AutoPlay.info = function(s) { console.log("### "+s); Game.Notify("Automatic Playthrough",s,1,100); }
  981. AutoPlay.debugInfo = function(s) { console.log("======> "+s); Game.Notify("Debugging CookieBot",s,1,20); }
  982.  
  983. AutoPlay.logging = function() {
  984.   var before=window.localStorage.getItem("autoplayLog");
  985.   var toAdd="#logging autoplay V" + AutoPlay.version + " with " + AutoPlay.loggingInfo + "\n" + Game.WriteSave(1) + "\n";
  986.   AutoPlay.loggingInfo=0;
  987.   window.localStorage.setItem("autoplayLog",before+toAdd);
  988. }
  989.  
  990. AutoPlay.cleanLog = function() {
  991.   window.localStorage.setItem("autoplayLog","");
  992. }
  993.  
  994. AutoPlay.showLog = function() {
  995.   Game.Prompt('<h3>Cookie Bot Log</h3><div class="block">This is the log of the bot with saves at important stages.<br>Copy it and use it as you like.</div><div class="block"><textarea id="textareaPrompt" style="width:100%;height:128px;" readonly>'+window.localStorage.getItem("autoplayLog")+'</textarea></div>',['All done!']);
  996. }
  997.  
  998. AutoPlay.handleNotes = function() {
  999.   for (var i in Game.Notes) {
  1000.     if (Game.Notes[i].quick==0) { Game.Notes[i].life=2000*Game.fps; Game.Notes[i].quick=1; }
  1001. } }
  1002.  
  1003. function range(start, end) {
  1004.   var foo = [];
  1005.   for (var i = start; i <= end; i++) { foo.push(i); }
  1006.   return foo;
  1007. }
  1008.  
  1009. AutoPlay.whatTheBotIsDoing = function() {
  1010.   return '<div style="padding:8px;width:400px;font-size:11px;text-aligfwen:center;">'+
  1011.     '<span style="color:#6f6;font-size:18px"> What is the bot doing?</span>'+
  1012.     '<div class="line"></div>'+
  1013.     AutoPlay.activities+
  1014.         '</div>';
  1015. }
  1016.  
  1017. AutoPlay.addActivity = function(str) {
  1018.   if(!AutoPlay.activities.includes(str)) AutoPlay.activities+= '<div class="line"></div>'+str;
  1019. }
  1020.  
  1021. //===================== Init & Start ==========================
  1022.  
  1023. if (AutoPlay.autoPlayer) { AutoPlay.info("replacing old version of autoplay"); clearInterval(AutoPlay.autoPlayer); }
  1024. AutoPlay.autoPlayer = setInterval(AutoPlay.run, 300); // was 100 before, but that is too quick
  1025. AutoPlay.findNextAchievement();
  1026. l('versionNumber').innerHTML='v. '+Game.version+" (with autoplay v."+AutoPlay.version+")";
  1027. l('versionNumber').innerHTML='v. '+Game.version+' <span '+Game.getDynamicTooltip('AutoPlay.whatTheBotIsDoing','this')+">(with autoplay v."+AutoPlay.version+")"+'</span>';
  1028. if (Game.version != AutoPlay.gameVersion) AutoPlay.info("Warning: cookieBot is last tested with cookie clicker version " + AutoPlay.gameVersion);

OCJC Pastebin is a general-purpose paste service.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste
',['All done!']); } AutoPlay.handleNotes = function() { for (var i in Game.Notes) { if (Game.Notes[i].quick==0) { Game.Notes[i].life=2000*Game.fps; Game.Notes[i].quick=1; } } } function range(start, end) { var foo = []; for (var i = start; i <= end; i++) { foo.push(i); } return foo; } AutoPlay.whatTheBotIsDoing = function() { return '
'+ ' What is the bot doing?'+ '
'+ AutoPlay.activities+ '
'; } AutoPlay.addActivity = function(str) { if(!AutoPlay.activities.includes(str)) AutoPlay.activities+= '
'+str; } //===================== Init & Start ========================== if (AutoPlay.autoPlayer) { AutoPlay.info("replacing old version of autoplay"); clearInterval(AutoPlay.autoPlayer); } AutoPlay.autoPlayer = setInterval(AutoPlay.run, 300); // was 100 before, but that is too quick AutoPlay.findNextAchievement(); l('versionNumber').innerHTML='v. '+Game.version+" (with autoplay v."+AutoPlay.version+")"; l('versionNumber').innerHTML='v. '+Game.version+' (with autoplay v."+AutoPlay.version+")"+''; if (Game.version != AutoPlay.gameVersion) AutoPlay.info("Warning: cookieBot is last tested with cookie clicker version " + AutoPlay.gameVersion);

Login or Register to edit or fork this paste. It's free.