Merge pull request #510 from Aktanusa/master

Publish hot fixes to GitHub Pages
This commit is contained in:
DanielNoord
2021-01-25 23:42:18 +01:00
committed by GitHub
5 changed files with 160 additions and 44 deletions

22
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,22 @@
The following is a description of the our approach to the project.
Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data.
Here is a description of what should be stored in each of the source JS. Make edits to the source file first and then use the combine file to compile the final file:
JS | Description
-- | -
Cache | Functions related to creating and storing data cache
Config | Functions related to manipulating CM configuration
Data | Hard coded values
Disp | Functions related to displaying CM's UI
Footer | The footer of CM's JS (not modified often or ever)
Header | The header of CM's JS (not modified often or ever)
Main | Functions related to the main loop and initializing CM
Sim | Functions related to simulate something
These are some additional guidelines:
- Try to use DOM as much as possible instead of using string manipulation to modify HTML.
- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message.
- Try to follow the formatting and annotation as specified by JSCode
- PR's should target the `dev` branch

View File

@@ -73,7 +73,7 @@ CM.Cache.CacheDragonAuras = function() {
* It is called by CM.Loop() and CM.Cache.InitCache()
* @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers
* @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest wrinkler
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
*/
CM.Cache.CacheWrinklers = function() {
CM.Cache.WrinklersTotal = 0;
@@ -93,8 +93,10 @@ CM.Cache.CacheWrinklers = function() {
else if (godLvl == 3) sucked *= 1.05;
}
CM.Cache.WrinklersTotal += sucked;
if (Game.wrinklers[i].type == 0) CM.Cache.WrinklersNormal += sucked;
if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i];
if (Game.wrinklers[i].type == 0) {
CM.Cache.WrinklersNormal += sucked;
if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i];
}
}
}
@@ -181,7 +183,7 @@ CM.Cache.CacheMissingUpgrades = function() {
str += CM.Disp.crateMissing(me);
if (me.pool == 'prestige') CM.Cache.MissingUpgradesPrestige += str;
else if (me.pool == 'cookie') CM.Cache.MissingUpgradesCookies += str;
else if (me.pool != 'toggle' && me.pool != 'unused') CM.Cache.MissingUpgrades += str;
else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str;
}
}
}
@@ -997,7 +999,7 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}};
// Calculation
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single fattest) Wrinklers', toggle: true};
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true};
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
@@ -1062,11 +1064,12 @@ CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax',
CM.ConfigData.Title = {type: 'bool', group: 'Notification', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true};
// Tooltip
CM.ConfigData.TooltipBuildUp = {type: 'bool', group: 'Tooltip', label: ['Buildings/Upgrades Tooltip Information OFF', 'Buildings/Upgrades Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades', toggle: true};
CM.ConfigData.TooltipInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Tooltip Information OFF', 'Extra Tooltip Information ON'], desc: 'Extra information in tooltips', toggle: true};
CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true};
CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true};
CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true};
CM.ConfigData.ToolWarnConjureFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true};
CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true};
CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}};
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
@@ -1147,11 +1150,12 @@ CM.Data.ConfigDefault = {
WrinklerMaxVolume: 100,
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
Title: 1,
TooltipBuildUp: 1,
TooltipInfo: 1,
TooltipAmor: 0,
ToolWarnLucky: 1,
ToolWarnLuckyFrenzy: 1,
ToolWarnConjure: 1,
ToolWarnConjureFrenzy: 1,
ToolWarnEdifice: 1,
ToolWarnPos: 1,
TooltipGrim:1,
@@ -1375,8 +1379,11 @@ CM.Disp.Beautify = function(num, floats, forced) {
return num.toString()
}
else if (0.001 < num && num < CM.Options.ScaleCutoff) {
answer = num.toFixed(0);
answer = num.toFixed(2);
if (CM.Options.ScaleSeparator) answer = answer.toLocaleString('nl');
for (let i = 0; i < 3; i++) {
if (answer[answer.length - 1] == "0" | answer[answer.length - 1] == ".") answer = answer.slice(0, -1)
}
return answer;
}
else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Scientific notation, 123456789 => 1.235E+8
@@ -1788,6 +1795,10 @@ CM.Disp.UpdateTimerBar = function() {
if (numberOfTimers != 0) {
CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px';
}
if (CM.Disp.LastNumberOfTimers != numberOfTimers) {
CM.Disp.LastNumberOfTimers = numberOfTimers
CM.Disp.UpdateBotTimerBarPosition();
}
}
}
@@ -2593,6 +2604,8 @@ CM.Disp.TooltipCreateWarningSection = function() {
CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px';
CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText'));
CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px';
CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjureFrenzy', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)', 'CMDispTooltipWarnConjureFrenzyText'));
CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px';
CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText'));
return CM.Disp.TooltipWarn;
@@ -2605,6 +2618,9 @@ CM.Disp.TooltipCreateWarningSection = function() {
CM.Disp.UpdateTooltip = function() {
CM.Sim.CopyData();
if (l('tooltipAnchor').style.display != 'none' && l('CMTooltipArea')) {
if (CM.Options.TooltipInfo == 0) {
l('CMTooltipArea').style.display = "none";
}
l('CMTooltipArea').innerHTML = '';
tooltipBox = CM.Disp.TooltipCreateTooltipBox();
l('CMTooltipArea').appendChild(tooltipBox);
@@ -2845,7 +2861,7 @@ CM.Disp.UpdateTooltipWarnings = function() {
if (CM.Options.ToolWarnLucky == 1) {
if (amount < limitLucky && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnLucky').style.display = '';
l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnLucky').style.display = 'none';
}
else l('CMDispTooltipWarnLucky').style.display = 'none';
@@ -2854,7 +2870,7 @@ CM.Disp.UpdateTooltipWarnings = function() {
limitLuckyFrenzy = limitLucky * 7;
if (amount < limitLuckyFrenzy && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
}
else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
@@ -2863,15 +2879,24 @@ CM.Disp.UpdateTooltipWarnings = function() {
var limitConjure = limitLucky * 2;
if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnConjure').style.display = '';
l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnConjure').style.display = 'none';
}
else l('CMDispTooltipWarnConjure').style.display = 'none';
if (CM.Options.ToolWarnConjureFrenzy == 1) {
var limitConjureFrenzy = limitLucky * 2 * 7;
if ((amount < limitConjureFrenzy) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
l('CMDispTooltipWarnConjureFrenzyText').textContent = Beautify(limitConjureFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitConjureFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
}
else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
if (CM.Options.ToolWarnEdifice == 1) {
if (CM.Cache.Edifice && amount < CM.Cache.Edifice && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnEdifice').style.display = '';
l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
}
else l('CMDispTooltipWarnEdifice').style.display = 'none';
@@ -3229,22 +3254,24 @@ CM.Disp.CreatePrefOption = function(config) {
return div;
}
else if (CM.ConfigData[config].type == "color") {
var div = document.createElement('div');
for (var i = 0; i < CM.Disp.colors.length; i++) {
var div = document.createElement('div');
div.className = 'listing';
var innerDiv = document.createElement('div');
innerDiv.className = 'listing';
var input = document.createElement('input');
input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i];
input.className = 'option';
input.style.width = '65px';
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
div.appendChild(input);
innerDiv.appendChild(input);
eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}');
var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change});
var label = document.createElement('label');
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
div.appendChild(label);
return div;
innerDiv.appendChild(label);
div.appendChild(innerDiv)
}
return div
}
else if (CM.ConfigData[config].type == "numscale") {
var div = document.createElement('div');
@@ -3365,9 +3392,9 @@ CM.Disp.AddMenuStats = function(title) {
var popFattestA = document.createElement('a');
popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option';
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };;
popFattestFrag.appendChild(popFattestA);
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag));
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ' + (CM.Cache.WrinklersFattest[1] ? CM.Cache.WrinklersFattest[1] : "None") + ")", popFattestFrag));
}
}
@@ -3759,7 +3786,25 @@ CM.Disp.CreateStatsSpellsSection = function() {
}
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Cookies Required', conjureReqFrag, 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (MAX)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward)), 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureCur)), 'GoldCookTooltipPlaceholder'));
var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30);
var conjureFrenzyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.FormatTime((CM.Cache.Conjure * 7 - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
var conjureFrenzyReqFrag = document.createDocumentFragment();
var conjureFrenzyReqSpan = document.createElement('span');
conjureFrenzyReqSpan.style.fontWeight = 'bold';
conjureFrenzyReqSpan.className = CM.Disp.colorTextPre + conjureFrenzyColor;
conjureFrenzyReqSpan.textContent = Beautify(CM.Cache.Conjure * 7);
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan);
if (conjureFrenzyTime != '') {
var conjureFrenzyReqSmall = document.createElement('small');
conjureFrenzyReqSmall.textContent = ' (' + conjureFrenzyTime + ')';
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall);
}
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (MAX) (Frenzy)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward * 7)), 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder'));
if (CM.Cache.Edifice) {
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Spontaneous Edifice\" Cookies Required (most expensive building)', document.createTextNode(CM.Disp.Beautify(CM.Cache.Edifice) + ' (' + CM.Cache.EdificeBuilding + ")"), 'GoldCookTooltipPlaceholder'));
}
@@ -3856,7 +3901,9 @@ CM.Disp.AddMissingUpgrades = function() {
l('menu').children[5].appendChild(upgrades)
}
if (CM.Cache.MissingUpgrades) {
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length;
if (Game.UpgradesOwned) {
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length;
} else var normalUpgradesOwned = 0;
var title = document.createElement('div');
title.id = "CMMissingUpgradesTitle";
title.className = "listing";
@@ -3928,7 +3975,7 @@ CM.Disp.CreateWrinklerButtons = function() {
popFattestA.id = "PopFattestWrinklerButton"
popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option';
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
l('sectionLeftExtra').children[0].append(popFattestA);
}

View File

@@ -42,7 +42,7 @@ CM.Cache.CacheDragonAuras = function() {
* It is called by CM.Loop() and CM.Cache.InitCache()
* @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers
* @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest wrinkler
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
*/
CM.Cache.CacheWrinklers = function() {
CM.Cache.WrinklersTotal = 0;
@@ -62,8 +62,10 @@ CM.Cache.CacheWrinklers = function() {
else if (godLvl == 3) sucked *= 1.05;
}
CM.Cache.WrinklersTotal += sucked;
if (Game.wrinklers[i].type == 0) CM.Cache.WrinklersNormal += sucked;
if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i];
if (Game.wrinklers[i].type == 0) {
CM.Cache.WrinklersNormal += sucked;
if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i];
}
}
}
@@ -150,7 +152,7 @@ CM.Cache.CacheMissingUpgrades = function() {
str += CM.Disp.crateMissing(me);
if (me.pool == 'prestige') CM.Cache.MissingUpgradesPrestige += str;
else if (me.pool == 'cookie') CM.Cache.MissingUpgradesCookies += str;
else if (me.pool != 'toggle' && me.pool != 'unused') CM.Cache.MissingUpgrades += str;
else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str;
}
}
}

