Fixed linting issues

This commit is contained in:
Daniël van Noord
2021-05-01 22:43:02 +02:00
parent 1d12977984
commit 1c8bd79640
94 changed files with 8692 additions and 1316 deletions

View File

@@ -1,11 +1,7 @@
/** General functions to format or beautify strings */
import { CMOptions } from '../../Config/VariablesAndData';
import {
metric,
shortScale,
shortScaleAbbreviated,
} from '../../Data/Scales.ts';
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts';
import { BackupFunctions } from '../../Main/VariablesAndData';
/**
@@ -44,12 +40,8 @@ export default function Beautify(num, floats, forced) {
answer = num.toExponential(decimals).toString().replace('e', 'E');
} else {
const exponential = num.toExponential().toString();
const AmountOfTenPowerThree = Math.floor(
exponential.slice(exponential.indexOf('e') + 1) / 3,
);
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(
decimals,
);
const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3);
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals);
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
if ((CMOptions.Scale === 1 && !forced) || forced === 1) {
// Metric scale, 123456789 => 123.457 M
@@ -63,10 +55,7 @@ export default function Beautify(num, floats, forced) {
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 3 && !forced) || forced === 3) {
// Short scale, 123456789 => 123.457 M
if (
num >= 0.01 &&
num < Number(`1e${shortScaleAbbreviated.length * 3}`)
) {
if (num >= 0.01 && num < Number(`1e${shortScaleAbbreviated.length * 3}`)) {
answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`;
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 5 && !forced) || forced === 5) {
@@ -76,9 +65,7 @@ export default function Beautify(num, floats, forced) {
}
if (answer === '') {
// eslint-disable-next-line no-console
console.log(
`Could not beautify number with Cookie Monster Beautify: ${num}`,
);
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
answer = BackupFunctions.Beautify(num, floats);
}
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');

View File

@@ -25,8 +25,7 @@ export default function FormatTime(time, longFormat) {
str += `${(m < 10 ? '0' : '') + m}:`;
str += (s < 10 ? '0' : '') + s;
} else {
if (formattedTime > 777600000)
return longFormat ? 'Over 9000 days!' : '>9000d';
if (formattedTime > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
str +=
y > 0
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` // eslint-disable-line no-nested-ternary

View File

@@ -1,10 +1,5 @@
import { CMOptions } from '../../Config/VariablesAndData';
import {
ColourGreen,
ColourOrange,
ColourRed,
ColourYellow,
} from '../VariablesAndData';
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
import FormatTime from './FormatTime';
/**

View File

@@ -1,8 +1,4 @@
import {
CacheObjects1,
CacheObjects10,
CacheObjects100,
} from '../../Cache/VariablesAndData';
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -31,8 +27,7 @@ export default function UpdateBuildings() {
if (Game.buyMode === 1) {
if (CMOptions.BuildColour === 1) {
Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color =
CMOptions[`Colour${target[i].color}`];
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`];
});
} else {
Object.keys(Game.Objects).forEach((i) => {
@@ -70,14 +65,16 @@ export default function UpdateBuildings() {
return o;
});
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1
: a.pp < b.pp
? -1
: 0);
: 0,
);
} else if (CMOptions.SortBuildings === 2) {
arr = Object.keys(target).map((k) => {
const o = target[k];
@@ -86,14 +83,16 @@ export default function UpdateBuildings() {
return o;
});
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1
: a.pp < b.pp
? -1
: 0);
: 0,
);
}
for (let x = 0; x < arr.length; x++) {

View File

@@ -38,24 +38,12 @@ function CreateUpgradeBarLegend() {
return div;
};
legend.appendChild(
legendLine(ColourBlue, 'Better than the best PP of a building option'),
);
legend.appendChild(
legendLine(ColourGreen, 'Same as the best PP building option'),
);
legend.appendChild(
legendLine(ColourYellow, 'Within the top 10 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourOrange, 'Within the top 20 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourRed, 'Within the top 30 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'),
);
legend.appendChild(legendLine(ColourBlue, 'Better than the best PP of a building option'));
legend.appendChild(legendLine(ColourGreen, 'Same as the best PP building option'));
legend.appendChild(legendLine(ColourYellow, 'Within the top 10 of PP for buildings'));
legend.appendChild(legendLine(ColourOrange, 'Within the top 20 of PP for buildings'));
legend.appendChild(legendLine(ColourRed, 'Within the top 30 of PP for buildings'));
legend.appendChild(legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'));
legend.appendChild(legendLine(ColourGray, 'Negative or infinity PP'));
return legend;
}
@@ -99,8 +87,5 @@ export default function CreateUpgradeBar() {
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColourPurple));
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColourGray));
l('upgrades').parentNode.insertBefore(
UpgradeBar,
l('upgrades').parentNode.childNodes[3],
);
l('upgrades').parentNode.insertBefore(UpgradeBar, l('upgrades').parentNode.childNodes[3]);
}

View File

@@ -33,11 +33,8 @@ export default function UpdateUpgrades() {
const me = Game.UpgradesInStore[i];
let addedColour = false;
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
if (
l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1
) {
l(`upgrade${i}`).childNodes[j].className =
ColourBackPre + CacheUpgrades[me.name].color;
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
addedColour = true;
break;
}
@@ -79,13 +76,15 @@ export default function UpdateUpgrades() {
}
if (CMOptions.SortUpgrades) {
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1
: a.pp < b.pp
? -1
: 0);
: 0,
);
} else {
arr.sort((a, b) => a.price - b.price);
}
@@ -94,7 +93,6 @@ export default function UpdateUpgrades() {
return arr2.findIndex((e) => e.name === upgrade.name);
};
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
l(`upgrade${x}`).style.order =
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
}
}

View File

@@ -14,17 +14,14 @@ import FormatTime from '../BeautifyAndFormatting/FormatTime';
export function AddAuraInfo(aura) {
if (CMOptions.DragonAuraInfo === 1) {
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
const timeToRecover = FormatTime(
priceOfChange / (bonusCPS + Game.cookiesPs),
);
const timeToRecover = FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
let bonusCPSPercentage;
if (Game.cookiesPs === 0) bonusCPSPercentage = Beautify(Infinity);
else bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100);
l('dragonAuraInfo').style.minHeight = '60px';
l('dragonAuraInfo').style.margin = '8px';
l('dragonAuraInfo').appendChild(document.createElement('div')).className =
'line';
l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line';
const div = document.createElement('div');
div.style.minWidth = '200px';
div.style.textAlign = 'center';

View File

@@ -27,10 +27,8 @@ export default function CreateGCTimer(cookie) {
cookie.pop();
};
GCTimer.onmouseover = function () {
cookie.l.style.filter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
cookie.l.style.webkitFilter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
cookie.l.style.filter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; // eslint-disable-line no-param-reassign
cookie.l.style.webkitFilter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; // eslint-disable-line no-param-reassign
};
GCTimer.onmouseout = function () {
cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign

View File

@@ -5,11 +5,7 @@
* @param {number} targetMagic The target magic level
* @returns {number} count / Game.fps The time it takes to reach targetMagic
*/
export default function CalculateGrimoireRefillTime(
currentMagic,
maxMagic,
targetMagic,
) {
export default function CalculateGrimoireRefillTime(currentMagic, maxMagic, targetMagic) {
let magic = currentMagic;
let count = 0;
while (magic < targetMagic) {

View File

@@ -18,16 +18,10 @@ export default function GetCPS() {
return Game.cookiesPs * (1 - Game.cpsSucked);
}
if (CMOptions.CalcWrink === 1) {
return (
Game.cookiesPs *
(CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05))
);
return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05));
}
if (CacheWrinklersFattest[1] !== null)
if (
CMOptions.CalcWrink === 2 &&
Game.wrinklers[CacheWrinklersFattest[1]].type === 1
) {
if (CMOptions.CalcWrink === 2 && Game.wrinklers[CacheWrinklersFattest[1]].type === 1) {
return (
Game.cookiesPs *
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +
@@ -36,7 +30,6 @@ export default function GetCPS() {
}
return (
Game.cookiesPs *
(CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount +
(1 - CacheCurrWrinklerCount * 0.05))
(CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount + (1 - CacheCurrWrinklerCount * 0.05))
);
}

View File

@@ -1,7 +1,4 @@
import {
CacheWrinklersFattest,
CacheWrinklersTotal,
} from '../../Cache/VariablesAndData';
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
/**

View File

@@ -5,11 +5,8 @@
*/
export default function UpdateBackground() {
Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth;
Game.Background.canvas.height =
Game.Background.canvas.parentNode.offsetHeight;
Game.LeftBackground.canvas.width =
Game.LeftBackground.canvas.parentNode.offsetWidth;
Game.LeftBackground.canvas.height =
Game.LeftBackground.canvas.parentNode.offsetHeight;
Game.Background.canvas.height = Game.Background.canvas.parentNode.offsetHeight;
Game.LeftBackground.canvas.width = Game.LeftBackground.canvas.parentNode.offsetWidth;
Game.LeftBackground.canvas.height = Game.LeftBackground.canvas.parentNode.offsetHeight;
Game.DrawBackground();
}

View File

@@ -1,10 +1,6 @@
/** Functions related to the Bottom Bar */
import {
CacheObjects1,
CacheObjects10,
CacheObjects100,
} from '../../Cache/VariablesAndData';
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts';
import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -13,12 +9,7 @@ import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
import GetCPS from '../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
import {
ColourBlue,
ColourTextPre,
ColourYellow,
LastTargetBotBar,
} from '../VariablesAndData';
import { ColourBlue, ColourTextPre, ColourYellow, LastTargetBotBar } from '../VariablesAndData';
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
/**
@@ -35,8 +26,7 @@ export function CreateBotBar() {
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
BotBar.style.borderTop = '1px solid black';
BotBar.style.overflow = 'auto';
BotBar.style.textShadow =
'-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
BotBar.style.textShadow = '-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
const table = BotBar.appendChild(document.createElement('table'));
table.style.width = '100%';
@@ -53,9 +43,7 @@ export function CreateBotBar() {
};
const type = tbody.appendChild(document.createElement('tr'));
type.style.fontWeight = 'bold';
type.appendChild(
firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColourYellow),
);
type.appendChild(firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColourYellow));
const bonus = tbody.appendChild(document.createElement('tr'));
bonus.appendChild(firstCol('Bonus Income', ColourBlue));
const pp = tbody.appendChild(document.createElement('tr'));
@@ -90,37 +78,28 @@ export function UpdateBotBar() {
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
count
].childNodes[1].textContent = Game.Objects[i].amount;
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[
count
].textContent = Beautify(target[i].bonus, 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
count
].className = ColourTextPre + target[i].color;
let PPString;
if (CMOptions.PPDisplayTime)
PPString = FormatTime(Math.round(target[i].pp));
else PPString = Beautify(Math.round(target[i].pp), 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
count
].textContent = PPString;
const timeColour = GetTimeColour(
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(
target[i].bonus,
2,
);
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count
].className = ColourTextPre + timeColour.color;
if (
timeColour.text === 'Done!' &&
Game.cookies < Game.Objects[i].bulkPrice
) {
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
ColourTextPre + target[i].color;
let PPString;
if (CMOptions.PPDisplayTime) PPString = FormatTime(Math.round(target[i].pp));
else PPString = Beautify(Math.round(target[i].pp), 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = PPString;
const timeColour = GetTimeColour(
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
);
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
ColourTextPre + timeColour.color;
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count
].textContent = `${timeColour.text} (with Wrink)`;
} else
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count
].textContent = timeColour.text;
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
timeColour.text;
});
}
}

View File

@@ -77,9 +77,7 @@ export function CreateBotBarBuildingColumn(buildingName) {
const i = buildingName;
const header = type.appendChild(document.createElement('td'));
header.appendChild(
document.createTextNode(
`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`,
),
document.createTextNode(`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`),
);
const span = header.appendChild(document.createElement('span'));

View File

@@ -57,28 +57,19 @@ export function UpdateTimerBar() {
let numberOfTimers = 0;
// Regulates visibility of Golden Cookie timer
if (
Game.shimmerTypes.golden.spawned === 0 &&
!Game.Has('Golden switch [off]')
) {
if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) {
l('CMTimerBarGC').style.display = '';
l('CMTimerBarGCMinBar').style.width = `${Math.round(
(Math.max(
0,
Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time,
) *
(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) *
maxWidthTwoBar) /
Game.shimmerTypes.golden.maxTime,
)}px`;
if (CMOptions.TimerBarOverlay >= 1)
l('CMTimerBarGCMinBar').textContent = Math.ceil(
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) /
Game.fps,
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps,
);
else l('CMTimerBarGCMinBar').textContent = '';
if (
Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime
) {
if (Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime) {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
} else {
@@ -102,37 +93,27 @@ export function UpdateTimerBar() {
);
else l('CMTimerBarGCBar').textContent = '';
l('CMTimerBarGCTime').textContent = Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
Game.fps,
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
);
numberOfTimers += 1;
} else l('CMTimerBarGC').style.display = 'none';
// Regulates visibility of Reindeer timer
if (
Game.season === 'christmas' &&
Game.shimmerTypes.reindeer.spawned === 0
) {
if (Game.season === 'christmas' && Game.shimmerTypes.reindeer.spawned === 0) {
l('CMTimerBarRen').style.display = '';
l('CMTimerBarRenMinBar').style.width = `${Math.round(
(Math.max(
0,
Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time,
) *
(Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) *
maxWidthTwoBar) /
Game.shimmerTypes.reindeer.maxTime,
)}px`;
if (CMOptions.TimerBarOverlay >= 1)
l('CMTimerBarRenMinBar').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.minTime -
Game.shimmerTypes.reindeer.time) /
Game.fps,
(Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps,
);
else l('CMTimerBarRenMinBar').textContent = '';
l('CMTimerBarRenBar').style.width = `${Math.round(
(Math.min(
Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
) *
maxWidthTwoBar) /
@@ -141,16 +122,13 @@ export function UpdateTimerBar() {
if (CMOptions.TimerBarOverlay >= 1)
l('CMTimerBarRenBar').textContent = Math.ceil(
Math.min(
Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.time,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
) / Game.fps,
);
else l('CMTimerBarRenBar').textContent = '';
l('CMTimerBarRenTime').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
Game.fps,
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
);
numberOfTimers += 1;
} else {
@@ -180,13 +158,10 @@ export function UpdateTimerBar() {
else timer.lastChild.children[1].textContent = '';
timer.lastChild.children[1].style.width = `${Math.round(
(Game.buffs[i].time *
(maxWidthOneBar -
Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
(maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
Game.buffs[i].maxTime,
)}px`;
timer.lastChild.children[2].textContent = Math.ceil(
Game.buffs[i].time / Game.fps,
);
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
numberOfTimers += 1;
BuffTimerBars[Game.buffs[i].name] = timer;
}

View File

@@ -15,12 +15,9 @@ export default function CreateSectionHideButtons() {
l('vaultUpgrades').style.display = 'none';
} else {
l('upgrades').style.display = 'flex';
if (l('toggleUpgrades').children.length !== 0)
l('toggleUpgrades').style.display = 'block';
if (l('techUpgrades').children.length !== 0)
l('techUpgrades').style.display = 'block';
if (l('vaultUpgrades').children.length !== 0)
l('vaultUpgrades').style.display = 'block';
if (l('toggleUpgrades').children.length !== 0) l('toggleUpgrades').style.display = 'block';
if (l('techUpgrades').children.length !== 0) l('techUpgrades').style.display = 'block';
if (l('vaultUpgrades').children.length !== 0) l('vaultUpgrades').style.display = 'block';
}
};
a.textContent = 'Hide/Show Upgrades';
@@ -28,8 +25,7 @@ export default function CreateSectionHideButtons() {
const b = document.createElement('a');
b.className = 'option';
b.onclick = function () {
if (l('products').style.display === 'grid')
l('products').style.display = 'none';
if (l('products').style.display === 'grid') l('products').style.display = 'none';
else l('products').style.display = 'grid';
};
b.textContent = 'Hide/Show Buildings';

View File

@@ -18,11 +18,7 @@ export default function CreateWrinklerButtons() {
};
popAllA.onmouseover = function () {
Game.tooltip.dynamic = 1;
Game.tooltip.draw(
this,
() => CreateTooltip('wb', 'PopAll'),
'this',
);
Game.tooltip.draw(this, () => CreateTooltip('wb', 'PopAll'), 'this');
Game.tooltip.wobble();
};
l('sectionLeftExtra').children[0].append(popAllA);
@@ -31,19 +27,14 @@ export default function CreateWrinklerButtons() {
popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option';
popFattestA.onclick = function () {
if (CacheWrinklersFattest[1] !== null)
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
if (CacheWrinklersFattest[1] !== null) Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
};
popFattestA.onmouseout = function () {
Game.tooltip.shouldHide = 1;
};
popFattestA.onmouseover = function () {
Game.tooltip.dynamic = 1;
Game.tooltip.draw(
this,
() => CreateTooltip('wb', 'PopFattest'),
'this',
);
Game.tooltip.draw(this, () => CreateTooltip('wb', 'PopFattest'), 'this');
Game.tooltip.wobble();
};
l('sectionLeftExtra').children[0].append(popFattestA);

View File

@@ -1,11 +1,7 @@
import jscolor, * as JsColor from '@eastdesire/jscolor';
import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites';
import { SaveConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
import {
ConfigPrefix,
ToggleConfig,
ToggleConfigVolume,
} from '../../../Config/ToggleSetting';
import { ConfigPrefix, ToggleConfig, ToggleConfigVolume } from '../../../Config/ToggleSetting';
import { CMOptions } from '../../../Config/VariablesAndData';
import {} from '../../../Data/Sectionheaders.ts';
import Config from '../../../Data/SettingsData';
@@ -13,10 +9,7 @@ import RefreshScale from '../../HelperFunctions/RefreshScale';
import UpdateColours from '../../HelperFunctions/UpdateColours';
import Flash from '../../Notifications/Flash';
import PlaySound from '../../Notifications/Sound';
import {
FavouriteSettings,
SimpleTooltipElements,
} from '../../VariablesAndData';
import { FavouriteSettings, SimpleTooltipElements } from '../../VariablesAndData';
import CookieMonsterPrompt from '../Prompt';
/**
@@ -37,10 +30,7 @@ function CreateFavouriteStar(config) {
Game.UpdateMenu();
};
FavStar.onmouseover = function () {
Game.tooltip.draw(
this,
escape(SimpleTooltipElements.FavouriteSettingPlaceholder.innerHTML),
);
Game.tooltip.draw(this, escape(SimpleTooltipElements.FavouriteSettingPlaceholder.innerHTML));
};
FavStar.onmouseout = function () {
Game.tooltip.hide();

View File

@@ -1,9 +1,6 @@
import { LoadConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
import { CMOptions } from '../../../Config/VariablesAndData';
import {
ConfigGroups,
ConfigGroupsNotification,
} from '../../../Data/Sectionheaders.ts';
import { ConfigGroups, ConfigGroupsNotification } from '../../../Data/Sectionheaders.ts';
import Config from '../../../Data/SettingsData';
import ConfigDefault from '../../../Data/SettingsDefault.ts';
import { FavouriteSettings } from '../../VariablesAndData';
@@ -35,24 +32,19 @@ export default function AddMenuPref(title) {
// Make sub-sections of Notification section
if (group === 'Notification') {
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
const subGroupObject = CreatePrefHeader(
subGroup,
ConfigGroupsNotification[subGroup],
); // (group, display-name of group)
const subGroupObject = CreatePrefHeader(subGroup, ConfigGroupsNotification[subGroup]); // (group, display-name of group)
subGroupObject.style.fontSize = '15px';
subGroupObject.style.opacity = '0.5';
frag.appendChild(subGroupObject);
if (CMOptions.Header[subGroup]) {
Object.keys(Config).forEach((option) => {
if (Config[option].group === subGroup)
frag.appendChild(CreatePrefOption(option));
if (Config[option].group === subGroup) frag.appendChild(CreatePrefOption(option));
});
}
});
} else {
Object.keys(Config).forEach((option) => {
if (Config[option].group === group)
frag.appendChild(CreatePrefOption(option));
if (Config[option].group === group) frag.appendChild(CreatePrefOption(option));
});
}
}
@@ -72,8 +64,6 @@ export default function AddMenuPref(title) {
l('menu').childNodes[2].insertBefore(
frag,
l('menu').childNodes[2].childNodes[
l('menu').childNodes[2].childNodes.length - 1
],
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],
);
}

View File

@@ -64,9 +64,7 @@ export default function AddMenuStats(title) {
const popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(
document.createTextNode(
`${Beautify(CacheWrinklersTotal)} / ${Beautify(
CacheWrinklersNormal,
)} `,
`${Beautify(CacheWrinklersTotal)} / ${Beautify(CacheWrinklersNormal)} `,
),
);
const popAllA = document.createElement('a');
@@ -77,31 +75,22 @@ export default function AddMenuStats(title) {
};
popAllFrag.appendChild(popAllA);
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Rewards of Popping (All/Normal)',
popAllFrag,
),
CreateElements.StatsListing('basic', 'Rewards of Popping (All/Normal)', popAllFrag),
);
const popFattestFrag = document.createDocumentFragment();
popFattestFrag.appendChild(
document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `),
);
popFattestFrag.appendChild(document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `));
const popFattestA = document.createElement('a');
popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option';
popFattestA.onclick = function () {
if (CacheWrinklersFattest[1] !== null)
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
if (CacheWrinklersFattest[1] !== null) Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
};
popFattestFrag.appendChild(popFattestA);
stats.appendChild(
CreateElements.StatsListing(
'basic',
`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${
CacheWrinklersFattest[1] !== null
? CacheWrinklersFattest[1]
: 'None'
CacheWrinklersFattest[1] !== null ? CacheWrinklersFattest[1] : 'None'
})`,
popFattestFrag,
),
@@ -128,9 +117,9 @@ export default function AddMenuStats(title) {
stats.appendChild(
CreateElements.StatsListing(
'basic',
`Average cookie clicks per second (past ${
ClickTimes[CMOptions.AvgClicksHist]
}${CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'})`,
`Average cookie clicks per second (past ${ClickTimes[CMOptions.AvgClicksHist]}${
CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'
})`,
document.createTextNode(Beautify(CacheAverageClicks, 1)),
),
);
@@ -181,9 +170,7 @@ export default function AddMenuStats(title) {
Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60)),
4,
);
stats.appendChild(
CreateElements.StatsListing('basic', 'Time till autosave', timer),
);
stats.appendChild(CreateElements.StatsListing('basic', 'Time till autosave', timer));
}
}

View File

@@ -64,10 +64,7 @@ export function StatsListing(type, name, text, placeholder) {
Game.tooltip.hide();
};
tooltip.onmouseover = function () {
Game.tooltip.draw(
this,
escape(SimpleTooltipElements[placeholder].innerHTML),
);
Game.tooltip.draw(this, escape(SimpleTooltipElements[placeholder].innerHTML));
};
tooltip.style.cursor = 'default';
tooltip.style.display = 'inline-block';

View File

@@ -7,8 +7,7 @@ function CrateTooltipLockedAchievements(me) {
tags.push('Locked', 0);
let neuromancy = 0;
if (Game.Has('Neuromancy') || (Game.sesame && me.pool === 'debug'))
neuromancy = 1;
if (Game.Has('Neuromancy') || (Game.sesame && me.pool === 'debug')) neuromancy = 1;
if (neuromancy && me.won === 0) tags.push('Click to win!', '#00c462');
else if (neuromancy && me.won > 0) tags.push('Click to lose!', '#00c462');
@@ -21,9 +20,9 @@ function CrateTooltipLockedAchievements(me) {
let tagsStr = '';
for (let i = 0; i < tags.length; i += 2) {
if (i % 2 === 0)
tagsStr += ` <div class="tag" style="color:${
tags[i + 1] === 0 ? '#fff' : tags[i + 1]
};">[${tags[i]}]</div>`;
tagsStr += ` <div class="tag" style="color:${tags[i + 1] === 0 ? '#fff' : tags[i + 1]};">[${
tags[i]
}]</div>`;
}
tagsStr = tagsStr.substring(1);
@@ -35,9 +34,9 @@ function CrateTooltipLockedAchievements(me) {
${tagsStr}<div class="line"></div><div class="description">${desc}</div></div>
${
Game.sesame
? `<div style="font-size:9px;">Id : ${me.id} | Order : ${Math.floor(
me.order,
)}${me.tier ? ` | Tier : ${me.tier}` : ''}</div>`
? `<div style="font-size:9px;">Id : ${me.id} | Order : ${Math.floor(me.order)}${
me.tier ? ` | Tier : ${me.tier}` : ''
}</div>`
: ''
}`;
}
@@ -58,9 +57,7 @@ export default function AddMissingAchievements() {
const id = achievsCrate.onclick.toString().split(/\[(.*)\]/gi)[1];
const { icon } = Game.AchievementsById[id];
// eslint-disable-next-line no-param-reassign
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${
-icon[1] * 48
}px`;
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${-icon[1] * 48}px`;
// eslint-disable-next-line no-param-reassign
achievsCrate.onmouseover = function () {
if (!Game.mouseDown) {
@@ -68,10 +65,9 @@ export default function AddMissingAchievements() {
Game.tooltip.dynamic = 1;
Game.tooltip.draw(
this,
() => (function () {
return CrateTooltipLockedAchievements(
Game.AchievementsById[id],
);
() =>
(function () {
return CrateTooltipLockedAchievements(Game.AchievementsById[id]);
})(),
'top',
);

View File

@@ -12,22 +12,16 @@ import {
export function AddMissingUpgrades() {
l('menu').childNodes.forEach((menuSection) => {
if (menuSection.children[0]) {
if (
menuSection.children[0].innerHTML === 'Prestige' &&
CacheMissingUpgradesPrestige
) {
if (menuSection.children[0].innerHTML === 'Prestige' && CacheMissingUpgradesPrestige) {
const prestigeUpgradesMissing =
CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || [])
.length / 2;
CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || []).length / 2;
const title = document.createElement('div');
title.id = 'CMMissingUpgradesPrestigeTitle';
title.className = 'listing';
const titlefrag = document.createElement('div');
titlefrag.innerHTML = `<b>Missing Prestige upgrades:</b> ${prestigeUpgradesMissing}/${
Game.PrestigeUpgrades.length
} (${Math.floor(
(prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100,
)}%)`;
} (${Math.floor((prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100)}%)`;
title.appendChild(titlefrag);
menuSection.appendChild(title);
const upgrades = document.createElement('div');
@@ -46,8 +40,7 @@ export function AddMissingUpgrades() {
Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length
} (${Math.floor(
(normalUpgradesMissing /
(Game.UpgradesByPool[''].length +
Game.UpgradesByPool.tech.length)) *
(Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length)) *
100,
)}%)`;
title.appendChild(titlefrag);
@@ -62,17 +55,14 @@ export function AddMissingUpgrades() {
}
if (CacheMissingUpgradesCookies) {
const cookieUpgradesMissing =
CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || [])
.length / 2;
CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || []).length / 2;
const title = document.createElement('div');
title.id = 'CMMissingUpgradesCookiesTitle';
title.className = 'listing';
const titlefrag = document.createElement('div');
titlefrag.innerHTML = `<b>Missing Cookie upgrades:</b> ${cookieUpgradesMissing}/${
Game.UpgradesByPool.cookie.length
} (${Math.floor(
(cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100,
)}%)`;
} (${Math.floor((cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100)}%)`;
title.appendChild(titlefrag);
menuSection.appendChild(title);
const upgrades = document.createElement('div');
@@ -104,8 +94,8 @@ export function crateMissing(me) {
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
return `<div class="${classes}"
${Game.getDynamicTooltip(tooltip, 'top', true)}
style = "${`${
icon[2] ? `background-image: url(${icon[2]});` : ''
}background-position:${-icon[0] * 48}px ${-icon[1] * 48}px`};">
style = "${`${icon[2] ? `background-image: url(${icon[2]});` : ''}background-position:${
-icon[0] * 48
}px ${-icon[1] * 48}px`};">
</div>`;
}

View File

@@ -58,13 +58,10 @@ export function LuckySection() {
const section = document.createElement('div');
section.className = 'CMStatsLuckySection';
const luckyColour =
Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColourRed : ColourGreen;
const luckyColour = Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColourRed : ColourGreen;
const luckyTime =
Game.cookies + GetWrinkConfigBank() < CacheLucky
? FormatTime(
(CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
? FormatTime((CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const luckyReqFrag = document.createDocumentFragment();
const luckyReqSpan = document.createElement('span');
@@ -78,23 +75,14 @@ export function LuckySection() {
luckyReqFrag.appendChild(luckyReqSmall);
}
section.appendChild(
StatsListing(
'withTooltip',
'"Lucky!" cookies required',
luckyReqFrag,
goldCookTooltip,
),
StatsListing('withTooltip', '"Lucky!" cookies required', luckyReqFrag, goldCookTooltip),
);
const luckyColourFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy ? ColourRed : ColourGreen;
const luckyTimeFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
? FormatTime(
(CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
? FormatTime((CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const luckyReqFrenFrag = document.createDocumentFragment();
const luckyReqFrenSpan = document.createElement('span');
@@ -122,8 +110,7 @@ export function LuckySection() {
luckyRewardMaxSpan.style.fontWeight = 'bold';
luckyRewardMaxSpan.className = ColourTextPre + CacheLuckyReward;
luckyRewardMaxSpan.textContent =
Beautify(CacheLuckyReward) +
(luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
Beautify(CacheLuckyReward) + (luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
section.appendChild(
StatsListing(
'withTooltip',
@@ -184,15 +171,10 @@ export function ChainSection() {
section.className = 'CMStatsChainSection';
const chainColour =
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheChainRequired ? ColourRed : ColourGreen;
const chainTime =
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
? FormatTime(
(CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
)
? FormatTime((CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const chainReqFrag = document.createDocumentFragment();
const chainReqSpan = document.createElement('span');
@@ -206,24 +188,14 @@ export function ChainSection() {
chainReqFrag.appendChild(chainReqSmall);
}
section.appendChild(
StatsListing(
'withTooltip',
'"Chain" cookies required',
chainReqFrag,
goldCookTooltip,
),
StatsListing('withTooltip', '"Chain" cookies required', chainReqFrag, goldCookTooltip),
);
const chainWrathColour =
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired ? ColourRed : ColourGreen;
const chainWrathTime =
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
? FormatTime(
(CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
)
? FormatTime((CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const chainWrathReqFrag = document.createDocumentFragment();
const chainWrathReqSpan = document.createElement('span');
@@ -246,15 +218,10 @@ export function ChainSection() {
);
const chainColourFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired ? ColourRed : ColourGreen;
const chainTimeFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
? FormatTime(
(CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
)
? FormatTime((CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const chainReqFrenFrag = document.createDocumentFragment();
const chainReqFrenSpan = document.createElement('span');
@@ -277,15 +244,11 @@ export function ChainSection() {
);
const chainWrathColourFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired ? ColourRed : ColourGreen;
const chainWrathTimeFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
? FormatTime(
(CacheChainFrenzyWrathRequired -
(Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
(CacheChainFrenzyWrathRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
: '';
const chainWrathReqFrenFrag = document.createDocumentFragment();
@@ -313,9 +276,7 @@ export function ChainSection() {
'withTooltip',
'"Chain" reward (max) (golden / wrath)',
document.createTextNode(
`${Beautify(CacheChainMaxReward[0])} / ${Beautify(
CacheChainWrathMaxReward[0],
)}`,
`${Beautify(CacheChainMaxReward[0])} / ${Beautify(CacheChainWrathMaxReward[0])}`,
),
goldCookTooltip,
),
@@ -326,9 +287,7 @@ export function ChainSection() {
'withTooltip',
'"Chain" reward (max) (frenzy) (golden / wrath)',
document.createTextNode(
`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(
CacheChainFrenzyMaxReward[0],
)}`,
`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(CacheChainFrenzyMaxReward[0])}`,
),
goldCookTooltip,
),
@@ -338,23 +297,13 @@ export function ChainSection() {
Game.cookiesPs * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment,
Game.cookies * 0.5,
);
const chainCur = MaxChainCookieReward(
7,
chainCurMax,
CacheGoldenCookiesMult,
)[0];
const chainCurWrath = MaxChainCookieReward(
6,
chainCurMax,
CacheWrathCookiesMult,
)[0];
const chainCur = MaxChainCookieReward(7, chainCurMax, CacheGoldenCookiesMult)[0];
const chainCurWrath = MaxChainCookieReward(6, chainCurMax, CacheWrathCookiesMult)[0];
section.appendChild(
StatsListing(
'withTooltip',
'"Chain" reward (cur) (golden / wrath)',
document.createTextNode(
`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`,
),
document.createTextNode(`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`),
goldCookTooltip,
),
);
@@ -364,9 +313,7 @@ export function ChainSection() {
'withTooltip',
'CPS needed for next level (g / w)',
document.createTextNode(
`${Beautify(CacheChainRequiredNext)} / ${Beautify(
CacheChainWrathRequiredNext,
)}`,
`${Beautify(CacheChainRequiredNext)} / ${Beautify(CacheChainWrathRequiredNext)}`,
),
'ChainNextLevelPlaceholder',
),
@@ -395,14 +342,10 @@ export function SpellsSection() {
section.className = 'CMStatsSpellsSection';
const conjureColour =
Game.cookies + GetWrinkConfigBank() < CacheConjure
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheConjure ? ColourRed : ColourGreen;
const conjureTime =
Game.cookies + GetWrinkConfigBank() < CacheConjure
? FormatTime(
(CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
? FormatTime((CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const conjureReqFrag = document.createDocumentFragment();
@@ -434,18 +377,14 @@ export function SpellsSection() {
);
const conjureFrenzyColour =
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
? ColourRed
: ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7 ? ColourRed : ColourGreen;
const conjureFrenzyCur = Math.min(
(Game.cookies + GetWrinkConfigBank()) * 0.15,
CacheNoGoldSwitchCookiesPS * 60 * 30,
);
const conjureFrenzyTime =
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
? FormatTime(
(CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
? FormatTime((CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
: '';
const conjureFrenzyReqFrag = document.createDocumentFragment();
@@ -488,9 +427,7 @@ export function SpellsSection() {
StatsListing(
'withTooltip',
'"Spontaneous Edifice" cookies required (most expensive building)',
document.createTextNode(
`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`,
),
document.createTextNode(`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`),
'GoldCookTooltipPlaceholder',
),
);
@@ -506,60 +443,40 @@ export function GardenSection() {
const section = document.createElement('div');
section.className = 'CMStatsGardenSection';
const bakeberryColour =
Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColourRed : ColourGreen;
const bakeberryColour = Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColourRed : ColourGreen;
const bakeberryFrag = document.createElement('span');
bakeberryFrag.style.fontWeight = 'bold';
bakeberryFrag.className = ColourTextPre + bakeberryColour;
bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 10 * 100);
section.appendChild(
StatsListing(
'basic',
'Cookies required for max reward of Bakeberry: ',
bakeberryFrag,
),
StatsListing('basic', 'Cookies required for max reward of Bakeberry: ', bakeberryFrag),
);
const chocorootColour =
Game.cookies < Game.cookiesPs * 60 * 100 ? ColourRed : ColourGreen;
const chocorootColour = Game.cookies < Game.cookiesPs * 60 * 100 ? ColourRed : ColourGreen;
const chocorootFrag = document.createElement('span');
chocorootFrag.style.fontWeight = 'bold';
chocorootFrag.className = ColourTextPre + chocorootColour;
chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 100);
section.appendChild(
StatsListing(
'basic',
'Cookies required for max reward of Chocoroot: ',
chocorootFrag,
),
StatsListing('basic', 'Cookies required for max reward of Chocoroot: ', chocorootFrag),
);
const queenbeetColour =
Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColourRed : ColourGreen;
const queenbeetColour = Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColourRed : ColourGreen;
const queenbeetFrag = document.createElement('span');
queenbeetFrag.style.fontWeight = 'bold';
queenbeetFrag.className = ColourTextPre + queenbeetColour;
queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60 * 25);
section.appendChild(
StatsListing(
'basic',
'Cookies required for max reward of Queenbeet: ',
queenbeetFrag,
),
StatsListing('basic', 'Cookies required for max reward of Queenbeet: ', queenbeetFrag),
);
const duketaterColour =
Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColourRed : ColourGreen;
const duketaterColour = Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColourRed : ColourGreen;
const duketaterFrag = document.createElement('span');
duketaterFrag.style.fontWeight = 'bold';
duketaterFrag.className = ColourTextPre + duketaterColour;
duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 15 * 100);
section.appendChild(
StatsListing(
'basic',
'Cookies required for max reward of Duketater: ',
duketaterFrag,
),
StatsListing('basic', 'Cookies required for max reward of Duketater: ', duketaterFrag),
);
const missingPlantDrops = [];
Object.keys(GameData.PlantDrops).forEach((i) => {
@@ -569,11 +486,7 @@ export function GardenSection() {
});
if (missingPlantDrops.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Rare plant drops left to unlock',
StatsMissDisp(missingPlantDrops),
),
StatsListing('basic', 'Rare plant drops left to unlock', StatsMissDisp(missingPlantDrops)),
);
}
return section;
@@ -592,18 +505,14 @@ export function PrestigeSection() {
CacheRealCookiesEarned +
Game.cookiesReset +
CacheWrinklersTotal +
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
? CacheLastChoEgg
: 0),
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CacheLastChoEgg : 0),
),
);
section.appendChild(
StatsListing(
'withTooltip',
'Prestige level (cur / max)',
document.createTextNode(
`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`,
),
document.createTextNode(`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`),
'PrestMaxTooltipPlaceholder',
),
);
@@ -614,21 +523,14 @@ export function PrestigeSection() {
(CacheRealCookiesEarned +
Game.cookiesReset +
CacheWrinklersTotal +
((
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
? CacheLastChoEgg
: 0
)
((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CacheLastChoEgg : 0)
? CacheLastChoEgg
: 0)),
);
const cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
const cookiesNextSmall = document.createElement('small');
cookiesNextSmall.textContent = ` (${FormatTime(
neededCook / CacheAvgCPSWithChoEgg,
1,
)})`;
cookiesNextSmall.textContent = ` (${FormatTime(neededCook / CacheAvgCPSWithChoEgg, 1)})`;
cookiesNextFrag.appendChild(cookiesNextSmall);
section.appendChild(
StatsListing(
@@ -663,8 +565,7 @@ export function PrestigeSection() {
const HCTarget = Number(CMOptions.HeavenlyChipsTarget);
if (!Number.isNaN(HCTarget)) {
const CookiesTillTarget =
HCTarget -
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
if (CookiesTillTarget > 0) {
section.appendChild(
StatsListing(
@@ -677,9 +578,7 @@ export function PrestigeSection() {
StatsListing(
'basic',
'Time till target (cur, current 5 second average)',
document.createTextNode(
FormatTime(CookiesTillTarget / CacheHCPerSecond),
),
document.createTextNode(FormatTime(CookiesTillTarget / CacheHCPerSecond)),
),
);
}
@@ -695,18 +594,11 @@ export function PrestigeSection() {
resetFrag.appendChild(resetSmall);
}
section.appendChild(
StatsListing(
'withTooltip',
'Reset bonus income',
resetFrag,
'ResetTooltipPlaceholder',
),
StatsListing('withTooltip', 'Reset bonus income', resetFrag, 'ResetTooltipPlaceholder'),
);
const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
const willHave = Math.floor(
Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned),
);
const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
const willGet = willHave - currentPrestige;
if (!Game.Has('Lucky digit')) {
let delta7 = 7 - (willHave % 10);
@@ -719,9 +611,7 @@ export function PrestigeSection() {
`${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`,
),
);
section.appendChild(
StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7),
);
section.appendChild(StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7));
}
if (!Game.Has('Lucky number')) {
@@ -735,9 +625,7 @@ export function PrestigeSection() {
`${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`,
),
);
section.appendChild(
StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777),
);
section.appendChild(StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777));
}
if (!Game.Has('Lucky payout')) {
@@ -751,9 +639,7 @@ export function PrestigeSection() {
`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`,
),
);
section.appendChild(
StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777),
);
section.appendChild(StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777));
}
return section;
@@ -803,8 +689,7 @@ export function SeasonSection() {
specDisp = true;
}
});
const choEgg =
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const choEgg = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const centEgg = Game.Has('Century egg');
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
@@ -834,9 +719,7 @@ export function SeasonSection() {
'basic',
'Chance of receiving a cookie from wrinkler/shiny wrinkler',
document.createTextNode(
`${Beautify(
(1 - failRateHalloween) * obtainedCookiesChance * 100,
)}% / ${Beautify(
`${Beautify((1 - failRateHalloween) * obtainedCookiesChance * 100)}% / ${Beautify(
(1 - failRateHalloween * 0.9) * obtainedCookiesChance * 100,
)}%`,
),
@@ -867,9 +750,7 @@ export function SeasonSection() {
'basic',
'Chance of receiving a cookie from reindeer',
document.createTextNode(
`${Beautify(
(1 - failRateChristmas) * obtainedCookiesChance * 100,
)}%`,
`${Beautify((1 - failRateChristmas) * obtainedCookiesChance * 100)}%`,
),
),
);
@@ -897,23 +778,14 @@ export function SeasonSection() {
// Calculations courtesy of @svschouw, at https://github.com/Aktanusa/CookieMonster/issues/25
const succesRateEgg = 1 - failRateEgg;
const obtainedEggs = Game.eggDrops.length - missingNormalEggs.length;
const obtainedRareEggs =
Game.rareEggDrops.length - missingRareEggs.length;
const pNormal1 =
succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pRare1 =
succesRateEgg *
0.1 *
(1 - obtainedRareEggs / Game.rareEggDrops.length);
const pRedropNormal =
succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
const pRedropRare =
succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
const obtainedRareEggs = Game.rareEggDrops.length - missingRareEggs.length;
const pNormal1 = succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pRare1 = succesRateEgg * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
const pRedropNormal = succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
const pRedropRare = succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
const pRedrop = pRedropNormal + pRedropRare;
const pNormal2 =
pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pRare2 =
pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
const pNormal2 = pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pRare2 = pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
return [pNormal1 + pNormal2, pRare1 + pRare2];
};
if (missingNormalEggs.length !== 0) {
@@ -929,29 +801,21 @@ export function SeasonSection() {
'basic',
'Chance of receiving an egg from wrinkler/golden cookie',
document.createTextNode(
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(
dropRateEgg(0.9)[0] * 100,
)}%`,
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(dropRateEgg(0.9)[0] * 100)}%`,
),
),
);
}
if (missingRareEggs.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Rare easter eggs left to unlock',
StatsMissDisp(missingRareEggs),
),
StatsListing('basic', 'Rare easter eggs left to unlock', StatsMissDisp(missingRareEggs)),
);
section.appendChild(
StatsListing(
'basic',
'Chance of receiving a rare egg from wrinkler/golden cookie',
document.createTextNode(
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(
dropRateEgg(0.9)[1] * 100,
)}%`,
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(dropRateEgg(0.9)[1] * 100)}%`,
),
),
);
@@ -959,11 +823,7 @@ export function SeasonSection() {
if (Game.season === 'christmas')
section.appendChild(
StatsListing(
'basic',
'Reindeer reward',
document.createTextNode(Beautify(CacheSeaSpec)),
),
StatsListing('basic', 'Reindeer reward', document.createTextNode(Beautify(CacheSeaSpec))),
);
if (choEgg) {
section.appendChild(
@@ -980,9 +840,7 @@ export function SeasonSection() {
StatsListing(
'basic',
'Century egg multiplier',
document.createTextNode(
`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`,
),
document.createTextNode(`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`),
),
);
}

View File

@@ -12,9 +12,7 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
export default function Flash(mode, config, forced) {
// The arguments check makes the sound not play upon initialization of the mod
if (
((CMOptions[config] === 1 || forced) &&
mode === 3 &&
isInitializing === false) ||
((CMOptions[config] === 1 || forced) && mode === 3 && isInitializing === false) ||
mode === 1
) {
l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`];

View File

@@ -14,8 +14,7 @@ export default function PlaySound(url, sndConfig, volConfig, forced) {
if ((CMOptions[sndConfig] === 1 || forced) && isInitializing === false) {
// eslint-disable-next-line new-cap
const sound = new Audio(url);
if (CMOptions.GeneralSound)
sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
if (CMOptions.GeneralSound) sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
else sound.volume = CMOptions[volConfig] / 100;
sound.play();
}

View File

@@ -20,12 +20,7 @@ export function CreateFavicon() {
export function UpdateFavicon() {
if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) {
if (CacheSpawnedGoldenShimmer.wrath)
l('CMFavicon').href =
'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
else
l('CMFavicon').href =
'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
} else
l('CMFavicon').href =
'https://orteil.dashnet.org/cookieclicker/favicon.ico';
l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
else l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
} else l('CMFavicon').href = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
}

View File

@@ -1,14 +1,8 @@
/** Functions related to updating the tab in the browser's tab-bar */
import {
CacheSeasonPopShimmer,
CacheSpawnedGoldenShimmer,
} from '../../Cache/VariablesAndData';
import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import {
LastSeasonPopupState,
LastTickerFortuneState,
} from '../../Main/VariablesAndData';
import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData';
import { Title } from '../VariablesAndData';
/**
@@ -28,14 +22,10 @@ export default function UpdateTitle() {
if (CacheSpawnedGoldenShimmer) {
if (CacheSpawnedGoldenShimmer.wrath)
titleGC = `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
else
titleGC = `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
else titleGC = `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
} else if (!Game.Has('Golden switch [off]')) {
titleGC = `[${
Number(l('CMTimerBarGCMinBar').textContent) < 0 ? '!' : ''
}${Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
Game.fps,
titleGC = `[${Number(l('CMTimerBarGCMinBar').textContent) < 0 ? '!' : ''}${Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
)}]`;
} else titleGC = '[GS]';
@@ -46,15 +36,10 @@ export default function UpdateTitle() {
if (Game.season === 'christmas') {
addSP = true;
if (LastSeasonPopupState)
titleSP = `[R${Math.ceil(CacheSeasonPopShimmer.life / Game.fps)}]`;
if (LastSeasonPopupState) titleSP = `[R${Math.ceil(CacheSeasonPopShimmer.life / Game.fps)}]`;
else {
titleSP = `[${
Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : ''
}${Math.ceil(
(Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.time) /
Game.fps,
titleSP = `[${Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : ''}${Math.ceil(
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
)}]`;
}
}
@@ -64,9 +49,7 @@ export default function UpdateTitle() {
if (str.charAt(0) === '[') {
str = str.substring(str.lastIndexOf(']') + 1);
}
document.title = `${
titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')
} ${str}`;
document.title = `${titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')} ${str}`;
} else if (CMOptions.Title === 2) {
let str = '';
let spawn = false;

View File

@@ -15,44 +15,35 @@ export default function ReplaceAscendTooltip() {
const cookiesToNext = Math.max(
0,
Game.HowManyCookiesReset(
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) +
1,
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1,
) -
(Game.cookiesEarned + Game.cookiesReset),
);
const startDate = Game.sayTime(
((Date.now() - Game.startDate) / 1000) * Game.fps,
-1,
);
const startDate = Game.sayTime(((Date.now() - Game.startDate) / 1000) * Game.fps, -1);
let str = '';
str += `You've been on this run for <b>${
startDate === '' ? 'not very long' : startDate
}</b>.<br>`;
str += '<div class="line"></div>';
if (Game.prestige > 0) {
str += `Your prestige level is currently <b>${Beautify(
str += `Your prestige level is currently <b>${Beautify(Game.prestige)}</b>.<br>(CpS +${Beautify(
Game.prestige,
)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`;
)}%)`;
str += '<div class="line"></div>';
}
if (CacheLastHeavenlyChips < 1)
str += 'Ascending now would grant you no prestige.';
if (CacheLastHeavenlyChips < 1) str += 'Ascending now would grant you no prestige.';
else if (CacheLastHeavenlyChips < 2)
str +=
'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';
else
str += `Ascending now would grant you<br><b>${Beautify(
CacheLastHeavenlyChips,
)} prestige levels</b> (+${Beautify(
CacheLastHeavenlyChips,
)}% CpS)<br>and <b>${Beautify(
)} prestige levels</b> (+${Beautify(CacheLastHeavenlyChips)}% CpS)<br>and <b>${Beautify(
CacheLastHeavenlyChips,
)} heavenly chips</b> to spend.`;
str += '<div class="line"></div>';
str += `You need <b>${Beautify(
cookiesToNext,
)} more cookies</b> for the next level.<br>`;
str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`;
str += `${
CMOptions.TooltipAscendButton
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify(

View File

@@ -1,9 +1,5 @@
import UpdateTooltips from './UpdateTooltips';
import {
SimpleTooltipElements,
TooltipName,
TooltipType,
} from '../VariablesAndData';
import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
@@ -93,32 +89,20 @@ export function CreateTooltip(type, name) {
} else if (type === 'u') {
// Upgrades
if (!Game.UpgradesInStore[name]) return '';
l('tooltip').innerHTML = Game.crateTooltip(
Game.UpgradesInStore[name],
'store',
);
l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store');
} else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip();
// Sugar Lumps
else if (type === 'g')
l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(
name,
)();
l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)();
// Grimoire
else if (type === 'p')
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(
name[0],
name[1],
)();
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])();
// Harvest all button in garden
else if (type === 'ha')
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
else if (type === 'wb') l('tooltip').innerHTML = '';
else if (type === 'pag')
l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
else if (type === 'pag') l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
else if (type === 'pas')
l('tooltip').innerHTML = Game.Objects.Temple.minigame.slotTooltip(
name[0],
)();
l('tooltip').innerHTML = Game.Objects.Temple.minigame.slotTooltip(name[0])();
// Adds area for extra tooltip-sections
if (

View File

@@ -45,9 +45,7 @@ export default function Building() {
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
const increase = Math.round(
(TooltipBonusIncome / Game.cookiesPs) * 10000,
);
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
if (Number.isFinite(increase) && increase !== 0) {
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
} else {
@@ -55,8 +53,7 @@ export default function Building() {
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
}
l('CMTooltipBorder').className =
ColourTextPre + target[TooltipName].color;
l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].color;
if (CMOptions.PPDisplayTime)
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
@@ -65,10 +62,7 @@ export default function Building() {
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
);
l('CMTooltipTime').textContent = timeColour.text;
if (
timeColour.text === 'Done!' &&
Game.cookies < target[TooltipName].price
) {
if (timeColour.text === 'Done!' && Game.cookies < target[TooltipName].price) {
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
} else l('CMTooltipTime').textContent = timeColour.text;
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
@@ -80,18 +74,11 @@ export default function Building() {
// eslint-disable-next-line no-restricted-syntax
for (const i of Object.keys(Game.Objects[TooltipName].productionAchievs)) {
if (
!Game.HasAchiev(
Game.Objects[TooltipName].productionAchievs[i].achiev.name,
)
) {
const nextProductionAchiev =
Game.Objects[TooltipName].productionAchievs[i];
if (!Game.HasAchiev(Game.Objects[TooltipName].productionAchievs[i].achiev.name)) {
const nextProductionAchiev = Game.Objects[TooltipName].productionAchievs[i];
l('CMTooltipTime').style.marginBottom = '4px';
l('CMTooltipProductionLeftHeader').style.display = '';
l(
'CMTooltipProductionLeft',
).className = `ProdAchievement${TooltipName}`;
l('CMTooltipProductionLeft').className = `ProdAchievement${TooltipName}`;
l('CMTooltipProductionLeft').textContent = Beautify(
nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies,
15,
@@ -109,10 +96,7 @@ export default function Building() {
let PPOfAmount;
if (Game.cookiesPs) {
PPOfAmount =
Math.max(
ObjectsTillNext.price - (Game.cookies + GetWrinkConfigBank()),
0,
) /
Math.max(ObjectsTillNext.price - (Game.cookies + GetWrinkConfigBank()), 0) /
Game.cookiesPs +
ObjectsTillNext.price /
BuyBuildingsBonusIncome(TooltipName, ObjectsTillNext.AmountNeeded);
@@ -128,8 +112,7 @@ export default function Building() {
const PPFrag = document.createElement('span');
if (CMOptions.PPDisplayTime) PPFrag.textContent = FormatTime(PPOfAmount);
else PPFrag.textContent = Beautify(PPOfAmount);
PPFrag.className =
ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price);
PPFrag.className = ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price);
l('CMTooltipNextAchievement').appendChild(PPFrag);
} else {
l('CMTooltipNextAchievementHeader').style.display = 'none';

View File

@@ -9,46 +9,31 @@ import * as Create from '../CreateTooltip';
*/
export default function GardenPlots() {
const { minigame } = Game.Objects.Farm;
if (
CMOptions.TooltipPlots &&
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
) {
if (CMOptions.TooltipPlots && minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0) {
const mature =
minigame.plot[TooltipName[1]][TooltipName[0]][1] >
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
.mature;
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature;
const plantName =
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
.name;
l('CMTooltipBorder').appendChild(
Create.TooltipCreateHeader('Reward (Current / Maximum)'),
);
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].name;
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Reward (Current / Maximum)'));
const reward = document.createElement('div');
reward.id = 'CMTooltipPlantReward';
l('CMTooltipBorder').appendChild(reward);
if (plantName === 'Bakeberry') {
l('CMTooltipPlantReward').textContent = `${
mature
? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30))
: '0'
mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : '0'
} / ${Beautify(Game.cookiesPs * 60 * 30)}`;
} else if (plantName === 'Chocoroot' || plantName === 'White chocoroot') {
l('CMTooltipPlantReward').textContent = `${
mature
? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3))
: '0'
mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : '0'
} / ${Beautify(Game.cookiesPs * 60 * 3)}`;
} else if (plantName === 'Queenbeet') {
l('CMTooltipPlantReward').textContent = `${
mature
? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60))
: '0'
mature ? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : '0'
} / ${Beautify(Game.cookiesPs * 60 * 60)}`;
} else if (plantName === 'Duketater') {
l('CMTooltipPlantReward').textContent = `${
mature
? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120))
: '0'
mature ? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : '0'
} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
} else l('CMTooltipArea').style.display = 'none';
} else l('CMTooltipArea').style.display = 'none';

View File

@@ -48,9 +48,7 @@ export default function Grimoire() {
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
if (TooltipName === '0') {
tooltipBox.appendChild(
Create.TooltipCreateHeader('Cookies to be gained/lost'),
);
tooltipBox.appendChild(Create.TooltipCreateHeader('Cookies to be gained/lost'));
const conjure = document.createElement('div');
conjure.id = 'x';
tooltipBox.appendChild(conjure);

View File

@@ -10,9 +10,7 @@ import * as Create from '../CreateTooltip';
export default function HarvestAll() {
const { minigame } = Game.Objects.Farm;
if (CMOptions.TooltipLump) {
l('CMTooltipBorder').appendChild(
Create.TooltipCreateHeader('Cookies gained from harvesting:'),
);
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies gained from harvesting:'));
let totalGain = 0;
let mortal = 0;
if (Game.keys[16] && Game.keys[17]) mortal = 1;
@@ -27,31 +25,17 @@ export default function HarvestAll() {
if (mortal && me.immortal) count = false;
if (tile[1] < me.matureBase) count = false;
if (count && plantName === 'Bakeberry') {
totalGain += Math.min(
Game.cookies * 0.03,
Game.cookiesPs * 60 * 30,
);
} else if (
(count && plantName === 'Chocoroot') ||
plantName === 'White chocoroot'
) {
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30);
} else if ((count && plantName === 'Chocoroot') || plantName === 'White chocoroot') {
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3);
} else if (count && plantName === 'Queenbeet') {
totalGain += Math.min(
Game.cookies * 0.04,
Game.cookiesPs * 60 * 60,
);
totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60);
} else if (count && plantName === 'Duketater') {
totalGain += Math.min(
Game.cookies * 0.08,
Game.cookiesPs * 60 * 120,
);
totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120);
}
}
}
}
l('CMTooltipBorder').appendChild(
document.createTextNode(Beautify(totalGain)),
);
l('CMTooltipBorder').appendChild(document.createTextNode(Beautify(totalGain)));
} else l('CMTooltipArea').style.display = 'none';
}

View File

@@ -22,15 +22,11 @@ export default function PantheonGods() {
cps1.id = 'CMPantheonTooltipPosition1';
if (CacheGods[GodID][0] !== 0) {
cps1.textContent = Beautify(CacheGods[GodID][0]);
const increase = Math.round(
(CacheGods[GodID][0] / Game.cookiesPs) * 10000,
);
const increase = Math.round((CacheGods[GodID][0] / Game.cookiesPs) * 10000);
if (Number.isFinite(increase) && increase !== 0) {
cps1.textContent += ` (${increase / 100}% of income)`;
} else {
cps1.textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
cps1.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`;
}
} else cps1.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps1);
@@ -40,15 +36,11 @@ export default function PantheonGods() {
cps2.id = 'CMPantheonTooltipPosition2';
if (CacheGods[GodID][1] !== 0) {
cps2.textContent = Beautify(CacheGods[GodID][1]);
const increase = Math.round(
(CacheGods[GodID][1] / Game.cookiesPs) * 10000,
);
const increase = Math.round((CacheGods[GodID][1] / Game.cookiesPs) * 10000);
if (Number.isFinite(increase) && increase !== 0) {
cps2.textContent += ` (${increase / 100}% of income)`;
} else {
cps2.textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
cps2.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`;
}
} else cps2.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps2);
@@ -58,15 +50,11 @@ export default function PantheonGods() {
cps3.id = 'CMPantheonTooltipPosition2';
if (CacheGods[GodID][2] !== 0) {
cps3.textContent = Beautify(CacheGods[GodID][2]);
const increase = Math.round(
(CacheGods[GodID][2] / Game.cookiesPs) * 10000,
);
const increase = Math.round((CacheGods[GodID][2] / Game.cookiesPs) * 10000);
if (Number.isFinite(increase) && increase !== 0) {
cps3.textContent += ` (${increase / 100}% of income)`;
} else {
cps3.textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
cps3.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`;
}
} else cps3.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps3);

View File

@@ -1,7 +1,4 @@
import {
CacheLastChoEgg,
CacheUpgrades,
} from '../../../Cache/VariablesAndData';
import { CacheLastChoEgg, CacheUpgrades } from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime';
@@ -25,22 +22,15 @@ export default function Upgrade() {
const tooltipBox = l('CMTooltipBorder');
Create.TooltipCreateCalculationSection(tooltipBox);
TooltipBonusIncome =
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonus;
TooltipPrice = Game.Upgrades[
Game.UpgradesInStore[TooltipName].name
].getPrice();
TooltipBonusMouse =
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
TooltipBonusIncome = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonus;
TooltipPrice = Game.Upgrades[Game.UpgradesInStore[TooltipName].name].getPrice();
TooltipBonusMouse = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
if (CMOptions.TooltipBuildUpgrade === 1) {
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
// Don't display certain parts of tooltip if not applicable
if (
l('CMTooltipIncome').textContent === '0' &&
(TooltipType === 'b' || TooltipType === 'u')
) {
if (l('CMTooltipIncome').textContent === '0' && (TooltipType === 'b' || TooltipType === 'u')) {
l('Bonus IncomeTitle').style.display = 'none';
l('CMTooltipIncome').style.display = 'none';
l('Payback PeriodTitle').style.display = 'none';
@@ -54,8 +44,7 @@ export default function Upgrade() {
}01% of income)`;
}
l('CMTooltipBorder').className =
ColourTextPre +
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
// If clicking power upgrade
if (TooltipBonusMouse) {
l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse);
@@ -64,9 +53,7 @@ export default function Upgrade() {
}
// If only a clicking power upgrade change PP to click-based period
if (TooltipBonusIncome === 0 && TooltipBonusMouse) {
l('CMTooltipPP').textContent = `${Beautify(
TooltipPrice / TooltipBonusMouse,
)} Clicks`;
l('CMTooltipPP').textContent = `${Beautify(TooltipPrice / TooltipBonusMouse)} Clicks`;
l('CMTooltipPP').style.color = 'white';
} else {
if (CMOptions.PPDisplayTime)
@@ -79,8 +66,7 @@ export default function Upgrade() {
2,
);
l('CMTooltipPP').className =
ColourTextPre +
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
}
}
const timeColour = GetTimeColour(
@@ -103,9 +89,7 @@ export default function Upgrade() {
);
const chocolate = document.createElement('div');
chocolate.style.color = 'white';
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(
CacheLastChoEgg,
)}`;
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(CacheLastChoEgg)}`;
l('CMTooltipBorder').appendChild(chocolate);
}
} else l('CMTooltipArea').style.display = 'none';

View File

@@ -6,11 +6,7 @@ import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime';
import GetCPS from '../../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
import {
TooltipBonusIncome,
TooltipPrice,
TooltipType,
} from '../../VariablesAndData';
import { TooltipBonusIncome, TooltipPrice, TooltipType } from '../../VariablesAndData';
import * as Create from '../CreateTooltip';
/**
@@ -23,16 +19,10 @@ export default function Warnings() {
ToggleToolWarnPos();
}
if (CMOptions.ToolWarnPos === 0)
l('CMDispTooltipWarningParent').style.right = '0px';
else
l('CMDispTooltipWarningParent').style.top = `${
l('tooltip').offsetHeight
}px`;
if (CMOptions.ToolWarnPos === 0) l('CMDispTooltipWarningParent').style.right = '0px';
else l('CMDispTooltipWarningParent').style.top = `${l('tooltip').offsetHeight}px`;
l('CMDispTooltipWarningParent').style.width = `${
l('tooltip').offsetWidth - 6
}px`;
l('CMDispTooltipWarningParent').style.width = `${l('tooltip').offsetWidth - 6}px`;
const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice;
const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0;
@@ -48,72 +38,46 @@ export default function Warnings() {
l('CMDispTooltipWarnLucky').style.display = '';
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(
limitLucky - amount,
)} (${FormatTime(
(limitLucky - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
)} (${FormatTime((limitLucky - amount) / (GetCPS() + bonusIncomeUsed))})`;
} else l('CMDispTooltipWarnLucky').style.display = 'none';
} else l('CMDispTooltipWarnLucky').style.display = 'none';
if (CMOptions.ToolWarnLuckyFrenzy === 1) {
const limitLuckyFrenzy = limitLucky * 7;
if (
amount < limitLuckyFrenzy &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
if (amount < limitLuckyFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(
limitLuckyFrenzy - amount,
)} (${FormatTime(
(limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
)} (${FormatTime((limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
if (CMOptions.ToolWarnConjure === 1) {
const limitConjure = limitLucky * 2;
if (
amount < limitConjure &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
if (amount < limitConjure && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnConjure').style.display = '';
l('CMDispTooltipWarnConjureText').textContent = `${Beautify(
limitConjure - amount,
)} (${FormatTime(
(limitConjure - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
)} (${FormatTime((limitConjure - amount) / (GetCPS() + bonusIncomeUsed))})`;
} else l('CMDispTooltipWarnConjure').style.display = 'none';
} else l('CMDispTooltipWarnConjure').style.display = 'none';
if (CMOptions.ToolWarnConjureFrenzy === 1) {
const limitConjureFrenzy = limitLucky * 2 * 7;
if (
amount < limitConjureFrenzy &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
if (amount < limitConjureFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(
limitConjureFrenzy - amount,
)} (${FormatTime(
(limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
)} (${FormatTime((limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
if (
CMOptions.ToolWarnEdifice === 1 &&
Game.Objects['Wizard tower'].minigameLoaded
) {
if (
CacheEdifice &&
amount < CacheEdifice &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
if (CMOptions.ToolWarnEdifice === 1 && Game.Objects['Wizard tower'].minigameLoaded) {
if (CacheEdifice && amount < CacheEdifice && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnEdifice').style.display = '';
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(
CacheEdifice - amount,
)} (${FormatTime(
(CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
)} (${FormatTime((CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed))})`;
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
@@ -130,8 +94,7 @@ export default function Warnings() {
l('CMDispTooltipWarnUserText').textContent = `${Beautify(
CMOptions.ToolWarnUser * GetCPS() - amount,
)} (${FormatTime(
(CMOptions.ToolWarnUser * GetCPS() - amount) /
(GetCPS() + bonusIncomeUsed),
(CMOptions.ToolWarnUser * GetCPS() - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
} else l('CMDispTooltipWarnUser').style.display = 'none';
} else l('CMDispTooltipWarnUser').style.display = 'none';

View File

@@ -1,7 +1,4 @@
import {
CacheWrinklersFattest,
CacheWrinklersTotal,
} from '../../../Cache/VariablesAndData';
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../../Cache/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify';
import { TooltipName } from '../../VariablesAndData';
import * as Create from '../CreateTooltip';

View File

@@ -35,10 +35,7 @@ export default function UpdateTooltips() {
HarvestAll();
} else if (TooltipType === 'wb') {
WrinklerButton();
} else if (
TooltipType === 'pag' ||
(TooltipType === 'pas' && TooltipName[1] !== -1)
) {
} else if (TooltipType === 'pag' || (TooltipType === 'pas' && TooltipName[1] !== -1)) {
PantheonGods();
}
Warnings();

View File

@@ -20,10 +20,7 @@ export function CheckWrinklerTooltip() {
const me = Game.wrinklers[i];
if (me.phase > 0 && me.selected) {
showingTooltip = true;
if (
TooltipWrinklerBeingShown[i] === 0 ||
TooltipWrinklerBeingShown[i] === undefined
) {
if (TooltipWrinklerBeingShown[i] === 0 || TooltipWrinklerBeingShown[i] === undefined) {
const placeholder = document.createElement('div');
const wrinkler = document.createElement('div');
wrinkler.style.minWidth = '120px';

View File

@@ -73,11 +73,7 @@ export const TooltipText = [
'The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg',
'300px',
],
[
'ChainNextLevelPlaceholder',
'Cheated cookies might break this formula',
'250px',
],
['ChainNextLevelPlaceholder', 'Cheated cookies might break this formula', '250px'],
[
'FavouriteSettingPlaceholder',
"Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings",