From 8dc228125b1cefde53d2f28d71bfc95b69f5df4c Mon Sep 17 00:00:00 2001 From: flx-sta <50131232+flx-sta@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:43:56 -0700 Subject: [PATCH] add: const to control usage of seasonal splash messages --- src/data/splash-messages.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/data/splash-messages.ts b/src/data/splash-messages.ts index a628e585a5e..3e6f3643dae 100644 --- a/src/data/splash-messages.ts +++ b/src/data/splash-messages.ts @@ -41,6 +41,8 @@ interface Season { //#region Constants +/** Whether to use seasonal splash messages in general */ +const USE_SEASONAL_SPLASH_MESSAGES = false; /** The weight multiplier for the battles-won splash message */ const BATTLES_WON_WEIGHT_MULTIPLIER = 10; /** The weight multiplier for the seasonal splash messages */ @@ -113,18 +115,20 @@ const seasonalSplashMessages: Season[] = [ export function getSplashMessages(): string[] { const splashMessages: string[] = [...commonSplashMessages]; - // add seasonal splash messages if the season is active - for (const { name, start, end, messages } of seasonalSplashMessages) { - const now = new Date(); - const startDate = new Date(`${start}-${now.getFullYear()}`); - const endDate = new Date(`${end}-${now.getFullYear()}`); + if (USE_SEASONAL_SPLASH_MESSAGES) { + // add seasonal splash messages if the season is active + for (const { name, start, end, messages } of seasonalSplashMessages) { + const now = new Date(); + const startDate = new Date(`${start}-${now.getFullYear()}`); + const endDate = new Date(`${end}-${now.getFullYear()}`); - if (now >= startDate && now <= endDate) { - console.log(`Adding ${messages.length} ${name} splash messages (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`); - messages.forEach((message) => { - const weightedMessage = Array(SEASONAL_WEIGHT_MULTIPLIER).fill(message); - splashMessages.push(...weightedMessage); - }); + if (now >= startDate && now <= endDate) { + console.log(`Adding ${messages.length} ${name} splash messages (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`); + messages.forEach((message) => { + const weightedMessage = Array(SEASONAL_WEIGHT_MULTIPLIER).fill(message); + splashMessages.push(...weightedMessage); + }); + } } }