View File

@@ -115,7 +115,7 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}};
// Calculation
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single fattest) Wrinklers', toggle: true};
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true};
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
@@ -180,11 +180,12 @@ CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax',
CM.ConfigData.Title = {type: 'bool', group: 'Notification', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true};
// Tooltip
CM.ConfigData.TooltipBuildUp = {type: 'bool', group: 'Tooltip', label: ['Buildings/Upgrades Tooltip Information OFF', 'Buildings/Upgrades Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades', toggle: true};
CM.ConfigData.TooltipInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Tooltip Information OFF', 'Extra Tooltip Information ON'], desc: 'Extra information in tooltips', toggle: true};
CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true};
CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true};
CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true};
CM.ConfigData.ToolWarnConjureFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true};
CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true};
CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}};
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
@@ -265,11 +266,12 @@ CM.Data.ConfigDefault = {
WrinklerMaxVolume: 100,
WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
Title: 1,
TooltipBuildUp: 1,
TooltipInfo: 1,
TooltipAmor: 0,
ToolWarnLucky: 1,
ToolWarnLuckyFrenzy: 1,
ToolWarnConjure: 1,
ToolWarnConjureFrenzy: 1,
ToolWarnEdifice: 1,
ToolWarnPos: 1,
TooltipGrim:1,

View File

@@ -196,8 +196,11 @@ CM.Disp.Beautify = function(num, floats, forced) {
return num.toString()
}
else if (0.001 < num && num < CM.Options.ScaleCutoff) {
answer = num.toFixed(0);
answer = num.toFixed(2);
if (CM.Options.ScaleSeparator) answer = answer.toLocaleString('nl');
for (let i = 0; i < 3; i++) {
if (answer[answer.length - 1] == "0" | answer[answer.length - 1] == ".") answer = answer.slice(0, -1)
}
return answer;
}
else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Scientific notation, 123456789 => 1.235E+8
@@ -609,6 +612,10 @@ CM.Disp.UpdateTimerBar = function() {
if (numberOfTimers != 0) {
CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px';
}
if (CM.Disp.LastNumberOfTimers != numberOfTimers) {
CM.Disp.LastNumberOfTimers = numberOfTimers
CM.Disp.UpdateBotTimerBarPosition();
}
}
}
@@ -1414,6 +1421,8 @@ CM.Disp.TooltipCreateWarningSection = function() {
CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px';
CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText'));
CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px';
CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjureFrenzy', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)', 'CMDispTooltipWarnConjureFrenzyText'));
CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px';
CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText'));
return CM.Disp.TooltipWarn;
@@ -1426,6 +1435,9 @@ CM.Disp.TooltipCreateWarningSection = function() {
CM.Disp.UpdateTooltip = function() {
CM.Sim.CopyData();
if (l('tooltipAnchor').style.display != 'none' && l('CMTooltipArea')) {
if (CM.Options.TooltipInfo == 0) {
l('CMTooltipArea').style.display = "none";
}
l('CMTooltipArea').innerHTML = '';
tooltipBox = CM.Disp.TooltipCreateTooltipBox();
l('CMTooltipArea').appendChild(tooltipBox);
@@ -1666,7 +1678,7 @@ CM.Disp.UpdateTooltipWarnings = function() {
if (CM.Options.ToolWarnLucky == 1) {
if (amount < limitLucky && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnLucky').style.display = '';
l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnLucky').style.display = 'none';
}
else l('CMDispTooltipWarnLucky').style.display = 'none';
@@ -1675,7 +1687,7 @@ CM.Disp.UpdateTooltipWarnings = function() {
limitLuckyFrenzy = limitLucky * 7;
if (amount < limitLuckyFrenzy && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
}
else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
@@ -1684,15 +1696,24 @@ CM.Disp.UpdateTooltipWarnings = function() {
var limitConjure = limitLucky * 2;
if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnConjure').style.display = '';
l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnConjure').style.display = 'none';
}
else l('CMDispTooltipWarnConjure').style.display = 'none';
if (CM.Options.ToolWarnConjureFrenzy == 1) {
var limitConjureFrenzy = limitLucky * 2 * 7;
if ((amount < limitConjureFrenzy) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
l('CMDispTooltipWarnConjureFrenzyText').textContent = Beautify(limitConjureFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitConjureFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
}
else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
if (CM.Options.ToolWarnEdifice == 1) {
if (CM.Cache.Edifice && amount < CM.Cache.Edifice && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
l('CMDispTooltipWarnEdifice').style.display = '';
l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / CM.Disp.GetCPS()) + ')';
l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
}
else l('CMDispTooltipWarnEdifice').style.display = 'none';
@@ -2050,22 +2071,24 @@ CM.Disp.CreatePrefOption = function(config) {
return div;
}
else if (CM.ConfigData[config].type == "color") {
var div = document.createElement('div');
for (var i = 0; i < CM.Disp.colors.length; i++) {
var div = document.createElement('div');
div.className = 'listing';
var innerDiv = document.createElement('div');
innerDiv.className = 'listing';
var input = document.createElement('input');
input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i];
input.className = 'option';
input.style.width = '65px';
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
div.appendChild(input);
innerDiv.appendChild(input);
eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}');
var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change});
var label = document.createElement('label');
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
div.appendChild(label);
return div;
innerDiv.appendChild(label);
div.appendChild(innerDiv)
}
return div
}
else if (CM.ConfigData[config].type == "numscale") {
var div = document.createElement('div');
@@ -2186,9 +2209,9 @@ CM.Disp.AddMenuStats = function(title) {
var popFattestA = document.createElement('a');
popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option';
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };;
popFattestFrag.appendChild(popFattestA);
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag));
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ' + (CM.Cache.WrinklersFattest[1] ? CM.Cache.WrinklersFattest[1] : "None") + ")", popFattestFrag));
}
}
@@ -2580,7 +2603,25 @@ CM.Disp.CreateStatsSpellsSection = function() {
}
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Cookies Required', conjureReqFrag, 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (MAX)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward)), 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureCur)), 'GoldCookTooltipPlaceholder'));
var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30);
var conjureFrenzyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.FormatTime((CM.Cache.Conjure * 7 - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
var conjureFrenzyReqFrag = document.createDocumentFragment();
var conjureFrenzyReqSpan = document.createElement('span');
conjureFrenzyReqSpan.style.fontWeight = 'bold';
conjureFrenzyReqSpan.className = CM.Disp.colorTextPre + conjureFrenzyColor;
conjureFrenzyReqSpan.textContent = Beautify(CM.Cache.Conjure * 7);
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan);
if (conjureFrenzyTime != '') {
var conjureFrenzyReqSmall = document.createElement('small');
conjureFrenzyReqSmall.textContent = ' (' + conjureFrenzyTime + ')';
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall);
}
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (MAX) (Frenzy)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward * 7)), 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder'));
if (CM.Cache.Edifice) {
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Spontaneous Edifice\" Cookies Required (most expensive building)', document.createTextNode(CM.Disp.Beautify(CM.Cache.Edifice) + ' (' + CM.Cache.EdificeBuilding + ")"), 'GoldCookTooltipPlaceholder'));
}
@@ -2677,7 +2718,9 @@ CM.Disp.AddMissingUpgrades = function() {
l('menu').children[5].appendChild(upgrades)
}
if (CM.Cache.MissingUpgrades) {
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length;
if (Game.UpgradesOwned) {
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length;
} else var normalUpgradesOwned = 0;
var title = document.createElement('div');
title.id = "CMMissingUpgradesTitle";
title.className = "listing";
@@ -2749,7 +2792,7 @@ CM.Disp.CreateWrinklerButtons = function() {
popFattestA.id = "PopFattestWrinklerButton"
popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option';
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
l('sectionLeftExtra').children[0].append(popFattestA);
}