Greasy Fork 还支持 简体中文。

Cookie clicker tools

Cookie clicker tools (visual)

目前為 2018-12-06 提交的版本,檢視 最新版本

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