Files
CookieMonster/src/Main/CheckStates/Ticker.js
2021-07-11 10:21:16 +02:00

29 lines
1003 B
JavaScript

import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastTickerFortuneState } from '../VariablesAndData';
/**
* This function checks if there is a fortune cookie on the ticker
* 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', false);
PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL,
'FortuneSound',
'FortuneVolume',
false,
);
CreateNotification(
'FortuneNotification',
'Fortune Cookie found',
'A Fortune Cookie has appeared on the Ticker.',
);
}
}
}