Use Framework notifications

This commit is contained in:
Daniël van Noord
2021-07-20 18:08:11 +02:00
parent 9294a5bc87
commit e9dc2ffa51
6 changed files with 39 additions and 37 deletions

View File

@@ -1,5 +1,4 @@
import Flash from '../../Disp/Notifications/Flash'; import { notificationsFunctions as nF } from '@cookiemonsterteam/cookiemonsterframework/src/index';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastGardenNextStep } from '../VariablesAndData'; import { LastGardenNextStep } from '../VariablesAndData';
/** /**
@@ -11,8 +10,9 @@ export default function CheckGardenTick() {
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
) { ) {
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) { if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
Flash(3, 'GardFlash', false); nF.createFlash('cookieMonsterMod', 3, 'GardFlash', false);
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GardSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GardSoundURL,
'GardSound', 'GardSound',
'GardVolume', 'GardVolume',

View File

@@ -1,8 +1,6 @@
import { notificationsFunctions as nF } from '@cookiemonsterteam/cookiemonsterframework/src/index';
import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers'; import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon'; import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon';
import { GCTimers } from '../../Disp/VariablesAndData'; import { GCTimers } from '../../Disp/VariablesAndData';
import { import {
@@ -44,14 +42,16 @@ export default function CheckGoldenCookie() {
LastGoldenCookieState = Game.shimmerTypes.golden.n; LastGoldenCookieState = Game.shimmerTypes.golden.n;
if (LastGoldenCookieState) { if (LastGoldenCookieState) {
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) { if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
Flash(3, 'GCFlash', false); nF.createFlash('cookieMonsterMod', 3, 'GCFlash', false);
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCSoundURL,
'GCSound', 'GCSound',
'GCVolume', 'GCVolume',
false, false,
); );
CreateNotification( nF.createNotification(
'cookieMonsterMod',
'GCNotification', 'GCNotification',
'Golden Cookie Spawned', 'Golden Cookie Spawned',
'A Golden Cookie has spawned. Click it now!', 'A Golden Cookie has spawned. Click it now!',

View File

@@ -1,6 +1,4 @@
import Flash from '../../Disp/Notifications/Flash'; import { notificationsFunctions as nF } from '@cookiemonsterteam/cookiemonsterframework/src/index';
import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastMagicBarFull } from '../VariablesAndData'; import { LastMagicBarFull } from '../VariablesAndData';
/** /**
@@ -16,14 +14,16 @@ export default function CheckMagicMeter() {
if (minigame.magic < minigame.magicM) LastMagicBarFull = false; if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
else if (!LastMagicBarFull) { else if (!LastMagicBarFull) {
LastMagicBarFull = true; LastMagicBarFull = true;
Flash(3, 'MagicFlash', false); nF.createFlash('cookieMonsterMod', 3, 'MagicFlash', false);
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicSoundURL,
'MagicSound', 'MagicSound',
'MagicVolume', 'MagicVolume',
false, false,
); );
CreateNotification( nF.createNotification(
'cookieMonsterMod',
'MagicNotification', 'MagicNotification',
'Magic Meter full', 'Magic Meter full',
'Your Magic Meter is full. Cast a spell!', 'Your Magic Meter is full. Cast a spell!',

View File

@@ -1,7 +1,5 @@
import { notificationsFunctions as nF } from '@cookiemonsterteam/cookiemonsterframework/src/index';
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars
import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastSeasonPopupState } from '../VariablesAndData'; import { LastSeasonPopupState } from '../VariablesAndData';
/** /**
@@ -16,14 +14,16 @@ export default function CheckSeasonPopup() {
CacheSeasonPopShimmer = Game.shimmers[i]; CacheSeasonPopShimmer = Game.shimmers[i];
} }
}); });
Flash(3, 'SeaFlash', false); nF.createFlash('cookieMonsterMod', 3, 'SeaFlash', false);
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaSoundURL,
'SeaSound', 'SeaSound',
'SeaVolume', 'SeaVolume',
false, false,
); );
CreateNotification( nF.createNotification(
'cookieMonsterMod',
'SeaNotification', 'SeaNotification',
'Reindeer sighted!', 'Reindeer sighted!',
'A Reindeer has spawned. Click it now!', 'A Reindeer has spawned. Click it now!',

View File

@@ -1,6 +1,4 @@
import Flash from '../../Disp/Notifications/Flash'; import { notificationsFunctions as nF } from '@cookiemonsterteam/cookiemonsterframework/src/index';
import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastTickerFortuneState } from '../VariablesAndData'; import { LastTickerFortuneState } from '../VariablesAndData';
/** /**
@@ -11,14 +9,16 @@ export default function CheckTickerFortune() {
if (LastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) { if (LastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
LastTickerFortuneState = Game.TickerEffect && Game.TickerEffect.type === 'fortune'; LastTickerFortuneState = Game.TickerEffect && Game.TickerEffect.type === 'fortune';
if (LastTickerFortuneState) { if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash', false); nF.createFlash('cookieMonsterMod', 3, 'FortuneFlash', false);
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL,
'FortuneSound', 'FortuneSound',
'FortuneVolume', 'FortuneVolume',
false, false,
); );
CreateNotification( nF.createNotification(
'cookieMonsterMod',
'FortuneNotification', 'FortuneNotification',
'Fortune Cookie found', 'Fortune Cookie found',
'A Fortune Cookie has appeared on the Ticker.', 'A Fortune Cookie has appeared on the Ticker.',

View File

@@ -1,6 +1,4 @@
import Flash from '../../Disp/Notifications/Flash'; import { notificationsFunctions as nF } from '@cookiemonsterteam/cookiemonsterframework/src/index';
import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastWrinklerCount } from '../VariablesAndData'; import { LastWrinklerCount } from '../VariablesAndData';
/** /**
@@ -19,22 +17,24 @@ export default function CheckWrinklerCount() {
CurrentWrinklers === Game.getWrinklersMax() && CurrentWrinklers === Game.getWrinklersMax() &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxFlash Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxFlash
) { ) {
Flash(3, 'WrinklerMaxFlash', false); nF.createFlash('cookieMonsterMod', 3, 'WrinklerMaxFlash', false);
} else { } else {
Flash(3, 'WrinklerFlash', false); nF.createFlash('cookieMonsterMod', 3, 'WrinklerFlash', false);
} }
if ( if (
CurrentWrinklers === Game.getWrinklersMax() && CurrentWrinklers === Game.getWrinklersMax() &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSound Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSound
) { ) {
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSoundURL,
'WrinklerMaxSound', 'WrinklerMaxSound',
'WrinklerMaxVolume', 'WrinklerMaxVolume',
false, false,
); );
} else { } else {
PlaySound( nF.playCMSound(
'cookieMonsterMod',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerSoundURL, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerSoundURL,
'WrinklerSound', 'WrinklerSound',
'WrinklerVolume', 'WrinklerVolume',
@@ -45,13 +45,15 @@ export default function CheckWrinklerCount() {
CurrentWrinklers === Game.getWrinklersMax() && CurrentWrinklers === Game.getWrinklersMax() &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification
) { ) {
CreateNotification( nF.createNotification(
'cookieMonsterMod',
'WrinklerMaxNotification', 'WrinklerMaxNotification',
'Maximum Wrinklers Reached', 'Maximum Wrinklers Reached',
'You have reached your maximum ammount of wrinklers', 'You have reached your maximum ammount of wrinklers',
); );
} else { } else {
CreateNotification( nF.createNotification(
'cookieMonsterMod',
'WrinklerNotification', 'WrinklerNotification',
'A Wrinkler appeared', 'A Wrinkler appeared',
'A new wrinkler has appeared', 'A new wrinkler has appeared',