Create tooltip for wrinkler buttons #628
This commit is contained in:
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -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,10 @@ 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 = '';
|
||||||
|
|
||||||
// Adds area for extra tooltip-sections
|
// Adds area for extra tooltip-sections
|
||||||
if (
|
if (
|
||||||
@@ -152,7 +121,8 @@ 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'
|
||||||
) {
|
) {
|
||||||
const area = document.createElement('div');
|
const area = document.createElement('div');
|
||||||
area.id = 'CMTooltipArea';
|
area.id = 'CMTooltipArea';
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ import {
|
|||||||
CacheObjects10,
|
CacheObjects10,
|
||||||
CacheObjects100,
|
CacheObjects100,
|
||||||
CacheUpgrades,
|
CacheUpgrades,
|
||||||
|
CacheWrinklersFattest,
|
||||||
|
CacheWrinklersTotal,
|
||||||
} from '../../Cache/VariablesAndData';
|
} from '../../Cache/VariablesAndData';
|
||||||
import ToggleToolWarnPos from '../../Config/Toggles/ToggleToolWarnPos';
|
import ToggleToolWarnPos from '../../Config/Toggles/ToggleToolWarnPos';
|
||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
|
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
Beautify,
|
Beautify,
|
||||||
@@ -37,7 +40,7 @@ import * as Create from './CreateTooltip';
|
|||||||
/**
|
/**
|
||||||
* This function adds extra info to the Building tooltips
|
* This function adds extra info to the Building tooltips
|
||||||
*/
|
*/
|
||||||
export function Building() {
|
function Building() {
|
||||||
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
|
||||||
const tooltipBox = l('CMTooltipBorder');
|
const tooltipBox = l('CMTooltipBorder');
|
||||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||||
@@ -111,7 +114,7 @@ export function Building() {
|
|||||||
/**
|
/**
|
||||||
* This function adds extra info to the Upgrade tooltips
|
* This function adds extra info to the Upgrade tooltips
|
||||||
*/
|
*/
|
||||||
export function Upgrade() {
|
function Upgrade() {
|
||||||
const tooltipBox = l('CMTooltipBorder');
|
const tooltipBox = l('CMTooltipBorder');
|
||||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||||
|
|
||||||
@@ -200,7 +203,7 @@ export function Upgrade() {
|
|||||||
* This function adds extra info to the Sugar Lump tooltip
|
* This function adds extra info to the Sugar Lump tooltip
|
||||||
* It adds to the additional information to l('CMTooltipArea')
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
*/
|
*/
|
||||||
export function SugarLump() {
|
function SugarLump() {
|
||||||
if (CMOptions.TooltipLump === 1) {
|
if (CMOptions.TooltipLump === 1) {
|
||||||
const tooltipBox = l('CMTooltipBorder');
|
const tooltipBox = l('CMTooltipBorder');
|
||||||
|
|
||||||
@@ -219,7 +222,7 @@ export function SugarLump() {
|
|||||||
* This function adds extra info to the Grimoire tooltips
|
* This function adds extra info to the Grimoire tooltips
|
||||||
* It adds to the additional information to l('CMTooltipArea')
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
*/
|
*/
|
||||||
export function Grimoire() {
|
function Grimoire() {
|
||||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||||
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
||||||
|
|
||||||
@@ -289,7 +292,7 @@ export function Grimoire() {
|
|||||||
* This function adds extra info to the Garden plots tooltips
|
* This function adds extra info to the Garden plots tooltips
|
||||||
* It adds to the additional information to l('CMTooltipArea')
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
*/
|
*/
|
||||||
export function GardenPlots() {
|
function GardenPlots() {
|
||||||
const minigame = Game.Objects.Farm.minigame;
|
const minigame = Game.Objects.Farm.minigame;
|
||||||
if (
|
if (
|
||||||
CMOptions.TooltipPlots &&
|
CMOptions.TooltipPlots &&
|
||||||
@@ -341,7 +344,7 @@ export function GardenPlots() {
|
|||||||
* It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip()
|
* 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')
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
*/
|
*/
|
||||||
export function HarvestAll() {
|
function HarvestAll() {
|
||||||
const minigame = Game.Objects.Farm.minigame;
|
const minigame = Game.Objects.Farm.minigame;
|
||||||
if (CMOptions.TooltipLump) {
|
if (CMOptions.TooltipLump) {
|
||||||
l('CMTooltipBorder').appendChild(
|
l('CMTooltipBorder').appendChild(
|
||||||
@@ -391,10 +394,28 @@ export function HarvestAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function updates the warnings section of the building and upgrade tooltips
|
* This function adds extra info to the wrinkler button tooltip
|
||||||
* It is called by CM.Disp.UpdateTooltip()
|
* It adds to the additional information to l('CMTooltipArea')
|
||||||
*/
|
*/
|
||||||
export function Warnings() {
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates the warnings section of the building and upgrade tooltips
|
||||||
|
*/
|
||||||
|
function Warnings() {
|
||||||
if (TooltipType === 'b' || TooltipType === 'u') {
|
if (TooltipType === 'b' || TooltipType === 'u') {
|
||||||
if (document.getElementById('CMDispTooltipWarningParent') === null) {
|
if (document.getElementById('CMDispTooltipWarningParent') === null) {
|
||||||
l('tooltipAnchor').appendChild(Create.TooltipCreateWarningSection());
|
l('tooltipAnchor').appendChild(Create.TooltipCreateWarningSection());
|
||||||
@@ -517,3 +538,38 @@ export function Warnings() {
|
|||||||
l('CMDispTooltipWarningParent').remove();
|
l('CMDispTooltipWarningParent').remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates the sections of the tooltips created by CookieMonster
|
||||||
|
*/
|
||||||
|
export default function UpdateTooltips() {
|
||||||
|
CopyData();
|
||||||
|
if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) {
|
||||||
|
l('CMTooltipArea').innerHTML = '';
|
||||||
|
const tooltipBox = Create.TooltipCreateTooltipBox();
|
||||||
|
l('CMTooltipArea').appendChild(tooltipBox);
|
||||||
|
|
||||||
|
if (TooltipType === 'b') {
|
||||||
|
Building();
|
||||||
|
} else if (TooltipType === 'u') {
|
||||||
|
Upgrade();
|
||||||
|
} else if (TooltipType === 's') {
|
||||||
|
SugarLump();
|
||||||
|
} else if (TooltipType === 'g') {
|
||||||
|
Grimoire();
|
||||||
|
} else if (TooltipType === 'p') {
|
||||||
|
GardenPlots();
|
||||||
|
} else if (TooltipType === 'ha') {
|
||||||
|
HarvestAll();
|
||||||
|
} else if (TooltipType === 'wb') {
|
||||||
|
l('CMTooltipArea').innerHTML = '';
|
||||||
|
WrinklerButton();
|
||||||
|
}
|
||||||
|
Warnings();
|
||||||
|
} else if (l('CMTooltipArea') === null) {
|
||||||
|
// Remove warnings if its a basic tooltip
|
||||||
|
if (l('CMDispTooltipWarningParent') !== null) {
|
||||||
|
l('CMDispTooltipWarningParent').remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user