Implement food seasons

This commit is contained in:
Phillip Thelen
2024-02-21 17:05:21 +01:00
committed by Sabe Jones
parent 041edb3042
commit bca3e96e9c
3 changed files with 29 additions and 9 deletions

View File

@@ -45,7 +45,6 @@ if (process.env.ENABLE_TIME_TRAVEL) {
now: time, now: time,
shouldAdvanceTime: true, shouldAdvanceTime: true,
}); });
})(); })();
} }

View File

@@ -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: { valentines: {
start: '1970-02-13T08:00-05:00', start: '1970-02-13T08:00-05:00',
end: '1970-02-17T23:59-05:00', end: '1970-02-17T23:59-05:00',
@@ -39,17 +46,27 @@ export const REPEATING_EVENTS = {
}, },
], ],
}, },
birthday: { piDay: {
start: '1970-01-30T08:00-05:00', start: '1970-03-13T08:00-05:00',
end: '1970-02-08T23:59-05:00', end: '1970-03-15T23:59-05:00',
season: 'birthday', foodSeason: 'Pie',
npcImageSuffix: '_birthday', },
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: { harvestFeast: {
start: '1970-11-22T08:00-05:00', start: '1970-11-22T08:00-05:00',
end: '1970-11-27T20:00-05:00', end: '1970-11-27T20:00-05:00',
season: 'thanksgiving', season: 'thanksgiving',
npcImageSuffix: '_thanksgiving', npcImageSuffix: '_thanksgiving',
foodSeason: 'Pie',
}, },
}; };

View File

@@ -34,6 +34,7 @@ import faq from './faq';
import timeTravelers from './time-travelers'; import timeTravelers from './time-travelers';
import { getScheduleMatchingGroup } from './constants/schedule'; import { getScheduleMatchingGroup } from './constants/schedule';
import { getRepeatingEvents } from './constants/events';
import loginIncentives from './loginIncentives'; import loginIncentives from './loginIncentives';
@@ -202,9 +203,6 @@ api.premiumMounts = stable.premiumMounts;
api.specialMounts = stable.specialMounts; api.specialMounts = stable.specialMounts;
api.mountInfo = stable.mountInfo; 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 = { api.food = {
Meat: { Meat: {
text: t('foodMeat'), text: t('foodMeat'),
@@ -456,6 +454,12 @@ api.food = {
/* eslint-enable camelcase */ /* eslint-enable camelcase */
}; };
let FOOD_SEASON = 'Normal';
getRepeatingEvents(moment()).forEach(event => {
if (event.foodSeason) {
FOOD_SEASON = event.foodSeason;
}
});
each(api.food, (food, key) => { each(api.food, (food, key) => {
let foodType = 'Normal'; let foodType = 'Normal';
if (key.startsWith('Cake_')) { if (key.startsWith('Cake_')) {