2022-04-13
there are a few problems in the original cookie clicker that kept bugging me:
but i made fixes/workarounds for them:
i mainly play cookie clicker off of a local copy of the game, which i got from
=> https://github.com/ozh/cookieclicker
this copy has an outdated buildings.png so i got a new one from
=> https://orteil.dashnet.org/cookieclicker/img/
i hardcoded the heralds and custom grandma names to what they currently are based off:
=> https://orteil.dashnet.org/patreon/grab.php
and also console.log(Game.customGrandmaNames) on the web console of
=> https://orteil.dashnet.org/cookieclicker/
which i then minified using
=> https://duckduckgo.com/?q=minify+js
so i could fully get the benefits of the online version. orteil blocked cross-origin requests for /patreon/grab.php and server.php?q=checkupdate, so i didn't change the code for loading them.
i changed the buy mechanic to only work if there are enough cookies to buy # in bulk. i use "buy 100" and "sell all" a lot for the godzamok buff, but sometimes i accidentally click one more time than i wanted and then the game takes away all my money to buy 10 buildings. this is because the game will buy as many buildings as possible if there aren't enough cookies to buy 100.
i also added a buy max button because my edit removes the pseudo-"buy max" functionality "buy 100" originally had. i used 1000 as the amount because because it's the same number as the original "sell all" mechanic and it's unrealistic to have enough cookies to buy 1000 of one building in one go (costing a minimum of 15 vigintillion cookies) + i wouldn't sell my cursors for the godzamok buff since they're integral to my cookies per second.
the thing about cookie clicker is that the progession is ground to a halt past 90% of upgrades, which is around sexdecillion cookies. that's many powers of 10 away from the vigintillions. i'd have to dedicate myself to months or years of combos and waiting for months for enough sugar lumps to get very minimal boosts to get there.
i changed main.js to apply my modifications, instead of making a bookmarklet or userscript. but i might make one in the future.
one thing that was slightly crazy to me was how i didn't have to write var to create variables. felt like i was making up fake variables and every file, interpreter, code editor, etc. was just agreeing with them.
code:
Game.heralds=41; Game.customGrandmaNames=["Patreona","Janice","Gabrielle","Grandma McGrandmaface","Charlie","\"egg\" Sr.","Jet-dayo","Natsuki","Ivy","Rose","Babayaga","Grandma #42","SneakySquid","Swad Plan","Meep Moop","Psychedelic Rapper Andrew JD","Telos","Moondoge","Lily Bowen","Mrs PoopyButthole","Mrs Sugai Kirin","Survivor of the Stale","Betty Ann Niemi","Tjien Nio","The First Baker","Mamichette","dQw4w9WgXcQ","Carmelina Calabrese","The GrandNut","La mere Michel","Aune Mummo","Jeff Junior","Her?","Rydh","Euphegenia Doubtfire","Bear","How did you find me, JUNESUK?","Ahtelo","Steve...?","Fanny","DAF Pvnk - Mother of trucks","Koisuru Fortune Grandma","Lieselotte","Izual Rebirth","Cosma-Tanti","Starco","Knitting Slave","Forgotten Abbey","Granny Rags","Mrs. Fizzwidget","Nakamoto","Zan Tart-izanne","The Roach Queen","Khookiesi, Grandmother of Dragonflights","Hey guys, Dexterfan99 here","Aryll","Ms. Chievous","Don't Stop Me Now","Dauna","Gerry","Erina Pendleton-Joestar","Stacy's Grandma","Benyboy","Rosie Beestinger","Tesco employee #65","Oda","Grandma Jones","Dan","Krieg","Chris","Kamilla","Tandy","Elisabeth","MinionMemer","Eanydo Erdman","Cookieatron4000","TechhX","Turtlenator","Carmelina","Shiny Blue Grandma","Anne","Penka","\"Hey guys, it's Nicole\"","Cora","Freya28","Kiwibajs","EEEEEE","Ms. Denis Gur Arie","Idling Vasha","?????","Tammie","Grandma Kara","Sanda Reiss","Alex","Mirle","Audrey","Ittle Dew","You're Killing Me Smols","Baker? I hardly know her!","A Duplicate Grandma","Betty Margaret Davis","Chlorophyte Grandma","Felpinhazinha","Satan's grandmother","Ruby Rose","Miyori Grandma","Geuser","Anneliese","Pielak","Swamper","Pikachi","Grackitz","Deborah Wright","BUT IT WAS ME, DIO!","Barbara","SERAS FAMO!!!","Audrey Porter","Benny Zhy","Doctergreen","Kage","Jarvis Fishwick","Elder Pledge 668x in a row...","Tell Cersei, it was me.","Kimahri","Henrietta Gertrude","Tyler Liddick","noisypineapples","Linda-Bea Dolvoy","DevilishWarrior","Exterminator","Matthue Loose","Caden","moist butterscotch lips","Alireah","Fey Yoshida","Aviators","Ashlee <3","He Had Boxing Gloves On","Falling Collin","Error 404: Name not Found","Groz","Granny Jonathan","Hanna Highmark","Nonmoving Osmond","The Worm Which Waits","Lurking Tealeaf","Ruby Wrinkle","Her","\"Eggy Grandma\"","Cookie maker 100","Addison Bennett","Nasus","Only 30 characters, huh? Fine.","Matt Was Here","ScartTheWaz","Tanyac Crimson","Ume Ito","VenMissa","Velma Francis","amdnarG","Leota Marie","Nikola","Grandmommy Celestine","Annuziatta","hosh...","E","Joe Grandmomma","Granny Grearest","Vivian","Vovó Dal","Baker of Steak Cookies","Aku daikan","SkeletonJoke","David loves Rachel! <3","Polar","Loremaster Rawlins","lickin my cookie","Fmaily Gyu funy momens #420","Ms. Cppkies","WillStreet","Ian's Mom","Grandma Divah","Betty BeardPuller","Mamie Cobol","200rassberris","ipm1234","Galadion","Olive Gardenia","Megan I. McIntosh","Lady Sweets","Rivne","Autosuffisant","BoShek","Brooke Chumbers","Cthulhu","??pu???","binbinuser","Amma Jóna","the book was empty","Berit","DRIFTER1117","Yackemflam","Help me","YeOl'GrammityGram","Mason W","Peggy Hattenfels","majik","latte","amogus","Samuel Robertson","Anneliese Albina Emma","Barack Obama","Gramma Margaret"]; Game.attachTooltip(l('heralds'),function(){ var str=''; if (!Game.externalDataLoaded) { Game.heralds = 41; str+='Heralds couldn\'t be loaded. There may be an issue with our servers, or you are playing the game locally.'; str+=''; str+=(Game.heralds==1?'1 herald is':''+Game.heralds+' heralds are')+' selflessly inspiring a boost in production for everyone, resulting in
+'+Game.heralds+'% cookies per second.'; str+=''; if (Game.ascensionMode==1) str+='You are in a Born again run, and are not currently benefiting from heralds.'; else if (Game.Has('Heralds')) str+='You own the Heralds upgrade, and therefore benefit from the production boost.'; else str+='To benefit from the herald bonus, you need a special upgrade you do not yet own. You will permanently unlock it later in the game.'; }else { if (Game.heralds==0) str+='There are no heralds at the moment. Please consider donating to our Patreon!'; else { str+=(Game.heralds==1?'1 herald is':''+Game.heralds+' heralds are')+' selflessly inspiring a boost in production for everyone, resulting in
+'+Game.heralds+'% cookies per second.'; str+=''; if (Game.ascensionMode==1) str+='You are in a Born again run, and are not currently benefiting from heralds.'; else if (Game.Has('Heralds')) str+='You own the Heralds upgrade, and therefore benefit from the production boost.'; else str+='To benefit from the herald bonus, you need a special upgrade you do not yet own. You will permanently unlock it later in the game.'; } } str+='Heralds are people who have donated to our highest Patreon tier, and are limited to 100.
Each herald gives everyone +1% CpS.
Heralds benefit everyone playing the game, regardless of whether you donated.'; str+=''; return ''; },'this'); Game.storeBulkButton=function(id) { if (id==0) Game.buyMode=1; else if (id==1) Game.buyMode=-1; else if (id==2) Game.buyBulk=1; else if (id==3) Game.buyBulk=10; else if (id==4) Game.buyBulk=100; else if (id==5) { if (Game.buyMode == -1) Game.buyBulk=-1; else Game.buyBulk = 1000; } if (Game.buyMode==1 && Game.buyBulk==-1) Game.buyBulk=100; if (Game.buyMode==-1 && Game.buyBulk==1000) Game.buyBulk=-1; if (Game.buyMode==1) l('storeBulkBuy').className='storePreButton storeBulkMode selected'; else l('storeBulkBuy').className='storePreButton storeBulkMode'; if (Game.buyMode==-1) l('storeBulkSell').className='storePreButton storeBulkMode selected'; else l('storeBulkSell').className='storePreButton storeBulkMode'; if (Game.buyBulk==1) l('storeBulk1').className='storePreButton storeBulkAmount selected'; else l('storeBulk1').className='storePreButton storeBulkAmount'; if (Game.buyBulk==10) l('storeBulk10').className='storePreButton storeBulkAmount selected'; else l('storeBulk10').className='storePreButton storeBulkAmount'; if (Game.buyBulk==100) l('storeBulk100').className='storePreButton storeBulkAmount selected'; else l('storeBulk100').className='storePreButton storeBulkAmount'; if (Game.buyBulk==-1 || Game.buyBulk==1000) l('storeBulkMax').className='storePreButton storeBulkAmount selected'; else l('storeBulkMax').className='storePreButton storeBulkAmount'; if (Game.buyMode==1) { l('storeBulkMax').textContent='max'; l('products').className='storeSection'; } else { l('storeBulkMax').textContent='all'; l('products').className='storeSection selling'; } Game.storeToRefresh=1; if (id!=-1) PlaySound('snd/tick.mp3'); } this.getSumPrice=function(amount)//return how much it would cost to buy [amount] more of this building { var price=0; this.bulkAmount = 0; for (var i=Math.max(0,this.amount);iHeralds
'+str+'= this.getSumPrice(Game.buyBulk) || Game.buyBulk == 1000) { for (var i=0;i =price) { bought++; moni+=price; Game.Spend(price); this.amount++; this.bought++; price=this.getPrice(); this.price=price; if (this.buyFunction) this.buyFunction(); Game.recalculateGains=1; if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled'); this.highest=Math.max(this.highest,this.amount); Game.BuildingsOwned++; success=1; } } } if (success) {PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();} //if (moni>0 && amount>1) Game.Notify(this.name,'Bought '+bought+' for '+Beautify(moni)+' cookies','',2); } this.rebuild=function() { var me=this; //var classes='product'; var price=me.bulkPrice; /*if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';me.locked=0;} else {classes+=' locked';me.locked=1;} if (Game.cookies>=price) classes+=' enabled'; else classes+=' disabled'; if (me.l.className.indexOf('toggledOff')!=-1) classes+=' toggledOff'; */ var icon=[0,me.icon]; var iconOff=[1,me.icon]; if (me.iconFunc) icon=me.iconFunc(); var desc=me.desc; var name=me.name; var displayName=me.displayName; if (Game.season=='fools') { if (!Game.foolObjects[me.name]) { icon=[2,0]; iconOff=[3,0]; name=Game.foolObjects['Unknown'].name; desc=Game.foolObjects['Unknown'].desc; } else { icon=[2,me.icon]; iconOff=[3,me.icon]; name=Game.foolObjects[me.name].name; desc=Game.foolObjects[me.name].desc; } displayName=name; if (name.length>16) displayName=''+name+''; } icon=[icon[0]*64,icon[1]*64]; iconOff=[iconOff[0]*64,iconOff[1]*64]; //me.l.className=classes; //l('productIcon'+me.id).style.backgroundImage='url(img/'+icon+')'; l('productIcon'+me.id).style.backgroundPosition='-'+icon[0]+'px -'+icon[1]+'px'; //l('productIconOff'+me.id).style.backgroundImage='url(img/'+iconOff+')'; l('productIconOff'+me.id).style.backgroundPosition='-'+iconOff[0]+'px -'+iconOff[1]+'px'; l('productName'+me.id).innerHTML=displayName; l('productOwned'+me.id).textContent=me.amount?me.amount:''; l('productPrice'+me.id).textContent=Beautify(Math.round(price)); if (Game.buyBulk!=1000) l('productPriceMult'+me.id).textContent=(Game.buyBulk>1)?('x'+Game.buyBulk+' '):''; else l('productPriceMult'+me.id).textContent=('x'+this.bulkAmount+' '); l('productLevel'+me.id).textContent='lvl '+Beautify(me.level); if (Game.isMinigameReady(me) && Game.ascensionMode!=1) { l('productMinigameButton'+me.id).style.display='block'; if (!me.onMinigame) l('productMinigameButton'+me.id).textContent='View '+me.minigameName; else l('productMinigameButton'+me.id).textContent='Close '+me.minigameName; } else l('productMinigameButton'+me.id).style.display='none'; }
update 2022-07-11 renamed
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).