Cookie Clicker hack

Just a cookie clicker hack.

  1. // ==UserScript==
  2. // @name Cookie Clicker hack
  3. // @namespace https://gf.qytechs.cn/ru/scripts/392425-cookie-clicker-hack
  4. // @version 1.5.1
  5. // @license MIT
  6. // @description Just a cookie clicker hack.
  7. // @author hasha2982
  8. // @match *://orteil.dashnet.org/cookieclicker/*
  9. // @match *://orteil.dashnet.org/cookieclicker/
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // NOTE: Don't works in IE!
  14.  
  15. console.log('[== Starting hack... ==]');
  16.  
  17. var ans = '';
  18. var confirmans = false;
  19. var forCookies = {
  20. iter: 0,
  21. ctr: 0
  22. };
  23.  
  24. const hinfo = {
  25. version: '1.5',
  26. changes: ''
  27. };
  28.  
  29. var ac = {
  30. sure: false,
  31. click: function() {
  32. document.getElementById('bigCookie').click();
  33. },
  34. timer: null, // used for clearTimeout in ac.termtimer()
  35. termtimer: function() {
  36. if (ac.timer === null) {
  37. alert('false ac.termtimer() call');
  38. console.log(ac);
  39. } else {
  40. clearTimeout(ac.timer);
  41. }
  42. },
  43. warning: false
  44. };
  45.  
  46. /*var spawnReindeer = function() {
  47. var newReindeer = new Game.shimmer('reindeer');
  48. };*/
  49.  
  50. var mwheel = {
  51. active: false,
  52. active2: false
  53. };
  54.  
  55. var getFree = {
  56. itemName: '',
  57. wrongItem: false
  58. };
  59.  
  60. var buffs = {
  61. duration: 0,
  62. pow: 0
  63. };
  64.  
  65. var CookiePatcher = {
  66. patchedGrimoireBackfire: function(spell) {var failChance=0;return failChance;},
  67. originalGrimoireBackfire: function(spell) {var failChance=0.15;if(Game.hasBuff('Magic adept'))failChance*=0.1;if(Game.hasBuff('Magic inept'))failChance*=5;if(spell.failFunc)failChance=spell.failFunc(failChance);return failChance;} // Taken from original Cookie Clicker v.2.022 code and minified.
  68. };
  69.  
  70. document.onkeydown = function(e){
  71. e = e || window.event;
  72. var key = e.which || e.keyCode;
  73. if(key===72){
  74. hackMenu();
  75. } else if (key === 67) {
  76. ac.termtimer();
  77. }
  78. }; // thx StackOverflow
  79.  
  80. var hmenuText = 'Welcome to hasha2982\'s Cookie Clicker hack edited by bob448 v.' + hinfo.version + '!\nPlease enter a number of the function below:\n1) Earn free cookies\n2) Spawn golden cookies\n3) Autoclicker (tested on Cookie Clicker v.2.022)\n4) Mouse Wheel mode\n5) Buy for Free\n6) Earn Sugar lumps\n7) Gain buffs\n8) Grimoire hacks\n9) Earn Heavenly Chips';
  81.  
  82. function hackMenu() {
  83. // if (event.code = 'KeyH') {
  84. ans = prompt(hmenuText);
  85. if (ans == '1') {
  86. ans = prompt('How many cookies do you want to earn?');
  87. if (ans === "" || ans === null) {
  88. alert('Cancelled.');
  89. } else {
  90. Game.cookies += Number(ans);
  91. Game.cookiesEarned += Number(ans);
  92. }
  93. ///////////////////////////////////////////////////
  94. } else if (ans == '2') {
  95. ans = prompt('How many cookies do you want to spawn?');
  96. if (!(ans === "" || ans === null) && Number(ans) > 0) {
  97. forCookies.iter = Number(ans);
  98. for (; forCookies.ctr < forCookies.iter; forCookies.ctr++) {
  99. var newShimmer=new Game.shimmer("golden");
  100. console.log(`Golden cookie spawned.\nIteration ${forCookies.ctr} is finished.\nIterations remaining: ${forCookies.iter - forCookies.ctr}`);
  101. }
  102. forCookies.iter = 0;
  103. forCookies.ctr = 0;
  104. } else {
  105. alert('Cancelled.');
  106. }
  107. }
  108. ////////////////////////////////////////////////////
  109. /*else if (ans === '3') {
  110. Game.Notify('Note from the hack', 'Reindeer will be spawned in 2 seconds.');
  111. setTimeout(spawnReindeer, 2000);
  112. }*/
  113. ////////////////////////////////////////////////////
  114. else if (ans == '3') {
  115. ans = prompt('Enter delay between clicks in ms. (1000 ms. = 1 s.)\n(press \'c\' to disable autoclicker)');
  116. if (ans === null || ans === "" || ans === '0' || Number(ans) < 1) {
  117. alert('Cancelled.');
  118. } else if (Number(ans) <= 100) {
  119. confirmans = confirm('Delay lower than 100ms. can cause lags.\nAre you sure?');
  120. if (confirmans === true) {
  121. ac.sure = true;
  122. console.log(`ac.sure is set to true\n`); console.log(ac);
  123. }
  124. // if (ac.sure === true) { // here it goes
  125. ac.timer = setInterval(ac.click, Number(ans));
  126. // }
  127. } else {
  128. ac.timer = setInterval(ac.click, Number(ans));
  129. }
  130. }
  131. ////////////////////////////////////////////////////
  132. else if (ans === '4') {
  133. if (mwheel.active === false) {
  134. confirmans = confirm('Mouse wheel mode is disabled.\nIn mouse wheel mode every mouse wheel movement counts as a click on the cookie.\nYou can still use mouse buttons.\nPress \'OK\' to activate mouse wheel mode.\n(sorry for bad English.)');
  135. if (confirmans === true) {
  136. mwheel.active2 = true;
  137. console.log('Mouse wheel mode is activated.');
  138. } else {
  139. alert('Cancelled.');
  140. }
  141. } else if (mwheel.active === true) {
  142. confirmans = confirm('Mouse wheel mode is enabled.\nIn mouse wheel mode every mouse wheel movement counts as a click on the cookie.\nYou can still use mouse buttons.\nPress \'OK\' to deactivate mouse wheel mode.\n(sorry for bad English.)');
  143. if (confirmans === true) {
  144. mwheel.active2 = false;
  145. console.log('Mouse wheel mode is deactivated.');
  146. } else {
  147. alert('Cancelled.');
  148. }
  149. }
  150. if (mwheel.active2 === true) mwheel.active = true;
  151. else if (mwheel.active2 === false) mwheel.active = false;
  152. if (mwheel.active === true) document.onmousewheel = ac.click; // yoink
  153. else if (mwheel.active === false) document.onmousewheel = null; // null is default on orteil.dashnet.org/cookieclicker/
  154. }
  155. ////////////////////////////////////////////////////
  156. else if (ans === '5') {
  157. ans = prompt('Select what item you want to get for free:\n1) Сursor\n2) Alchemy lab\n3) Antimatter condenser\n4) Bank\n5) Chancemaker\n6) Factory\n7) Farm\n8) Fractal engine\n9) Grandma\n10) Javascript console\n11) Mine\n12) Portal\n13) Prism\n14) Shipment\n15) Temple\n16) Time machine\n17) Wizard tower'); // Cursor, Alchemy lab, Antimatter condenser, Bank, Chancemaker, Factory, Farm, Fractal engine, Grandma, Javascript console, Mine, Portal, Prism, Shipment, Temple, Time machine, Wizard tower
  158. getFree.wrongItem = false;
  159. if (ans === '1') getFree.itemName = 'Cursor';
  160. else if (ans === '2') getFree.itemName = 'Alchemy lab';
  161. else if (ans === '3') getFree.itemName = 'Antimatter condenser';
  162. else if (ans === '4') getFree.itemName = 'Bank';
  163. else if (ans === '5') getFree.itemName = 'Chancemaker';
  164. else if (ans === '6') getFree.itemName = 'Factory';
  165. else if (ans === '7') getFree.itemName = 'Farm';
  166. else if (ans === '8') getFree.itemName = 'Fractal engine';
  167. else if (ans === '9') getFree.itemName = 'Grandma';
  168. else if (ans === '10') getFree.itemName = 'Javascript console';
  169. else if (ans === '11') getFree.itemName = 'Mine';
  170. else if (ans === '12') getFree.itemName = 'Portal';
  171. else if (ans === '13') getFree.itemName = 'Prism';
  172. else if (ans === '14') getFree.itemName = 'Shipment';
  173. else if (ans === '15') getFree.itemName = 'Temple';
  174. else if (ans === '16') getFree.itemName = 'Time machine';
  175. else if (ans === '17') getFree.itemName = 'Wizard tower';
  176. else if (ans === null || ans === "" || ans === '') {
  177. alert('Cancelled.');
  178. getFree.wrongItem = true; // prevents you from buying nothing/error
  179. }
  180. else {
  181. alert('Wrong item.');
  182. getFree.wrongItem = true;
  183. }
  184. if (getFree.wrongItem === false) {
  185. ans = prompt(`How many \'${getFree.itemName}\' you want to get for free?`, '1');
  186. ans = Number(ans);
  187. if (isNaN(ans)) {
  188. alert('Your answer is not a number.');
  189. } else if (ans === null || ans === "" || ans === '') {
  190. alert('Cancelled.');
  191. } else {
  192. Game.Objects[getFree.itemName].getFree(ans);
  193. }
  194. }
  195. }
  196. ////////////////////////////////////////////////////
  197. else if (ans === '6') {
  198. ans = prompt('How many sugar lumps do you want to gain?');
  199. if (ans === null || ans === "" || ans === '') {
  200. alert('Cancelled.');
  201. } else {
  202. ans = Number(ans);
  203. // checking for NaN
  204. if (isNaN(ans)) {
  205. alert('Your answer is not a number');
  206. } else {
  207. Game.gainLumps(ans);
  208. Game.Notify('Note from the hack', `${ans} sugar lump(s) is gained.`);
  209. // beautifying :D
  210. /*
  211. var ansLast = ans.slice(-1);
  212. if (ansLast == '1') {
  213. Game.Notify('Note from the hack', `${ans} sugar lump(s) is gained.`);
  214. } else {
  215. Game.Notify('Note from the hack', `${ans} sugar lumps is gained.`);
  216. }
  217. */
  218. }
  219. }
  220. }
  221. ////////////////////////////////////////////////////
  222. else if (ans === '7') {
  223. ans = prompt('Enter a number of a buff below:\n1) Frenzy\nNew buffs will be added soon.');
  224. if (ans === '1') {
  225. ans = prompt('Enter duration of the buff in seconds.');
  226. buffs.duration = Number(ans);
  227. if (isNaN(buffs.duration)) {
  228. alert('Your answer is not a number.');
  229. } else {
  230. ans = prompt('Enter the power of the buff.\nFor example: you have 100 cookies per second, power of the buff is 2, and now your cookies per second value is 200.');
  231. buffs.pow = Number(ans);
  232. if (isNaN(buffs.pow)) {
  233. alert('Your answer is not a number.');
  234. } else {
  235. Game.gainBuff('frenzy', buffs.duration, buffs.pow);
  236. }
  237. }
  238. } else if (ans === null || ans === "" || ans === '') {
  239. alert('Cancelled.');
  240. } else {
  241. alert('Wrong buff.');
  242. }
  243. }
  244. ////////////////////////////////////////////////////
  245. else if (ans === '8') {
  246. if (Game.Objects["Wizard tower"].amount <= 0 || Game.Objects["Wizard tower"].level < 2) {
  247. alert('Sorry, but you haven\'t unlocked it yet');
  248. } else {
  249. ans = prompt('Grimoire hacks:\n1) Set backfire chance to 0\n2) Set backfire chance to normal');
  250. if (ans == '1') {
  251. Game.Notify('Cookie Patcher', 'Started to patch Grimoire backfire function...', null, true);
  252. Game.Objects["Wizard tower"].minigame.getFailChance = CookiePatcher.patchedGrimoireBackfire;
  253. Game.Notify('Cookie Patcher', 'Grimoire backfire function was patched!');
  254. } else if (ans == '2') {
  255. Game.Notify('Cookie Patcher', 'Started to patch Grimoire backfire function...', null, true);
  256. Game.Objects["Wizard tower"].minigame.getFailChance = CookiePatcher.originalGrimoireBackfire;
  257. Game.Notify('Cookie Patcher', 'Grimoire backfire function was patched!');
  258. } else if ((ans != '1' || ans != '2') && !(ans === null || ans === "" || ans === ''))/*idk what i'm doing wrong in my life*/ {
  259. alert('Wrong hack.');
  260. } else if (ans === null || ans === "" || ans === '') {
  261. alert('Cancelled.');
  262. }
  263. }
  264. }
  265. ///////////////////////////////////////////////////
  266. else if (ans == '9') {
  267. ans = prompt('How many heavenly chips do you want to earn?');
  268. if (ans === "" || ans === null) {
  269. alert('Cancelled.');
  270. } else {
  271. Game.heavenlyChips += Number(ans);
  272. }
  273. }
  274. ////////////////////////////////////////////////////
  275. else if (ans === null || ans === "") {
  276. console.log('Prevented \'Function not found\' message');
  277. }
  278. else {
  279. alert('Function not found.');
  280. }
  281. // }
  282. }
  283.  
  284. console.log('[== Hack is started. ==]\nVersion: v.' + hinfo.version);

QingJ © 2025

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