add: const to control usage of seasonal splash messages
This commit is contained in:
parent
90641df85f
commit
8dc228125b
|
@ -41,6 +41,8 @@ interface Season {
|
||||||
|
|
||||||
//#region Constants
|
//#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 */
|
/** The weight multiplier for the battles-won splash message */
|
||||||
const BATTLES_WON_WEIGHT_MULTIPLIER = 10;
|
const BATTLES_WON_WEIGHT_MULTIPLIER = 10;
|
||||||
/** The weight multiplier for the seasonal splash messages */
|
/** The weight multiplier for the seasonal splash messages */
|
||||||
|
@ -113,18 +115,20 @@ const seasonalSplashMessages: Season[] = [
|
||||||
export function getSplashMessages(): string[] {
|
export function getSplashMessages(): string[] {
|
||||||
const splashMessages: string[] = [...commonSplashMessages];
|
const splashMessages: string[] = [...commonSplashMessages];
|
||||||
|
|
||||||
// add seasonal splash messages if the season is active
|
if (USE_SEASONAL_SPLASH_MESSAGES) {
|
||||||
for (const { name, start, end, messages } of seasonalSplashMessages) {
|
// add seasonal splash messages if the season is active
|
||||||
const now = new Date();
|
for (const { name, start, end, messages } of seasonalSplashMessages) {
|
||||||
const startDate = new Date(`${start}-${now.getFullYear()}`);
|
const now = new Date();
|
||||||
const endDate = new Date(`${end}-${now.getFullYear()}`);
|
const startDate = new Date(`${start}-${now.getFullYear()}`);
|
||||||
|
const endDate = new Date(`${end}-${now.getFullYear()}`);
|
||||||
|
|
||||||
if (now >= startDate && now <= endDate) {
|
if (now >= startDate && now <= endDate) {
|
||||||
console.log(`Adding ${messages.length} ${name} splash messages (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`);
|
console.log(`Adding ${messages.length} ${name} splash messages (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`);
|
||||||
messages.forEach((message) => {
|
messages.forEach((message) => {
|
||||||
const weightedMessage = Array(SEASONAL_WEIGHT_MULTIPLIER).fill(message);
|
const weightedMessage = Array(SEASONAL_WEIGHT_MULTIPLIER).fill(message);
|
||||||
splashMessages.push(...weightedMessage);
|
splashMessages.push(...weightedMessage);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue