Merge branch 'dev' into mastertodev
This commit is contained in:
11
package-lock.json
generated
11
package-lock.json
generated
@@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "cookiemonster-mod",
|
"name": "cookiemonster-mod",
|
||||||
"version": "2.031.6",
|
"version": "2.031.5",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cookiemonster-mod",
|
"name": "cookiemonster-mod",
|
||||||
"version": "2.031.6",
|
"version": "2.031.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eastdesire/jscolor": "^2.4.5"
|
"@eastdesire/jscolor": "^2.4.5",
|
||||||
|
"lodash": "^4.17.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.19.0",
|
"eslint": "^7.19.0",
|
||||||
@@ -1758,7 +1759,6 @@
|
|||||||
},
|
},
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.20",
|
"version": "4.17.20",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/lru-cache": {
|
"node_modules/lru-cache": {
|
||||||
@@ -4271,8 +4271,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.20",
|
"version": "4.17.20"
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"lru-cache": {
|
"lru-cache": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
|
|||||||
13
src/Cache/PantheonGods/CacheGods.js
Normal file
13
src/Cache/PantheonGods/CacheGods.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import CalculateChangeGod from '../../Sim/SimulationEvents/GodChange';
|
||||||
|
import { CacheGods } from '../VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions caches the cps effect of each God in slot 1, 2 or 3
|
||||||
|
*/
|
||||||
|
export default function CachePantheonGods() {
|
||||||
|
for (let god = 0; god < 11; god += 1) {
|
||||||
|
for (let slot = 0; slot < 3; slot += 1) {
|
||||||
|
CacheGods[god][slot] = CalculateChangeGod(god, slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -99,3 +99,17 @@ export let CacheLastHeavenlyChips;
|
|||||||
export let CacheDoRemakeBuildPrices;
|
export let CacheDoRemakeBuildPrices;
|
||||||
|
|
||||||
export let CacheHadBuildAura;
|
export let CacheHadBuildAura;
|
||||||
|
|
||||||
|
export let CacheGods = {
|
||||||
|
0: [0, 0, 0],
|
||||||
|
1: [0, 0, 0],
|
||||||
|
2: [0, 0, 0],
|
||||||
|
3: [0, 0, 0],
|
||||||
|
4: [0, 0, 0],
|
||||||
|
5: [0, 0, 0],
|
||||||
|
6: [0, 0, 0],
|
||||||
|
7: [0, 0, 0],
|
||||||
|
8: [0, 0, 0],
|
||||||
|
9: [0, 0, 0],
|
||||||
|
10: [0, 0, 0],
|
||||||
|
};
|
||||||
|
|||||||
@@ -585,6 +585,16 @@ const Config = {
|
|||||||
'Shows a tooltip for plants that have a cookie reward.',
|
'Shows a tooltip for plants that have a cookie reward.',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
TooltipPantheon: new SettingStandard(
|
||||||
|
'bool',
|
||||||
|
'Tooltip',
|
||||||
|
[
|
||||||
|
'Show Extra Info Pantheon Tooltip OFF',
|
||||||
|
'Show Extra Info Pantheon Tooltip ON',
|
||||||
|
],
|
||||||
|
'Shows additional info in the pantheon tooltip',
|
||||||
|
true,
|
||||||
|
),
|
||||||
DragonAuraInfo: new SettingStandard(
|
DragonAuraInfo: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'Tooltip',
|
'Tooltip',
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ const ConfigDefault = {
|
|||||||
TooltipWrink: 1,
|
TooltipWrink: 1,
|
||||||
TooltipLump: 1,
|
TooltipLump: 1,
|
||||||
TooltipPlots: 1,
|
TooltipPlots: 1,
|
||||||
|
TooltipPantheon: 1,
|
||||||
DragonAuraInfo: 1,
|
DragonAuraInfo: 1,
|
||||||
TooltipAscendButton: 1,
|
TooltipAscendButton: 1,
|
||||||
Stats: 1,
|
Stats: 1,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
|
|||||||
import { UpdateBotBar } from './InfoBars/BottomBar';
|
import { UpdateBotBar } from './InfoBars/BottomBar';
|
||||||
import { UpdateTimerBar } from './InfoBars/TimerBar';
|
import { UpdateTimerBar } from './InfoBars/TimerBar';
|
||||||
import RefreshMenu from './MenuSections/Refreshmenu';
|
import RefreshMenu from './MenuSections/Refreshmenu';
|
||||||
import { UpdateTooltips } from './Tooltips/Tooltip';
|
import UpdateTooltips from './Tooltips/UpdateTooltips';
|
||||||
import {
|
import {
|
||||||
CheckWrinklerTooltip,
|
CheckWrinklerTooltip,
|
||||||
UpdateWrinklerTooltip,
|
UpdateWrinklerTooltip,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData';
|
import { CacheWrinklersFattest } from '../../Cache/VariablesAndData';
|
||||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||||
|
import { CreateTooltip } from '../Tooltips/Tooltip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
* This function creates two objects at the bottom of the left column that allowing popping of wrinklers
|
||||||
@@ -12,6 +13,20 @@ export default function CreateWrinklerButtons() {
|
|||||||
popAllA.onclick = function () {
|
popAllA.onclick = function () {
|
||||||
PopAllNormalWrinklers();
|
PopAllNormalWrinklers();
|
||||||
};
|
};
|
||||||
|
popAllA.onmouseout = function () {
|
||||||
|
Game.tooltip.shouldHide = 1;
|
||||||
|
};
|
||||||
|
popAllA.onmouseover = function () {
|
||||||
|
Game.tooltip.dynamic = 1;
|
||||||
|
Game.tooltip.draw(
|
||||||
|
this,
|
||||||
|
function () {
|
||||||
|
return CreateTooltip('wb', 'PopAll');
|
||||||
|
},
|
||||||
|
'this',
|
||||||
|
);
|
||||||
|
Game.tooltip.wobble();
|
||||||
|
};
|
||||||
l('sectionLeftExtra').children[0].append(popAllA);
|
l('sectionLeftExtra').children[0].append(popAllA);
|
||||||
const popFattestA = document.createElement('a');
|
const popFattestA = document.createElement('a');
|
||||||
popFattestA.id = 'PopFattestWrinklerButton';
|
popFattestA.id = 'PopFattestWrinklerButton';
|
||||||
@@ -21,5 +36,19 @@ export default function CreateWrinklerButtons() {
|
|||||||
if (CacheWrinklersFattest[1] !== null)
|
if (CacheWrinklersFattest[1] !== null)
|
||||||
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
|
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
|
||||||
};
|
};
|
||||||
|
popFattestA.onmouseout = function () {
|
||||||
|
Game.tooltip.shouldHide = 1;
|
||||||
|
};
|
||||||
|
popFattestA.onmouseover = function () {
|
||||||
|
Game.tooltip.dynamic = 1;
|
||||||
|
Game.tooltip.draw(
|
||||||
|
this,
|
||||||
|
function () {
|
||||||
|
return CreateTooltip('wb', 'PopFattest');
|
||||||
|
},
|
||||||
|
'this',
|
||||||
|
);
|
||||||
|
Game.tooltip.wobble();
|
||||||
|
};
|
||||||
l('sectionLeftExtra').children[0].append(popFattestA);
|
l('sectionLeftExtra').children[0].append(popFattestA);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
import * as UpdateTooltip from './UpdateTooltips';
|
import UpdateTooltips, * as UpdateTooltip from './UpdateTooltips';
|
||||||
import { TooltipCreateTooltipBox } from './CreateTooltip';
|
import { TooltipCreateTooltipBox } from './CreateTooltip';
|
||||||
import {
|
import {
|
||||||
Beautify,
|
Beautify,
|
||||||
@@ -32,38 +32,6 @@ export function CreateSimpleTooltip(placeholder, text, minWidth) {
|
|||||||
Tooltip.appendChild(desc);
|
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);
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function enhance the standard tooltips by creating and changing l('tooltip')
|
* This function enhance the standard tooltips by creating and changing l('tooltip')
|
||||||
* The function is called by .onmouseover events that have replaced original code to use CM.Disp.Tooltip()
|
* The function is called by .onmouseover events that have replaced original code to use CM.Disp.Tooltip()
|
||||||
@@ -141,9 +109,16 @@ export function CreateTooltip(type, name) {
|
|||||||
name[0],
|
name[0],
|
||||||
name[1],
|
name[1],
|
||||||
)();
|
)();
|
||||||
// Garden plots
|
// Harvest all button in garden
|
||||||
else if (type === 'ha')
|
else if (type === 'ha')
|
||||||
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden
|
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 === 'pas')
|
||||||
|
l('tooltip').innerHTML = Game.Objects.Temple.minigame.slotTooltip(
|
||||||
|
name[0],
|
||||||
|
)();
|
||||||
|
|
||||||
// Adds area for extra tooltip-sections
|
// Adds area for extra tooltip-sections
|
||||||
if (
|
if (
|
||||||
@@ -152,7 +127,10 @@ export function CreateTooltip(type, name) {
|
|||||||
type === 's' ||
|
type === 's' ||
|
||||||
type === 'g' ||
|
type === 'g' ||
|
||||||
(type === 'p' && !Game.keys[16]) ||
|
(type === 'p' && !Game.keys[16]) ||
|
||||||
type === 'ha'
|
type === 'ha' ||
|
||||||
|
type === 'wb' ||
|
||||||
|
type === 'pag' ||
|
||||||
|
(type === 'pas' && name[1] !== -1)
|
||||||
) {
|
) {
|
||||||
const area = document.createElement('div');
|
const area = document.createElement('div');
|
||||||
area.id = 'CMTooltipArea';
|
area.id = 'CMTooltipArea';
|
||||||
|
|||||||
95
src/Disp/Tooltips/TypesOfTooltips/Building.js
Normal file
95
src/Disp/Tooltips/TypesOfTooltips/Building.js
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import {
|
||||||
|
CacheObjects1,
|
||||||
|
CacheObjects10,
|
||||||
|
CacheObjects100,
|
||||||
|
} from '../../../Cache/VariablesAndData';
|
||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||||
|
import {
|
||||||
|
Beautify,
|
||||||
|
GetTimeColor,
|
||||||
|
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||||
|
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||||
|
import {
|
||||||
|
ColorTextPre,
|
||||||
|
LastTargetTooltipBuilding,
|
||||||
|
TooltipBonusIncome,
|
||||||
|
TooltipName,
|
||||||
|
TooltipPrice,
|
||||||
|
} from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Building tooltips
|
||||||
|
*/
|
||||||
|
export default function Building() {
|
||||||
|
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;
|
||||||
|
|
||||||
|
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)`;
|
||||||
|
} else {
|
||||||
|
l('CMTooltipIncome').textContent += ` (<0${
|
||||||
|
CMOptions.ScaleSeparator ? ',' : '.'
|
||||||
|
}01% 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';
|
||||||
|
}
|
||||||
55
src/Disp/Tooltips/TypesOfTooltips/GardenPlots.js
Normal file
55
src/Disp/Tooltips/TypesOfTooltips/GardenPlots.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import { TooltipName } from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Garden plots tooltips
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
export default 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';
|
||||||
|
}
|
||||||
80
src/Disp/Tooltips/TypesOfTooltips/Grimoire.js
Normal file
80
src/Disp/Tooltips/TypesOfTooltips/Grimoire.js
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData';
|
||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import {
|
||||||
|
Beautify,
|
||||||
|
GetTimeColor,
|
||||||
|
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
||||||
|
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||||
|
import { ColorTextPre, TooltipName } from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Grimoire tooltips
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
export default function Grimoire() {
|
||||||
|
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');
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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';
|
||||||
|
}
|
||||||
57
src/Disp/Tooltips/TypesOfTooltips/HarvestAll.js
Normal file
57
src/Disp/Tooltips/TypesOfTooltips/HarvestAll.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Garden Harvest All tooltip
|
||||||
|
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
export default 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;
|
||||||
|
|
||||||
|
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';
|
||||||
|
}
|
||||||
76
src/Disp/Tooltips/TypesOfTooltips/PantheonGods.js
Normal file
76
src/Disp/Tooltips/TypesOfTooltips/PantheonGods.js
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
import { CacheGods } from '../../../Cache/VariablesAndData';
|
||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import { TooltipName, TooltipType } from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Pantheon Gods tooltip
|
||||||
|
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
export default function PantheonGods() {
|
||||||
|
if (CMOptions.TooltipPantheon === 1) {
|
||||||
|
const tooltipBox = l('CMTooltipBorder');
|
||||||
|
let GodID;
|
||||||
|
if (TooltipType === 'pas') GodID = TooltipName[1];
|
||||||
|
else GodID = TooltipName;
|
||||||
|
|
||||||
|
// Time left till enough magic for spell
|
||||||
|
tooltipBox.appendChild(Create.TooltipCreateHeader('Effect in position 1:'));
|
||||||
|
const cps1 = document.createElement('div');
|
||||||
|
cps1.id = 'CMPantheonTooltipPosition1';
|
||||||
|
if (CacheGods[GodID][0] !== 0) {
|
||||||
|
cps1.textContent = Beautify(CacheGods[GodID][0]);
|
||||||
|
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)`;
|
||||||
|
}
|
||||||
|
} else cps1.textContent = 'No effect to CPS';
|
||||||
|
tooltipBox.appendChild(cps1);
|
||||||
|
|
||||||
|
tooltipBox.appendChild(Create.TooltipCreateHeader('Effect in position 2:'));
|
||||||
|
const cps2 = document.createElement('div');
|
||||||
|
cps2.id = 'CMPantheonTooltipPosition2';
|
||||||
|
if (CacheGods[GodID][1] !== 0) {
|
||||||
|
cps2.textContent = Beautify(CacheGods[GodID][1]);
|
||||||
|
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)`;
|
||||||
|
}
|
||||||
|
} else cps2.textContent = 'No effect to CPS';
|
||||||
|
tooltipBox.appendChild(cps2);
|
||||||
|
|
||||||
|
tooltipBox.appendChild(Create.TooltipCreateHeader('Effect in position 3:'));
|
||||||
|
const cps3 = document.createElement('div');
|
||||||
|
cps3.id = 'CMPantheonTooltipPosition2';
|
||||||
|
if (CacheGods[GodID][2] !== 0) {
|
||||||
|
cps3.textContent = Beautify(CacheGods[GodID][2]);
|
||||||
|
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)`;
|
||||||
|
}
|
||||||
|
} else cps3.textContent = 'No effect to CPS';
|
||||||
|
tooltipBox.appendChild(cps3);
|
||||||
|
|
||||||
|
l('CMTooltipArea').appendChild(tooltipBox);
|
||||||
|
} else l('CMTooltipArea').style.display = 'none';
|
||||||
|
}
|
||||||
22
src/Disp/Tooltips/TypesOfTooltips/SugarLump.js
Normal file
22
src/Disp/Tooltips/TypesOfTooltips/SugarLump.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import GetLumpColor from '../../HelperFunctions/GetLumpColor';
|
||||||
|
import { ColorTextPre } from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Sugar Lump tooltip
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
export default function SugarLump() {
|
||||||
|
if (CMOptions.TooltipLump === 1) {
|
||||||
|
const tooltipBox = l('CMTooltipBorder');
|
||||||
|
|
||||||
|
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';
|
||||||
|
}
|
||||||
108
src/Disp/Tooltips/TypesOfTooltips/Upgrade.js
Normal file
108
src/Disp/Tooltips/TypesOfTooltips/Upgrade.js
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
import {
|
||||||
|
CacheLastChoEgg,
|
||||||
|
CacheUpgrades,
|
||||||
|
} from '../../../Cache/VariablesAndData';
|
||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
import {
|
||||||
|
Beautify,
|
||||||
|
GetTimeColor,
|
||||||
|
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||||
|
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||||
|
import {
|
||||||
|
ColorTextPre,
|
||||||
|
TooltipBonusIncome,
|
||||||
|
TooltipBonusMouse,
|
||||||
|
TooltipName,
|
||||||
|
TooltipPrice,
|
||||||
|
TooltipType,
|
||||||
|
} from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the Upgrade tooltips
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
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)`;
|
||||||
|
} else {
|
||||||
|
l('CMTooltipIncome').textContent += ` (<0${
|
||||||
|
CMOptions.ScaleSeparator ? ',' : '.'
|
||||||
|
}01% 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';
|
||||||
|
}
|
||||||
144
src/Disp/Tooltips/TypesOfTooltips/Warnings.js
Normal file
144
src/Disp/Tooltips/TypesOfTooltips/Warnings.js
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
import GetCPSBuffMult from '../../../Cache/CPS/GetCPSBuffMult';
|
||||||
|
import { CacheEdifice, CacheLucky } from '../../../Cache/VariablesAndData';
|
||||||
|
import ToggleToolWarnPos from '../../../Config/Toggles/ToggleToolWarnPos';
|
||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Beautify,
|
||||||
|
FormatTime,
|
||||||
|
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||||
|
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||||
|
import {
|
||||||
|
TooltipBonusIncome,
|
||||||
|
TooltipPrice,
|
||||||
|
TooltipType,
|
||||||
|
} from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates the warnings section of the building and upgrade tooltips
|
||||||
|
*/
|
||||||
|
export default function Warnings() {
|
||||||
|
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`;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.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.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();
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/Disp/Tooltips/TypesOfTooltips/WrinklerButton.js
Normal file
25
src/Disp/Tooltips/TypesOfTooltips/WrinklerButton.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import {
|
||||||
|
CacheWrinklersFattest,
|
||||||
|
CacheWrinklersTotal,
|
||||||
|
} from '../../../Cache/VariablesAndData';
|
||||||
|
import { TooltipName } from '../../VariablesAndData';
|
||||||
|
import * as Create from '../CreateTooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function adds extra info to the wrinkler button tooltip
|
||||||
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
|
*/
|
||||||
|
export default function WrinklerButton() {
|
||||||
|
l('tooltip').innerHTML = '';
|
||||||
|
l('tooltip').appendChild(Create.TooltipCreateHeader('Reward:'));
|
||||||
|
|
||||||
|
const WrinklerReward = document.createElement('div');
|
||||||
|
WrinklerReward.id = 'CMWrinklerReward';
|
||||||
|
if (TooltipName === 'PopAll') {
|
||||||
|
WrinklerReward.textContent = CacheWrinklersTotal;
|
||||||
|
} else if (TooltipName === 'PopFattest') {
|
||||||
|
WrinklerReward.textContent = CacheWrinklersFattest[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
l('tooltip').appendChild(WrinklerReward);
|
||||||
|
}
|
||||||
@@ -1,519 +1,51 @@
|
|||||||
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
|
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||||
import {
|
import { TooltipName, TooltipType } from '../VariablesAndData';
|
||||||
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 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,
|
|
||||||
} from '../VariablesAndData';
|
|
||||||
import * as Create from './CreateTooltip';
|
import * as Create from './CreateTooltip';
|
||||||
|
import Building from './TypesOfTooltips/Building';
|
||||||
/** Functions that update specific types of tooltips */
|
import GardenPlots from './TypesOfTooltips/GardenPlots';
|
||||||
|
import Grimoire from './TypesOfTooltips/Grimoire';
|
||||||
|
import HarvestAll from './TypesOfTooltips/HarvestAll';
|
||||||
|
import PantheonGods from './TypesOfTooltips/PantheonGods';
|
||||||
|
import SugarLump from './TypesOfTooltips/SugarLump';
|
||||||
|
import Upgrade from './TypesOfTooltips/Upgrade';
|
||||||
|
import Warnings from './TypesOfTooltips/Warnings';
|
||||||
|
import WrinklerButton from './TypesOfTooltips/WrinklerButton';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds extra info to the Building tooltips
|
* This function updates the sections of the tooltips created by CookieMonster
|
||||||
*/
|
*/
|
||||||
export function Building() {
|
export default function UpdateTooltips() {
|
||||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
CopyData();
|
||||||
const tooltipBox = l('CMTooltipBorder');
|
if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) {
|
||||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
l('CMTooltipArea').innerHTML = '';
|
||||||
|
const tooltipBox = Create.TooltipCreateTooltipBox();
|
||||||
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;
|
|
||||||
|
|
||||||
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)`;
|
|
||||||
} else {
|
|
||||||
l('CMTooltipIncome').textContent += ` (<0${
|
|
||||||
CMOptions.ScaleSeparator ? ',' : '.'
|
|
||||||
}01% 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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function adds extra info to the Upgrade tooltips
|
|
||||||
*/
|
|
||||||
export 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;
|
|
||||||
|
|
||||||
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)`;
|
|
||||||
} else {
|
|
||||||
l('CMTooltipIncome').textContent += ` (<0${
|
|
||||||
CMOptions.ScaleSeparator ? ',' : '.'
|
|
||||||
}01% 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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function adds extra info to the Sugar Lump tooltip
|
|
||||||
* It adds to the additional information to l('CMTooltipArea')
|
|
||||||
*/
|
|
||||||
export function SugarLump() {
|
|
||||||
if (CMOptions.TooltipLump === 1) {
|
|
||||||
const tooltipBox = l('CMTooltipBorder');
|
|
||||||
|
|
||||||
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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function adds extra info to the Grimoire tooltips
|
|
||||||
* 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]);
|
|
||||||
|
|
||||||
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 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
l('CMTooltipArea').appendChild(tooltipBox);
|
l('CMTooltipArea').appendChild(tooltipBox);
|
||||||
} else l('CMTooltipArea').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if (TooltipType === 'b') {
|
||||||
* This function adds extra info to the Garden plots tooltips
|
Building();
|
||||||
* It adds to the additional information to l('CMTooltipArea')
|
} else if (TooltipType === 'u') {
|
||||||
*/
|
Upgrade();
|
||||||
export function GardenPlots() {
|
} else if (TooltipType === 's') {
|
||||||
const minigame = Game.Objects.Farm.minigame;
|
SugarLump();
|
||||||
if (
|
} else if (TooltipType === 'g') {
|
||||||
CMOptions.TooltipPlots &&
|
Grimoire();
|
||||||
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
|
} else if (TooltipType === 'p') {
|
||||||
) {
|
GardenPlots();
|
||||||
const mature =
|
} else if (TooltipType === 'ha') {
|
||||||
minigame.plot[TooltipName[1]][TooltipName[0]][1] >
|
HarvestAll();
|
||||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
|
} else if (TooltipType === 'wb') {
|
||||||
.matureBase;
|
WrinklerButton();
|
||||||
const plantName =
|
} else if (
|
||||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
|
TooltipType === 'pag' ||
|
||||||
.name;
|
(TooltipType === 'pas' && TooltipName[1] !== -1)
|
||||||
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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function adds extra info to the Garden Harvest All tooltip
|
|
||||||
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
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';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function updates the warnings section of the building and upgrade tooltips
|
|
||||||
* 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 (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`;
|
|
||||||
|
|
||||||
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.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.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 (
|
PantheonGods();
|
||||||
CacheEdifice &&
|
}
|
||||||
amount < CacheEdifice &&
|
Warnings();
|
||||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
} else if (l('CMTooltipArea') === null) {
|
||||||
) {
|
// Remove warnings if its a basic tooltip
|
||||||
l('CMDispTooltipWarnEdifice').style.display = '';
|
if (l('CMDispTooltipWarningParent') !== null) {
|
||||||
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(
|
l('CMDispTooltipWarningParent').remove();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import LoopCache from '../Cache/CacheLoop';
|
|||||||
import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';
|
import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';
|
||||||
import CacheSellAllForChoEgg from '../Cache/CPS/SellChoEgg';
|
import CacheSellAllForChoEgg from '../Cache/CPS/SellChoEgg';
|
||||||
import CacheDragonCost from '../Cache/Dragon/Dragon';
|
import CacheDragonCost from '../Cache/Dragon/Dragon';
|
||||||
|
import CachePantheonGods from '../Cache/PantheonGods/CacheGods';
|
||||||
import {
|
import {
|
||||||
CacheBuildingsPrices,
|
CacheBuildingsPrices,
|
||||||
CacheIncome,
|
CacheIncome,
|
||||||
@@ -57,6 +58,7 @@ export default function CMLoop() {
|
|||||||
CacheAllMissingUpgrades();
|
CacheAllMissingUpgrades();
|
||||||
CacheChain();
|
CacheChain();
|
||||||
CacheDragonCost();
|
CacheDragonCost();
|
||||||
|
CachePantheonGods();
|
||||||
|
|
||||||
CacheSeasonSpec();
|
CacheSeasonSpec();
|
||||||
CacheSellAllForChoEgg();
|
CacheSellAllForChoEgg();
|
||||||
|
|||||||
@@ -86,6 +86,40 @@ function ReplaceTooltipGarden() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ReplaceTooltipPantheon() {
|
||||||
|
if (Game.Objects.Temple.minigameLoaded) {
|
||||||
|
for (let i = 0; i < 11; i += 1) {
|
||||||
|
l(`templeGod${i}`).onmouseover = function () {
|
||||||
|
Game.tooltip.dynamic = 1;
|
||||||
|
Game.tooltip.draw(
|
||||||
|
this,
|
||||||
|
function () {
|
||||||
|
return CreateTooltip('pag', i);
|
||||||
|
},
|
||||||
|
'this',
|
||||||
|
);
|
||||||
|
Game.tooltip.wobble();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 3; i += 1) {
|
||||||
|
l(`templeSlot${i}`).onmouseover = function () {
|
||||||
|
Game.tooltip.dynamic = 1;
|
||||||
|
Game.tooltip.draw(
|
||||||
|
this,
|
||||||
|
function () {
|
||||||
|
return CreateTooltip('pas', [
|
||||||
|
i,
|
||||||
|
Game.Objects.Temple.minigame.slot[i],
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
'this',
|
||||||
|
);
|
||||||
|
Game.tooltip.wobble();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function call all functions that replace Game-tooltips with Cookie Monster enhanced tooltips
|
* This function call all functions that replace Game-tooltips with Cookie Monster enhanced tooltips
|
||||||
*/
|
*/
|
||||||
@@ -100,6 +134,7 @@ export default function ReplaceTooltips() {
|
|||||||
LoadMinigames();
|
LoadMinigames();
|
||||||
ReplaceTooltipGarden();
|
ReplaceTooltipGarden();
|
||||||
ReplaceTooltipGrimoire();
|
ReplaceTooltipGrimoire();
|
||||||
|
ReplaceTooltipPantheon();
|
||||||
ReplaceNativeGrimoire();
|
ReplaceNativeGrimoire();
|
||||||
};
|
};
|
||||||
Game.LoadMinigames();
|
Game.LoadMinigames();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SimObjects } from '../VariablesAndData';
|
import { SimGod1, SimGod2, SimGod3, SimObjects } from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks for the current God level in the sim data
|
* This function checks for the current God level in the sim data
|
||||||
@@ -11,10 +11,14 @@ export default function SimHasGod(what) {
|
|||||||
SimObjects.Temple.minigame = Game.Objects.Temple.minigame;
|
SimObjects.Temple.minigame = Game.Objects.Temple.minigame;
|
||||||
}
|
}
|
||||||
const god = SimObjects.Temple.minigame.gods[what];
|
const god = SimObjects.Temple.minigame.gods[what];
|
||||||
for (let i = 0; i < 3; i++) {
|
if (SimGod1 === god.id) {
|
||||||
if (SimObjects.Temple.minigame.slot[i] === god.id) {
|
return 1;
|
||||||
return i + 1;
|
}
|
||||||
}
|
if (SimGod2 === god.id) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SimGod3 === god.id) {
|
||||||
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import {
|
|||||||
SimAchievementsOwned,
|
SimAchievementsOwned,
|
||||||
SimDragonAura,
|
SimDragonAura,
|
||||||
SimDragonAura2,
|
SimDragonAura2,
|
||||||
|
SimGod1,
|
||||||
|
SimGod2,
|
||||||
|
SimGod3,
|
||||||
SimHeavenlyPower,
|
SimHeavenlyPower,
|
||||||
SimObjects,
|
SimObjects,
|
||||||
SimPledges,
|
SimPledges,
|
||||||
@@ -49,6 +52,11 @@ export default function CopyData() {
|
|||||||
you.basePrice = me.basePrice;
|
you.basePrice = me.basePrice;
|
||||||
you.free = me.free;
|
you.free = me.free;
|
||||||
if (me.minigameLoaded) {
|
if (me.minigameLoaded) {
|
||||||
|
if (me.name === 'Temple') {
|
||||||
|
SimGod1 = me.minigame.slot[0];
|
||||||
|
SimGod2 = me.minigame.slot[1];
|
||||||
|
SimGod3 = me.minigame.slot[2];
|
||||||
|
}
|
||||||
you.minigameLoaded = me.minigameLoaded;
|
you.minigameLoaded = me.minigameLoaded;
|
||||||
you.minigame = me.minigame;
|
you.minigame = me.minigame;
|
||||||
}
|
}
|
||||||
|
|||||||
34
src/Sim/SimulationEvents/GodChange.js
Normal file
34
src/Sim/SimulationEvents/GodChange.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
import CalculateGains from '../Calculations/CalculateGains';
|
||||||
|
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
|
||||||
|
import CopyData from '../SimulationData/CopyData';
|
||||||
|
import {
|
||||||
|
SimAchievementsOwned,
|
||||||
|
SimCookiesPs,
|
||||||
|
SimGod1,
|
||||||
|
SimGod2,
|
||||||
|
SimGod3,
|
||||||
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions calculates the cps and cost of changing a Dragon Aura
|
||||||
|
* It is called by CM.Disp.AddAuraInfo()
|
||||||
|
* @param {number} god The number of the slot to be swapped in
|
||||||
|
* * @param {number slot The slot the god will go to
|
||||||
|
* @returns {number} CM.Sim.cookiesPs - Game.cookiesPs The bonus cps and the price of the change
|
||||||
|
*/
|
||||||
|
export default function CalculateChangeGod(god, slot) {
|
||||||
|
CopyData();
|
||||||
|
if (slot === 0) SimGod1 = god;
|
||||||
|
else if (slot === 1) SimGod2 = god;
|
||||||
|
else if (slot === 2) SimGod3 = god;
|
||||||
|
|
||||||
|
const lastAchievementsOwned = SimAchievementsOwned;
|
||||||
|
CalculateGains();
|
||||||
|
|
||||||
|
CheckOtherAchiev();
|
||||||
|
if (lastAchievementsOwned !== SimAchievementsOwned) {
|
||||||
|
CalculateGains();
|
||||||
|
}
|
||||||
|
return SimCookiesPs - Game.cookiesPs;
|
||||||
|
}
|
||||||
@@ -12,6 +12,9 @@ export let SimHeavenlyPower;
|
|||||||
export let SimPrestige;
|
export let SimPrestige;
|
||||||
export let SimDragonAura;
|
export let SimDragonAura;
|
||||||
export let SimDragonAura2;
|
export let SimDragonAura2;
|
||||||
|
export let SimGod1;
|
||||||
|
export let SimGod2;
|
||||||
|
export let SimGod3;
|
||||||
export let SimDoSims;
|
export let SimDoSims;
|
||||||
export let SimEffs;
|
export let SimEffs;
|
||||||
export let SimDateCentury = Game.startDate;
|
export let SimDateCentury = Game.startDate;
|
||||||
|
|||||||
Reference in New Issue
Block a user