CookieClicker

CookieClicker Extension

  1. // ==UserScript==
  2. // @name CookieClicker
  3. // @namespace CookieClickerExtension
  4. // @include *orteil.dashnet.org/cookieclicker/*
  5. // @author Dummbroesel
  6. // @description CookieClicker Extension
  7. // @version 1.1.2
  8. // ==/UserScript==
  9.  
  10. document._g = false;
  11. document._c = false;
  12. document._o = false;
  13. document._u = false;
  14. document._s = false;
  15.  
  16. document._goldenCookieSpawnAndClickCHEAT;
  17. document._clickBigCookieCHEAT;
  18.  
  19. document._products;
  20. document._upgrades;
  21.  
  22. document._purchaseObjectCheat;
  23. document._purchaseUpgradesCHEAT;
  24. document._goldenCookieListenerCHEAT
  25.  
  26. document._autoPurchaseObject;
  27. document._autoPurchaseUpgrade;
  28.  
  29. document._gcc;
  30.  
  31. document.onkeypress = function(event) {
  32. var keyCode = (event.keyCode == 0)? event.charCode : event.keyCode;
  33. if (keyCode == 32) {
  34. document._products = document.getElementById('products').children;
  35. document._upgrades = document.getElementById('upgrades').children;
  36. document._autoPurchaseObject = function autoPurchaseObject() {
  37. for (i = document._products.length-1; i >= 0; i--)
  38. {
  39. if(document._products[i].classList.contains('enabled')) {
  40. document._products[i].click();
  41. return false;
  42. }
  43. }
  44. };
  45. document._autoPurchaseUpgrade = function autoPurchaseUpgrade() {
  46. if(Game.UpgradesInStore.length < 1) return false;
  47. if(Game.UpgradesInStore.length == 1)
  48. {
  49. var _firstChild = document._upgrades[0];
  50. if(_firstChild.classList.contains('enabled'))
  51. {
  52. if (Game.UpgradesInStore[0].name == "Elder Covenant"
  53. || Game.UpgradesInStore[0].name.indexOf("Ghostly biscuit") >=0
  54. || Game.UpgradesInStore[0].name.indexOf("Fool's biscuit") >=0
  55. || Game.UpgradesInStore[0].name.indexOf("Lovesick biscuit") >=0
  56. || Game.UpgradesInStore[0].name.indexOf("Festive biscuit") >=0
  57. || Game.UpgradesInStore[0].name.indexOf("Milk selector") >=0
  58. || Game.UpgradesInStore[0].name.indexOf("Golden switch [off]") >=0
  59. || Game.UpgradesInStore[0].name.indexOf("Bunny biscuit") >=0)
  60. {
  61. return false;
  62. }
  63. _firstChild.click();
  64. }
  65. }
  66. if(Game.UpgradesInStore.length > 1)
  67. {
  68. for (i=0;i<document._upgrades.length;i++){
  69. if(document._upgrades[i].classList.contains('enabled')) {
  70. if (Game.UpgradesInStore[i].name == "Elder Covenant"
  71. || Game.UpgradesInStore[i].name.indexOf("Ghostly biscuit") >=0
  72. || Game.UpgradesInStore[i].name.indexOf("Fool's biscuit") >=0
  73. || Game.UpgradesInStore[i].name.indexOf("Lovesick biscuit") >=0
  74. || Game.UpgradesInStore[i].name.indexOf("Festive biscuit") >=0
  75. || Game.UpgradesInStore[i].name.indexOf("Milk selector") >=0
  76. || Game.UpgradesInStore[i].name.indexOf("Golden switch [off]") >=0
  77. || Game.UpgradesInStore[i].name.indexOf("Bunny biscuit") >=0)
  78. {
  79. }
  80. else {
  81. document._upgrades[i].click();
  82. }
  83. }
  84. else {
  85. break;
  86. }
  87. }
  88. //var _firstChild = document._upgrades[0];
  89. //var _secondChild = document._upgrades[1];
  90. //if(_firstChild.classList.contains('enabled'))
  91. //{
  92. // if (Game.UpgradesInStore[0].name == "Elder Covenant" && Game.UpgradesInStore[0].basePrice == 66666666666666)
  93. // {
  94. // if(_secondChild.classList.contains('enabled'))
  95. // {
  96. // _secondChild.click();
  97. // }
  98. // } else {
  99. // _firstChild.click();
  100. // }
  101. //}
  102. }
  103. };
  104. document._gcc = function () {
  105. if (Game.goldenCookie.life > 0) Game.goldenCookie.click();
  106. };
  107. console.log('Initilized');
  108. } else if (keyCode == 103) {
  109. //g goldencookie spawn&clicker
  110. if(document._g) {
  111. clearInterval(document._goldenCookieSpawnAndClickCHEAT);
  112. document._g = false;
  113. console.log('GoldenCookieSpawn&Clicker Deactivated');
  114. }
  115. else {
  116. document._goldenCookieSpawnAndClickCHEAT = setInterval("Game.goldenCookie.spawn(); Game.goldenCookie.click();", 5);
  117. document._g = true;
  118. console.log('GoldenCookieSpawn&Clicker Activated');
  119. }
  120. } else if (keyCode == 99) {
  121. //c bigcookie clicker
  122. if (document._c) { clearInterval(document._clickBigCookieCHEAT); document._c = false; console.log('BigCookieClicker Deactivated'); }
  123. else {
  124. document._clickBigCookieCHEAT = setInterval("Game.ClickCookie();", 5);
  125. document._c = true;
  126. console.log('BigCookieClicker Activated');
  127. }
  128. } else if (keyCode == 111) {
  129. //o Buildings purchaser
  130. if(document._o) {
  131. clearInterval(document._purchaseObjectCheat);
  132. document._o = false;
  133. console.log('AutoObjectPurchaser Deactivated');
  134. }
  135. else{
  136. document._purchaseObjectCheat = setInterval('document._autoPurchaseObject()', 10);
  137. document._o = true;
  138. console.log('AutoObjectPurchaser Activated');
  139. }
  140. } else if (keyCode == 117) {
  141. //u Upgrade purchaser
  142. if (document._u) {
  143. clearInterval(document._purchaseUpgradesCHEAT);
  144. document._u = false;
  145. console.log('AutoUpgradePurchaser Deactivated');
  146. }
  147. else {
  148. document._purchaseUpgradesCHEAT = setInterval("document._autoPurchaseUpgrade()", 10);
  149. document._u = true;
  150. console.log('AutoUpgradePurchaser Activated');
  151. }
  152. } else if(keyCode == 114) {
  153. //r Reset Game keep Achievments
  154. Game.Reset(true);
  155. console.log('Game successfully reset!');
  156. } else if (keyCode == 115) {
  157. //s GoldenCookieClicker
  158. if (document._s) {
  159. clearInterval(document._goldenCookieListenerCHEAT);
  160. document._s = false;
  161. console.log('GoldenCookieClicker Deactivated');
  162. }
  163. else {
  164. document._goldenCookieListenerCHEAT = setInterval("document._gcc()", 1000);
  165. document._s = true;
  166. console.log('GoldenCookieClicker Activated');
  167. }
  168. } else if(keyCode == 113) {
  169. Game.goldenCookie.spawn();
  170. }
  171. }