From bca3e96e9c546f64d2c42de03ee52d5f48790697 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 21 Feb 2024 17:05:21 +0100 Subject: [PATCH] Implement food seasons --- website/client/src/main.js | 1 - .../common/script/content/constants/events.js | 27 +++++++++++++++---- website/common/script/content/index.js | 10 ++++--- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/website/client/src/main.js b/website/client/src/main.js index ddf86c80a6..9c4851e28c 100644 --- a/website/client/src/main.js +++ b/website/client/src/main.js @@ -45,7 +45,6 @@ if (process.env.ENABLE_TIME_TRAVEL) { now: time, shouldAdvanceTime: true, }); - })(); } diff --git a/website/common/script/content/constants/events.js b/website/common/script/content/constants/events.js index a5cba04539..1ab77c3bc8 100644 --- a/website/common/script/content/constants/events.js +++ b/website/common/script/content/constants/events.js @@ -25,6 +25,13 @@ export const REPEATING_EVENTS = { }, ], }, + birthday: { + start: '1970-01-30T08:00-05:00', + end: '1970-02-08T23:59-05:00', + season: 'birthday', + npcImageSuffix: '_birthday', + foodSeason: 'Cake', + }, valentines: { start: '1970-02-13T08:00-05:00', end: '1970-02-17T23:59-05:00', @@ -39,17 +46,27 @@ export const REPEATING_EVENTS = { }, ], }, - birthday: { - start: '1970-01-30T08:00-05:00', - end: '1970-02-08T23:59-05:00', - season: 'birthday', - npcImageSuffix: '_birthday', + piDay: { + start: '1970-03-13T08:00-05:00', + end: '1970-03-15T23:59-05:00', + foodSeason: 'Pie', + }, + namingDay: { + start: '1970-07-30T08:00-05:00', + end: '1970-08-01T23:59-05:00', + foodSeason: 'Cake', + }, + habitoween: { + start: '1970-10-30T08:00-05:00', + end: '1970-11-01T23:59-05:00', + foodSeason: 'Candy', }, harvestFeast: { start: '1970-11-22T08:00-05:00', end: '1970-11-27T20:00-05:00', season: 'thanksgiving', npcImageSuffix: '_thanksgiving', + foodSeason: 'Pie', }, }; diff --git a/website/common/script/content/index.js b/website/common/script/content/index.js index 67fcda98f1..d3691461d6 100644 --- a/website/common/script/content/index.js +++ b/website/common/script/content/index.js @@ -34,6 +34,7 @@ import faq from './faq'; import timeTravelers from './time-travelers'; import { getScheduleMatchingGroup } from './constants/schedule'; +import { getRepeatingEvents } from './constants/events'; import loginIncentives from './loginIncentives'; @@ -202,9 +203,6 @@ api.premiumMounts = stable.premiumMounts; api.specialMounts = stable.specialMounts; api.mountInfo = stable.mountInfo; -// For seasonal events, change this constant: -const FOOD_SEASON = moment().isBefore('2023-03-15T12:00-05:00') ? 'Pie' : 'Normal'; - api.food = { Meat: { text: t('foodMeat'), @@ -456,6 +454,12 @@ api.food = { /* eslint-enable camelcase */ }; +let FOOD_SEASON = 'Normal'; +getRepeatingEvents(moment()).forEach(event => { + if (event.foodSeason) { + FOOD_SEASON = event.foodSeason; + } +}); each(api.food, (food, key) => { let foodType = 'Normal'; if (key.startsWith('Cake_')) {