Cookie clicker tools

Cookie clicker tools (visual)

目前為 2020-02-16 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Cookie clicker tools
  3. // @namespace orteil.dashnet.org
  4. // @version 2.185
  5. // @description Cookie clicker tools (visual)
  6. // @author Anton
  7. // @match http://orteil.dashnet.org/cookieclicker/*
  8. // @match https://orteil.dashnet.org/cookieclicker/*
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var tAutoBuy, tPopGolden, tClickFrenzy, oldTitle = '', oldGameUpdateTicker,
  15. tPriority, tBankAuto, tAscendDetector, isClickingNow = false,
  16. tSeasonSwitcher, tDragon, tReloadPageOnWrongBuff, tAutoClickInterval = 75;
  17.  
  18. var _GameHelpers = {
  19. isHardcore: function () {
  20. return parseInt(Game.ascensionMode) === 1
  21. && !Game.HasAchiev('Hardcore')
  22. && Game.HasAchiev('True Neverclick');
  23. },
  24. isNeverclick: function () {
  25. return parseInt(Game.ascensionMode) === 1
  26. && !Game.HasAchiev('True Neverclick');
  27. },
  28. isAscend: function () {
  29. return parseInt(Game.OnAscend) === 1;
  30. },
  31. hasDragon: function () {
  32. return Game.Has('A crumbly egg');
  33. },
  34. getMilkMult: function() {
  35. var milkMult = 1;
  36. if (Game.Has('Santa\'s milk and cookies')) milkMult *= 1.05;
  37. if (Game.hasAura('Breath of Milk')) milkMult *= 1.05;
  38. milkMult *= Game.eff('milk');
  39. return milkMult;
  40. },
  41. getKittenPercentByUpgradeName: function(kName) {
  42. var milkMult = _GameHelpers.getMilkMult();
  43. if (kName === 'Kitten helpers') return Game.milkProgress*0.1*milkMult;
  44. if (kName === 'Kitten workers') return Game.milkProgress*0.125*milkMult;
  45. if (kName === 'Kitten engineers') return Game.milkProgress*0.15*milkMult;
  46. if (kName === 'Kitten overseers') return Game.milkProgress*0.175*milkMult;
  47. if (kName === 'Kitten managers') return Game.milkProgress*0.2*milkMult;
  48. if (kName === 'Kitten accountants') return Game.milkProgress*0.2*milkMult;
  49. if (kName === 'Kitten specialists') return Game.milkProgress*0.2*milkMult;
  50. if (kName === 'Kitten experts') return Game.milkProgress*0.2*milkMult;
  51. if (kName === 'Kitten consultants') return Game.milkProgress*0.2*milkMult;
  52. if (kName === 'Kitten assistants to the regional manager') return Game.milkProgress*0.175*milkMult;
  53. if (kName === 'Kitten marketeers') return Game.milkProgress*0.15*milkMult;
  54. if (kName === 'Kitten analysts') return Game.milkProgress*0.125*milkMult;
  55. if (kName === 'Kitten angels') return Game.milkProgress*0.1*milkMult;
  56. return 0;
  57. },
  58. getDragonAuraName: function (aura) {
  59. if (typeof Game.dragonAuras[aura] !== 'undefined') {
  60. return Game.dragonAuras[aura].name + " (" + Game.dragonAuras[aura].desc + ")";
  61. }
  62. return 'Unknown (' + aura + ')';
  63. },
  64. beautify: function(n, floats) {
  65. return n < 1 ? String(n) : Beautify(parseFloat(n), floats);
  66. },
  67. dragonHasAura2: function () {
  68. return Game.dragonLevel >= 21;
  69. }
  70. };
  71.  
  72. var _GameStat = {
  73. halloweenSeasonUpgrades: ['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies'],
  74. valentineUpgrades: ['Pure heart biscuits','Ardent heart biscuits','Sour heart biscuits','Weeping heart biscuits','Golden heart biscuits','Eternal heart biscuits'],
  75. christmasUpgrades: ['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits'],
  76. getBuffMult: function () {
  77. var buffMult = 1;
  78. for (var buff in Game.buffs) {
  79. if (Game.buffs[buff] !== 0 && typeof Game.buffs[buff].multCpS !== 'undefined') {
  80. buffMult = buffMult * Game.buffs[buff].multCpS;
  81. }
  82. }
  83. return buffMult <= 0 ? 1 : buffMult;
  84. },
  85. getNormalCookiesPs: function () {
  86. return Game.cookiesPs > 0 ? Game.cookiesPs / _GameStat.getBuffMult() : 1;
  87. },
  88. getMinimalMoney: function () {
  89. return Math.floor(_GameStat.getNormalCookiesPs() * 42100 * _BotSettings.options.bankStoragePercent / 100);
  90. },
  91. getMoneyCanSpend: function () {
  92. return Game.cookies - _GameStat.getMinimalMoney();
  93. },
  94. getWrinklerCount: function () {
  95. var wrinklersCount = 0;
  96. for (var i in Game.wrinklers) {
  97. if (Game.wrinklers[i].sucked > 0) {
  98. wrinklersCount++;
  99. }
  100. }
  101. return wrinklersCount;
  102. },
  103. getUpgradeListToUnlock: function() {
  104. var result = [];
  105. for (var x in Game.UnlockAt) {
  106. if (Game.UnlockAt.hasOwnProperty(x) &&
  107. Game.Upgrades.hasOwnProperty(Game.UnlockAt[x].name) &&
  108. Game.Upgrades[Game.UnlockAt[x].name].bought === 0)
  109. {
  110. result.push(Game.UnlockAt[x]);
  111. }
  112. }
  113.  
  114. for (x in _GameStat.halloweenSeasonUpgrades) {
  115. if (_GameStat.halloweenSeasonUpgrades.hasOwnProperty(x) &&
  116. Game.Upgrades[_GameStat.halloweenSeasonUpgrades[x]].bought === 0)
  117. {
  118. result.push({cookies:'',name:_GameStat.halloweenSeasonUpgrades[x],require:'Kill wrinkler',season:'halloween'});
  119. }
  120. }
  121.  
  122. for (x in Game.easterEggs) {
  123. if (Game.easterEggs.hasOwnProperty(x) &&
  124. Game.Upgrades[Game.easterEggs[x]].bought === 0)
  125. {
  126. result.push({cookies:'',name:Game.easterEggs[x],require:'Find egg',season:'easter'});
  127. }
  128. }
  129.  
  130. var lastValentineName = '';
  131. for (x in _GameStat.valentineUpgrades) {
  132. if (_GameStat.valentineUpgrades.hasOwnProperty(x) &&
  133. Game.Upgrades[_GameStat.valentineUpgrades[x]].bought === 0)
  134. {
  135. result.push({cookies:'',name:_GameStat.valentineUpgrades[x],require:lastValentineName,season:'valentines'});
  136. lastValentineName = _GameStat.valentineUpgrades[x];
  137. }
  138. }
  139.  
  140. for (x in _GameStat.christmasUpgrades) {
  141. if (_GameStat.christmasUpgrades.hasOwnProperty(x) &&
  142. Game.Upgrades[_GameStat.christmasUpgrades[x]].bought === 0)
  143. {
  144. result.push({cookies:Game.Upgrades[_GameStat.christmasUpgrades[x]].basePrice,name:_GameStat.christmasUpgrades[x],require:'Christmas',season:'christmas'});
  145. }
  146. }
  147.  
  148. return result;
  149. }
  150. };
  151.  
  152. var _BotStat = {
  153. getHistoryList: function() {
  154. var hist = [];
  155. hist.push('2.169 - added achievements Neverclick and Hardcore');
  156. hist.push('2.156 - lumps harvesting + achievement');
  157. hist.push('2.155 - fix some bugs with new version of the Game');
  158. hist.push('2.136 - buyAll function (it is a kind of cheat)');
  159. hist.push('2.128 - santa and dragon upgrades');
  160. hist.push('2.122 - season switcher');
  161. hist.push('2.118 - show season unlocks in "Need to unlock" table');
  162. hist.push('2.114 - option to disable auto clicking');
  163. hist.push('2.113 - info table "Achievements to unlock"');
  164. hist.push('2.112 - info table "Need to unlock"');
  165. hist.push('2.111 - option to buy infernal upgrades');
  166. hist.push('2.109 - kill all wrinklers button');
  167. hist.push('2.107 - click first 15 minutes after ascend');
  168. hist.push('2.101 - remove all bufs on negative multiplier (same as reload page)');
  169. hist.push('2.100 - Info section + ascend detector');
  170. hist.push('2.099 - mouse click upgrades');
  171. hist.push('2.097 - auto bank storage');
  172. hist.push('2.096 - buy objects more than 1');
  173. hist.push('2.091 - priority table refactor');
  174. hist.push('2.090 - buy very cheap items first');
  175. hist.push('2.086 - clear log button');
  176. hist.push('2.084 - buy unknown upgrades if their price is 0.1% of cookie storage');
  177. hist.push('2.083 - mouse upgrades is processed as Upgrades');
  178. hist.push('2.082 - start from scratch');
  179. hist.push('2.079 - hide donate box');
  180. hist.push('2.078 - Kittens now is processed as Upgrades');
  181. return hist;
  182. }
  183. };
  184.  
  185. var _BotSettings = {
  186. options: {
  187. bankStoragePercent: 0,
  188. bankStorageAuto: false,
  189. buyInfernalUpgrades: false,
  190. noClicking: false,
  191. autoSeason: false,
  192. disableTicker: false
  193. },
  194. store: function(name, value) {
  195. if (typeof(Storage) !== "undefined") localStorage.setItem(name, value);
  196. },
  197. restore: function(name, asBool) {
  198. if (typeof asBool === 'undefined') asBool = false;
  199. if (typeof(Storage) !== "undefined") {
  200. if (asBool) {
  201. return (localStorage.getItem(name) === 'true' || localStorage.getItem(name) === true);
  202. } else {
  203. return localStorage.getItem(name);
  204. }
  205. }
  206. else return undefined;
  207. },
  208. restoreAll: function() {
  209. _BotSettings.options.bankStoragePercent = parseInt(_BotSettings.restore('bankStoragePercent'));
  210. if (typeof _BotSettings.options.bankStoragePercent === 'undefined' || _BotSettings.options.bankStoragePercent === null) {
  211. _BotSettings.options.bankStoragePercent = 0;
  212. }
  213. _BotSettings.options.bankStorageAuto = _BotSettings.restore('bankStorageAuto', true);
  214. if (typeof _BotSettings.options.bankStorageAuto === 'undefined' || _BotSettings.options.bankStorageAuto === null) {
  215. _BotSettings.options.bankStorageAuto = false;
  216. }
  217.  
  218. _BotSettings.options.buyInfernalUpgrades = _BotSettings.restore('buyInfernalUpgrades', true);
  219. if (typeof _BotSettings.options.buyInfernalUpgrades === 'undefined' || _BotSettings.options.buyInfernalUpgrades === null) {
  220. _BotSettings.options.buyInfernalUpgrades = false;
  221. }
  222.  
  223. _BotSettings.options.noClicking = _BotSettings.restore('noClicking', true);
  224. if (typeof _BotSettings.options.noClicking === 'undefined' || _BotSettings.options.noClicking === null) {
  225. _BotSettings.options.noClicking = false;
  226. }
  227.  
  228. _BotSettings.options.autoSeason = _BotSettings.restore('autoSeason', true);
  229. if (typeof _BotSettings.options.autoSeason === 'undefined' || _BotSettings.options.autoSeason === null) {
  230. _BotSettings.options.autoSeason = false;
  231. }
  232.  
  233. _BotSettings.options.disableTicker = _BotSettings.restore('disableTicker', true);
  234. if (typeof _BotSettings.options.disableTicker === 'undefined' || _BotSettings.options.disableTicker === null) {
  235. _BotSettings.options.disableTicker = false;
  236. }
  237. },
  238. setBankStogarePercent: function(val, needUpdate) {
  239. if (_BotSettings.options.bankStoragePercent !== val) {
  240. if (needUpdate === true) jQuery('#bankStoragePercent').val(val);
  241. if (console) console.log('bankStoragePercent =', val);
  242. _BotSettings.store('bankStoragePercent', val);
  243. _BotSettings.options.bankStoragePercent = val;
  244. jQuery('#bankStoragePercentLabel').text('Storage (' + _GameHelpers.beautify(_GameStat.getMinimalMoney()) + ') percent: ' + val + '%');
  245. _LogPage.updateLog();
  246. }
  247. },
  248. getOptionNameByButtonId: function (id) {
  249. if (id === 'bankStorageAuto') {
  250. return "Automatic set of bank storage percent";
  251. } else if (id === 'buyInfernalUpgrades') {
  252. return "Automatic buy infernal upgrades (makes granny evil)";
  253. } else if (id === 'noClicking') {
  254. return "Restrict auto clicking";
  255. } else if (id === 'autoSeason') {
  256. return "Auto season swithcer";
  257. } else if (id === 'disableTicker') {
  258. return "News disabled";
  259. }
  260. return "";
  261. },
  262. getOptionTitle: function (optionName) {
  263. return _BotSettings.getOptionNameByButtonId(optionName) + ": " +
  264. (_BotSettings.options[optionName] ? 'TRUE' : 'FALSE');
  265. }
  266. };
  267.  
  268. var _BotUI = {
  269. $caption: undefined,
  270. $logButton: undefined,
  271. oldTickerText: undefined,
  272. $getCaption: function() {
  273. if (typeof _BotUI.$caption === 'undefined') {
  274. _BotUI.$caption = jQuery('#versionNumber');
  275. }
  276. return _BotUI.$caption;
  277. },
  278. setCaption: function(txt) {
  279. if (_BotUI.$getCaption().text() !== txt) _BotUI.$getCaption().text(txt);
  280. },
  281. setTitle: function(txt) {
  282. var newTitle = (_LogPage.newLogs > 0 ? '(' + _LogPage.newLogs + ') ' : '') + txt;
  283. if (document.title !== newTitle) {
  284. oldTitle = txt;
  285. document.title = newTitle;
  286. }
  287. },
  288. setTitleWithPercent: function(have, need, txt) {
  289. var percent = Math.ceil(have / (need !== 0 ? need : 1) * 100);
  290. _BotUI.setTitle(String(percent) + "% - " + txt);
  291. },
  292. triggerOptionValue: function(optionName, $button) {
  293. _BotSettings.options[optionName] = !_BotSettings.options[optionName];
  294. _BotSettings.store(optionName, _BotSettings.options[optionName]);
  295. var newButtonTitle = _BotSettings.getOptionTitle(optionName);
  296. _LogPage.addLog(newButtonTitle, true);
  297. $button.text(newButtonTitle);
  298. },
  299. processUiButtonClick: function ($button) {
  300. var id = $button.attr('data-id');
  301. if (id === 'bankStorageAuto') {
  302. _BotUI.triggerOptionValue('bankStorageAuto', $button);
  303. _BotLogic.bankAutoFunction();
  304. } else if (id === 'killWrinklers') {
  305. _BotLogic.killAllWrinklers(true);
  306. } else if (id === 'buyEverything') {
  307. _BotLogic.buyEverything();
  308. } else if (id === 'buyInfernalUpgrades') {
  309. _BotUI.triggerOptionValue('buyInfernalUpgrades', $button);
  310. } else if (id === 'noClicking') {
  311. _BotUI.triggerOptionValue('noClicking', $button);
  312. } else if (id === 'autoSeason') {
  313. _BotUI.triggerOptionValue('autoSeason', $button);
  314. } else if (id === 'disableTicker') {
  315. _BotUI.triggerOptionValue('disableTicker', $button);
  316. } else if (id === 'clearLog') {
  317. _LogPage.logLinesArray = [];
  318. _LogPage.newLogs = 0;
  319. }
  320. _LogPage.updateLog();
  321. },
  322. initLogButton: function() {
  323. _BotUI.$logButton = jQuery('#logButton');
  324.  
  325. _BotUI.$logButton.text('Log').on("click", function() {
  326. _LogPage.newLogs = 0;
  327. _BotUI.$logButton.text('Log');
  328. });
  329.  
  330. Game.CCT = {}; // Coockie clicker tools
  331. Game.CCT.onsliderchange = function(el) {
  332. var val = $(el).val();
  333. _BotSettings.setBankStogarePercent(val);
  334. };
  335. Game.CCT.getPriorityListObj = function() {
  336. return _Priority.aList;
  337. };
  338. Game.CCT.onbuttonclick = function(el,e) {
  339. e.preventDefault();
  340. var $button = jQuery(el);
  341. _BotUI.processUiButtonClick($button);
  342. };
  343. },
  344. setTickerText: function(newText) {
  345. if (_BotUI.oldTickerText !== newText) {
  346. _BotUI.oldTickerText = newText;
  347. Game.Ticker = newText;
  348. Game.TickerDraw();
  349. }
  350. },
  351. generateTinkerText: function() {
  352. if (_BotLogic.started) {
  353. return "Bot ACTIVE";
  354. } else {
  355. return "Bot stopped...";
  356. }
  357. },
  358. initBot: function () {
  359. jQuery('#versionNumber').on("click", function() {
  360. if (!_BotLogic.started)
  361. _BotLogic.start();
  362. else
  363. _BotLogic.stop();
  364. });
  365. jQuery('#donateBox').hide();
  366.  
  367. oldGameUpdateTicker = Game.UpdateTicker;
  368. Game.UpdateTicker = function () {
  369. if (_BotSettings.options.disableTicker) {
  370. _BotUI.setTickerText(_BotUI.generateTinkerText());
  371. } else {
  372. oldGameUpdateTicker();
  373. }
  374. };
  375. }
  376. };
  377.  
  378. var _Priority = {
  379. aList: {},
  380. addPriorityForUpgrades: function () {
  381. var moneyCanSpend = _GameStat.getMoneyCanSpend();
  382. var buffMult = _GameStat.getBuffMult();
  383.  
  384. for (var g in Game.UpgradesById) {
  385. if (Game.UpgradesById[g].bought === 0 && parseInt(Game.UpgradesById[g].unlocked) === 1) {
  386. var isMultiplier = Game.UpgradesById[g].desc.indexOf('production multiplier') >= 0;
  387. var isDouble = Game.UpgradesById[g].desc.indexOf('<b>twice</b>') >= 0;
  388. var isDoubleGrandma = Game.UpgradesById[g].desc.indexOf('Grandmas are <b>twice</b>') >= 0;
  389. var isKitten = Game.UpgradesById[g].name.indexOf('Kitten ') >= 0;
  390. var isDoubleCursor = Game.UpgradesById[g].desc.indexOf('The mouse and cursors are <b>twice</b>') >= 0;
  391. var isClickIncrease = Game.UpgradesById[g].desc.indexOf('Clicking gains <b>+1%') >= 0;
  392. var isSpecialTech = Game.UpgradesById[g].pool === 'tech' && typeof Game.UpgradesById[g].clickFunction !== 'undefined';
  393. if (isSpecialTech && Game.UpgradesById[g].clickFunction !== 'undefined' && _BotSettings.options.buyInfernalUpgrades) {
  394. delete (Game.UpgradesById[g].clickFunction);
  395. }
  396. var increasedMoney = 0;
  397. if (isClickIncrease) {
  398. if (!_GameHelpers.isNeverclick) {
  399. increasedMoney = Game.cookiesPs * 0.01;
  400. }
  401. } else if (isDoubleCursor) {
  402. increasedMoney = Game.Objects['Cursor'].storedTotalCps * Game.globalCpsMult / buffMult;
  403. if (isClickingNow) increasedMoney += Game.computedMouseCps * 1000 / tAutoClickInterval;
  404. } else if (isKitten) {
  405. var kittenPercent = _GameHelpers.getKittenPercentByUpgradeName(Game.UpgradesById[g].name);
  406. increasedMoney = _GameStat.getNormalCookiesPs() * kittenPercent;
  407. } else if (isDoubleGrandma) {
  408. increasedMoney = Game.Objects['Grandma'].storedTotalCps * Game.globalCpsMult / buffMult;
  409. } else if (isMultiplier) {
  410. increasedMoney = _GameStat.getNormalCookiesPs() * Game.UpgradesById[g].power / 100;
  411. } else if (isDouble) {
  412. increasedMoney = Game.UpgradesById[g].buildingTie.storedTotalCps * Game.globalCpsMult / buffMult;
  413. }
  414. var interest = increasedMoney > 0 ? Game.UpgradesById[g].getPrice() / increasedMoney : '-';
  415. if (interest !== '-') {
  416. if (typeof _Priority.aList[Math.floor(interest)] === 'undefined') {
  417. var pp = moneyCanSpend / Game.UpgradesById[g].getPrice(); // percent of cheapness
  418. if (pp > 50) interest /= pp * 50;
  419. _Priority.aList[Math.floor(interest)] = {
  420. name: Game.UpgradesById[g].name,
  421. price: Game.UpgradesById[g].getPrice(),
  422. cps: 1,
  423. type: 'upgrade',
  424. id: g,
  425. income: increasedMoney
  426. };
  427. }
  428. } else if (Game.UpgradesById[g].type === 'upgrade' &&
  429. Game.UpgradesById[g].getPrice() < moneyCanSpend &&
  430. Game.UpgradesById[g].pool !== 'toggle' && (!isSpecialTech || _BotSettings.options.buyInfernalUpgrades))
  431. {
  432. interest = Game.UpgradesById[g].getPrice() / moneyCanSpend * 1000;
  433. if (typeof _Priority.aList[Math.floor(interest)] === 'undefined') {
  434. pp = moneyCanSpend / Game.UpgradesById[g].getPrice(); // percent of cheapness
  435. if (pp > 50) interest /= pp * 50;
  436. _Priority.aList[Math.floor(interest)] = {
  437. name: Game.UpgradesById[g].name,
  438. price: Game.UpgradesById[g].getPrice(),
  439. cps: 1,
  440. type: 'upgrade',
  441. id: g,
  442. income: 0
  443. };
  444. }
  445. }
  446. }
  447. }
  448. },
  449. addPriorityForObjects: function () {
  450. var moneyCanSpend = _GameStat.getMoneyCanSpend();
  451. var buffMult = _GameStat.getBuffMult();
  452.  
  453. for (var i in Game.ObjectsById) {
  454. if (typeof i !== 'undefined' && i !== 'undefined' && Game.ObjectsById.hasOwnProperty(i)) {
  455. if (Game.ObjectsById[i].locked === 0) {
  456. var objectCps = Math.max(Game.ObjectsById[i].storedTotalCps, Game.ObjectsById[i].storedCps);
  457. var objectAmount = Math.max(Game.ObjectsById[i].amount, 1);
  458. var cps = (objectCps / objectAmount) * Game.globalCpsMult / buffMult;
  459. var interest = Game.ObjectsById[i].price / cps;
  460. var pp2 = moneyCanSpend / Game.ObjectsById[i].price; // percent of cheapness
  461. if (pp2 > 50) interest /= pp2 * 50;
  462. if (isNaN(Math.floor(interest)) && Game.ObjectsById[i].price < moneyCanSpend) interest = 0;
  463. _Priority.aList[Math.floor(interest)] = {
  464. name: Game.ObjectsById[i].name,
  465. price: Game.ObjectsById[i].price,
  466. cps: cps,
  467. type: 'buy',
  468. id: i,
  469. income: cps
  470. };
  471. }
  472. }
  473. }
  474. },
  475. createPriorityList: function() {
  476. if (_GameHelpers.isAscend()) return;
  477.  
  478. _Priority.aList = {};
  479.  
  480. // top priority
  481. var topPriorityList = ['A festive hat','A crumbly egg','Heavenly chip secret','Heavenly cookie stand','Heavenly bakery','Heavenly confectionery','Heavenly key'];
  482. for (var tt in topPriorityList) {
  483. var tp = Game.Upgrades[topPriorityList[tt]];
  484. if (typeof tp !== 'undefined' && tp.bought === 0 && parseInt(tp.unlocked) === 1) {
  485. tp.buy();
  486. break;
  487. }
  488. }
  489.  
  490. if (!_GameHelpers.isHardcore()) {
  491. _Priority.addPriorityForUpgrades();
  492. }
  493.  
  494. _Priority.addPriorityForObjects();
  495. }
  496. };
  497.  
  498. var _LogPage = {
  499. version: (typeof GM_info == 'function' ? GM_info().script.version :
  500. (typeof GM_info == 'object' ? GM_info.script.version : '?')),
  501. logTitle: '<div class="section">Cookie clicker tools is here!</div>',
  502. logLinesArray: [],
  503. newLogs: 0,
  504. clearLogButton: '<button data-id="clearLog" onclick="Game.CCT.onbuttonclick(this,event)">Clear Log</button>',
  505. killWrinklersButton: '<button data-id="killWrinklers" onclick="Game.CCT.onbuttonclick(this,event)">Kill wrinklers</button>',
  506. buyEverythingButton: '<button data-id="buyEverything" onclick="Game.CCT.onbuttonclick(this,event)">Buy everything</button>',
  507. priorityTableStyles: '<style type="text/css">.prioritytable{width:100%;}.prioritytable td,.prioritytable th{padding:3px;}</style>',
  508. priorityTableHeader: '<table class="prioritytable"><tr style="border-bottom:1px solid;text-align:left;font-weight:bold;"><th>Type</th><th>Name</th><th>Price</th><th>Interest</th><th>Income</th><th>% bank</th></tr>',
  509. needbuyTableHeader: '<table class="prioritytable"><tr style="border-bottom:1px solid;text-align:left;font-weight:bold;"><th>Name</th><th>Price</th><th>Prerequisite</th><th>Season</th></tr>',
  510. needAchieveTableHeader: '<table class="prioritytable"><tr style="border-bottom:1px solid;text-align:left;font-weight:bold;"><th>Name</th><th>Description</th></tr>',
  511. tableFooter: '</table>',
  512. lastLogUpdatedTime: new Date(),
  513. getTableRow: function (cols) {
  514. var result = '<tr>';
  515. for (var colId in cols) {
  516. if (cols.hasOwnProperty(colId)) {
  517. result += '<td>' + cols[colId] + '</td>';
  518. }
  519. }
  520. return result + '</tr>'
  521. },
  522. getLogSectionTitle: function (text) {
  523. return '<div class="title">' + text + '</div>';
  524. },
  525. getLogSection: function (sectionTitle, items) {
  526. return '<div class="subsection">' + _LogPage.getLogSectionTitle(sectionTitle) +
  527. '<div class="listing">' + items.join('</div><div class="listing">') + '</div>' +
  528. '</div>';
  529. },
  530. getLogPriorityTable: function() {
  531. var moneyCanSpend = _GameStat.getMoneyCanSpend();
  532. var t = _LogPage.priorityTableHeader;
  533. for (var i in _Priority.aList) {
  534. if (_Priority.aList.hasOwnProperty(i)) {
  535. var o = _Priority.aList[i];
  536. var pp = Math.floor(moneyCanSpend / o.price * 100);
  537. t += '<tr><td>' + o.type + '</td><td>' + o.name + '</td><td>' + _GameHelpers.beautify(o.price) + '</td><td>' + i + '</td><td>' + _GameHelpers.beautify(o.income) + '</td><td>' + pp + '</td></tr>';
  538. }
  539. }
  540. t += '</table>';
  541. var priorityListCaption = 'Priority ' + _LogPage.clearLogButton + ' ' + _LogPage.killWrinklersButton + ' ' + _LogPage.buyEverythingButton;
  542. return _LogPage.priorityTableStyles + '<div class="subsection">' + _LogPage.getLogSectionTitle(priorityListCaption) + '<div class="listing">' + t + '</div></div>';
  543. },
  544. getLogNeedBuyTable: function() {
  545. var objList = _GameStat.getUpgradeListToUnlock();
  546. if (objList && objList.length > 0) {
  547. var t = _LogPage.needbuyTableHeader;
  548. for (var i in objList) {
  549. if (objList.hasOwnProperty(i)) {
  550. var o = objList[i];
  551. t += _LogPage.getTableRow([
  552. o.name,
  553. _GameHelpers.beautify(o.cookies),
  554. typeof o.require !== 'undefined' ? o.require : '',
  555. typeof o.season !== 'undefined' ? o.season : ''
  556. ]);
  557. }
  558. }
  559. t += _LogPage.tableFooter;
  560. return _LogPage.priorityTableStyles + '<div class="subsection">' + _LogPage.getLogSectionTitle('Need to unlock') + '<div class="listing">' + t + '</div></div>';
  561. } else {
  562. return '';
  563. }
  564. },
  565. getLogNeedAchieveTable: function() {
  566. var ach = [];
  567. for (var i in Game.Achievements) {
  568. if(Game.Achievements[i].won === 0 && Game.Achievements[i].pool !== 'dungeon') {
  569. ach.push(Game.Achievements[i]);
  570. }
  571. }
  572. if (ach.length > 0) {
  573. var t = _LogPage.needAchieveTableHeader;
  574. for (i in ach) {
  575. var o = ach[i];
  576. t += _LogPage.getTableRow([
  577. o.name,
  578. o.desc
  579. ]);
  580. }
  581. t += _LogPage.tableFooter;
  582. return _LogPage.priorityTableStyles + '<div class="subsection">' + _LogPage.getLogSectionTitle('Achievements to unlock') + '<div class="listing">' + t + '</div></div>';
  583. } else {
  584. return '';
  585. }
  586. },
  587. getOptionsSectionList: function() {
  588. var content = [];
  589. content.push('<label for="bankStoragePercent" id="bankStoragePercentLabel">Storage (' + _GameHelpers.beautify(_GameStat.getMinimalMoney()) + ') percent: ' + _BotSettings.options.bankStoragePercent + '%</label> <input name="bankStoragePercent" id="bankStoragePercent" type="range" min="0" max="100" value="' + _BotSettings.options.bankStoragePercent + '" onchange="Game.CCT.onsliderchange(this)" />');
  590. content.push('<button data-id="bankStorageAuto" onclick="Game.CCT.onbuttonclick(this,event)">' + _BotSettings.getOptionTitle('bankStorageAuto') + '</button>');
  591. content.push('<button data-id="buyInfernalUpgrades" onclick="Game.CCT.onbuttonclick(this,event)">' + _BotSettings.getOptionTitle('buyInfernalUpgrades') + '</button>');
  592. content.push('<button data-id="noClicking" onclick="Game.CCT.onbuttonclick(this,event)">' + _BotSettings.getOptionTitle('noClicking') + '</button>');
  593. content.push('<button data-id="autoSeason" onclick="Game.CCT.onbuttonclick(this,event)">' + _BotSettings.getOptionTitle('autoSeason') + '</button>');
  594. content.push('<button data-id="disableTicker" onclick="Game.CCT.onbuttonclick(this,event)">' + _BotSettings.getOptionTitle('disableTicker') + '</button>');
  595. content.push( _LogPage.clearLogButton);
  596. return content;
  597. },
  598. getInfoSectionList: function() {
  599. var content = [];
  600.  
  601. var wrinklersTotal = 0;
  602. for (var i in Game.wrinklers) {
  603. wrinklersTotal += Game.wrinklers[i].sucked;
  604. }
  605.  
  606. var chipsOwned = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
  607. var ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
  608. var ascendWillGet = ascendNowToOwn - chipsOwned;
  609. var cookiesToDoubleInitial = Game.HowManyCookiesReset(chipsOwned * 2) - (Game.cookiesEarned + Game.cookiesReset);
  610. var normalCookiePs = _GameStat.getNormalCookiesPs();
  611. var timeToReachDouble = Math.floor(cookiesToDoubleInitial / normalCookiePs);
  612.  
  613. content.push('Now clicking: ' + (isClickingNow ? "YES" : "NO"));
  614. content.push('Per click: ' + _GameHelpers.beautify(Game.computedMouseCps));
  615. content.push('Cookies to double prestige: ' + (cookiesToDoubleInitial >= 0 ? _GameHelpers.beautify(cookiesToDoubleInitial) : 'No info'));
  616. content.push('Time to double prestige: ' + Game.sayTime(timeToReachDouble * Game.fps, 2));
  617. content.push('Heavenly chips in storage: ' + Game.heavenlyChips);
  618. content.push('You will get prestige by ascending: ' + ascendWillGet);
  619. content.push('Heavenly chips after ascend: ' + (Game.heavenlyChips + ascendWillGet));
  620. content.push('Buff mult: ' + _GameStat.getBuffMult());
  621. content.push('Normal CpS: ' + _GameHelpers.beautify(normalCookiePs));
  622. content.push('Money bank: ' + _GameHelpers.beautify(_GameStat.getMinimalMoney()));
  623. content.push('Money can spend: ' + _GameHelpers.beautify(_GameStat.getMoneyCanSpend()));
  624. content.push('Wrinklers: ' + _GameStat.getWrinklerCount());
  625. content.push('Wrinklers sucked: ' + _GameHelpers.beautify(wrinklersTotal));
  626. if (Game.dragonLevel<Game.dragonLevels.length-1) {
  627. content.push('Next Dragon upgrade: ' + Game.dragonLevels[Game.dragonLevel].costStr());
  628. }
  629. if (_GameHelpers.hasDragon() && Game.dragonAura >= 0 && typeof Game.dragonAuras[Game.dragonAura] !== 'undefined') {
  630. content.push("Aura: " + _GameHelpers.getDragonAuraName(Game.dragonAura));
  631. if (_GameHelpers.dragonHasAura2()) {
  632. content.push("Aura 2: " + _GameHelpers.getDragonAuraName(Game.dragonAura2));
  633. }
  634. }
  635. return content;
  636. },
  637. updateLog: function () {
  638. if (_GameHelpers.isAscend()) return;
  639.  
  640. var curTime = new Date();
  641. var timeInterval = curTime - _LogPage.lastLogUpdatedTime;
  642. if (timeInterval <= 500) return;
  643. _LogPage.lastLogUpdatedTime = curTime;
  644.  
  645. Game.updateLog = _LogPage.logTitle +
  646. _LogPage.getLogPriorityTable() +
  647. _LogPage.getLogSection('Info', _LogPage.getInfoSectionList()) +
  648. _LogPage.getLogSection('Log', _LogPage.logLinesArray) +
  649. _LogPage.getLogSection('Options', _LogPage.getOptionsSectionList()) +
  650. _LogPage.getLogNeedBuyTable() +
  651. _LogPage.getLogNeedAchieveTable() +
  652. _LogPage.getLogSection('History', _BotStat.getHistoryList());
  653. var newButtonText = _LogPage.newLogs > 0 ? 'Log (' + _LogPage.newLogs + ')' : 'Log';
  654. if (_BotUI.$logButton.text() !== newButtonText) _BotUI.$logButton.text(newButtonText);
  655. _BotUI.setTitle(oldTitle);
  656. },
  657. addLog: function(text, notCritical) {
  658. var t = new Date();
  659. _LogPage.logLinesArray.push(t.toUTCString() + ': ' + text);
  660. if (notCritical !== true) _LogPage.newLogs++;
  661. _LogPage.updateLog();
  662. },
  663. init: function () {
  664. _LogPage.logTitle = '<div class="section">Cookie clicker tools ' + _LogPage.version + ' is here!</div>';
  665. }
  666. };
  667.  
  668. var _BotLogic = {
  669. started: false,
  670. killAllWrinklers: function (immediately) {
  671. if (typeof immediately === 'undefined') immediately = false;
  672. var wrinklersCount = _GameStat.getWrinklerCount();
  673. if (wrinklersCount >= 10 || immediately === true) {
  674. var wrinklesIncome = 0;
  675. for (var i in Game.wrinklers) {
  676. wrinklesIncome += Game.wrinklers[i].sucked;
  677. Game.wrinklers[i].hp = 0; // kill ALL
  678. }
  679. if (wrinklesIncome > 0) {
  680. _LogPage.addLog('Killed all Wrinkles for ' + _GameHelpers.beautify(wrinklesIncome) + ' of count ' + wrinklersCount + '.', true);
  681. }
  682. }
  683. },
  684. buyEverything: function () {
  685. if (!_GameHelpers.isHardcore()) {
  686. for (var x in Game.UpgradesById) {
  687. if (Game.UpgradesById.hasOwnProperty(x)) {
  688. if (parseInt(Game.UpgradesById[x].unlocked) === 1
  689. && Game.UpgradesById[x].bought === 0 && Game.UpgradesById[x].canBuy()) {
  690. var pool = Game.UpgradesById[x].pool;
  691. if (pool !== "prestige" &&
  692. pool !== 'debug' &&
  693. pool !== 'toggle' &&
  694. pool !== 'tech' &&
  695. pool !== 'shadow' &&
  696. pool !== 'unused' &&
  697. pool !== 'dungeon') {
  698. Game.UpgradesById[x].buy();
  699. _LogPage.addLog('Buy upgrade ' + Game.UpgradesById[x].name + ' for ' + _GameHelpers.beautify(Game.UpgradesById[x].getPrice()));
  700. }
  701. }
  702. }
  703. }
  704. }
  705. for (x in Game.ObjectsById) {
  706. if (Game.ObjectsById.hasOwnProperty(x)) {
  707. var cnt = 0, sum = 0;
  708. while (Game.cookies >= Game.ObjectsById[x].getPrice()) {
  709. sum += Game.ObjectsById[x].getPrice();
  710. Game.ObjectsById[x].buy(1);
  711. cnt++;
  712. }
  713. if (cnt > 0) _LogPage.addLog('Buy ' + cnt + ' object ' + Game.ObjectsById[x].name + ' for ' + _GameHelpers.beautify(sum));
  714. }
  715. }
  716. },
  717. buyLump: function () {
  718. if (!Game.canLumps()) return;
  719. var needAchievement = Game.Achievements['Hand-picked'] &&
  720. parseInt(Game.Achievements['Hand-picked'].won) === 0;
  721. var age = Date.now() - Game.lumpT;
  722.  
  723. if (age > Game.lumpMatureAge && needAchievement) {
  724. _LogPage.addLog('Trying to get lump achievement, collecting Mature lump');
  725. if (Game.clickLump) Game.clickLump();
  726. } else if (age > Game.lumpRipeAge) {
  727. _LogPage.addLog('Collecting Ripe lump');
  728. if (Game.clickLump) Game.clickLump();
  729. } else if (age > Game.lumpOverripeAge) {
  730. _LogPage.addLog('Collecting Overripe lump');
  731. if (Game.clickLump) Game.clickLump();
  732. }
  733. },
  734. bankAutoFunction: function () {
  735. if (_BotSettings.options.bankStorageAuto && !_GameHelpers.isAscend()) {
  736. for (var idx in _Priority.aList) {
  737. if (_Priority.aList.hasOwnProperty(idx)) {
  738. var bankStorageNew = Math.floor(idx / 50000);
  739. if (bankStorageNew > 100) bankStorageNew = 100;
  740. if (!isNaN(bankStorageNew)) _BotSettings.setBankStogarePercent(bankStorageNew, true);
  741. else if (console) console.log('bankStorageNew error:', idx);
  742. break;
  743. }
  744. }
  745. }
  746. },
  747. makeABuy: function() {
  748. if (_GameHelpers.isAscend()) return;
  749.  
  750. _BotLogic.killAllWrinklers();
  751.  
  752. var moneyCanSpend = _GameStat.getMoneyCanSpend();
  753.  
  754. if (moneyCanSpend < 0) {
  755. var minimalMoney = _GameStat.getMinimalMoney();
  756. _BotUI.setCaption('Collecting minimum ' + _GameHelpers.beautify(minimalMoney));
  757. _BotUI.setTitleWithPercent(Game.cookies, minimalMoney, 'minimum');
  758. return;
  759. }
  760.  
  761. for (var idx in _Priority.aList) {
  762. if (_Priority.aList.hasOwnProperty(idx)) {
  763. var needToBuy = _Priority.aList[idx];
  764. if (needToBuy.type === 'upgrade') {
  765. _BotUI.setCaption('Upgrading ' + needToBuy.name + ' for ' + _GameHelpers.beautify(needToBuy.price));
  766. if (needToBuy.price < moneyCanSpend) {
  767. if (Game.UpgradesById[needToBuy.id].canBuy()) {
  768. Game.UpgradesById[needToBuy.id].buy();
  769. _LogPage.addLog('Buy upgrade ' + Game.UpgradesById[needToBuy.id].name + ' for ' + _GameHelpers.beautify(needToBuy.price));
  770. _Priority.createPriorityList();
  771. }
  772. } else {
  773. _BotUI.setTitleWithPercent(moneyCanSpend, needToBuy.price, Game.UpgradesById[needToBuy.id].name);
  774. }
  775. } else {
  776. var objPrice = Game.ObjectsById[needToBuy.id].price;
  777. _BotUI.setCaption('Collecting ' + _GameHelpers.beautify(objPrice) + ' for ' + needToBuy.name);
  778. if (objPrice < moneyCanSpend) {
  779. var amount = 1;
  780. var objPrice100 = Game.ObjectsById[needToBuy.id].getSumPrice(100);
  781. var objPrice10 = Game.ObjectsById[needToBuy.id].getSumPrice(10);
  782. if (objPrice100 < moneyCanSpend) {
  783. Game.ObjectsById[needToBuy.id].buy(100);
  784. amount = 100;
  785. objPrice = objPrice100;
  786. } else if (objPrice10 < moneyCanSpend) {
  787. Game.ObjectsById[needToBuy.id].buy(10);
  788. amount = 10;
  789. objPrice = objPrice10;
  790. } else {
  791. Game.ObjectsById[needToBuy.id].buy(1);
  792. }
  793. _LogPage.addLog('Buy ' + amount + ' object ' + Game.ObjectsById[needToBuy.id].name + ' for ' + _GameHelpers.beautify(objPrice));
  794. _Priority.createPriorityList();
  795. } else {
  796. _BotUI.setTitleWithPercent(moneyCanSpend, needToBuy.price, Game.ObjectsById[needToBuy.id].name);
  797. }
  798. }
  799. break;
  800. }
  801. }
  802.  
  803. _BotLogic.buyLump();
  804. },
  805. start: function () {
  806. tAutoBuy = setInterval(_BotLogic.makeABuy, 500);
  807. tSeasonSwitcher = setInterval(_BotLogic.seasonSwitcher, 3000);
  808. tDragon = setInterval(_BotLogic.dragonSwitcher, 10000);
  809.  
  810. _BotLogic.started = true;
  811. _BotUI.setCaption('Started');
  812. _LogPage.addLog('Autobuy start!', true);
  813. },
  814. stop: function () {
  815. clearInterval(tAutoBuy);
  816. clearInterval(tSeasonSwitcher);
  817. clearInterval(tDragon);
  818.  
  819. _BotLogic.started = false;
  820. _BotUI.setCaption('Collecting gold...');
  821. _LogPage.addLog('Autobuy stop.', true);
  822. },
  823. dragonSwitcher: function () {
  824. if (_GameHelpers.isAscend()) return;
  825.  
  826. if (_GameHelpers.hasDragon() && Game.dragonLevel<Game.dragonLevels.length-1 && Game.dragonLevels[Game.dragonLevel].cost()) {
  827. _LogPage.addLog("Upgrading dragon Level " + (Game.dragonLevel+1) + " of " + Game.dragonLevels.length);
  828. Game.UpgradeDragon();
  829. Game.specialTab = 'Hello';
  830. Game.ToggleSpecialMenu(0);
  831. }
  832.  
  833. if (Game.dragonLevel >= 12 && parseInt(Game.dragonAura) !== 9) {
  834. Game.dragonAura = 9; //"Arcane Aura"
  835. Game.recalculateGains = 1;
  836. _LogPage.addLog("Switching dragon Aura to " + _GameHelpers.getDragonAuraName(Game.dragonAura));
  837. } else if (_GameHelpers.dragonHasAura2() && parseInt(Game.dragonAura2) !== 15) {
  838. Game.dragonAura2 = 15; //"Radiant Appetite"
  839. Game.recalculateGains = 1;
  840. _LogPage.addLog("Switching dragon Aura2 to " + _GameHelpers.getDragonAuraName(Game.dragonAura2));
  841. } else if (Game.dragonLevel >= 4 && Game.dragonLevel < 12 && parseInt(Game.dragonAura) !== (Game.dragonLevel - 3)) {
  842. Game.dragonAura = Game.dragonLevel - 3;
  843. Game.recalculateGains = 1;
  844. _LogPage.addLog("Switching dragon Aura to " + _GameHelpers.getDragonAuraName(Game.dragonAura));
  845. }
  846. },
  847. seasonSwitcher: function() {
  848. if (!_BotSettings.options.autoSeason) return;
  849. if (_GameHelpers.isAscend()) return;
  850.  
  851. if (_GameStat.getWrinklerCount() >= 8) {
  852. var halloweenSeason = ['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies'];
  853. for (var x in halloweenSeason) {
  854. if (halloweenSeason.hasOwnProperty(x) && Game.Upgrades[halloweenSeason[x]].bought === 0) {
  855. if (Game.season !== 'halloween') {
  856. Game.Upgrades['Ghostly biscuit'].buy();
  857. _BotLogic.killAllWrinklers(true);
  858. return;
  859. }
  860. }
  861. }
  862. }
  863.  
  864. if (!Game.Has('Santa\'s dominion')) {
  865. if (Game.season !== 'christmas') {
  866. Game.Upgrades['Festive biscuit'].buy();
  867. } else {
  868. if (Game.Has('A festive hat')) {
  869. for (var i = 0; i < (14 - Game.santaLevel); i++) Game.UpgradeSanta();
  870. Game.specialTab = 'Hello';
  871. Game.ToggleSpecialMenu(0);
  872. }
  873. }
  874. return;
  875. }
  876.  
  877. var valentines = ['Pure heart biscuits','Ardent heart biscuits','Sour heart biscuits','Weeping heart biscuits','Golden heart biscuits','Eternal heart biscuits'];
  878. for (x in valentines) {
  879. if (valentines.hasOwnProperty(x) && Game.Upgrades[valentines[x]].bought === 0) {
  880. if (Game.season !== 'valentines') {
  881. Game.Upgrades['Lovesick biscuit'].buy();
  882. }
  883. return;
  884. }
  885. }
  886.  
  887. for (x in Game.easterEggs) {
  888. if (Game.easterEggs.hasOwnProperty(x) && Game.Upgrades[Game.easterEggs[x]].bought === 0) {
  889. if (Game.season !== 'easter') {
  890. Game.Upgrades['Bunny biscuit'].buy();
  891. }
  892. return;
  893. }
  894. }
  895.  
  896. if (Game.season !== 'christmas') {
  897. Game.Upgrades['Festive biscuit'].buy();
  898. }
  899. },
  900. removeNegativeBuff: function () {
  901. if (_GameStat.getBuffMult() < 1) {
  902. var hasBuffsToKill = false;
  903. for (var buff in Game.buffs) {
  904. if (Game.buffs[buff] !== 0 && typeof Game.buffs[buff].multCpS !== 'undefined') {
  905. Game.buffs[buff].time = 0; // remove all buffs, not only negative (not cheating)
  906. hasBuffsToKill = true;
  907. }
  908. }
  909. if (hasBuffsToKill) _LogPage.addLog('Remove all buffs because of negative multiplier', true);
  910. }
  911. },
  912. updatePriorityAndLog: function () {
  913. _Priority.createPriorityList();
  914. _LogPage.updateLog();
  915. },
  916. ascendDetector: function () {
  917. if (_GameHelpers.isAscend()) {
  918. _BotUI.setCaption("Select wisely");
  919. _BotSettings.setBankStogarePercent(0, true);
  920. } else {
  921. if (_GameHelpers.isNeverclick()) {
  922. if (Game.cookiesEarned < 15) {
  923. var s = Math.max(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time, 0);
  924. var s1 = Math.max(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time, 0);
  925. if (s > 0) {
  926. _BotUI.setCaption("Waiting golden cookies for " + s + " time")
  927. } else if (s1 > 0) {
  928. _BotUI.setCaption("Waiting golden cookies for more " + s1 + " time")
  929. }
  930. } else if (Game.Objects.Cursor.amount === 0) {
  931. Game.Objects.Cursor.buy();
  932. }
  933. }
  934. }
  935. },
  936. popGolden: function () {
  937. var golden = Game.shimmers;
  938. if (golden && golden.length > 0) {
  939. for (var i in golden) {
  940. if (golden.hasOwnProperty(i)) {
  941. golden[i].pop();
  942. }
  943. }
  944. }
  945. },
  946. doAutoClick: function () {
  947. if (_BotSettings.options.noClicking) return;
  948. var date=new Date();
  949. date.setTime(Date.now()-Game.startDate);
  950. var seconds = date.getTime() / 1000;
  951. var buffMult = _GameStat.getBuffMult();
  952. var buffClicker = typeof Game.hasBuff !== 'undefined' && (
  953. Game.hasBuff('Click frenzy') ||
  954. Game.hasBuff('Cursed finger') ||
  955. Game.hasBuff('Elder frenzy') ||
  956. Game.hasBuff('Dragon Harvest') ||
  957. Game.hasBuff('Dragonflight')
  958. );
  959. if (buffMult >= 15 ||
  960. Game.cookiesPs < 1000000 ||
  961. buffClicker ||
  962. seconds < 1000)
  963. {
  964. var $bigCookie = jQuery('#bigCookie');
  965. Game.mouseX = $bigCookie.width() / 2 + $bigCookie.offset().left;
  966. Game.mouseY = $bigCookie.height() / 2 + $bigCookie.offset().top;
  967. if (typeof Game.ClickCookie === 'function') Game.ClickCookie();
  968. isClickingNow = true;
  969. } else {
  970. isClickingNow = false;
  971. }
  972. }
  973. };
  974.  
  975. setTimeout(function() {
  976. _BotSettings.restoreAll();
  977.  
  978. _LogPage.init();
  979. _BotUI.initBot();
  980. _BotUI.initLogButton();
  981.  
  982. tPriority = setInterval(_BotLogic.updatePriorityAndLog, 1000);
  983. tReloadPageOnWrongBuff = setInterval(_BotLogic.removeNegativeBuff, 1000);
  984. tAscendDetector = setInterval(_BotLogic.ascendDetector, 1000);
  985. tPopGolden = setInterval(_BotLogic.popGolden, 500);
  986. tBankAuto = setInterval(_BotLogic.bankAutoFunction, 600001); // 10 minutes
  987. tClickFrenzy = setInterval(_BotLogic.doAutoClick, tAutoClickInterval);
  988.  
  989. _BotUI.setCaption('Collecting gold...');
  990.  
  991. _BotLogic.updatePriorityAndLog();
  992. _BotLogic.bankAutoFunction();
  993. }, 5000);
  994. })();