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:
@@ -7,11 +7,14 @@ import { LastGardenNextStep } from '../VariablesAndData';
|
||||
* This function checks if a garden tick has happened
|
||||
*/
|
||||
export default function CheckGardenTick() {
|
||||
if (Game.Objects.Farm.minigameLoaded && LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep) {
|
||||
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
|
||||
Flash(3, 'GardFlash');
|
||||
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume');
|
||||
}
|
||||
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
||||
}
|
||||
if (
|
||||
Game.Objects.Farm.minigameLoaded &&
|
||||
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
|
||||
) {
|
||||
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
|
||||
Flash(3, 'GardFlash');
|
||||
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume');
|
||||
}
|
||||
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheSpawnedGoldenShimmer,
|
||||
CacheGoldenShimmersByID,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
@@ -7,7 +10,11 @@ import Notification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CurrSpawnedGoldenCookieState, LastGoldenCookieState, LastSpawnedGoldenCookieState } from '../VariablesAndData';
|
||||
import {
|
||||
CurrSpawnedGoldenCookieState,
|
||||
LastGoldenCookieState,
|
||||
LastSpawnedGoldenCookieState,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* Auxilirary function that finds all currently spawned shimmers.
|
||||
@@ -15,15 +22,15 @@ import { CurrSpawnedGoldenCookieState, LastGoldenCookieState, LastSpawnedGoldenC
|
||||
* It is called by CM.CM.Main.CheckGoldenCookie
|
||||
*/
|
||||
function FindShimmer() {
|
||||
CurrSpawnedGoldenCookieState = 0;
|
||||
CacheGoldenShimmersByID = {};
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
|
||||
CacheSpawnedGoldenShimmer = Game.shimmers[i];
|
||||
CurrSpawnedGoldenCookieState += 1;
|
||||
}
|
||||
}
|
||||
CurrSpawnedGoldenCookieState = 0;
|
||||
CacheGoldenShimmersByID = {};
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
|
||||
CacheSpawnedGoldenShimmer = Game.shimmers[i];
|
||||
CurrSpawnedGoldenCookieState += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,36 +38,43 @@ function FindShimmer() {
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckGoldenCookie() {
|
||||
FindShimmer();
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
|
||||
GCTimers[i].parentNode.removeChild(GCTimers[i]);
|
||||
delete GCTimers[i];
|
||||
}
|
||||
}
|
||||
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
|
||||
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||
if (LastGoldenCookieState) {
|
||||
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
||||
Flash(3, 'GCFlash');
|
||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
|
||||
Notification('GCNotification', 'Golden Cookie Spawned', 'A Golden Cookie has spawned. Click it now!');
|
||||
}
|
||||
FindShimmer();
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
|
||||
GCTimers[i].parentNode.removeChild(GCTimers[i]);
|
||||
delete GCTimers[i];
|
||||
}
|
||||
}
|
||||
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
|
||||
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||
if (LastGoldenCookieState) {
|
||||
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
||||
Flash(3, 'GCFlash');
|
||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
|
||||
Notification(
|
||||
'GCNotification',
|
||||
'Golden Cookie Spawned',
|
||||
'A Golden Cookie has spawned. Click it now!',
|
||||
);
|
||||
}
|
||||
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
|
||||
CreateGCTimer(Game.shimmers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateFavicon();
|
||||
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
|
||||
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
|
||||
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
|
||||
GCTimers[i].style.transform = CacheGoldenShimmersByID[i].l.style.transform;
|
||||
GCTimers[i].textContent = Math.ceil(CacheGoldenShimmersByID[i].life / Game.fps);
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
|
||||
CreateGCTimer(Game.shimmers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateFavicon();
|
||||
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
|
||||
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
|
||||
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
|
||||
GCTimers[i].style.transform =
|
||||
CacheGoldenShimmersByID[i].l.style.transform;
|
||||
GCTimers[i].textContent = Math.ceil(
|
||||
CacheGoldenShimmersByID[i].life / Game.fps,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,21 @@ import { LastMagicBarFull } from '../VariablesAndData';
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckMagicMeter() {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded && CMOptions.GrimoireBar === 1) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
||||
else if (!LastMagicBarFull) {
|
||||
LastMagicBarFull = true;
|
||||
Flash(3, 'MagicFlash');
|
||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
|
||||
Notification('MagicNotification', 'Magic Meter full', 'Your Magic Meter is full. Cast a spell!');
|
||||
}
|
||||
}
|
||||
if (
|
||||
Game.Objects['Wizard tower'].minigameLoaded &&
|
||||
CMOptions.GrimoireBar === 1
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
||||
else if (!LastMagicBarFull) {
|
||||
LastMagicBarFull = true;
|
||||
Flash(3, 'MagicFlash');
|
||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
|
||||
Notification(
|
||||
'MagicNotification',
|
||||
'Magic Meter full',
|
||||
'Your Magic Meter is full. Cast a spell!',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,16 +11,20 @@ import { LastSeasonPopupState } from '../VariablesAndData';
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckSeasonPopup() {
|
||||
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
|
||||
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
|
||||
CacheSeasonPopShimmer = Game.shimmers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
Flash(3, 'SeaFlash');
|
||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
|
||||
Notification('SeaNotification', 'Reindeer sighted!', 'A Reindeer has spawned. Click it now!');
|
||||
}
|
||||
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
|
||||
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
|
||||
CacheSeasonPopShimmer = Game.shimmers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
Flash(3, 'SeaFlash');
|
||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
|
||||
Notification(
|
||||
'SeaNotification',
|
||||
'Reindeer sighted!',
|
||||
'A Reindeer has spawned. Click it now!',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,20 @@ import { LastTickerFortuneState } from '../VariablesAndData';
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckTickerFortune() {
|
||||
if (LastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
|
||||
LastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune');
|
||||
if (LastTickerFortuneState) {
|
||||
Flash(3, 'FortuneFlash');
|
||||
PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
|
||||
Notification('FortuneNotification', 'Fortune Cookie found', 'A Fortune Cookie has appeared on the Ticker.');
|
||||
}
|
||||
}
|
||||
if (
|
||||
LastTickerFortuneState !==
|
||||
(Game.TickerEffect && Game.TickerEffect.type === 'fortune')
|
||||
) {
|
||||
LastTickerFortuneState =
|
||||
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
|
||||
if (LastTickerFortuneState) {
|
||||
Flash(3, 'FortuneFlash');
|
||||
PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
|
||||
Notification(
|
||||
'FortuneNotification',
|
||||
'Fortune Cookie found',
|
||||
'A Fortune Cookie has appeared on the Ticker.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,30 +9,55 @@ import { LastWrinklerCount } from '../VariablesAndData';
|
||||
* It is called by CM.Main.Loop
|
||||
*/
|
||||
export default function CheckWrinklerCount() {
|
||||
if (Game.elderWrath > 0) {
|
||||
let CurrentWrinklers = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
|
||||
}
|
||||
if (CurrentWrinklers > LastWrinklerCount) {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxFlash) {
|
||||
Flash(3, 'WrinklerMaxFlash');
|
||||
} else {
|
||||
Flash(3, 'WrinklerFlash');
|
||||
}
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxSound) {
|
||||
PlaySound(CMOptions.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
|
||||
} else {
|
||||
PlaySound(CMOptions.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
|
||||
}
|
||||
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxNotification) {
|
||||
Notification('WrinklerMaxNotification', 'Maximum Wrinklers Reached', 'You have reached your maximum ammount of wrinklers');
|
||||
} else {
|
||||
Notification('WrinklerNotification', 'A Wrinkler appeared', 'A new wrinkler has appeared');
|
||||
}
|
||||
} else {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
}
|
||||
}
|
||||
if (Game.elderWrath > 0) {
|
||||
let CurrentWrinklers = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
|
||||
}
|
||||
if (CurrentWrinklers > LastWrinklerCount) {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxFlash
|
||||
) {
|
||||
Flash(3, 'WrinklerMaxFlash');
|
||||
} else {
|
||||
Flash(3, 'WrinklerFlash');
|
||||
}
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxSound
|
||||
) {
|
||||
PlaySound(
|
||||
CMOptions.WrinklerMaxSoundURL,
|
||||
'WrinklerMaxSound',
|
||||
'WrinklerMaxVolume',
|
||||
);
|
||||
} else {
|
||||
PlaySound(
|
||||
CMOptions.WrinklerSoundURL,
|
||||
'WrinklerSound',
|
||||
'WrinklerVolume',
|
||||
);
|
||||
}
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxNotification
|
||||
) {
|
||||
Notification(
|
||||
'WrinklerMaxNotification',
|
||||
'Maximum Wrinklers Reached',
|
||||
'You have reached your maximum ammount of wrinklers',
|
||||
);
|
||||
} else {
|
||||
Notification(
|
||||
'WrinklerNotification',
|
||||
'A Wrinkler appeared',
|
||||
'A new wrinkler has appeared',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,39 +24,53 @@ import AddWrinklerAreaDetect from './WrinklerArea/AddDetectArea';
|
||||
* Initialization loop of Cookie Monster
|
||||
*/
|
||||
export default function InitializeCookieMonster() {
|
||||
InitData();
|
||||
CacheStatsCookies();
|
||||
InitCache();
|
||||
InitData();
|
||||
CacheStatsCookies();
|
||||
InitCache();
|
||||
|
||||
// Stored to check if we need to re-initiliaze data
|
||||
LastModCount = Object.keys(Game.mods).length;
|
||||
// Stored to check if we need to re-initiliaze data
|
||||
LastModCount = Object.keys(Game.mods).length;
|
||||
|
||||
// Creating visual elements
|
||||
CreateCssArea();
|
||||
CreateBotBar();
|
||||
CreateTimerBar();
|
||||
CreateUpgradeBar();
|
||||
CreateWhiteScreen();
|
||||
CreateFavicon();
|
||||
for (const i of Object.keys(TooltipText)) {
|
||||
CreateSimpleTooltip(TooltipText[i][0], TooltipText[i][1], TooltipText[i][2]);
|
||||
}
|
||||
CreateWrinklerButtons();
|
||||
UpdateBuildingUpgradeStyle();
|
||||
// Creating visual elements
|
||||
CreateCssArea();
|
||||
CreateBotBar();
|
||||
CreateTimerBar();
|
||||
CreateUpgradeBar();
|
||||
CreateWhiteScreen();
|
||||
CreateFavicon();
|
||||
for (const i of Object.keys(TooltipText)) {
|
||||
CreateSimpleTooltip(
|
||||
TooltipText[i][0],
|
||||
TooltipText[i][1],
|
||||
TooltipText[i][2],
|
||||
);
|
||||
}
|
||||
CreateWrinklerButtons();
|
||||
UpdateBuildingUpgradeStyle();
|
||||
|
||||
ReplaceTooltips();
|
||||
AddWrinklerAreaDetect();
|
||||
ReplaceTooltips();
|
||||
AddWrinklerAreaDetect();
|
||||
|
||||
// Replace native functions
|
||||
ReplaceNative();
|
||||
ReplaceNativeGrimoire();
|
||||
Game.CalculateGains();
|
||||
// Replace native functions
|
||||
ReplaceNative();
|
||||
ReplaceNativeGrimoire();
|
||||
Game.CalculateGains();
|
||||
|
||||
LoadConfig(); // Must be after all things are created!
|
||||
CMLastAscendState = Game.OnAscend;
|
||||
LoadConfig(); // Must be after all things are created!
|
||||
CMLastAscendState = Game.OnAscend;
|
||||
|
||||
if (Game.prefs.popups) Game.Popup(`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`);
|
||||
else Game.Notify(`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`, '', '', 1, 1);
|
||||
if (Game.prefs.popups)
|
||||
Game.Popup(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`,
|
||||
);
|
||||
else
|
||||
Game.Notify(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`,
|
||||
'',
|
||||
'',
|
||||
1,
|
||||
1,
|
||||
);
|
||||
|
||||
Game.Win('Third-party');
|
||||
Game.Win('Third-party');
|
||||
}
|
||||
|
||||
105
src/Main/Loop.js
105
src/Main/Loop.js
@@ -3,13 +3,20 @@ import LoopCache from '../Cache/CacheLoop';
|
||||
import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';
|
||||
import CacheSellAllForChoEgg from '../Cache/CPS/SellChoEgg';
|
||||
import CacheDragonCost from '../Cache/Dragon/Dragon';
|
||||
import { CacheBuildingsPrices, CacheIncome } from '../Cache/PriceAndIncome/PriceAndIncome';
|
||||
import {
|
||||
CacheBuildingsPrices,
|
||||
CacheIncome,
|
||||
} from '../Cache/PriceAndIncome/PriceAndIncome';
|
||||
import { CacheChain } from '../Cache/Stats/ChainCookies';
|
||||
import CacheAllMissingUpgrades from '../Cache/Stats/MissingUpgrades';
|
||||
import CacheSeasonSpec from '../Cache/Stats/Reindeer';
|
||||
import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from '../Cache/Stats/Stats';
|
||||
import {
|
||||
CacheDoRemakeBuildPrices, CacheHadBuildAura,
|
||||
CacheGoldenAndWrathCookiesMults,
|
||||
CacheStatsCookies,
|
||||
} from '../Cache/Stats/Stats';
|
||||
import {
|
||||
CacheDoRemakeBuildPrices,
|
||||
CacheHadBuildAura,
|
||||
} from '../Cache/VariablesAndData';
|
||||
import UpdateAscendState from '../Disp/HelperFunctions/UpdateAscendState';
|
||||
import { LastAscendState } from '../Disp/VariablesAndData';
|
||||
@@ -28,58 +35,58 @@ import { LastModCount } from './VariablesAndData';
|
||||
* CM.init registers it to the "logic" hook provided by the modding api
|
||||
*/
|
||||
export default function CMLoop() {
|
||||
if (LastAscendState !== Game.OnAscend) {
|
||||
LastAscendState = Game.OnAscend;
|
||||
UpdateAscendState();
|
||||
}
|
||||
if (!Game.OnAscend && Game.AscendTimer === 0) {
|
||||
// Check if any other mods have been loaded
|
||||
if (LastModCount !== Object.keys(Game.mods).length) {
|
||||
InitData();
|
||||
InitCache();
|
||||
LastModCount = Object.keys(Game.mods).length;
|
||||
}
|
||||
if (LastAscendState !== Game.OnAscend) {
|
||||
LastAscendState = Game.OnAscend;
|
||||
UpdateAscendState();
|
||||
}
|
||||
if (!Game.OnAscend && Game.AscendTimer === 0) {
|
||||
// Check if any other mods have been loaded
|
||||
if (LastModCount !== Object.keys(Game.mods).length) {
|
||||
InitData();
|
||||
InitCache();
|
||||
LastModCount = Object.keys(Game.mods).length;
|
||||
}
|
||||
|
||||
// CM.Sim.DoSims is set whenever CPS has changed
|
||||
if (SimDoSims) {
|
||||
CacheIncome();
|
||||
// CM.Sim.DoSims is set whenever CPS has changed
|
||||
if (SimDoSims) {
|
||||
CacheIncome();
|
||||
|
||||
CacheNoGoldSwitchCPS(); // Needed first
|
||||
CacheGoldenAndWrathCookiesMults();
|
||||
CacheStatsCookies();
|
||||
CacheAllMissingUpgrades();
|
||||
CacheChain();
|
||||
CacheDragonCost();
|
||||
CacheNoGoldSwitchCPS(); // Needed first
|
||||
CacheGoldenAndWrathCookiesMults();
|
||||
CacheStatsCookies();
|
||||
CacheAllMissingUpgrades();
|
||||
CacheChain();
|
||||
CacheDragonCost();
|
||||
|
||||
CacheSeasonSpec();
|
||||
CacheSellAllForChoEgg();
|
||||
CacheSeasonSpec();
|
||||
CacheSellAllForChoEgg();
|
||||
|
||||
SimDoSims = 0;
|
||||
}
|
||||
SimDoSims = 0;
|
||||
}
|
||||
|
||||
// Check for aura change to recalculate buildings prices
|
||||
const hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
|
||||
if (!CacheHadBuildAura && hasBuildAura) {
|
||||
CacheHadBuildAura = true;
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
} else if (CacheHadBuildAura && !hasBuildAura) {
|
||||
CacheHadBuildAura = false;
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
}
|
||||
// Check for aura change to recalculate buildings prices
|
||||
const hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
|
||||
if (!CacheHadBuildAura && hasBuildAura) {
|
||||
CacheHadBuildAura = true;
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
} else if (CacheHadBuildAura && !hasBuildAura) {
|
||||
CacheHadBuildAura = false;
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
}
|
||||
|
||||
if (CacheDoRemakeBuildPrices) {
|
||||
CacheBuildingsPrices();
|
||||
CacheDoRemakeBuildPrices = 0;
|
||||
}
|
||||
if (CacheDoRemakeBuildPrices) {
|
||||
CacheBuildingsPrices();
|
||||
CacheDoRemakeBuildPrices = 0;
|
||||
}
|
||||
|
||||
LoopCache();
|
||||
LoopCache();
|
||||
|
||||
// Check all changing minigames and game-states
|
||||
CheckGoldenCookie();
|
||||
CheckTickerFortune();
|
||||
CheckSeasonPopup();
|
||||
CheckGardenTick();
|
||||
CheckMagicMeter();
|
||||
CheckWrinklerCount();
|
||||
}
|
||||
// Check all changing minigames and game-states
|
||||
CheckGoldenCookie();
|
||||
CheckTickerFortune();
|
||||
CheckSeasonPopup();
|
||||
CheckGardenTick();
|
||||
CheckMagicMeter();
|
||||
CheckWrinklerCount();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting'
|
||||
|
||||
import CalculateGrimoireRefillTime from '../../Disp/HelperFunctions/CalculateGrimoireRefillTime';
|
||||
import {
|
||||
BackupGrimoireDraw, BackupGrimoireLaunch, BackupGrimoireLaunchMod, HasReplaceNativeGrimoireDraw, HasReplaceNativeGrimoireLaunch,
|
||||
BackupGrimoireDraw,
|
||||
BackupGrimoireLaunch,
|
||||
BackupGrimoireLaunchMod,
|
||||
HasReplaceNativeGrimoireDraw,
|
||||
HasReplaceNativeGrimoireLaunch,
|
||||
} from '../VariablesAndData';
|
||||
import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
|
||||
@@ -12,42 +16,59 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
* This function fixes replaces the .draw function of the Grimoire
|
||||
*/
|
||||
function ReplaceNativeGrimoireDraw() {
|
||||
if (!HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireDraw = minigame.draw;
|
||||
Game.Objects['Wizard tower'].minigame.draw = function () {
|
||||
BackupGrimoireDraw();
|
||||
if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
|
||||
minigame.magicBarTextL.innerHTML += ` (${FormatTime(CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM))})`;
|
||||
}
|
||||
};
|
||||
HasReplaceNativeGrimoireDraw = true;
|
||||
}
|
||||
if (
|
||||
!HasReplaceNativeGrimoireDraw &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireDraw = minigame.draw;
|
||||
Game.Objects['Wizard tower'].minigame.draw = function () {
|
||||
BackupGrimoireDraw();
|
||||
if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
|
||||
minigame.magicBarTextL.innerHTML += ` (${FormatTime(
|
||||
CalculateGrimoireRefillTime(
|
||||
minigame.magic,
|
||||
minigame.magicM,
|
||||
minigame.magicM,
|
||||
),
|
||||
)})`;
|
||||
}
|
||||
};
|
||||
HasReplaceNativeGrimoireDraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function fixes replaces the .launch function of the Grimoire
|
||||
*/
|
||||
function ReplaceNativeGrimoireLaunch() {
|
||||
if (!HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireLaunch = minigame.launch;
|
||||
BackupGrimoireLaunchMod = new Function(`return ${minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame')}`);
|
||||
Game.Objects['Wizard tower'].minigame.launch = function () {
|
||||
BackupGrimoireLaunchMod();
|
||||
ReplaceTooltipGrimoire();
|
||||
HasReplaceNativeGrimoireDraw = false;
|
||||
ReplaceNativeGrimoireDraw();
|
||||
if (
|
||||
!HasReplaceNativeGrimoireLaunch &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireLaunch = minigame.launch;
|
||||
BackupGrimoireLaunchMod = new Function(
|
||||
`return ${minigame.launch
|
||||
.toString()
|
||||
.split('=this')
|
||||
.join("= Game.Objects['Wizard tower'].minigame")}`,
|
||||
);
|
||||
Game.Objects['Wizard tower'].minigame.launch = function () {
|
||||
BackupGrimoireLaunchMod();
|
||||
ReplaceTooltipGrimoire();
|
||||
HasReplaceNativeGrimoireDraw = false;
|
||||
ReplaceNativeGrimoireDraw();
|
||||
|
||||
HasReplaceNativeGrimoireLaunch = true;
|
||||
};
|
||||
}
|
||||
HasReplaceNativeGrimoireLaunch = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function fixes replaces the Launch and Draw functions of the Grimoire
|
||||
*/
|
||||
export default function ReplaceNativeGrimoire() {
|
||||
ReplaceNativeGrimoireLaunch();
|
||||
ReplaceNativeGrimoireDraw();
|
||||
ReplaceNativeGrimoireLaunch();
|
||||
ReplaceNativeGrimoireDraw();
|
||||
}
|
||||
|
||||
@@ -5,16 +5,22 @@ import { TooltipGrimoireBackup } from '../VariablesAndData';
|
||||
* This function replaces the original .onmouseover functions of the Grimoire minigame
|
||||
*/
|
||||
export default function ReplaceTooltipGrimoire() {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) {
|
||||
if (l(`grimoireSpell${i}`).onmouseover !== null) {
|
||||
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
|
||||
l(`grimoireSpell${i}`).onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(this, function () { return CreateTooltip('g', `${i}`); }, 'this');
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) {
|
||||
if (l(`grimoireSpell${i}`).onmouseover !== null) {
|
||||
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
|
||||
l(`grimoireSpell${i}`).onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('g', `${i}`);
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,20 +7,24 @@ import { TooltipUpgradeBackup } from '../VariablesAndData';
|
||||
* It is called by Game.RebuildUpgrades() through CM.Main.ReplaceNative() and is therefore not permanent like the other ReplaceTooltip functions
|
||||
*/
|
||||
export default function ReplaceTooltipUpgrade() {
|
||||
TooltipUpgradeBackup = [];
|
||||
for (const i of Object.keys(Game.UpgradesInStore)) {
|
||||
if (l(`upgrade${i}`).onmouseover !== null) {
|
||||
TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover;
|
||||
l(`upgrade${i}`).onmouseover = function () {
|
||||
if (!Game.mouseDown) {
|
||||
Game.setOnCrate(this);
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(this, function () {
|
||||
return CreateTooltip('u', `${i}`);
|
||||
}, 'store');
|
||||
Game.tooltip.wobble();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
TooltipUpgradeBackup = [];
|
||||
for (const i of Object.keys(Game.UpgradesInStore)) {
|
||||
if (l(`upgrade${i}`).onmouseover !== null) {
|
||||
TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover;
|
||||
l(`upgrade${i}`).onmouseover = function () {
|
||||
if (!Game.mouseDown) {
|
||||
Game.setOnCrate(this);
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('u', `${i}`);
|
||||
},
|
||||
'store',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
import { CreateTooltip } from '../../Disp/Tooltips/Tooltip';
|
||||
import {
|
||||
LoadMinigames, TooltipBuildBackup, TooltipLumpBackup,
|
||||
LoadMinigames,
|
||||
TooltipBuildBackup,
|
||||
TooltipLumpBackup,
|
||||
} from '../VariablesAndData';
|
||||
import ReplaceNativeGrimoire from './NativeGrimoire';
|
||||
import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
@@ -12,65 +14,93 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
* This function replaces the original .onmouseover functions of buildings
|
||||
*/
|
||||
function ReplaceTooltipBuild() {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
const me = Game.Objects[i];
|
||||
if (l(`product${me.id}`).onmouseover !== null) {
|
||||
TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
|
||||
l(`product${me.id}`).onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(this, function () { return CreateTooltip('b', `${i}`); }, 'store');
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
const me = Game.Objects[i];
|
||||
if (l(`product${me.id}`).onmouseover !== null) {
|
||||
TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
|
||||
l(`product${me.id}`).onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('b', `${i}`);
|
||||
},
|
||||
'store',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function replaces the original .onmouseover functions of sugar lumps
|
||||
*/
|
||||
function ReplaceTooltipLump() {
|
||||
if (Game.canLumps()) {
|
||||
TooltipLumpBackup = l('lumps').onmouseover;
|
||||
l('lumps').onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(this, function () { return CreateTooltip('s', 'Lump'); }, 'this');
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
if (Game.canLumps()) {
|
||||
TooltipLumpBackup = l('lumps').onmouseover;
|
||||
l('lumps').onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('s', 'Lump');
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function replaces the original .onmouseover functions of all garden plants
|
||||
*/
|
||||
function ReplaceTooltipGarden() {
|
||||
if (Game.Objects.Farm.minigameLoaded) {
|
||||
l('gardenTool-1').onmouseover = function () { Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function () { return CreateTooltip('ha', 'HarvestAllButton'); }, 'this'); Game.tooltip.wobble(); };
|
||||
Array.from(l('gardenPlot').children).forEach((child) => {
|
||||
const coords = child.id.slice(-3);
|
||||
child.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(this, function () { return CreateTooltip('p', [`${coords[0]}`, `${coords[2]}`]); }, 'this');
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
});
|
||||
}
|
||||
if (Game.Objects.Farm.minigameLoaded) {
|
||||
l('gardenTool-1').onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('ha', 'HarvestAllButton');
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
Array.from(l('gardenPlot').children).forEach((child) => {
|
||||
const coords = child.id.slice(-3);
|
||||
child.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return CreateTooltip('p', [`${coords[0]}`, `${coords[2]}`]);
|
||||
},
|
||||
'this',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function call all functions that replace Game-tooltips with Cookie Monster enhanced tooltips
|
||||
*/
|
||||
export default function ReplaceTooltips() {
|
||||
ReplaceTooltipBuild();
|
||||
ReplaceTooltipLump();
|
||||
ReplaceTooltipBuild();
|
||||
ReplaceTooltipLump();
|
||||
|
||||
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
|
||||
// they were not loaded initially
|
||||
LoadMinigames = Game.LoadMinigames;
|
||||
Game.LoadMinigames = function () {
|
||||
LoadMinigames();
|
||||
ReplaceTooltipGarden();
|
||||
ReplaceTooltipGrimoire();
|
||||
ReplaceNativeGrimoire();
|
||||
};
|
||||
Game.LoadMinigames();
|
||||
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
|
||||
// they were not loaded initially
|
||||
LoadMinigames = Game.LoadMinigames;
|
||||
Game.LoadMinigames = function () {
|
||||
LoadMinigames();
|
||||
ReplaceTooltipGarden();
|
||||
ReplaceTooltipGrimoire();
|
||||
ReplaceNativeGrimoire();
|
||||
};
|
||||
Game.LoadMinigames();
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
* before execution of their actual function
|
||||
*/
|
||||
export default function FixMouseY(target) {
|
||||
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) {
|
||||
const timerBarHeight = parseInt(l('CMTimerBar').style.height, 10);
|
||||
Game.mouseY -= timerBarHeight;
|
||||
target();
|
||||
Game.mouseY += timerBarHeight;
|
||||
} else {
|
||||
target();
|
||||
}
|
||||
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) {
|
||||
const timerBarHeight = parseInt(l('CMTimerBar').style.height, 10);
|
||||
Game.mouseY -= timerBarHeight;
|
||||
target();
|
||||
Game.mouseY += timerBarHeight;
|
||||
} else {
|
||||
target();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import jscolor from '@eastdesire/jscolor';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { Beautify as CMBeautify, FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify as CMBeautify,
|
||||
FormatTime,
|
||||
} from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { AddAuraInfo, AddDragonLevelUpTooltip } from '../../Disp/Dragon/Dragon';
|
||||
import AddMenu from '../../Disp/MenuSections/AddMenus';
|
||||
import UpdateTitle from '../../Disp/TabTitle/TabTitle';
|
||||
import ReplaceAscendTooltip from '../../Disp/Tooltips/AscendButton';
|
||||
import UpdateTooltipLocation from '../../Disp/Tooltips/PositionLocation';
|
||||
import { CMSayTime, Title } from '../../Disp/VariablesAndData';
|
||||
import { SimDateAges, SimDateCentury, SimDoSims } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
SimDateAges,
|
||||
SimDateCentury,
|
||||
SimDoSims,
|
||||
} from '../../Sim/VariablesAndData';
|
||||
import ReplaceTooltipUpgrade from '../ReplaceGameElements/TooltipUpgrades';
|
||||
import { BackupFunctions } from '../VariablesAndData';
|
||||
import FixMouseY from './FixMouse';
|
||||
@@ -17,110 +24,133 @@ import FixMouseY from './FixMouse';
|
||||
* This function replaces certain native (from the base-game) functions
|
||||
*/
|
||||
export default function ReplaceNative() {
|
||||
// eslint-disable-next-line no-undef
|
||||
BackupFunctions.Beautify = Beautify;
|
||||
// eslint-disable-next-line no-undef
|
||||
Beautify = CMBeautify;
|
||||
// eslint-disable-next-line no-undef
|
||||
BackupFunctions.Beautify = Beautify;
|
||||
// eslint-disable-next-line no-undef
|
||||
Beautify = CMBeautify;
|
||||
|
||||
BackupFunctions.CalculateGains = Game.CalculateGains;
|
||||
Game.CalculateGains = function () {
|
||||
BackupFunctions.CalculateGains();
|
||||
SimDoSims = 1;
|
||||
SimDateAges = Date.now();
|
||||
SimDateCentury = Date.now();
|
||||
};
|
||||
BackupFunctions.CalculateGains = Game.CalculateGains;
|
||||
Game.CalculateGains = function () {
|
||||
BackupFunctions.CalculateGains();
|
||||
SimDoSims = 1;
|
||||
SimDateAges = Date.now();
|
||||
SimDateCentury = Date.now();
|
||||
};
|
||||
|
||||
BackupFunctions.tooltip = {};
|
||||
BackupFunctions.tooltip.draw = Game.tooltip.draw;
|
||||
BackupFunctions.tooltip.drawMod = new Function(`return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`)();
|
||||
Game.tooltip.draw = function (from, text, origin) {
|
||||
BackupFunctions.tooltip.drawMod(from, text, origin);
|
||||
};
|
||||
BackupFunctions.tooltip = {};
|
||||
BackupFunctions.tooltip.draw = Game.tooltip.draw;
|
||||
BackupFunctions.tooltip.drawMod = new Function(
|
||||
`return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`,
|
||||
)();
|
||||
Game.tooltip.draw = function (from, text, origin) {
|
||||
BackupFunctions.tooltip.drawMod(from, text, origin);
|
||||
};
|
||||
|
||||
BackupFunctions.tooltip.update = Game.tooltip.update;
|
||||
BackupFunctions.tooltip.updateMod = new Function(`return ${Game.tooltip.update.toString().split('this.').join('Game.tooltip.')}`)();
|
||||
Game.tooltip.update = function () {
|
||||
BackupFunctions.tooltip.updateMod();
|
||||
UpdateTooltipLocation();
|
||||
};
|
||||
BackupFunctions.tooltip.update = Game.tooltip.update;
|
||||
BackupFunctions.tooltip.updateMod = new Function(
|
||||
`return ${Game.tooltip.update
|
||||
.toString()
|
||||
.split('this.')
|
||||
.join('Game.tooltip.')}`,
|
||||
)();
|
||||
Game.tooltip.update = function () {
|
||||
BackupFunctions.tooltip.updateMod();
|
||||
UpdateTooltipLocation();
|
||||
};
|
||||
|
||||
BackupFunctions.UpdateWrinklers = Game.UpdateWrinklers;
|
||||
Game.UpdateWrinklers = function () {
|
||||
FixMouseY(BackupFunctions.UpdateWrinklers);
|
||||
};
|
||||
BackupFunctions.UpdateWrinklers = Game.UpdateWrinklers;
|
||||
Game.UpdateWrinklers = function () {
|
||||
FixMouseY(BackupFunctions.UpdateWrinklers);
|
||||
};
|
||||
|
||||
BackupFunctions.UpdateSpecial = Game.UpdateSpecial;
|
||||
Game.UpdateSpecial = function () {
|
||||
FixMouseY(BackupFunctions.UpdateSpecial);
|
||||
};
|
||||
BackupFunctions.UpdateSpecial = Game.UpdateSpecial;
|
||||
Game.UpdateSpecial = function () {
|
||||
FixMouseY(BackupFunctions.UpdateSpecial);
|
||||
};
|
||||
|
||||
// Assumes newer browsers
|
||||
l('bigCookie').removeEventListener('click', Game.ClickCookie, false);
|
||||
l('bigCookie').addEventListener('click', function () { FixMouseY(Game.ClickCookie); }, false);
|
||||
// Assumes newer browsers
|
||||
l('bigCookie').removeEventListener('click', Game.ClickCookie, false);
|
||||
l('bigCookie').addEventListener(
|
||||
'click',
|
||||
function () {
|
||||
FixMouseY(Game.ClickCookie);
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
BackupFunctions.RebuildUpgrades = Game.RebuildUpgrades;
|
||||
Game.RebuildUpgrades = function () {
|
||||
BackupFunctions.RebuildUpgrades();
|
||||
ReplaceTooltipUpgrade();
|
||||
Game.CalculateGains();
|
||||
};
|
||||
BackupFunctions.RebuildUpgrades = Game.RebuildUpgrades;
|
||||
Game.RebuildUpgrades = function () {
|
||||
BackupFunctions.RebuildUpgrades();
|
||||
ReplaceTooltipUpgrade();
|
||||
Game.CalculateGains();
|
||||
};
|
||||
|
||||
BackupFunctions.ClickProduct = Game.ClickProduct;
|
||||
/**
|
||||
* This function adds a check to the purchase of a building to allow BulkBuyBlock to work.
|
||||
* If the options is 1 (on) bulkPrice is under cookies you can't buy the building.
|
||||
*/
|
||||
Game.ClickProduct = function (what) {
|
||||
if (!CMOptions.BulkBuyBlock || (Game.ObjectsById[what].bulkPrice < Game.cookies || Game.buyMode === -1)) {
|
||||
BackupFunctions.ClickProduct(what);
|
||||
}
|
||||
};
|
||||
BackupFunctions.ClickProduct = Game.ClickProduct;
|
||||
/**
|
||||
* This function adds a check to the purchase of a building to allow BulkBuyBlock to work.
|
||||
* If the options is 1 (on) bulkPrice is under cookies you can't buy the building.
|
||||
*/
|
||||
Game.ClickProduct = function (what) {
|
||||
if (
|
||||
!CMOptions.BulkBuyBlock ||
|
||||
Game.ObjectsById[what].bulkPrice < Game.cookies ||
|
||||
Game.buyMode === -1
|
||||
) {
|
||||
BackupFunctions.ClickProduct(what);
|
||||
}
|
||||
};
|
||||
|
||||
BackupFunctions.DescribeDragonAura = Game.DescribeDragonAura;
|
||||
/**
|
||||
* This function adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
|
||||
* This adds information about CPS differences and costs to the aura choosing interface
|
||||
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||
*/
|
||||
Game.DescribeDragonAura = function (aura) {
|
||||
BackupFunctions.DescribeDragonAura(aura);
|
||||
AddAuraInfo(aura);
|
||||
};
|
||||
BackupFunctions.DescribeDragonAura = Game.DescribeDragonAura;
|
||||
/**
|
||||
* This function adds the function CM.Disp.AddAuraInfo() to Game.DescribeDragonAura()
|
||||
* This adds information about CPS differences and costs to the aura choosing interface
|
||||
* @param {number} aura The number of the aura currently selected by the mouse/user
|
||||
*/
|
||||
Game.DescribeDragonAura = function (aura) {
|
||||
BackupFunctions.DescribeDragonAura(aura);
|
||||
AddAuraInfo(aura);
|
||||
};
|
||||
|
||||
BackupFunctions.ToggleSpecialMenu = Game.ToggleSpecialMenu;
|
||||
/**
|
||||
* This function adds the code to display the tooltips for the levelUp button of the dragon
|
||||
*/
|
||||
Game.ToggleSpecialMenu = function (on) {
|
||||
BackupFunctions.ToggleSpecialMenu(on);
|
||||
AddDragonLevelUpTooltip();
|
||||
};
|
||||
BackupFunctions.ToggleSpecialMenu = Game.ToggleSpecialMenu;
|
||||
/**
|
||||
* This function adds the code to display the tooltips for the levelUp button of the dragon
|
||||
*/
|
||||
Game.ToggleSpecialMenu = function (on) {
|
||||
BackupFunctions.ToggleSpecialMenu(on);
|
||||
AddDragonLevelUpTooltip();
|
||||
};
|
||||
|
||||
BackupFunctions.UpdateMenu = Game.UpdateMenu;
|
||||
Game.UpdateMenu = function () {
|
||||
if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
|
||||
BackupFunctions.UpdateMenu();
|
||||
AddMenu();
|
||||
}
|
||||
};
|
||||
BackupFunctions.UpdateMenu = Game.UpdateMenu;
|
||||
Game.UpdateMenu = function () {
|
||||
if (
|
||||
typeof jscolor.picker === 'undefined' ||
|
||||
typeof jscolor.picker.owner === 'undefined'
|
||||
) {
|
||||
BackupFunctions.UpdateMenu();
|
||||
AddMenu();
|
||||
}
|
||||
};
|
||||
|
||||
BackupFunctions.sayTime = Game.sayTime;
|
||||
CMSayTime = function (time, detail) {
|
||||
if (Number.isNaN(time) || time <= 0) return BackupFunctions.sayTime(time, detail);
|
||||
return FormatTime(time / Game.fps, 1);
|
||||
};
|
||||
BackupFunctions.sayTime = Game.sayTime;
|
||||
CMSayTime = function (time, detail) {
|
||||
if (Number.isNaN(time) || time <= 0)
|
||||
return BackupFunctions.sayTime(time, detail);
|
||||
return FormatTime(time / Game.fps, 1);
|
||||
};
|
||||
|
||||
BackupFunctions.Logic = Game.Logic;
|
||||
Game.Logic = function () {
|
||||
BackupFunctions.Logic();
|
||||
BackupFunctions.Logic = Game.Logic;
|
||||
Game.Logic = function () {
|
||||
BackupFunctions.Logic();
|
||||
|
||||
// Update tab title
|
||||
let title = 'Cookie Clicker';
|
||||
if (Game.season === 'fools') title = 'Cookie Baker';
|
||||
Title = `${(Game.OnAscend ? 'Ascending! ' : '')}${CMBeautify(Game.cookies)} ${(Game.cookies === 1 ? 'cookie' : 'cookies')} - ${title}`;
|
||||
UpdateTitle();
|
||||
// Update tab title
|
||||
let title = 'Cookie Clicker';
|
||||
if (Game.season === 'fools') title = 'Cookie Baker';
|
||||
Title = `${Game.OnAscend ? 'Ascending! ' : ''}${CMBeautify(Game.cookies)} ${
|
||||
Game.cookies === 1 ? 'cookie' : 'cookies'
|
||||
} - ${title}`;
|
||||
UpdateTitle();
|
||||
|
||||
// Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here...
|
||||
ReplaceAscendTooltip();
|
||||
};
|
||||
// Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here...
|
||||
ReplaceAscendTooltip();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { TooltipWrinklerArea, TooltipWrinklerBeingShown } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
TooltipWrinklerArea,
|
||||
TooltipWrinklerBeingShown,
|
||||
} from '../../Disp/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler
|
||||
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||
*/
|
||||
export default function AddWrinklerAreaDetect() {
|
||||
l('backgroundLeftCanvas').onmouseover = function () { TooltipWrinklerArea = 1; };
|
||||
l('backgroundLeftCanvas').onmouseout = function () {
|
||||
TooltipWrinklerArea = 0;
|
||||
Game.tooltip.hide();
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
};
|
||||
l('backgroundLeftCanvas').onmouseover = function () {
|
||||
TooltipWrinklerArea = 1;
|
||||
};
|
||||
l('backgroundLeftCanvas').onmouseout = function () {
|
||||
TooltipWrinklerArea = 0;
|
||||
Game.tooltip.hide();
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user