Added prettier to master (#662)
* Bump dev to 2.031.6 * Added prettier (#661) * Added prettier * Added prettier * Added prettier
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { CacheHCPerSecond, CacheTimeTillNextPrestige } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheHCPerSecond,
|
||||
CacheTimeTillNextPrestige,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
@@ -8,21 +11,53 @@ import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
* @returns {object} div An object containing the stylized header
|
||||
*/
|
||||
export default function ReplaceAscendTooltip() {
|
||||
const ascendNowToGet = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) - Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
|
||||
const cookiesToNext = Game.HowManyCookiesReset(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);
|
||||
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(Game.prestige)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`;
|
||||
str += '<div class="line"></div>';
|
||||
}
|
||||
if (ascendNowToGet < 1) str += 'Ascending now would grant you no prestige.';
|
||||
else if (ascendNowToGet < 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(ascendNowToGet)} prestige levels</b> (+${Beautify(ascendNowToGet)}% CpS)<br>and <b>${Beautify(ascendNowToGet)} 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 += `${CMOptions.TooltipAscendButton ? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you are making ${Beautify(CacheHCPerSecond, 2)} chips on average in the last 5 seconds.<br>` : ''}`;
|
||||
l('ascendTooltip').innerHTML = str;
|
||||
const ascendNowToGet =
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) -
|
||||
Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
|
||||
const cookiesToNext =
|
||||
Game.HowManyCookiesReset(
|
||||
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,
|
||||
);
|
||||
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(
|
||||
Game.prestige,
|
||||
)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`;
|
||||
str += '<div class="line"></div>';
|
||||
}
|
||||
if (ascendNowToGet < 1) str += 'Ascending now would grant you no prestige.';
|
||||
else if (ascendNowToGet < 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(
|
||||
ascendNowToGet,
|
||||
)} prestige levels</b> (+${Beautify(
|
||||
ascendNowToGet,
|
||||
)}% CpS)<br>and <b>${Beautify(
|
||||
ascendNowToGet,
|
||||
)} 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 += `${
|
||||
CMOptions.TooltipAscendButton
|
||||
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you are making ${Beautify(
|
||||
CacheHCPerSecond,
|
||||
2,
|
||||
)} chips on average in the last 5 seconds.<br>`
|
||||
: ''
|
||||
}`;
|
||||
l('ascendTooltip').innerHTML = str;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorTextPre, ColorBorderPre, ColorGray, ColorBlue, ColorRed, ColorYellow, ColorPurple, TooltipType,
|
||||
ColorTextPre,
|
||||
ColorBorderPre,
|
||||
ColorGray,
|
||||
ColorBlue,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
ColorPurple,
|
||||
TooltipType,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/** Creates various sections of tooltips */
|
||||
@@ -10,14 +17,14 @@ import {
|
||||
* @returns {object} div An object containing the stylized box
|
||||
*/
|
||||
export function TooltipCreateTooltipBox() {
|
||||
l('tooltip').firstChild.style.paddingBottom = '4px'; // Sets padding on base-tooltip
|
||||
const tooltipBox = document.createElement('div');
|
||||
tooltipBox.style.border = '1px solid';
|
||||
tooltipBox.style.padding = '4px';
|
||||
tooltipBox.style.margin = '0px -4px';
|
||||
tooltipBox.id = 'CMTooltipBorder';
|
||||
tooltipBox.className = ColorTextPre + ColorGray;
|
||||
return tooltipBox;
|
||||
l('tooltip').firstChild.style.paddingBottom = '4px'; // Sets padding on base-tooltip
|
||||
const tooltipBox = document.createElement('div');
|
||||
tooltipBox.style.border = '1px solid';
|
||||
tooltipBox.style.padding = '4px';
|
||||
tooltipBox.style.margin = '0px -4px';
|
||||
tooltipBox.id = 'CMTooltipBorder';
|
||||
tooltipBox.className = ColorTextPre + ColorGray;
|
||||
return tooltipBox;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,12 +33,12 @@ export function TooltipCreateTooltipBox() {
|
||||
* @returns {object} div An object containing the stylized header
|
||||
*/
|
||||
export function TooltipCreateHeader(text) {
|
||||
const div = document.createElement('div');
|
||||
div.style.fontWeight = 'bold';
|
||||
div.id = `${text}Title`;
|
||||
div.className = ColorTextPre + ColorBlue;
|
||||
div.textContent = text;
|
||||
return div;
|
||||
const div = document.createElement('div');
|
||||
div.style.fontWeight = 'bold';
|
||||
div.id = `${text}Title`;
|
||||
div.className = ColorTextPre + ColorBlue;
|
||||
div.textContent = text;
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,51 +47,105 @@ export function TooltipCreateHeader(text) {
|
||||
* @returns {object} TooltipWarn The Warnings-tooltip object
|
||||
*/
|
||||
export function TooltipCreateWarningSection() {
|
||||
const TooltipWarn = document.createElement('div');
|
||||
TooltipWarn.style.position = 'absolute';
|
||||
TooltipWarn.style.display = 'block';
|
||||
TooltipWarn.style.left = 'auto';
|
||||
TooltipWarn.style.bottom = 'auto';
|
||||
TooltipWarn.id = 'CMDispTooltipWarningParent';
|
||||
const TooltipWarn = document.createElement('div');
|
||||
TooltipWarn.style.position = 'absolute';
|
||||
TooltipWarn.style.display = 'block';
|
||||
TooltipWarn.style.left = 'auto';
|
||||
TooltipWarn.style.bottom = 'auto';
|
||||
TooltipWarn.id = 'CMDispTooltipWarningParent';
|
||||
|
||||
const create = function (boxId, color, labelTextFront, labelTextBack, deficitId) {
|
||||
const box = document.createElement('div');
|
||||
box.id = boxId;
|
||||
box.style.display = 'none';
|
||||
box.style.transition = 'opacity 0.1s ease-out';
|
||||
box.className = ColorBorderPre + color;
|
||||
box.style.padding = '2px';
|
||||
box.style.background = '#000 url(img/darkNoise.png)';
|
||||
const labelDiv = document.createElement('div');
|
||||
box.appendChild(labelDiv);
|
||||
const labelSpan = document.createElement('span');
|
||||
labelSpan.className = ColorTextPre + color;
|
||||
labelSpan.style.fontWeight = 'bold';
|
||||
labelSpan.textContent = labelTextFront;
|
||||
labelDiv.appendChild(labelSpan);
|
||||
labelDiv.appendChild(document.createTextNode(labelTextBack));
|
||||
const deficitDiv = document.createElement('div');
|
||||
box.appendChild(deficitDiv);
|
||||
const deficitSpan = document.createElement('span');
|
||||
deficitSpan.id = deficitId;
|
||||
deficitDiv.appendChild(document.createTextNode('Deficit: '));
|
||||
deficitDiv.appendChild(deficitSpan);
|
||||
return box;
|
||||
};
|
||||
const create = function (
|
||||
boxId,
|
||||
color,
|
||||
labelTextFront,
|
||||
labelTextBack,
|
||||
deficitId,
|
||||
) {
|
||||
const box = document.createElement('div');
|
||||
box.id = boxId;
|
||||
box.style.display = 'none';
|
||||
box.style.transition = 'opacity 0.1s ease-out';
|
||||
box.className = ColorBorderPre + color;
|
||||
box.style.padding = '2px';
|
||||
box.style.background = '#000 url(img/darkNoise.png)';
|
||||
const labelDiv = document.createElement('div');
|
||||
box.appendChild(labelDiv);
|
||||
const labelSpan = document.createElement('span');
|
||||
labelSpan.className = ColorTextPre + color;
|
||||
labelSpan.style.fontWeight = 'bold';
|
||||
labelSpan.textContent = labelTextFront;
|
||||
labelDiv.appendChild(labelSpan);
|
||||
labelDiv.appendChild(document.createTextNode(labelTextBack));
|
||||
const deficitDiv = document.createElement('div');
|
||||
box.appendChild(deficitDiv);
|
||||
const deficitSpan = document.createElement('span');
|
||||
deficitSpan.id = deficitId;
|
||||
deficitDiv.appendChild(document.createTextNode('Deficit: '));
|
||||
deficitDiv.appendChild(deficitSpan);
|
||||
return box;
|
||||
};
|
||||
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnLucky', ColorRed, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Lucky!"', 'CMDispTooltipWarnLuckyText'));
|
||||
TooltipWarn.firstChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnLuckyFrenzy', ColorYellow, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)', 'CMDispTooltipWarnLuckyFrenzyText'));
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', ColorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText'));
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnConjureFrenzy', ColorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)', 'CMDispTooltipWarnConjureFrenzyText'));
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', ColorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText'));
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(create('CMDispTooltipWarnUser', ColorRed, 'Warning: ', `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`, 'CMDispTooltipWarnUserText'));
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnLucky',
|
||||
ColorRed,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Lucky!"',
|
||||
'CMDispTooltipWarnLuckyText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.firstChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnLuckyFrenzy',
|
||||
ColorYellow,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',
|
||||
'CMDispTooltipWarnLuckyFrenzyText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnConjure',
|
||||
ColorPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',
|
||||
'CMDispTooltipWarnConjureText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnConjureFrenzy',
|
||||
ColorPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',
|
||||
'CMDispTooltipWarnConjureFrenzyText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnEdifice',
|
||||
ColorPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',
|
||||
'CMDispTooltipWarnEdificeText',
|
||||
),
|
||||
);
|
||||
TooltipWarn.lastChild.style.marginBottom = '4px';
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnUser',
|
||||
ColorRed,
|
||||
'Warning: ',
|
||||
`Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`,
|
||||
'CMDispTooltipWarnUserText',
|
||||
),
|
||||
);
|
||||
|
||||
return TooltipWarn;
|
||||
return TooltipWarn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,38 +154,40 @@ export function TooltipCreateWarningSection() {
|
||||
* @param {object} tooltip Object of a TooltipBox, normally created by a call to CM.Disp.TooltipCreateTooltipBox()
|
||||
*/
|
||||
export function TooltipCreateCalculationSection(tooltip) {
|
||||
tooltip.appendChild(TooltipCreateHeader('Bonus Income'));
|
||||
const income = document.createElement('div');
|
||||
income.style.marginBottom = '4px';
|
||||
income.style.color = 'white';
|
||||
income.id = 'CMTooltipIncome';
|
||||
tooltip.appendChild(income);
|
||||
tooltip.appendChild(TooltipCreateHeader('Bonus Income'));
|
||||
const income = document.createElement('div');
|
||||
income.style.marginBottom = '4px';
|
||||
income.style.color = 'white';
|
||||
income.id = 'CMTooltipIncome';
|
||||
tooltip.appendChild(income);
|
||||
|
||||
tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click'));
|
||||
tooltip.lastChild.style.display = 'none';
|
||||
const click = document.createElement('div');
|
||||
click.style.marginBottom = '4px';
|
||||
click.style.color = 'white';
|
||||
click.style.display = 'none';
|
||||
click.id = 'CMTooltipCookiePerClick';
|
||||
tooltip.appendChild(click);
|
||||
tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click'));
|
||||
tooltip.lastChild.style.display = 'none';
|
||||
const click = document.createElement('div');
|
||||
click.style.marginBottom = '4px';
|
||||
click.style.color = 'white';
|
||||
click.style.display = 'none';
|
||||
click.id = 'CMTooltipCookiePerClick';
|
||||
tooltip.appendChild(click);
|
||||
|
||||
tooltip.appendChild(TooltipCreateHeader('Payback Period'));
|
||||
const pp = document.createElement('div');
|
||||
pp.style.marginBottom = '4px';
|
||||
pp.id = 'CMTooltipPP';
|
||||
tooltip.appendChild(pp);
|
||||
tooltip.appendChild(TooltipCreateHeader('Payback Period'));
|
||||
const pp = document.createElement('div');
|
||||
pp.style.marginBottom = '4px';
|
||||
pp.id = 'CMTooltipPP';
|
||||
tooltip.appendChild(pp);
|
||||
|
||||
tooltip.appendChild(TooltipCreateHeader('Time Left'));
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltip.appendChild(time);
|
||||
tooltip.appendChild(TooltipCreateHeader('Time Left'));
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltip.appendChild(time);
|
||||
|
||||
if (TooltipType === 'b') {
|
||||
tooltip.appendChild(TooltipCreateHeader('Production left till next achievement'));
|
||||
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left
|
||||
const production = document.createElement('div');
|
||||
production.id = 'CMTooltipProduction';
|
||||
tooltip.appendChild(production);
|
||||
}
|
||||
if (TooltipType === 'b') {
|
||||
tooltip.appendChild(
|
||||
TooltipCreateHeader('Production left till next achievement'),
|
||||
);
|
||||
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left
|
||||
const production = document.createElement('div');
|
||||
production.id = 'CMTooltipProduction';
|
||||
tooltip.appendChild(production);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,26 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
* It is called by Game.tooltip.update() because of CM.Main.ReplaceNative()
|
||||
*/
|
||||
export default function UpdateTooltipLocation() {
|
||||
if (Game.tooltip.origin === 'store') {
|
||||
let warnOffset = 0;
|
||||
if (CMOptions.ToolWarnLucky === 1 && CMOptions.ToolWarnPos === 1 && l('CMDispTooltipWarningParent') !== null) {
|
||||
warnOffset = l('CMDispTooltipWarningParent').clientHeight - 4;
|
||||
}
|
||||
Game.tooltip.tta.style.top = `${Math.min(parseInt(Game.tooltip.tta.style.top, 10), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46)}px`;
|
||||
}
|
||||
// Kept for future possible use if the code changes again
|
||||
/* else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
|
||||
if (Game.tooltip.origin === 'store') {
|
||||
let warnOffset = 0;
|
||||
if (
|
||||
CMOptions.ToolWarnLucky === 1 &&
|
||||
CMOptions.ToolWarnPos === 1 &&
|
||||
l('CMDispTooltipWarningParent') !== null
|
||||
) {
|
||||
warnOffset = l('CMDispTooltipWarningParent').clientHeight - 4;
|
||||
}
|
||||
Game.tooltip.tta.style.top = `${Math.min(
|
||||
parseInt(Game.tooltip.tta.style.top, 10),
|
||||
l('game').clientHeight +
|
||||
l('topBar').clientHeight -
|
||||
Game.tooltip.tt.clientHeight -
|
||||
warnOffset -
|
||||
46,
|
||||
)}px`;
|
||||
}
|
||||
// Kept for future possible use if the code changes again
|
||||
/* else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
|
||||
Game.tooltip.tta.style.top = (parseInt(Game.tooltip.tta.style.top) + parseInt(CM.Disp.TimerBar.style.height)) + 'px';
|
||||
} */
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import * as UpdateTooltip from './UpdateTooltips';
|
||||
import { TooltipCreateTooltipBox } from './CreateTooltip';
|
||||
import { Beautify, GetTimeColor } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { TooltipName, TooltipType } from '../VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
@@ -17,47 +20,48 @@ import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
* @param {string} minWidth The minimum width of the tooltip
|
||||
*/
|
||||
export function CreateSimpleTooltip(placeholder, text, minWidth) {
|
||||
const Tooltip = document.createElement('div');
|
||||
Tooltip.id = placeholder;
|
||||
const desc = document.createElement('div');
|
||||
desc.style.minWidth = minWidth;
|
||||
desc.style.marginBottom = '4px';
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'left';
|
||||
div.textContent = text;
|
||||
desc.appendChild(div);
|
||||
Tooltip.appendChild(desc);
|
||||
const Tooltip = document.createElement('div');
|
||||
Tooltip.id = placeholder;
|
||||
const desc = document.createElement('div');
|
||||
desc.style.minWidth = minWidth;
|
||||
desc.style.marginBottom = '4px';
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'left';
|
||||
div.textContent = text;
|
||||
desc.appendChild(div);
|
||||
Tooltip.appendChild(desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates the sections of the tooltips created by CookieMonster
|
||||
*/
|
||||
export function UpdateTooltips() {
|
||||
CopyData();
|
||||
if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) {
|
||||
l('CMTooltipArea').innerHTML = '';
|
||||
const tooltipBox = TooltipCreateTooltipBox();
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
CopyData();
|
||||
if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) {
|
||||
l('CMTooltipArea').innerHTML = '';
|
||||
const tooltipBox = TooltipCreateTooltipBox();
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
|
||||
if (TooltipType === 'b') {
|
||||
UpdateTooltip.Building();
|
||||
} else if (TooltipType === 'u') {
|
||||
UpdateTooltip.Upgrade();
|
||||
} else if (TooltipType === 's') {
|
||||
UpdateTooltip.SugarLump();
|
||||
} else if (TooltipType === 'g') {
|
||||
UpdateTooltip.Grimoire();
|
||||
} else if (TooltipType === 'p') {
|
||||
UpdateTooltip.GardenPlots();
|
||||
} else if (TooltipType === 'ha') {
|
||||
UpdateTooltip.HarvestAll();
|
||||
}
|
||||
UpdateTooltip.Warnings();
|
||||
} else if (l('CMTooltipArea') === null) { // Remove warnings if its a basic tooltip
|
||||
if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
}
|
||||
if (TooltipType === 'b') {
|
||||
UpdateTooltip.Building();
|
||||
} else if (TooltipType === 'u') {
|
||||
UpdateTooltip.Upgrade();
|
||||
} else if (TooltipType === 's') {
|
||||
UpdateTooltip.SugarLump();
|
||||
} else if (TooltipType === 'g') {
|
||||
UpdateTooltip.Grimoire();
|
||||
} else if (TooltipType === 'p') {
|
||||
UpdateTooltip.GardenPlots();
|
||||
} else if (TooltipType === 'ha') {
|
||||
UpdateTooltip.HarvestAll();
|
||||
}
|
||||
UpdateTooltip.Warnings();
|
||||
} else if (l('CMTooltipArea') === null) {
|
||||
// Remove warnings if its a basic tooltip
|
||||
if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,49 +72,98 @@ export function UpdateTooltips() {
|
||||
* @returns {string} l('tooltip').innerHTML The HTML of the l('tooltip')-object
|
||||
*/
|
||||
export function CreateTooltip(type, name) {
|
||||
if (type === 'b') { // Buildings
|
||||
l('tooltip').innerHTML = Game.Objects[name].tooltip();
|
||||
// Adds amortization info to the list of info per building
|
||||
if (CMOptions.TooltipAmor === 1) {
|
||||
const buildPrice = BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount);
|
||||
const amortizeAmount = buildPrice - Game.Objects[name].totalCookies;
|
||||
if (amortizeAmount > 0) {
|
||||
l('tooltip').innerHTML = l('tooltip').innerHTML
|
||||
.split('so far</div>')
|
||||
.join(`so far<br/>• <b>${Beautify(amortizeAmount)}</b> ${Math.floor(amortizeAmount) === 1 ? 'cookie' : 'cookies'} left to amortize (${GetTimeColor((buildPrice - Game.Objects[name].totalCookies) / (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text})</div>`);
|
||||
}
|
||||
}
|
||||
if (Game.buyMode === -1) {
|
||||
/*
|
||||
* Fix sell price displayed in the object tooltip.
|
||||
*
|
||||
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
|
||||
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
|
||||
*
|
||||
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
|
||||
*/
|
||||
l('tooltip').innerHTML = l('tooltip').innerHTML.split(Beautify(Game.Objects[name].bulkPrice)).join(Beautify((Game.Objects[name], Game.Objects[name].basePrice, Game.Objects[name].amount, Game.Objects[name].free, Game.buyBulk, 1)));
|
||||
}
|
||||
} else if (type === 'u') { // Upgrades
|
||||
if (!Game.UpgradesInStore[name]) return '';
|
||||
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)(); // Grimoire
|
||||
else if (type === 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots
|
||||
else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden
|
||||
if (type === 'b') {
|
||||
// Buildings
|
||||
l('tooltip').innerHTML = Game.Objects[name].tooltip();
|
||||
// Adds amortization info to the list of info per building
|
||||
if (CMOptions.TooltipAmor === 1) {
|
||||
const buildPrice = BuildingGetPrice(
|
||||
Game.Objects[name],
|
||||
Game.Objects[name].basePrice,
|
||||
0,
|
||||
Game.Objects[name].free,
|
||||
Game.Objects[name].amount,
|
||||
);
|
||||
const amortizeAmount = buildPrice - Game.Objects[name].totalCookies;
|
||||
if (amortizeAmount > 0) {
|
||||
l('tooltip').innerHTML = l('tooltip')
|
||||
.innerHTML.split('so far</div>')
|
||||
.join(
|
||||
`so far<br/>• <b>${Beautify(amortizeAmount)}</b> ${
|
||||
Math.floor(amortizeAmount) === 1 ? 'cookie' : 'cookies'
|
||||
} left to amortize (${
|
||||
GetTimeColor(
|
||||
(buildPrice - Game.Objects[name].totalCookies) /
|
||||
(Game.Objects[name].storedTotalCps * Game.globalCpsMult),
|
||||
).text
|
||||
})</div>`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Game.buyMode === -1) {
|
||||
/*
|
||||
* Fix sell price displayed in the object tooltip.
|
||||
*
|
||||
* The buildings sell price displayed by the game itself (without any mod) is incorrect.
|
||||
* The following line of code fixes this issue, and can be safely removed when the game gets fixed.
|
||||
*
|
||||
* This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262
|
||||
*/
|
||||
l('tooltip').innerHTML = l('tooltip')
|
||||
.innerHTML.split(Beautify(Game.Objects[name].bulkPrice))
|
||||
.join(
|
||||
Beautify(
|
||||
(Game.Objects[name],
|
||||
Game.Objects[name].basePrice,
|
||||
Game.Objects[name].amount,
|
||||
Game.Objects[name].free,
|
||||
Game.buyBulk,
|
||||
1),
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if (type === 'u') {
|
||||
// Upgrades
|
||||
if (!Game.UpgradesInStore[name]) return '';
|
||||
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,
|
||||
)();
|
||||
// Grimoire
|
||||
else if (type === 'p')
|
||||
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(
|
||||
name[0],
|
||||
name[1],
|
||||
)();
|
||||
// Garden plots
|
||||
else if (type === 'ha')
|
||||
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden
|
||||
|
||||
// Adds area for extra tooltip-sections
|
||||
if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || (type === 'p' && !Game.keys[16]) || type === 'ha') {
|
||||
const area = document.createElement('div');
|
||||
area.id = 'CMTooltipArea';
|
||||
l('tooltip').appendChild(area);
|
||||
}
|
||||
// Adds area for extra tooltip-sections
|
||||
if (
|
||||
(type === 'b' && Game.buyMode === 1) ||
|
||||
type === 'u' ||
|
||||
type === 's' ||
|
||||
type === 'g' ||
|
||||
(type === 'p' && !Game.keys[16]) ||
|
||||
type === 'ha'
|
||||
) {
|
||||
const area = document.createElement('div');
|
||||
area.id = 'CMTooltipArea';
|
||||
l('tooltip').appendChild(area);
|
||||
}
|
||||
|
||||
// Sets global variables used by CM.Disp.UpdateTooltip()
|
||||
TooltipType = type;
|
||||
TooltipName = name;
|
||||
// Sets global variables used by CM.Disp.UpdateTooltip()
|
||||
TooltipType = type;
|
||||
TooltipName = name;
|
||||
|
||||
UpdateTooltips();
|
||||
UpdateTooltips();
|
||||
|
||||
return l('tooltip').innerHTML;
|
||||
return l('tooltip').innerHTML;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,34 @@
|
||||
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheEdifice, CacheLastChoEgg, CacheLucky, CacheNoGoldSwitchCookiesPS, CacheObjects1, CacheObjects10, CacheObjects100, CacheUpgrades,
|
||||
CacheEdifice,
|
||||
CacheLastChoEgg,
|
||||
CacheLucky,
|
||||
CacheNoGoldSwitchCookiesPS,
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
CacheUpgrades,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import ToggleToolWarnPos from '../../Config/Toggles/ToggleToolWarnPos';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { Beautify, FormatTime, GetTimeColor } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CalculateGrimoireRefillTime from '../HelperFunctions/CalculateGrimoireRefillTime';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetLumpColor from '../HelperFunctions/GetLumpColor';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorTextPre, LastTargetTooltipBuilding, TooltipBonusIncome, TooltipBonusMouse, TooltipName, TooltipPrice, TooltipType,
|
||||
ColorTextPre,
|
||||
LastTargetTooltipBuilding,
|
||||
TooltipBonusIncome,
|
||||
TooltipBonusMouse,
|
||||
TooltipName,
|
||||
TooltipPrice,
|
||||
TooltipType,
|
||||
} from '../VariablesAndData';
|
||||
import * as Create from './CreateTooltip';
|
||||
|
||||
@@ -21,114 +38,154 @@ import * as Create from './CreateTooltip';
|
||||
* This function adds extra info to the Building tooltips
|
||||
*/
|
||||
export function Building() {
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
|
||||
let target;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetTooltipBuilding = target;
|
||||
} else {
|
||||
target = LastTargetTooltipBuilding;
|
||||
}
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
let target;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetTooltipBuilding = target;
|
||||
} else {
|
||||
target = LastTargetTooltipBuilding;
|
||||
}
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
|
||||
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
||||
TooltipBonusIncome = target[TooltipName].bonus;
|
||||
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
||||
TooltipBonusIncome = target[TooltipName].bonus;
|
||||
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
|
||||
const increase = Math.round(TooltipBonusIncome / Game.cookiesPs * 10000);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
|
||||
l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + target[TooltipName].color;
|
||||
const timeColor = GetTimeColor((TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS());
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (timeColor.text === 'Done!' && Game.cookies < target[TooltipName].price) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
}
|
||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
|
||||
const increase = Math.round(
|
||||
(TooltipBonusIncome / Game.cookiesPs) * 10000,
|
||||
);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
|
||||
l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + target[TooltipName].color;
|
||||
const timeColor = GetTimeColor(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < target[TooltipName].price
|
||||
) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
}
|
||||
|
||||
// Add "production left till next achievement"-bar
|
||||
l('CMTooltipProductionHeader').style.display = 'none';
|
||||
l('CMTooltipTime').style.marginBottom = '0px';
|
||||
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];
|
||||
l('CMTooltipTime').style.marginBottom = '4px';
|
||||
l('CMTooltipProductionHeader').style.display = '';
|
||||
l('CMTooltipProduction').className = `ProdAchievement${TooltipName}`;
|
||||
l('CMTooltipProduction').textContent = Beautify(nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies, 15);
|
||||
l('CMTooltipProduction').style.color = 'white';
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
// Add "production left till next achievement"-bar
|
||||
l('CMTooltipProductionHeader').style.display = 'none';
|
||||
l('CMTooltipTime').style.marginBottom = '0px';
|
||||
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];
|
||||
l('CMTooltipTime').style.marginBottom = '4px';
|
||||
l('CMTooltipProductionHeader').style.display = '';
|
||||
l('CMTooltipProduction').className = `ProdAchievement${TooltipName}`;
|
||||
l('CMTooltipProduction').textContent = Beautify(
|
||||
nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies,
|
||||
15,
|
||||
);
|
||||
l('CMTooltipProduction').style.color = 'white';
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds extra info to the Upgrade tooltips
|
||||
*/
|
||||
export function Upgrade() {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
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')) {
|
||||
l('Bonus IncomeTitle').style.display = 'none';
|
||||
l('CMTooltipIncome').style.display = 'none';
|
||||
l('Payback PeriodTitle').style.display = 'none';
|
||||
l('CMTooltipPP').style.display = 'none';
|
||||
} else {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
// If clicking power upgrade
|
||||
if (TooltipBonusMouse) {
|
||||
l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse);
|
||||
l('CMTooltipCookiePerClick').style.display = 'block';
|
||||
l('CMTooltipCookiePerClick').previousSibling.style.display = 'block';
|
||||
}
|
||||
// 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').style.color = 'white';
|
||||
} else {
|
||||
l('CMTooltipPP').textContent = Beautify(CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
}
|
||||
}
|
||||
const timeColor = GetTimeColor((TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS());
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (timeColor.text === 'Done!' && Game.cookies < Game.UpgradesInStore[TooltipName].getPrice()) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
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')
|
||||
) {
|
||||
l('Bonus IncomeTitle').style.display = 'none';
|
||||
l('CMTooltipIncome').style.display = 'none';
|
||||
l('Payback PeriodTitle').style.display = 'none';
|
||||
l('CMTooltipPP').style.display = 'none';
|
||||
} else {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className =
|
||||
ColorTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
// If clicking power upgrade
|
||||
if (TooltipBonusMouse) {
|
||||
l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse);
|
||||
l('CMTooltipCookiePerClick').style.display = 'block';
|
||||
l('CMTooltipCookiePerClick').previousSibling.style.display = 'block';
|
||||
}
|
||||
// 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').style.color = 'white';
|
||||
} else {
|
||||
l('CMTooltipPP').textContent = Beautify(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
2,
|
||||
);
|
||||
l('CMTooltipPP').className =
|
||||
ColorTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
}
|
||||
}
|
||||
const timeColor = GetTimeColor(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < Game.UpgradesInStore[TooltipName].getPrice()
|
||||
) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
|
||||
// Add extra info to Chocolate egg tooltip
|
||||
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
||||
l('CMTooltipBorder').lastChild.style.marginBottom = '4px';
|
||||
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies to be gained (Currently/Max)'));
|
||||
const chocolate = document.createElement('div');
|
||||
chocolate.style.color = 'white';
|
||||
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(CacheLastChoEgg)}`;
|
||||
l('CMTooltipBorder').appendChild(chocolate);
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
// Add extra info to Chocolate egg tooltip
|
||||
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
||||
l('CMTooltipBorder').lastChild.style.marginBottom = '4px';
|
||||
l('CMTooltipBorder').appendChild(
|
||||
Create.TooltipCreateHeader('Cookies to be gained (Currently/Max)'),
|
||||
);
|
||||
const chocolate = document.createElement('div');
|
||||
chocolate.style.color = 'white';
|
||||
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(
|
||||
CacheLastChoEgg,
|
||||
)}`;
|
||||
l('CMTooltipBorder').appendChild(chocolate);
|
||||
}
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,18 +193,18 @@ export function Upgrade() {
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function SugarLump() {
|
||||
if (CMOptions.TooltipLump === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
if (CMOptions.TooltipLump === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump'));
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump'));
|
||||
|
||||
const lumpType = document.createElement('div');
|
||||
lumpType.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(lumpType);
|
||||
const lumpColor = GetLumpColor(Game.lumpCurrentType);
|
||||
lumpType.textContent = lumpColor.text;
|
||||
lumpType.className = ColorTextPre + lumpColor.color;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
const lumpType = document.createElement('div');
|
||||
lumpType.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(lumpType);
|
||||
const lumpColor = GetLumpColor(Game.lumpCurrentType);
|
||||
lumpType.textContent = lumpColor.text;
|
||||
lumpType.className = ColorTextPre + lumpColor.color;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,53 +212,69 @@ export function SugarLump() {
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function Grimoire() {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
||||
|
||||
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
// Time left till enough magic for spell
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Time Left'));
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(time);
|
||||
const timeColor = GetTimeColor(CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost));
|
||||
time.textContent = timeColor.text;
|
||||
time.className = ColorTextPre + timeColor.color;
|
||||
// Time left till enough magic for spell
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Time Left'));
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(time);
|
||||
const timeColor = GetTimeColor(
|
||||
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
|
||||
);
|
||||
time.textContent = timeColor.text;
|
||||
time.className = ColorTextPre + timeColor.color;
|
||||
|
||||
// Time left untill magic spent is recovered
|
||||
if (spellCost <= minigame.magic) {
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Recover Time'));
|
||||
const recover = document.createElement('div');
|
||||
recover.id = 'CMTooltipRecover';
|
||||
tooltipBox.appendChild(recover);
|
||||
const recoverColor = GetTimeColor(CalculateGrimoireRefillTime(Math.max(0, minigame.magic - spellCost), minigame.magicM, minigame.magic));
|
||||
recover.textContent = recoverColor.text;
|
||||
recover.className = ColorTextPre + recoverColor.color;
|
||||
}
|
||||
// Time left untill magic spent is recovered
|
||||
if (spellCost <= minigame.magic) {
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Recover Time'));
|
||||
const recover = document.createElement('div');
|
||||
recover.id = 'CMTooltipRecover';
|
||||
tooltipBox.appendChild(recover);
|
||||
const recoverColor = GetTimeColor(
|
||||
CalculateGrimoireRefillTime(
|
||||
Math.max(0, minigame.magic - spellCost),
|
||||
minigame.magicM,
|
||||
minigame.magic,
|
||||
),
|
||||
);
|
||||
recover.textContent = recoverColor.text;
|
||||
recover.className = ColorTextPre + recoverColor.color;
|
||||
}
|
||||
|
||||
// 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'));
|
||||
const conjure = document.createElement('div');
|
||||
conjure.id = 'x';
|
||||
tooltipBox.appendChild(conjure);
|
||||
const reward = document.createElement('span');
|
||||
reward.style.color = '#33FF00';
|
||||
reward.textContent = Beautify(Math.min((Game.cookies + GetWrinkConfigBank()) * 0.15, CacheNoGoldSwitchCookiesPS * 60 * 30), 2);
|
||||
conjure.appendChild(reward);
|
||||
const seperator = document.createElement('span');
|
||||
seperator.textContent = ' / ';
|
||||
conjure.appendChild(seperator);
|
||||
const loss = document.createElement('span');
|
||||
loss.style.color = 'red';
|
||||
loss.textContent = Beautify((CacheNoGoldSwitchCookiesPS * 60 * 15), 2);
|
||||
conjure.appendChild(loss);
|
||||
}
|
||||
// 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'),
|
||||
);
|
||||
const conjure = document.createElement('div');
|
||||
conjure.id = 'x';
|
||||
tooltipBox.appendChild(conjure);
|
||||
const reward = document.createElement('span');
|
||||
reward.style.color = '#33FF00';
|
||||
reward.textContent = Beautify(
|
||||
Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * 60 * 30,
|
||||
),
|
||||
2,
|
||||
);
|
||||
conjure.appendChild(reward);
|
||||
const seperator = document.createElement('span');
|
||||
seperator.textContent = ' / ';
|
||||
conjure.appendChild(seperator);
|
||||
const loss = document.createElement('span');
|
||||
loss.style.color = 'red';
|
||||
loss.textContent = Beautify(CacheNoGoldSwitchCookiesPS * 60 * 15, 2);
|
||||
conjure.appendChild(loss);
|
||||
}
|
||||
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,24 +282,50 @@ export function Grimoire() {
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function GardenPlots() {
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
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].matureBase;
|
||||
const plantName = 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'} / ${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'} / ${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'} / ${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'} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
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]
|
||||
.matureBase;
|
||||
const plantName =
|
||||
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'
|
||||
} / ${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'
|
||||
} / ${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'
|
||||
} / ${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'
|
||||
} / ${Beautify(Game.cookiesPs * 60 * 120)}`;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,36 +334,52 @@ export function GardenPlots() {
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export function HarvestAll() {
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
if (CMOptions.TooltipLump) {
|
||||
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies gained from harvesting:'));
|
||||
let totalGain = 0;
|
||||
let mortal = 0;
|
||||
if (Game.keys[16] && Game.keys[17]) mortal = 1;
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
if (minigame.plot[y][x][0] >= 1) {
|
||||
const tile = minigame.plot[y][x];
|
||||
const me = minigame.plantsById[tile[0] - 1];
|
||||
const plantName = me.name;
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
if (CMOptions.TooltipLump) {
|
||||
l('CMTooltipBorder').appendChild(
|
||||
Create.TooltipCreateHeader('Cookies gained from harvesting:'),
|
||||
);
|
||||
let totalGain = 0;
|
||||
let mortal = 0;
|
||||
if (Game.keys[16] && Game.keys[17]) mortal = 1;
|
||||
for (let y = 0; y < 6; y++) {
|
||||
for (let x = 0; x < 6; x++) {
|
||||
if (minigame.plot[y][x][0] >= 1) {
|
||||
const tile = minigame.plot[y][x];
|
||||
const me = minigame.plantsById[tile[0] - 1];
|
||||
const plantName = me.name;
|
||||
|
||||
let count = true;
|
||||
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 * 3);
|
||||
} else if (count && plantName === 'Queenbeet') {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l('CMTooltipBorder').appendChild(document.createTextNode(Beautify(totalGain)));
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
let count = true;
|
||||
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 * 3);
|
||||
} else if (count && plantName === 'Queenbeet') {
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l('CMTooltipBorder').appendChild(
|
||||
document.createTextNode(Beautify(totalGain)),
|
||||
);
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,73 +387,125 @@ export function HarvestAll() {
|
||||
* It is called by CM.Disp.UpdateTooltip()
|
||||
*/
|
||||
export function Warnings() {
|
||||
if (TooltipType === 'b' || TooltipType === 'u') {
|
||||
if (document.getElementById('CMDispTooltipWarningParent') === null) {
|
||||
l('tooltipAnchor').appendChild(Create.TooltipCreateWarningSection());
|
||||
ToggleToolWarnPos();
|
||||
}
|
||||
if (TooltipType === 'b' || TooltipType === 'u') {
|
||||
if (document.getElementById('CMDispTooltipWarningParent') === null) {
|
||||
l('tooltipAnchor').appendChild(Create.TooltipCreateWarningSection());
|
||||
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;
|
||||
let limitLucky = CacheLucky;
|
||||
if (CMOptions.ToolWarnBon === 1) {
|
||||
let bonusNoFren = TooltipBonusIncome;
|
||||
bonusNoFren /= GetCPSBuffMult();
|
||||
limitLucky += ((bonusNoFren * 60 * 15) / 0.15);
|
||||
}
|
||||
const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice;
|
||||
const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0;
|
||||
let limitLucky = CacheLucky;
|
||||
if (CMOptions.ToolWarnBon === 1) {
|
||||
let bonusNoFren = TooltipBonusIncome;
|
||||
bonusNoFren /= GetCPSBuffMult();
|
||||
limitLucky += (bonusNoFren * 60 * 15) / 0.15;
|
||||
}
|
||||
|
||||
if (CMOptions.ToolWarnLucky === 1) {
|
||||
if (amount < limitLucky && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnLucky').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(limitLucky - amount)} (${FormatTime((limitLucky - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnLucky').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnLucky').style.display = 'none';
|
||||
if (CMOptions.ToolWarnLucky === 1) {
|
||||
if (amount < limitLucky && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnLucky').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(
|
||||
limitLucky - amount,
|
||||
)} (${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)) {
|
||||
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(limitLuckyFrenzy - amount)} (${FormatTime((limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
|
||||
if (CMOptions.ToolWarnLuckyFrenzy === 1) {
|
||||
const limitLuckyFrenzy = limitLucky * 7;
|
||||
if (
|
||||
amount < limitLuckyFrenzy &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(
|
||||
limitLuckyFrenzy - amount,
|
||||
)} (${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)) {
|
||||
l('CMDispTooltipWarnConjure').style.display = '';
|
||||
l('CMDispTooltipWarnConjureText').textContent = `${Beautify(limitConjure - amount)} (${FormatTime((limitConjure - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnConjure').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnConjure').style.display = 'none';
|
||||
if (CMOptions.ToolWarnConjure === 1) {
|
||||
const limitConjure = limitLucky * 2;
|
||||
if (
|
||||
amount < limitConjure &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnConjure').style.display = '';
|
||||
l('CMDispTooltipWarnConjureText').textContent = `${Beautify(
|
||||
limitConjure - amount,
|
||||
)} (${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)) {
|
||||
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(limitConjureFrenzy - amount)} (${FormatTime((limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
|
||||
if (CMOptions.ToolWarnConjureFrenzy === 1) {
|
||||
const limitConjureFrenzy = limitLucky * 2 * 7;
|
||||
if (
|
||||
amount < limitConjureFrenzy &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
|
||||
l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(
|
||||
limitConjureFrenzy - amount,
|
||||
)} (${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)) {
|
||||
l('CMDispTooltipWarnEdifice').style.display = '';
|
||||
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(CacheEdifice - amount)} (${FormatTime((CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
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),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnEdifice').style.display = 'none';
|
||||
|
||||
if (CMOptions.ToolWarnUser > 0) {
|
||||
if (amount < CMOptions.ToolWarnUser * GetCPS() && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnUser').style.display = '';
|
||||
// Need to update tooltip text dynamically
|
||||
l('CMDispTooltipWarnUser').children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`;
|
||||
l('CMDispTooltipWarnUserText').textContent = `${Beautify(CMOptions.ToolWarnUser * GetCPS() - amount)} (${FormatTime((CMOptions.ToolWarnUser * GetCPS() - amount) / (GetCPS() + bonusIncomeUsed))})`;
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
if (CMOptions.ToolWarnUser > 0) {
|
||||
if (
|
||||
amount < CMOptions.ToolWarnUser * GetCPS() &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnUser').style.display = '';
|
||||
// Need to update tooltip text dynamically
|
||||
l(
|
||||
'CMDispTooltipWarnUser',
|
||||
).children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`;
|
||||
l('CMDispTooltipWarnUserText').textContent = `${Beautify(
|
||||
CMOptions.ToolWarnUser * GetCPS() - amount,
|
||||
)} (${FormatTime(
|
||||
(CMOptions.ToolWarnUser * GetCPS() - amount) /
|
||||
(GetCPS() + bonusIncomeUsed),
|
||||
)})`;
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else l('CMDispTooltipWarnUser').style.display = 'none';
|
||||
} else if (l('CMDispTooltipWarningParent') !== null) {
|
||||
l('CMDispTooltipWarningParent').remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { TooltipWrinkler, TooltipWrinklerArea, TooltipWrinklerBeingShown } from '../VariablesAndData';
|
||||
import {
|
||||
TooltipWrinkler,
|
||||
TooltipWrinklerArea,
|
||||
TooltipWrinklerBeingShown,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function checks and create a tooltip for the wrinklers
|
||||
@@ -9,34 +13,38 @@ import { TooltipWrinkler, TooltipWrinklerArea, TooltipWrinklerBeingShown } from
|
||||
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||
*/
|
||||
export function CheckWrinklerTooltip() {
|
||||
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect
|
||||
let showingTooltip = false;
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
const me = Game.wrinklers[i];
|
||||
if (me.phase > 0 && me.selected) {
|
||||
showingTooltip = true;
|
||||
if (TooltipWrinklerBeingShown[i] === 0 || TooltipWrinklerBeingShown[i] === undefined) {
|
||||
const placeholder = document.createElement('div');
|
||||
const wrinkler = document.createElement('div');
|
||||
wrinkler.style.minWidth = '120px';
|
||||
wrinkler.style.marginBottom = '4px';
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'center';
|
||||
div.id = 'CMTooltipWrinkler';
|
||||
wrinkler.appendChild(div);
|
||||
placeholder.appendChild(wrinkler);
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
TooltipWrinkler = i;
|
||||
TooltipWrinklerBeingShown[i] = 1;
|
||||
} else break;
|
||||
} else {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
}
|
||||
if (!showingTooltip) {
|
||||
Game.tooltip.hide();
|
||||
}
|
||||
}
|
||||
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) {
|
||||
// Latter is set by CM.Main.AddWrinklerAreaDetect
|
||||
let showingTooltip = false;
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
const me = Game.wrinklers[i];
|
||||
if (me.phase > 0 && me.selected) {
|
||||
showingTooltip = true;
|
||||
if (
|
||||
TooltipWrinklerBeingShown[i] === 0 ||
|
||||
TooltipWrinklerBeingShown[i] === undefined
|
||||
) {
|
||||
const placeholder = document.createElement('div');
|
||||
const wrinkler = document.createElement('div');
|
||||
wrinkler.style.minWidth = '120px';
|
||||
wrinkler.style.marginBottom = '4px';
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'center';
|
||||
div.id = 'CMTooltipWrinkler';
|
||||
wrinkler.appendChild(div);
|
||||
placeholder.appendChild(wrinkler);
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
TooltipWrinkler = i;
|
||||
TooltipWrinklerBeingShown[i] = 1;
|
||||
} else break;
|
||||
} else {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
}
|
||||
if (!showingTooltip) {
|
||||
Game.tooltip.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,19 +53,19 @@ export function CheckWrinklerTooltip() {
|
||||
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||
*/
|
||||
export function UpdateWrinklerTooltip() {
|
||||
if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) {
|
||||
let sucked = Game.wrinklers[TooltipWrinkler].sucked;
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
sucked *= toSuck;
|
||||
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
if (godLvl === 1) sucked *= 1.15;
|
||||
else if (godLvl === 2) sucked *= 1.1;
|
||||
else if (godLvl === 3) sucked *= 1.05;
|
||||
}
|
||||
l('CMTooltipWrinkler').textContent = Beautify(sucked);
|
||||
}
|
||||
if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) {
|
||||
let sucked = Game.wrinklers[TooltipWrinkler].sucked;
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
sucked *= toSuck;
|
||||
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
if (godLvl === 1) sucked *= 1.15;
|
||||
else if (godLvl === 2) sucked *= 1.1;
|
||||
else if (godLvl === 3) sucked *= 1.05;
|
||||
}
|
||||
l('CMTooltipWrinkler').textContent = Beautify(sucked);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user