Implement events throughout the year

This commit is contained in:
Phillip Thelen
2024-02-15 16:14:42 +01:00
committed by Sabe Jones
parent 2a84561e00
commit 249394b4ad
8 changed files with 174 additions and 100 deletions
@@ -8,6 +8,33 @@ const gemsPromo = {
'84gems': 125,
};
export const REPEATING_EVENTS = {
nye: {
start: '1970-12-28T08:00-05:00',
end: '1970-01-04T23:59-05:00',
season: 'nye',
npcImageSuffix: '_nye',
},
valentines: {
start: '1970-02-13T08:00-05:00',
end: '1970-02-17T23:59-05:00',
season: 'valentines',
npcImageSuffix: '_valentines',
},
birthday: {
start: '1970-01-30T08:00-05:00',
end: '1970-02-08T23:59-05:00',
season: 'birthday',
npcImageSuffix: '_birthday',
},
harvestFeast: {
start: '1970-11-22T08:00-05:00',
end: '1970-11-27T20:00-05:00',
season: 'thanksgiving',
npcImageSuffix: '_thanksgiving',
},
};
export const EVENTS = {
noEvent: {
start: '2024-05-01T00:00-04:00',
@@ -24,7 +24,7 @@ export const USER_CAN_OWN_QUEST_CATEGORIES = [
'pet',
];
export { EVENTS } from './events';
export { EVENTS, REPEATING_EVENTS } from './events';
export { default as SEASONAL_SETS } from './seasonalSets';
export { default as ANIMAL_COLOR_ACHIEVEMENTS } from './animalColorAchievements';
export { default as ANIMAL_SET_ACHIEVEMENTS } from './animalSetAchievements';
@@ -627,88 +627,104 @@ export const GALA_KEYS = [
'fall',
];
export const GALA_SCHEDULE = {
0: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.winter,
},
{
type: 'seasonalSpells',
items: [
'snowball',
],
},
{
type: 'seasonalQuests',
items: [
'evilsanta',
'evilsanta2',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'winteryHairColors',
'winterySkins',
]),
},
],
1: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.spring,
},
{
type: 'seasonalSpells',
items: [
'shinySeed',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'shimmerHairColors',
'pastelSkins',
]),
},
],
2: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.summer,
},
{
type: 'seasonalSpells',
items: [
'seafoam',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'splashySkins',
]),
},
],
3: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.fall,
},
{
type: 'seasonalSpells',
items: [
'spookySparkles',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'hauntedHairColors',
'supernaturalSkins',
]),
},
],
0: {
startMonth: 11,
endMonth: 1,
filters: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.winter,
},
{
type: 'seasonalSpells',
items: [
'snowball',
],
},
{
type: 'seasonalQuests',
items: [
'evilsanta',
'evilsanta2',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'winteryHairColors',
'winterySkins',
]),
},
],
},
1: {
startMonth: 2,
endMonth: 4,
filters: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.spring,
},
{
type: 'seasonalSpells',
items: [
'shinySeed',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'shimmerHairColors',
'pastelSkins',
]),
},
],
},
2: {
startMonth: 5,
endMonth: 7,
filters: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.summer,
},
{
type: 'seasonalSpells',
items: [
'seafoam',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'splashySkins',
]),
},
],
},
3: {
startMonth: 8,
endMonth: 10,
filters: [
{
type: 'seasonalGear',
items: SEASONAL_SETS.fall,
},
{
type: 'seasonalSpells',
items: [
'spookySparkles',
],
},
{
type: 'customizations',
matcher: customizationMatcher([
'hauntedHairColors',
'supernaturalSkins',
]),
},
],
},
};
function getDay (date) {
@@ -752,17 +768,14 @@ export function assembleScheduledMatchers (date) {
}
}
items.push(...GALA_SCHEDULE[getGalaIndex(date)]);
items.push(...GALA_SCHEDULE[getGalaIndex(date)].filters);
return items;
}
let cachedScheduleMatchers = null;
export function getScheduleMatchingGroup (type, date) {
let checkedDate = date;
if (checkedDate === undefined) {
checkedDate = new Date();
}
const checkedDate = date || new Date();
if (cacheDate !== null && (getDay(checkedDate) !== getDay(cacheDate)
|| getMonth(checkedDate) !== getMonth(cacheDate))) {
cacheDate = null;
@@ -806,3 +819,18 @@ export function getScheduleMatchingGroup (type, date) {
export function getCurrentGalaKey (date) {
return GALA_KEYS[getGalaIndex(date || new Date())];
}
export function getCurrentGalaEvent (date) {
const checkedDate = date || new Date();
const index = getGalaIndex(checkedDate);
const key = GALA_KEYS[index];
const gala = GALA_SCHEDULE[index];
const today = new Date();
return {
event: key,
npcImageSuffix: `_${key}`,
season: key,
start: `${today.getFullYear()}.${gala.startMonth + 1}.${GALA_SWITCHOVER_DAY}`,
end: `${today.getFullYear()}.${gala.endMonth + 1}.${GALA_SWITCHOVER_DAY}`,
};
}