Cookie clicker tools

Cookie clicker tools (visual)

目前為 2017-03-10 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Cookie clicker tools
  3. // @namespace orteil.dashnet.org
  4. // @version 2.105
  5. // @description Cookie clicker tools (visual)
  6. // @author Anton
  7. // @match http://orteil.dashnet.org/cookieclicker/*
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. var log = [], logTitle = '<div class="section">Cookie clicker tools 2.105 is here!</div>', newLogs = 0;
  14.  
  15. var started = false, t2, t3, tClick, tClickFrenzy, oldTitle = '', tLog,
  16. tPriority, tBankAuto, tAscendDetector, isClickingNow = false, tReloadPageOnWrongBuff;
  17.  
  18. var _history = function() {
  19. var hist = [];
  20. hist.push('2.103 - Info section fix');
  21. hist.push('2.101 - remove all bufs on negative multiplier (same as reload page)');
  22. hist.push('2.100 - Info section + ascend detector');
  23. hist.push('2.099 - mouse click upgrades');
  24. hist.push('2.097 - auto bank storage');
  25. hist.push('2.096 - buy objects more than 1');
  26. hist.push('2.095 - objects CpS fix (buffs)');
  27. hist.push('2.094 - objects CpS fix (buffs)');
  28. hist.push('2.093 - objects CpS fix');
  29. hist.push('2.092 - priority table fix');
  30. hist.push('2.091 - priority table refactor');
  31. hist.push('2.090 - buy very cheap items first');
  32. hist.push('2.089 - fix pool toggle buy');
  33. hist.push('2.087 - fix buy unknown upgrades');
  34. hist.push('2.086 - clear log button');
  35. hist.push('2.084 - buy unknown upgrades if their price is 0.1% of cookie storage');
  36. hist.push('2.083 - mouse upgrades is processed as Upgrades');
  37. hist.push('2.082 - start from scratch');
  38. hist.push('2.080 - add history, add option "showTimeCompensate"');
  39. hist.push('2.079 - hide donate box');
  40. hist.push('2.078 - Kittens now is processed as Upgrades');
  41. return hist;
  42. }
  43.  
  44. var _getKittenPercentByUpgradeName = function(kName) {
  45. if (kName == 'Kitten helpers') return Game.milkProgress*0.1;
  46. if (kName == 'Kitten workers') return Game.milkProgress*0.125;
  47. if (kName == 'Kitten engineers') return Game.milkProgress*0.15;
  48. if (kName == 'Kitten overseers') return Game.milkProgress*0.175;
  49. if (kName == 'Kitten managers') return Game.milkProgress*0.2;
  50. if (kName == 'Kitten accountants') return Game.milkProgress*0.2;
  51. if (kName == 'Kitten specialists') return Game.milkProgress*0.2;
  52. if (kName == 'Kitten experts') return Game.milkProgress*0.2;
  53. if (kName == 'Kitten angels') return Game.milkProgress*0.1;
  54. return 0;
  55. }
  56.  
  57. var options = {
  58. bankStoragePercent: 100,
  59. showTimeCompensate: false,
  60. bankStorageAuto: false
  61. };
  62. var _store = function(name, value) {
  63. if (typeof(Storage) !== "undefined") localStorage.setItem(name, value);
  64. };
  65. var _restore = function(name) {
  66. if (typeof(Storage) !== "undefined") return localStorage.getItem(name);
  67. else return undefined;
  68. };
  69.  
  70. var _getBuffMult = function () {
  71. var buffMult = 1;
  72. for (var buff in Game.buffs) {
  73. if (Game.buffs[buff] !== 0 && typeof Game.buffs[buff].multCpS !== 'undefined') {
  74. buffMult = buffMult * Game.buffs[buff].multCpS;
  75. }
  76. }
  77. return buffMult === 0 ? 1 : buffMult;
  78. };
  79.  
  80. var _getNormalCookiesPs = function () {
  81. return Game.cookiesPs > 0 ? Game.cookiesPs / _getBuffMult() : 1;
  82. };
  83.  
  84. var _getMinimalMoney = function () {
  85. return Math.floor(_getNormalCookiesPs() * 42100 * options.bankStoragePercent / 100);
  86. };
  87.  
  88. var _getMoneyCanSpend = function () {
  89. var moneyCanSpend = Game.cookies - _getMinimalMoney();
  90. return moneyCanSpend;
  91. };
  92.  
  93. var _getWrinklerCount = function () {
  94. var wrinklersCount = 0;
  95. for (var i in Game.wrinklers) {
  96. if (Game.wrinklers[i].sucked > 0) {
  97. wrinklersCount++;
  98. }
  99. }
  100. return wrinklersCount;
  101. };
  102.  
  103. var priorityListObj = {}, priorityList = [], timeCompensateObj = {}, timeCompensateList = [];
  104. var _createPriorityList = function() {
  105. var moneyCanSpend = _getMoneyCanSpend();
  106. var money = Game.cookies;
  107. var buffMult = _getBuffMult();
  108. priorityList = [];
  109. priorityListObj = {};
  110. for (var g in Game.UpgradesById) {
  111. if (Game.UpgradesById[g].bought === 0 && Game.UpgradesById[g].unlocked == 1) {
  112. var isMultiplier = Game.UpgradesById[g].desc.indexOf('production multiplier') >= 0;
  113. var isDouble = Game.UpgradesById[g].desc.indexOf('<b>twice</b>') >= 0;
  114. var isDoubleGrandma = Game.UpgradesById[g].desc.indexOf('Grandmas are <b>twice</b>') >= 0;
  115. var isKitten = Game.UpgradesById[g].name.indexOf('Kitten ') >= 0;
  116. var isDoubleCursor = Game.UpgradesById[g].desc.indexOf('The mouse and cursors are <b>twice</b>') >= 0;
  117. var isClickIncrease = Game.UpgradesById[g].desc.indexOf('Clicking gains <b>+1%') >= 0;
  118. var increasedMoney = 0;
  119. if (isClickIncrease) {
  120. increasedMoney = Game.cookiesPs * 0.01;
  121. } else if (isDoubleCursor) {
  122. increasedMoney = Game.Objects['Cursor'].storedTotalCps * Game.globalCpsMult / buffMult;
  123. } else if (isKitten) {
  124. var kittenPercent = _getKittenPercentByUpgradeName(Game.UpgradesById[g].name);
  125. increasedMoney = _getNormalCookiesPs() * kittenPercent;
  126. } else if (isDoubleGrandma) {
  127. increasedMoney = Game.Objects['Grandma'].storedTotalCps * Game.globalCpsMult / buffMult;
  128. } else if (isMultiplier) {
  129. increasedMoney = _getNormalCookiesPs() * Game.UpgradesById[g].power / 100;
  130. } else if (isDouble) {
  131. increasedMoney = Game.UpgradesById[g].buildingTie.storedTotalCps * Game.globalCpsMult / buffMult;
  132. }
  133. var interest = increasedMoney > 0 ? Game.UpgradesById[g].basePrice / increasedMoney : '-';
  134. if (interest != '-') {
  135. if (typeof priorityListObj[Math.floor(interest)] === 'undefined') {
  136. var pp = moneyCanSpend / Game.UpgradesById[g].basePrice; // percent of cheapness
  137. if (pp > 50) interest /= pp * 50;
  138. priorityListObj[Math.floor(interest)] = {
  139. name: Game.UpgradesById[g].name,
  140. title: Game.UpgradesById[g].name + ' - ' + Beautify(Game.UpgradesById[g].basePrice),
  141. price: Game.UpgradesById[g].basePrice,
  142. cps: 1,
  143. type: 'upgrade',
  144. id: g,
  145. income: increasedMoney
  146. };
  147. }
  148. } else if (Game.UpgradesById[g].type == 'upgrade' &&
  149. Game.UpgradesById[g].basePrice < moneyCanSpend &&
  150. Game.UpgradesById[g].pool != 'toggle' && Game.UpgradesById[g].pool != 'tech')
  151. {
  152. interest = Game.UpgradesById[g].basePrice / moneyCanSpend * 1000;
  153. if (typeof priorityListObj[Math.floor(interest)] === 'undefined') {
  154. pp = moneyCanSpend / Game.UpgradesById[g].basePrice; // percent of cheapness
  155. if (pp > 50) interest /= pp * 50;
  156. priorityListObj[Math.floor(interest)] = {
  157. name: Game.UpgradesById[g].name,
  158. title: Game.UpgradesById[g].name + ' - ' + Beautify(Game.UpgradesById[g].basePrice),
  159. price: Game.UpgradesById[g].basePrice,
  160. cps: 1,
  161. type: 'upgrade',
  162. id: g,
  163. income: 0
  164. };
  165. }
  166. }
  167. //priorityList.push(Game.UpgradesById[g].name + ' - ' + Beautify(Game.UpgradesById[g].basePrice) + ' (INTEREST: ' + Beautify(interest) + ')');
  168. }
  169. }
  170. for (var i in Game.ObjectsById) {
  171. if (typeof i !== 'undefined' && i != 'undefined' && Game.ObjectsById.hasOwnProperty(i)) {
  172. if (Game.ObjectsById[i].locked === 0) {
  173. var cps = (Game.ObjectsById[i].storedTotalCps / Game.ObjectsById[i].amount) * Game.globalCpsMult / buffMult;
  174. interest = Game.ObjectsById[i].price / cps;
  175. var pp = moneyCanSpend / Game.ObjectsById[i].price; // percent of cheapness
  176. if (pp > 50) interest /= pp * 50;
  177. if (isNaN(Math.floor(interest)) && Game.ObjectsById[i].price < moneyCanSpend) interest = 0;
  178. priorityListObj[Math.floor(interest)] = {
  179. name: Game.ObjectsById[i].name,
  180. title: Game.ObjectsById[i].name + ' - ' + Beautify(Game.ObjectsById[i].price),
  181. price: Game.ObjectsById[i].price,
  182. cps: cps,
  183. type: 'buy',
  184. id: i,
  185. income: cps
  186. };
  187. //priorityList.push(Game.ObjectsById[i].name + ' - ' + Beautify(Game.ObjectsById[i].price) + ' (INTEREST: ' + Beautify(interest) + ')');
  188. }
  189. }
  190. }
  191. for (i in priorityListObj) {
  192. var prefix = priorityListObj[i].price < moneyCanSpend ? '!!! ' : (priorityListObj[i].price < money ? '! ' : '');
  193. var pp = Math.floor(moneyCanSpend / priorityListObj[i].price * 100);
  194. priorityList.push(prefix + priorityListObj[i].title + ' : ' + i + ' (' + pp + '%)');
  195. }
  196.  
  197. timeCompensateObj = {};
  198. timeCompensateList = [];
  199. for (i in priorityListObj) {
  200. var o = priorityListObj[i];
  201. if (o.type == 'buy') {
  202. var cpsWithPercent = (o.cps / _getNormalCookiesPs() + 1) * o.cps;
  203. var interestNew = o.price / cpsWithPercent;
  204. timeCompensateObj[Math.floor(interestNew)] = {
  205. name: o.name,
  206. title: o.title,
  207. price: o.price,
  208. cps: cpsWithPercent,
  209. type: 'buy',
  210. id: o.id,
  211. income: o.income
  212. };
  213. } else {
  214. timeCompensateObj[i] = o;
  215. }
  216. }
  217. for (i in timeCompensateObj) {
  218. prefix = timeCompensateObj[i].price < moneyCanSpend ? '!!! ' : (timeCompensateObj[i].price < money ? '! ' : '');
  219. timeCompensateList.push(prefix + timeCompensateObj[i].title + ' : ' + i);
  220. }
  221. };
  222.  
  223. var _caption = function(txt) {
  224. var $v = jQuery('#versionNumber');
  225. if ($v.text() != txt) $v.text(txt);
  226. };
  227.  
  228. var _title = function(txt) {
  229. var newTitle = (newLogs > 0 ? '(' + newLogs + ') ' : '') + txt;
  230. if (document.title != newTitle) {
  231. oldTitle = txt;
  232. document.title = newTitle;
  233. }
  234. };
  235.  
  236. var _titlePercent = function(have, need, txt) {
  237. var percent = Math.ceil(have / (need !== 0 ? need : 1) * 100);
  238. _title(String(percent) + "% - " + txt);
  239. };
  240.  
  241. var _logSectionTitle = function (text) {
  242. return '<div class="title">' + text + '</div>';
  243. };
  244.  
  245. var _logSection = function (title, items) {
  246. return '<div class="subsection">' + _logSectionTitle(title) +
  247. '<div class="listing">' + items.join('</div><div class="listing">') + '</div>' +
  248. '</div>';
  249. };
  250. var clearLogButton = '<button data-id="clearLog" onclick="document.getElementById(\'logButton\').onbuttonclick(this,event)">Clear Log</button>';
  251.  
  252. var _logPriorityTable = function() {
  253. var moneyCanSpend = _getMoneyCanSpend();
  254. var styles = '<style type="text/css">.prioritytable{width:100%;}.prioritytable td,.prioritytable th{padding:3px;}</style>';
  255. var t = '<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>';
  256. for (i in priorityListObj) {
  257. var o = priorityListObj[i];
  258. var pp = Math.floor(moneyCanSpend / o.price * 100);
  259. t += '<tr><td>' + o.type + '</td><td>' + o.name + '</td><td>' + Beautify(o.price) + '</td><td>' + i + '</td><td>' + Beautify(o.income) + '</td><td>' + pp + '</td></tr>';
  260. }
  261. t += '</table>';
  262. return styles + '<div class="subsection">' + _logSectionTitle('Priority ' + clearLogButton) + '<div class="listing">' + t + '</div></div>';
  263. }
  264. var _optionsSection = function() {
  265. var content = [];
  266. content.push('<label for="bankStoragePercent" id="bankStoragePercentLabel">Storage (' + Beautify(_getMinimalMoney()) + ') percent: ' + options.bankStoragePercent + '%</label> <input name="bankStoragePercent" id="bankStoragePercent" type="range" min="0" max="100" value="' + options.bankStoragePercent + '" onchange="document.getElementById(\'logButton\').onsliderchange(this)" />');
  267. content.push('<button data-id="showTimeCompensate" onclick="document.getElementById(\'logButton\').onbuttonclick(this,event)">showTimeCompensate: ' + (options.showTimeCompensate ? 'TRUE' : 'FALSE') + '</button>');
  268. content.push('<button data-id="bankStorageAuto" onclick="document.getElementById(\'logButton\').onbuttonclick(this,event)">bankStorageAuto: ' + (options.bankStorageAuto ? 'TRUE' : 'FALSE') + '</button>');
  269. content.push(clearLogButton);
  270. return content;
  271. };
  272.  
  273. var _infoSection = function() {
  274. var content = [];
  275. var wrinklersTotal = 0;
  276. for (var i in Game.wrinklers) {
  277. wrinklersTotal += Game.wrinklers[i].sucked;
  278. }
  279. var chipsOwned = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
  280. var ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
  281. var ascendWillGet = ascendNowToOwn - chipsOwned;
  282. var cookiesToDoubleInitial = Game.HowManyCookiesReset(chipsOwned * 2) - (Game.cookiesEarned + Game.cookiesReset);
  283. var timeToReachDouble = Math.floor(cookiesToDoubleInitial / _getNormalCookiesPs());
  284. content.push('Now clicking: ' + (isClickingNow ? "YES" : "NO"));
  285. content.push('Wrinklers: ' + _getWrinklerCount());
  286. content.push('Wrinklers sucked: ' + Beautify(wrinklersTotal));
  287. content.push('Heavenly chips in storage: ' + Game.heavenlyChips);
  288. content.push('Heavenly chips after ascend: ' + (Game.heavenlyChips + ascendWillGet));
  289. content.push('Buff mult: ' + _getBuffMult());
  290. content.push('Normal CpS: ' + Beautify(_getNormalCookiesPs()));
  291. content.push('Money bank: ' + Beautify(_getMinimalMoney()));
  292. content.push('Money can spend: ' + Beautify(_getMoneyCanSpend()));
  293. content.push('You will get prestige by ascending: ' + ascendWillGet);
  294. content.push('Cookies to double prestige: ' + Beautify(cookiesToDoubleInitial));
  295. content.push('Time to double prestige: ' + Game.sayTime(timeToReachDouble * Game.fps, 2));
  296. return content;
  297. }
  298.  
  299. var _updateLog = function () {
  300. Game.updateLog = logTitle +
  301. //_logSection('Priority ' + clearLogButton, priorityList) +
  302. _logPriorityTable() +
  303. (options.showTimeCompensate ? _logSection('Priority (time compensate)', timeCompensateList) : '') +
  304. _logSection('Info', _infoSection()) +
  305. _logSection('Log', log) +
  306. _logSection('Options', _optionsSection()) +
  307. _logSection('History', _history());
  308. var newButtonText = newLogs > 0 ? 'Log (' + newLogs + ')' : 'Log';
  309. if (jQuery('#logButton').text() != newButtonText) jQuery('#logButton').text(newButtonText);
  310. _title(oldTitle);
  311. };
  312.  
  313. var _setBankStogarePercent = function(val, needUpdate) {
  314. if (options.bankStoragePercent != val) {
  315. if (needUpdate === true) jQuery('#bankStoragePercent').val(val);
  316. if (console) console.log('bankStoragePercent =', val);
  317. _store('bankStoragePercent', val);
  318. options.bankStoragePercent = val;
  319. jQuery('#bankStoragePercentLabel').text('Storage (' + Beautify(_getMinimalMoney()) + ') percent: ' + val + '%');
  320. _updateLog();
  321. }
  322. }
  323.  
  324. document.getElementById('logButton').onsliderchange = function(el) {
  325. var val = $(el).val();
  326. _setBankStogarePercent(val);
  327. };
  328.  
  329. var _bankAutoFunction = function() {
  330. if (options.bankStorageAuto && priorityList.length > 0 && Game.OnAscend == 0) {
  331. for (var idx in priorityListObj) {
  332. var bankStorageNew = Math.floor(idx / 50000);
  333. if (bankStorageNew > 100) bankStorageNew = 100;
  334. if (!isNaN(bankStorageNew)) _setBankStogarePercent(bankStorageNew, true);
  335. else if (console) console.log('bankStorageNew error:', idx);
  336. break;
  337. }
  338. }
  339. };
  340.  
  341. document.getElementById('logButton').onbuttonclick = function(el,e) {
  342. e.preventDefault();
  343. var id = jQuery(el).attr('data-id');
  344. if (id == 'showTimeCompensate') {
  345. options.showTimeCompensate = !options.showTimeCompensate;
  346. if (console) console.log('showTimeCompensate =', options.showTimeCompensate ? 'TRUE' : 'FALSE');
  347. } else if (id == 'bankStorageAuto') {
  348. options.bankStorageAuto = !options.bankStorageAuto;
  349. _store('bankStorageAuto', options.bankStorageAuto);
  350. if (console) console.log('bankStorageAuto =', options.bankStorageAuto ? 'TRUE' : 'FALSE');
  351. _bankAutoFunction();
  352. } else if (id == 'clearLog') {
  353. log = [];
  354. newLogs = 0;
  355. }
  356. jQuery(el).attr('disabled', 'disabled');
  357. _updateLog();
  358. }
  359.  
  360. var _addLog = function(text, notCritical) {
  361. var t = new Date();
  362. log.push(t.toUTCString() + ': ' + text);
  363. if (notCritical !== true) newLogs++;
  364. _updateLog();
  365. };
  366.  
  367. jQuery('#logButton').text('Log').on("click", function() {
  368. newLogs = 0;
  369. jQuery('#logButton').text('Log');
  370. });
  371.  
  372. var _killAllWrinklers = function () {
  373. var wrinklersCount = _getWrinklerCount();
  374. if (wrinklersCount >= 10) {
  375. var wrinklesIncome = 0;
  376. for (var i in Game.wrinklers) {
  377. wrinklesIncome += Game.wrinklers[i].sucked;
  378. Game.wrinklers[i].hp = 0; // kill ALL
  379. }
  380. if (wrinklesIncome > 0) {
  381. _addLog('Killed all Wrinkles for ' + Beautify(wrinklesIncome) + ' because of count 10.', true);
  382. }
  383. }
  384. };
  385.  
  386. var _makeABuy = function() {
  387.  
  388. _killAllWrinklers();
  389.  
  390. var moneyCanSpend = _getMoneyCanSpend();
  391.  
  392. if (moneyCanSpend < 0) {
  393. var minimalMoney = _getMinimalMoney();
  394. _caption('Collecting minimum ' + Beautify(minimalMoney));
  395. _titlePercent(Game.cookies, minimalMoney, 'minimum');
  396. return;
  397. }
  398. var needToBuy = undefined, needToBuyInterest = undefined;
  399. if (priorityList.length > 0) {
  400. for (var idx in priorityListObj) {
  401. needToBuy = priorityListObj[idx];
  402. needToBuyInterest = idx;
  403. if (needToBuy.type == 'upgrade') {
  404. _caption('Upgrading ' + needToBuy.name + ' for ' + Beautify(needToBuy.price));
  405. if (needToBuy.price < moneyCanSpend) {
  406. if (Game.UpgradesById[needToBuy.id].canBuy()) {
  407. Game.UpgradesById[needToBuy.id].buy();
  408. _addLog('Buy upgrade ' + Game.UpgradesById[needToBuy.id].name + ' for ' + Beautify(needToBuy.price));
  409. _createPriorityList();
  410. }
  411. } else {
  412. _titlePercent(moneyCanSpend, needToBuy.price, Game.UpgradesById[needToBuy.id].name);
  413. }
  414. } else {
  415. _caption('Collecting ' + Beautify(needToBuy.price) + ' for ' + needToBuy.name);
  416. if (Game.ObjectsById[needToBuy.id].price < moneyCanSpend) {
  417. var amount = 1;
  418. if (Game.ObjectsById[needToBuy.id].getSumPrice(100) < moneyCanSpend) {
  419. Game.ObjectsById[needToBuy.id].buy(100);
  420. amount = 100;
  421. } else if (Game.ObjectsById[needToBuy.id].getSumPrice(10) < moneyCanSpend) {
  422. Game.ObjectsById[needToBuy.id].buy(10);
  423. amount = 10;
  424. } else {
  425. Game.ObjectsById[needToBuy.id].buy(1);
  426. }
  427. _addLog('Buy ' + amount + ' object ' + Game.ObjectsById[needToBuy.id].name + ' for ' + Beautify(Game.ObjectsById[needToBuy.id].price));
  428. _createPriorityList();
  429. } else {
  430. _titlePercent(moneyCanSpend, needToBuy.price, Game.ObjectsById[needToBuy.id].name);
  431. }
  432. }
  433. break;
  434. }
  435. }
  436. };
  437.  
  438. var startT = function() {
  439. t2 = setInterval(_makeABuy, 500);
  440.  
  441. started = true;
  442. _caption('Started');
  443. _addLog('Autobuy start!', true);
  444. };
  445.  
  446. var stopT = function() {
  447. clearInterval(t2);
  448. started = false;
  449. _caption('Collecting gold...');
  450. _addLog('Autobuy stop.', true);
  451. };
  452.  
  453. jQuery('#versionNumber').on("click", function() {
  454. if (!started)
  455. startT();
  456. else
  457. stopT();
  458. });
  459.  
  460. options.bankStoragePercent = _restore('bankStoragePercent');
  461. if (typeof options.bankStoragePercent === 'undefined' || options.bankStoragePercent === null) {
  462. options.bankStoragePercent = 100;
  463. }
  464. options.bankStorageAuto = _restore('bankStorageAuto');
  465. if (typeof options.bankStorageAuto === 'undefined' || options.bankStorageAuto === null) {
  466. options.bankStorageAuto = false;
  467. }
  468.  
  469. setTimeout(function() {
  470. jQuery('#donateBox').hide();
  471. tPriority = setInterval(function () {
  472. _createPriorityList();
  473. _updateLog();
  474. }, 1000);
  475.  
  476. tLog = setInterval(function () {
  477. _updateLog();
  478. }, 600);
  479.  
  480. tReloadPageOnWrongBuff = setInterval(function() {
  481. if (_getBuffMult() < 1) {
  482. var hasBuffsToKill = false;
  483. for (var buff in Game.buffs) {
  484. if (Game.buffs[buff] !== 0 && typeof Game.buffs[buff].multCpS !== 'undefined') {
  485. Game.buffs[buff].time = 0; // remove all buffs, not only negative (not cheating)
  486. hasBuffsToKill = true;
  487. }
  488. }
  489. if (hasBuffsToKill) _addLog('Remove all buffs because of negative multiplier', true);
  490. }
  491. }, 1000);
  492.  
  493. tAscendDetector = setInterval(function() {
  494. if (Game.OnAscend == 1) {
  495. _setBankStogarePercent(0, true);
  496. }
  497. }, 1000);
  498.  
  499. t3 = setInterval(function() {
  500. var golden = Game.shimmers;
  501. if (golden.length > 0) {
  502. for (var i in golden) {
  503. golden[i].pop();
  504. }
  505. }
  506. }, 500);
  507.  
  508. tBankAuto = setInterval(_bankAutoFunction, 600001); // 10 minutes
  509.  
  510. tClickFrenzy = setInterval(function() {
  511. if (Game.hasBuff('Click frenzy') ||
  512. Game.hasBuff('Cursed finger') ||
  513. Game.hasBuff('Elder frenzy') ||
  514. Game.hasBuff('Dragon Harvest') ||
  515. Game.hasBuff('Dragonflight') ||
  516. Game.cookiesPs < 1000000) {
  517. Game.ClickCookie();
  518. isClickingNow = true;
  519. } else {
  520. isClickingNow = false;
  521. }
  522. }, 75);
  523.  
  524. if (Game.cookiesPs < 1E6) {
  525. tClick = setInterval(function() {
  526. Game.mouseX = jQuery('#bigCookie').width() / 2 + jQuery('#bigCookie').offset().left;
  527. Game.mouseY = jQuery('#bigCookie').height() / 2 + jQuery('#bigCookie').offset().top;
  528. Game.ClickCookie();
  529. if (Game.cookiesPs > 1E8) clearInterval(tClick);
  530. }, 300);
  531. }
  532.  
  533. _caption('Collecting gold...');
  534. _bankAutoFunction();
  535. }, 5000);
  536. })();