Cookie Clicker Minihack

Adding some basic hack features to Orteil's Cookie Clicker games

  1. // ==UserScript==
  2. // @name Cookie Clicker Minihack
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.3
  5. // @description Adding some basic hack features to Orteil's Cookie Clicker games
  6. // @author You
  7. // @match *orteil.dashnet.org/cookieclicker/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. setTimeout(function() {
  12. 'use strict';
  13. // variables
  14. const config = {
  15. goldenCookies: true, // autoclick all golden cookies
  16. hideNotes: true, // notes/notifications
  17. autoClickSpeed: 20, // false to disable - number to choose clicks per secound
  18. autoshop: 800, // number of each item you want to have before it stops buying automatically
  19. disableBadEffects: true, // disable all negative effects (that I know about)
  20. addTimeToBuffs: 60, // number of secs more time to buffs ("boosts" like "Frenzy")
  21. extremeBoost: true // activates the "sugar frenzy" buff with extreme boost
  22. };
  23. // disable autoshop for this hack; it will add items from the shop for free all the time anyway
  24. config.ultimateHack = false;
  25.  
  26. // elements to use again, and again, and still again
  27. const shimmers = document.getElementById('shimmers'),
  28. notes = document.getElementById('notes'),
  29. bigCookie = document.getElementById('bigCookie'),
  30. upgrades = document.getElementById('upgrades'),
  31. shop = document.getElementById('products');
  32.  
  33. // autoclick any golden cookies
  34. if (config.goldenCookies) {
  35. setInterval(function() {
  36. let goldenCookies = shimmers.childNodes;
  37. if (goldenCookies.length === 0) return;
  38. for (let i = 0; i < goldenCookies.length; i++) {
  39. goldenCookies[i].click();
  40. }
  41. }, 500);
  42. }
  43.  
  44. // hide annoying notes/notifications located in bottom center
  45. if (config.hideNotes) {
  46. notes.style.display = 'none';
  47. }
  48.  
  49. // autoclick the cookie - limit to x times every secound for preventing overload
  50. if (typeof config.autoClickSpeed === 'number' && config.autoClickSpeed >= 0) {
  51. setInterval(() => {
  52. bigCookie.click();
  53. }, 1000 / config.autoClickSpeed);
  54. }
  55.  
  56. // auto upgrade
  57. setInterval(() => {
  58. const enabledEls = upgrades.childNodes;
  59. for (let i = 0; i < enabledEls.length; i++) {
  60. enabledEls[i].click();
  61. }
  62. }, 100);
  63.  
  64. // autoshop
  65. if (typeof config.autoshop === 'number' && config.autoshop >= 0) {
  66. setInterval(function() {
  67. // will toggle on the "buy" if "sell" is choosen
  68. Game.storeBulkButton(0); // eslint-disable-line
  69. // choose to buy only 1 when clicking items - because this code is based on clicking the elements
  70. Game.storeBulkButton(2); // eslint-disable-line
  71. const items = shop.childNodes;
  72. for (let i = 1; i < items.length; i++) {
  73. const item = items[i];
  74. let amountNode = item.getElementsByClassName('content')[0].childNodes[4];
  75. if (amountNode.innerText*1 < config.autoshop) {
  76. item.click(); // click item if you can afford it, and you don't have the amount you want
  77. }
  78. }
  79. }, 200);
  80. }
  81.  
  82. // disable bad effects
  83. if (config.disableBadEffects) {
  84. Game.SpawnWrinkler=function(){}; // eslint-disable-line
  85. window.Game.UpdateGrandmapocalypse=function(){};
  86. const badBuffs = ['clot', 'building debuff'];
  87. const origGainBuff = Game.gainBuff; // eslint-disable-line
  88. Game.gainBuff = function (type, time, ...args) { // eslint-disable-line
  89. if (typeof type !== 'string' || badBuffs.includes(type)) return console.log(`The "${type}"-buff got prevented from taking over your CpS`);
  90. else origGainBuff(type, time += parseInt(config.addTimeToBuffs), ...args);
  91. }
  92. }
  93.  
  94. // finish the game with hack, but without the cheat achievement?
  95. if (config.ultimateHack && (typeof config.autoshop !== 'number' || config.autoshop === 0)) {
  96. setInterval(() => {
  97. //
  98. }, 500) // every 0,5 sec
  99. }
  100.  
  101. if (config.extremeBoost) {
  102. setInterval(function() {
  103. Game.gainBuff('sugar frenzy', 10, 1e9); // eslint-disable-line
  104. }, 10*1e3 + 10);
  105. }
  106.  
  107. }, 3e3); // wait 3 sec before actually running this script

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址