',
lastLogUpdatedTime: new Date(),
getTableRow: function (cols) {
var result = '
';
for (var colId in cols) {
if (cols.hasOwnProperty(colId)) {
result += '
' + cols[colId] + '
';
}
}
return result + '
'
},
getLogSectionTitle: function (text) {
return '
' + text + '
';
},
getLogSection: function (sectionTitle, items) {
return '
' + _LogPage.getLogSectionTitle(sectionTitle) +
'
' + items.join('
') + '
' +
'
';
},
getLogPriorityTable: function() {
var moneyCanSpend = _GameStat.getMoneyCanSpend();
var t = _LogPage.priorityTableHeader;
for (var i in _Priority.aList) {
if (_Priority.aList.hasOwnProperty(i)) {
var o = _Priority.aList[i];
var pp = Math.floor(moneyCanSpend / o.price * 100);
t += '
';
},
getLogNeedBuyTable: function() {
var objList = _GameStat.getUpgradeListToUnlock();
if (objList && objList.length > 0) {
var t = _LogPage.needbuyTableHeader;
for (var i in objList) {
if (objList.hasOwnProperty(i)) {
var o = objList[i];
t += _LogPage.getTableRow([
o.name,
_GameHelpers.beautify(o.cookies),
typeof o.require !== 'undefined' ? o.require : '',
typeof o.season !== 'undefined' ? o.season : ''
]);
}
}
t += _LogPage.tableFooter;
return _LogPage.priorityTableStyles + '
' + _LogPage.getLogSectionTitle('Need to unlock') + '
' + t + '
';
} else {
return '';
}
},
getLogNeedAchieveTable: function() {
var ach = [];
for (var i in Game.Achievements) {
if(Game.Achievements[i].won === 0 && Game.Achievements[i].pool !== 'dungeon') {
ach.push(Game.Achievements[i]);
}
}
if (ach.length > 0) {
var t = _LogPage.needAchieveTableHeader;
for (i in ach) {
var o = ach[i];
t += _LogPage.getTableRow([
o.name,
o.desc
]);
}
t += _LogPage.tableFooter;
return _LogPage.priorityTableStyles + '
' + _LogPage.getLogSectionTitle('Achievements to unlock') + '
' + t + '
';
} else {
return '';
}
},
getOptionsSectionList: function() {
var content = [];
content.push(' ');
content.push('');
content.push('');
content.push('');
content.push('');
content.push('');
content.push( _LogPage.clearLogButton);
return content;
},
getInfoSectionList: function() {
var content = [];
var wrinklersTotal = 0;
for (var i in Game.wrinklers) {
wrinklersTotal += Game.wrinklers[i].sucked;
}
var chipsOwned = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
var ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
var ascendWillGet = ascendNowToOwn - chipsOwned;
var cookiesToDoubleInitial = Game.HowManyCookiesReset(chipsOwned * 2) - (Game.cookiesEarned + Game.cookiesReset);
var normalCookiePs = _GameStat.getNormalCookiesPs();
var timeToReachDouble = Math.floor(cookiesToDoubleInitial / normalCookiePs);
content.push('Now clicking: ' + (isClickingNow ? "YES" : "NO"));
content.push('Per click: ' + _GameHelpers.beautify(Game.computedMouseCps));
content.push('Cookies to double prestige: ' + (cookiesToDoubleInitial >= 0 ? _GameHelpers.beautify(cookiesToDoubleInitial) : 'No info'));
content.push('Time to double prestige: ' + Game.sayTime(timeToReachDouble * Game.fps, 2));
content.push('Heavenly chips in storage: ' + Game.heavenlyChips);
content.push('You will get prestige by ascending: ' + ascendWillGet);
content.push('Heavenly chips after ascend: ' + (Game.heavenlyChips + ascendWillGet));
content.push('Buff mult: ' + _GameStat.getBuffMult());
content.push('Normal CpS: ' + _GameHelpers.beautify(normalCookiePs));
content.push('Money bank: ' + _GameHelpers.beautify(_GameStat.getMinimalMoney()));
content.push('Money can spend: ' + _GameHelpers.beautify(_GameStat.getMoneyCanSpend()));
content.push('Wrinklers: ' + _GameStat.getWrinklerCount());
content.push('Wrinklers sucked: ' + _GameHelpers.beautify(wrinklersTotal));
if (Game.dragonLevel= 0 && typeof Game.dragonAuras[Game.dragonAura] !== 'undefined') {
content.push("Aura: " + _GameHelpers.getDragonAuraName(Game.dragonAura));
if (_GameHelpers.dragonHasAura2()) {
content.push("Aura 2: " + _GameHelpers.getDragonAuraName(Game.dragonAura2));
}
}
return content;
},
updateLog: function () {
if (_GameHelpers.isAscend()) return;
var curTime = new Date();
var timeInterval = curTime - _LogPage.lastLogUpdatedTime;
if (timeInterval <= 500) return;
_LogPage.lastLogUpdatedTime = curTime;
Game.updateLog = _LogPage.logTitle +
_LogPage.getLogPriorityTable() +
_LogPage.getLogSection('Info', _LogPage.getInfoSectionList()) +
_LogPage.getLogSection('Log', _LogPage.logLinesArray) +
_LogPage.getLogSection('Options', _LogPage.getOptionsSectionList()) +
_LogPage.getLogNeedBuyTable() +
_LogPage.getLogNeedAchieveTable() +
_LogPage.getLogSection('History', _BotStat.getHistoryList());
var newButtonText = _LogPage.newLogs > 0 ? 'Log (' + _LogPage.newLogs + ')' : 'Log';
if (_BotUI.$logButton.text() !== newButtonText) _BotUI.$logButton.text(newButtonText);
_BotUI.setTitle(oldTitle);
},
addLog: function(text, notCritical) {
var t = new Date();
_LogPage.logLinesArray.push(t.toUTCString() + ': ' + text);
if (notCritical !== true) _LogPage.newLogs++;
_LogPage.updateLog();
},
init: function () {
_LogPage.logTitle = '
Cookie clicker tools ' + _LogPage.version + ' is here!
';
}
};
var _BotLogic = {
started: false,
killAllWrinklers: function (immediately) {
if (typeof immediately === 'undefined') immediately = false;
var wrinklersCount = _GameStat.getWrinklerCount();
if (wrinklersCount >= 10 || immediately === true) {
var wrinklesIncome = 0;
for (var i in Game.wrinklers) {
wrinklesIncome += Game.wrinklers[i].sucked;
Game.wrinklers[i].hp = 0; // kill ALL
}
if (wrinklesIncome > 0) {
_LogPage.addLog('Killed all Wrinkles for ' + _GameHelpers.beautify(wrinklesIncome) + ' of count ' + wrinklersCount + '.', true);
}
}
},
buyEverything: function () {
if (!_GameHelpers.isHardcore()) {
for (var x in Game.UpgradesById) {
if (Game.UpgradesById.hasOwnProperty(x)) {
if (parseInt(Game.UpgradesById[x].unlocked) === 1
&& Game.UpgradesById[x].bought === 0 && Game.UpgradesById[x].canBuy()) {
var pool = Game.UpgradesById[x].pool;
if (pool !== "prestige" &&
pool !== 'debug' &&
pool !== 'toggle' &&
pool !== 'tech' &&
pool !== 'shadow' &&
pool !== 'unused' &&
pool !== 'dungeon') {
Game.UpgradesById[x].buy();
_LogPage.addLog('Buy upgrade ' + Game.UpgradesById[x].name + ' for ' + _GameHelpers.beautify(Game.UpgradesById[x].getPrice()));
}
}
}
}
}
for (x in Game.ObjectsById) {
if (Game.ObjectsById.hasOwnProperty(x)) {
var cnt = 0, sum = 0;
while (Game.cookies >= Game.ObjectsById[x].getPrice()) {
sum += Game.ObjectsById[x].getPrice();
Game.ObjectsById[x].buy(1);
cnt++;
}
if (cnt > 0) _LogPage.addLog('Buy ' + cnt + ' object ' + Game.ObjectsById[x].name + ' for ' + _GameHelpers.beautify(sum));
}
}
},
buyLump: function () {
if (!Game.canLumps()) return;
var needAchievement = Game.Achievements['Hand-picked'] &&
parseInt(Game.Achievements['Hand-picked'].won) === 0;
var age = Date.now() - Game.lumpT;
if (age > Game.lumpMatureAge && needAchievement) {
_LogPage.addLog('Trying to get lump achievement, collecting Mature lump');
if (Game.clickLump) Game.clickLump();
} else if (age > Game.lumpRipeAge) {
_LogPage.addLog('Collecting Ripe lump');
if (Game.clickLump) Game.clickLump();
} else if (age > Game.lumpOverripeAge) {
_LogPage.addLog('Collecting Overripe lump');
if (Game.clickLump) Game.clickLump();
}
},
bankAutoFunction: function () {
if (_BotSettings.options.bankStorageAuto && !_GameHelpers.isAscend()) {
for (var idx in _Priority.aList) {
if (_Priority.aList.hasOwnProperty(idx)) {
var bankStorageNew = Math.floor(idx / 50000);
if (bankStorageNew > 100) bankStorageNew = 100;
if (!isNaN(bankStorageNew)) _BotSettings.setBankStogarePercent(bankStorageNew, true);
else if (console) console.log('bankStorageNew error:', idx);
break;
}
}
}
},
makeABuy: function() {
if (_GameHelpers.isAscend()) return;
_BotLogic.killAllWrinklers();
var moneyCanSpend = _GameStat.getMoneyCanSpend();
if (moneyCanSpend < 0) {
var minimalMoney = _GameStat.getMinimalMoney();
_BotUI.setCaption('Collecting minimum ' + _GameHelpers.beautify(minimalMoney));
_BotUI.setTitleWithPercent(Game.cookies, minimalMoney, 'minimum');
return;
}
for (var idx in _Priority.aList) {
if (_Priority.aList.hasOwnProperty(idx)) {
var needToBuy = _Priority.aList[idx];
if (needToBuy.type === 'upgrade') {
_BotUI.setCaption('Upgrading ' + needToBuy.name + ' for ' + _GameHelpers.beautify(needToBuy.price));
if (needToBuy.price < moneyCanSpend) {
if (Game.UpgradesById[needToBuy.id].canBuy()) {
Game.UpgradesById[needToBuy.id].buy();
_LogPage.addLog('Buy upgrade ' + Game.UpgradesById[needToBuy.id].name + ' for ' + _GameHelpers.beautify(needToBuy.price));
_Priority.createPriorityList();
}
} else {
_BotUI.setTitleWithPercent(moneyCanSpend, needToBuy.price, Game.UpgradesById[needToBuy.id].name);
}
} else {
var objPrice = Game.ObjectsById[needToBuy.id].price;
_BotUI.setCaption('Collecting ' + _GameHelpers.beautify(objPrice) + ' for ' + needToBuy.name);
if (objPrice < moneyCanSpend) {
var amount = 1;
var objPrice100 = Game.ObjectsById[needToBuy.id].getSumPrice(100);
var objPrice10 = Game.ObjectsById[needToBuy.id].getSumPrice(10);
if (objPrice100 < moneyCanSpend) {
Game.ObjectsById[needToBuy.id].buy(100);
amount = 100;
objPrice = objPrice100;
} else if (objPrice10 < moneyCanSpend) {
Game.ObjectsById[needToBuy.id].buy(10);
amount = 10;
objPrice = objPrice10;
} else {
Game.ObjectsById[needToBuy.id].buy(1);
}
_LogPage.addLog('Buy ' + amount + ' object ' + Game.ObjectsById[needToBuy.id].name + ' for ' + _GameHelpers.beautify(objPrice));
_Priority.createPriorityList();
} else {
_BotUI.setTitleWithPercent(moneyCanSpend, needToBuy.price, Game.ObjectsById[needToBuy.id].name);
}
}
break;
}
}
_BotLogic.buyLump();
},
start: function () {
tAutoBuy = setInterval(_BotLogic.makeABuy, 500);
tSeasonSwitcher = setInterval(_BotLogic.seasonSwitcher, 3000);
tDragon = setInterval(_BotLogic.dragonSwitcher, 10000);
_BotLogic.started = true;
_BotUI.setCaption('Started');
_LogPage.addLog('Autobuy start!', true);
},
stop: function () {
clearInterval(tAutoBuy);
clearInterval(tSeasonSwitcher);
clearInterval(tDragon);
_BotLogic.started = false;
_BotUI.setCaption('Collecting gold...');
_LogPage.addLog('Autobuy stop.', true);
},
dragonSwitcher: function () {
if (_GameHelpers.isAscend()) return;
if (_GameHelpers.hasDragon() && Game.dragonLevel= 12 && parseInt(Game.dragonAura) !== 9) {
Game.dragonAura = 9; //"Arcane Aura"
Game.recalculateGains = 1;
_LogPage.addLog("Switching dragon Aura to " + _GameHelpers.getDragonAuraName(Game.dragonAura));
} else if (_GameHelpers.dragonHasAura2() && parseInt(Game.dragonAura2) !== 15) {
Game.dragonAura2 = 15; //"Radiant Appetite"
Game.recalculateGains = 1;
_LogPage.addLog("Switching dragon Aura2 to " + _GameHelpers.getDragonAuraName(Game.dragonAura2));
} else if (Game.dragonLevel >= 4 && Game.dragonLevel < 12 && parseInt(Game.dragonAura) !== (Game.dragonLevel - 3)) {
Game.dragonAura = Game.dragonLevel - 3;
Game.recalculateGains = 1;
_LogPage.addLog("Switching dragon Aura to " + _GameHelpers.getDragonAuraName(Game.dragonAura));
}
},
seasonSwitcher: function() {
if (!_BotSettings.options.autoSeason) return;
if (_GameHelpers.isAscend()) return;
if (_GameStat.getWrinklerCount() >= 8) {
var halloweenSeason = ['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies'];
for (var x in halloweenSeason) {
if (halloweenSeason.hasOwnProperty(x) && Game.Upgrades[halloweenSeason[x]].bought === 0) {
if (Game.season !== 'halloween') {
Game.Upgrades['Ghostly biscuit'].buy();
_BotLogic.killAllWrinklers(true);
return;
}
}
}
}
if (!Game.Has('Santa\'s dominion')) {
if (Game.season !== 'christmas') {
Game.Upgrades['Festive biscuit'].buy();
} else {
if (Game.Has('A festive hat')) {
for (var i = 0; i < (14 - Game.santaLevel); i++) Game.UpgradeSanta();
Game.specialTab = 'Hello';
Game.ToggleSpecialMenu(0);
}
}
return;
}
var valentines = ['Pure heart biscuits','Ardent heart biscuits','Sour heart biscuits','Weeping heart biscuits','Golden heart biscuits','Eternal heart biscuits'];
for (x in valentines) {
if (valentines.hasOwnProperty(x) && Game.Upgrades[valentines[x]].bought === 0) {
if (Game.season !== 'valentines') {
Game.Upgrades['Lovesick biscuit'].buy();
}
return;
}
}
for (x in Game.easterEggs) {
if (Game.easterEggs.hasOwnProperty(x) && Game.Upgrades[Game.easterEggs[x]].bought === 0) {
if (Game.season !== 'easter') {
Game.Upgrades['Bunny biscuit'].buy();
}
return;
}
}
if (Game.season !== 'christmas') {
Game.Upgrades['Festive biscuit'].buy();
}
},
removeNegativeBuff: function () {
if (_GameStat.getBuffMult() < 1) {
var hasBuffsToKill = false;
for (var buff in Game.buffs) {
if (Game.buffs[buff] !== 0 && typeof Game.buffs[buff].multCpS !== 'undefined') {
Game.buffs[buff].time = 0; // remove all buffs, not only negative (not cheating)
hasBuffsToKill = true;
}
}
if (hasBuffsToKill) _LogPage.addLog('Remove all buffs because of negative multiplier', true);
}
},
updatePriorityAndLog: function () {
_Priority.createPriorityList();
_LogPage.updateLog();
},
ascendDetector: function () {
if (_GameHelpers.isAscend()) {
_BotUI.setCaption("Select wisely");
_BotSettings.setBankStogarePercent(0, true);
} else {
if (_GameHelpers.isNeverclick()) {
if (Game.cookiesEarned < 15) {
var s = Math.max(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time, 0);
var s1 = Math.max(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time, 0);
if (s > 0) {
_BotUI.setCaption("Waiting golden cookies for " + s + " time")
} else if (s1 > 0) {
_BotUI.setCaption("Waiting golden cookies for more " + s1 + " time")
}
} else if (Game.Objects.Cursor.amount === 0) {
Game.Objects.Cursor.buy();
}
}
}
},
popGolden: function () {
var golden = Game.shimmers;
if (golden && golden.length > 0) {
for (var i in golden) {
if (golden.hasOwnProperty(i)) {
golden[i].pop();
}
}
}
},
doAutoClick: function () {
if (_BotSettings.options.noClicking) return;
var date=new Date();
date.setTime(Date.now()-Game.startDate);
var seconds = date.getTime() / 1000;
var buffMult = _GameStat.getBuffMult();
var buffClicker = typeof Game.hasBuff !== 'undefined' && (
Game.hasBuff('Click frenzy') ||
Game.hasBuff('Cursed finger') ||
Game.hasBuff('Elder frenzy') ||
Game.hasBuff('Dragon Harvest') ||
Game.hasBuff('Dragonflight')
);
if (buffMult >= 15 ||
Game.cookiesPs < 1000000 ||
buffClicker ||
seconds < 1000)
{
var $bigCookie = jQuery('#bigCookie');
Game.mouseX = $bigCookie.width() / 2 + $bigCookie.offset().left;
Game.mouseY = $bigCookie.height() / 2 + $bigCookie.offset().top;
if (typeof Game.ClickCookie === 'function') Game.ClickCookie();
isClickingNow = true;
} else {
isClickingNow = false;
}
}
};
setTimeout(function() {
_BotSettings.restoreAll();
_LogPage.init();
_BotUI.initBot();
_BotUI.initLogButton();
tPriority = setInterval(_BotLogic.updatePriorityAndLog, 1000);
tReloadPageOnWrongBuff = setInterval(_BotLogic.removeNegativeBuff, 1000);
tAscendDetector = setInterval(_BotLogic.ascendDetector, 1000);
tPopGolden = setInterval(_BotLogic.popGolden, 500);
tBankAuto = setInterval(_BotLogic.bankAutoFunction, 600001); // 10 minutes
tClickFrenzy = setInterval(_BotLogic.doAutoClick, tAutoClickInterval);
_BotUI.setCaption('Collecting gold...');
_BotLogic.updatePriorityAndLog();
_BotLogic.bankAutoFunction();
}, 5000);
})();