Improved building tooltip #766
This commit is contained in:
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
@@ -15,6 +15,7 @@ import {
|
|||||||
CacheGoldenAndWrathCookiesMults,
|
CacheGoldenAndWrathCookiesMults,
|
||||||
CacheStatsCookies,
|
CacheStatsCookies,
|
||||||
} from './Stats/Stats';
|
} from './Stats/Stats';
|
||||||
|
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
|
||||||
import {
|
import {
|
||||||
CacheAverageCookiesFromClicks,
|
CacheAverageCookiesFromClicks,
|
||||||
HeavenlyChipsDiff,
|
HeavenlyChipsDiff,
|
||||||
@@ -39,6 +40,7 @@ export default function InitCache() {
|
|||||||
ClickTimes[ClickTimes.length - 1] * 20,
|
ClickTimes[ClickTimes.length - 1] * 20,
|
||||||
);
|
);
|
||||||
CacheHeavenlyChipsPS();
|
CacheHeavenlyChipsPS();
|
||||||
|
AllAmountTillNextAchievement();
|
||||||
CacheAvgCPS();
|
CacheAvgCPS();
|
||||||
CacheIncome();
|
CacheIncome();
|
||||||
CacheBuildingsPrices();
|
CacheBuildingsPrices();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
CacheObjects1,
|
CacheObjects1,
|
||||||
CacheObjects10,
|
CacheObjects10,
|
||||||
CacheObjects100,
|
CacheObjects100,
|
||||||
|
CacheObjectsNextAchievement,
|
||||||
CacheUpgrades,
|
CacheUpgrades,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
@@ -82,6 +83,13 @@ export function CacheBuildingsPrices() {
|
|||||||
Game.Objects[i].free,
|
Game.Objects[i].free,
|
||||||
100,
|
100,
|
||||||
);
|
);
|
||||||
|
CacheObjectsNextAchievement[i].price = BuildingGetPrice(
|
||||||
|
Game.Objects[i],
|
||||||
|
Game.Objects[i].basePrice,
|
||||||
|
Game.Objects[i].amount,
|
||||||
|
Game.Objects[i].free,
|
||||||
|
CacheObjectsNextAchievement[i].AmountNeeded,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export function TooltipCreateCalculationSection(tooltip) {
|
|||||||
}
|
}
|
||||||
if (TooltipType === 'b') {
|
if (TooltipType === 'b') {
|
||||||
tooltip.appendChild(
|
tooltip.appendChild(
|
||||||
TooltipCreateHeader('Buildings left till next additional achievement'),
|
TooltipCreateHeader('Buildings (price / PP) left till next achievement'),
|
||||||
);
|
);
|
||||||
tooltip.lastChild.id = 'CMTooltipNextAchievementHeader'; // eslint-disable-line no-param-reassign
|
tooltip.lastChild.id = 'CMTooltipNextAchievementHeader'; // eslint-disable-line no-param-reassign
|
||||||
const production = document.createElement('div');
|
const production = document.createElement('div');
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import ColourOfPP from '../../../Cache/PP/ColourOfPP';
|
||||||
import {
|
import {
|
||||||
CacheObjects1,
|
CacheObjects1,
|
||||||
CacheObjects10,
|
CacheObjects10,
|
||||||
@@ -5,6 +6,7 @@ import {
|
|||||||
CacheObjectsNextAchievement,
|
CacheObjectsNextAchievement,
|
||||||
} from '../../../Cache/VariablesAndData';
|
} from '../../../Cache/VariablesAndData';
|
||||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import BuyBuildingsBonusIncome from '../../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||||
import { SimObjects } from '../../../Sim/VariablesAndData';
|
import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
Beautify,
|
Beautify,
|
||||||
@@ -101,13 +103,36 @@ export default function Building() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CacheObjectsNextAchievement[TooltipName].AmountNeeded < 101) {
|
const ObjectsTillNext = CacheObjectsNextAchievement[TooltipName];
|
||||||
|
if (ObjectsTillNext.AmountNeeded < 101) {
|
||||||
l('CMTooltipProductionLeft').style.marginBottom = '4px';
|
l('CMTooltipProductionLeft').style.marginBottom = '4px';
|
||||||
l('CMTooltipNextAchievementHeader').style.display = '';
|
l('CMTooltipNextAchievementHeader').style.display = '';
|
||||||
l('CMTooltipNextAchievement').textContent = Beautify(
|
|
||||||
CacheObjectsNextAchievement[TooltipName].AmountNeeded,
|
let PPOfAmount;
|
||||||
);
|
if (Game.cookiesPs) {
|
||||||
|
PPOfAmount =
|
||||||
|
Math.max(
|
||||||
|
ObjectsTillNext.price - (Game.cookies + GetWrinkConfigBank()),
|
||||||
|
0,
|
||||||
|
) /
|
||||||
|
Game.cookiesPs +
|
||||||
|
ObjectsTillNext.price /
|
||||||
|
BuyBuildingsBonusIncome(TooltipName, ObjectsTillNext.AmountNeeded);
|
||||||
|
} else
|
||||||
|
PPOfAmount =
|
||||||
|
ObjectsTillNext.price /
|
||||||
|
BuyBuildingsBonusIncome(TooltipName, ObjectsTillNext.AmountNeeded);
|
||||||
|
|
||||||
|
l('CMTooltipNextAchievement').textContent = `${Beautify(
|
||||||
|
ObjectsTillNext.AmountNeeded,
|
||||||
|
)} / ${Beautify(ObjectsTillNext.price)} / `;
|
||||||
l('CMTooltipNextAchievement').style.color = 'white';
|
l('CMTooltipNextAchievement').style.color = 'white';
|
||||||
|
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);
|
||||||
|
l('CMTooltipNextAchievement').appendChild(PPFrag);
|
||||||
} else {
|
} else {
|
||||||
l('CMTooltipNextAchievementHeader').style.display = 'none';
|
l('CMTooltipNextAchievementHeader').style.display = 'none';
|
||||||
l('CMTooltipProductionLeft').style.marginBottom = '0px';
|
l('CMTooltipProductionLeft').style.marginBottom = '0px';
|
||||||
|
|||||||
Reference in New Issue
Block a user