File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
import { CacheObjectsNextAchievement } from '../VariablesAndData';
|
||||
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement';
|
||||
|
||||
export default function AllAmountTillNextAchievement() {
|
||||
const result = {};
|
||||
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (
|
||||
Object.keys(CacheObjectsNextAchievement).length !== 0 &&
|
||||
CacheObjectsNextAchievement[i].TotalNeeded > Game.Objects[i].amount
|
||||
) {
|
||||
result[i] = {
|
||||
AmountNeeded:
|
||||
CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
|
||||
TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded,
|
||||
};
|
||||
} else {
|
||||
const tillNext = IndividualAmountTillNextAchievement(i);
|
||||
result[i] = {
|
||||
AmountNeeded: tillNext,
|
||||
TotalNeeded: Game.Objects[i].amount + tillNext,
|
||||
};
|
||||
}
|
||||
});
|
||||
CacheObjectsNextAchievement = result; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import { SimAchievementsOwned } from '../../Sim/VariablesAndData';
|
||||
|
||||
export default function IndividualAmountTillNextAchievement(building) {
|
||||
const AchievementsAtStart = Game.AchievementsOwned;
|
||||
for (let index = 0; index < 101; index++) {
|
||||
BuyBuildingsBonusIncome(building, index);
|
||||
if (SimAchievementsOwned > AchievementsAtStart) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return 101;
|
||||
}
|
||||
@@ -28,6 +28,7 @@ export let CacheLastChoEgg = 0;
|
||||
export let CacheObjects1 = {};
|
||||
export let CacheObjects10 = {};
|
||||
export let CacheObjects100 = {};
|
||||
export let CacheObjectsNextAchievement = {};
|
||||
|
||||
export let CacheWrinklersTotal = 0;
|
||||
export let CacheWrinklersNormal = 0;
|
||||
|
||||
@@ -25,8 +25,6 @@ export function ToggleConfig(config) {
|
||||
ConfigData[config].func();
|
||||
}
|
||||
|
||||
l(ConfigPrefix + config).innerHTML =
|
||||
ConfigData[config].label[CMOptions[config]];
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ export default function CreatePrefOption(config) {
|
||||
a.id = ConfigPrefix + config;
|
||||
a.onclick = function () {
|
||||
ToggleConfig(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
a.textContent = Config[config].label[CMOptions[config]];
|
||||
div.appendChild(a);
|
||||
@@ -102,9 +103,11 @@ export default function CreatePrefOption(config) {
|
||||
slider.value = CMOptions[config];
|
||||
slider.oninput = function () {
|
||||
ToggleConfigVolume(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
slider.onchange = function () {
|
||||
ToggleConfigVolume(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
volume.appendChild(slider);
|
||||
div.appendChild(volume);
|
||||
@@ -221,6 +224,7 @@ export default function CreatePrefOption(config) {
|
||||
CMOptions[config] = this.value;
|
||||
SaveConfig();
|
||||
RefreshScale();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
|
||||
@@ -185,10 +185,18 @@ export function TooltipCreateCalculationSection(tooltip) {
|
||||
tooltip.appendChild(
|
||||
TooltipCreateHeader('Production left till next achievement'),
|
||||
);
|
||||
// Assign a id in order to hide when no achiev's are left
|
||||
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // eslint-disable-line no-param-reassign
|
||||
tooltip.lastChild.id = 'CMTooltipProductionLeftHeader'; // eslint-disable-line no-param-reassign
|
||||
const production = document.createElement('div');
|
||||
production.id = 'CMTooltipProduction';
|
||||
production.id = 'CMTooltipProductionLeft';
|
||||
tooltip.appendChild(production);
|
||||
}
|
||||
if (TooltipType === 'b') {
|
||||
tooltip.appendChild(
|
||||
TooltipCreateHeader('Buildings left till next additional achievement'),
|
||||
);
|
||||
tooltip.lastChild.id = 'CMTooltipNextAchievementHeader'; // eslint-disable-line no-param-reassign
|
||||
const production = document.createElement('div');
|
||||
production.id = 'CMTooltipNextAchievement';
|
||||
tooltip.appendChild(production);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CacheObjectsNextAchievement,
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||
@@ -74,10 +75,9 @@ export default function Building() {
|
||||
}
|
||||
|
||||
// Add "production left till next achievement"-bar
|
||||
l('CMTooltipProductionHeader').style.display = 'none';
|
||||
l('CMTooltipProductionLeftHeader').style.display = 'none';
|
||||
l('CMTooltipTime').style.marginBottom = '0px';
|
||||
|
||||
// Can this ESLint error be solved while retaining the functionality of break?
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const i of Object.keys(Game.Objects[TooltipName].productionAchievs)) {
|
||||
if (
|
||||
@@ -88,15 +88,29 @@ export default function Building() {
|
||||
const nextProductionAchiev =
|
||||
Game.Objects[TooltipName].productionAchievs[i];
|
||||
l('CMTooltipTime').style.marginBottom = '4px';
|
||||
l('CMTooltipProductionHeader').style.display = '';
|
||||
l('CMTooltipProduction').className = `ProdAchievement${TooltipName}`;
|
||||
l('CMTooltipProduction').textContent = Beautify(
|
||||
l('CMTooltipProductionLeftHeader').style.display = '';
|
||||
l(
|
||||
'CMTooltipProductionLeft',
|
||||
).className = `ProdAchievement${TooltipName}`;
|
||||
l('CMTooltipProductionLeft').textContent = Beautify(
|
||||
nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies,
|
||||
15,
|
||||
);
|
||||
l('CMTooltipProduction').style.color = 'white';
|
||||
l('CMTooltipProductionLeft').style.color = 'white';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (CacheObjectsNextAchievement[TooltipName].AmountNeeded < 101) {
|
||||
l('CMTooltipProductionLeft').style.marginBottom = '4px';
|
||||
l('CMTooltipNextAchievementHeader').style.display = '';
|
||||
l('CMTooltipNextAchievement').textContent = Beautify(
|
||||
CacheObjectsNextAchievement[TooltipName].AmountNeeded,
|
||||
);
|
||||
l('CMTooltipNextAchievement').style.color = 'white';
|
||||
} else {
|
||||
l('CMTooltipNextAchievementHeader').style.display = 'none';
|
||||
l('CMTooltipProductionLeft').style.marginBottom = '0px';
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
CacheGoldenAndWrathCookiesMults,
|
||||
CacheStatsCookies,
|
||||
} from '../Cache/Stats/Stats';
|
||||
import AllAmountTillNextAchievement from '../Cache/TillNextAchievement/AllAmountTillNextAchievement';
|
||||
import {
|
||||
CacheDoRemakeBuildPrices,
|
||||
CacheHadBuildAura,
|
||||
@@ -50,6 +51,8 @@ export default function CMLoopHook() {
|
||||
|
||||
// CM.Sim.DoSims is set whenever CPS has changed
|
||||
if (SimDoSims) {
|
||||
AllAmountTillNextAchievement();
|
||||
|
||||
CacheIncome();
|
||||
|
||||
CacheNoGoldSwitchCPS(); // Needed first
|
||||
|
||||
Reference in New Issue
Block a user