WIP(shops): cShop reconciled to schedule backend

This commit is contained in:
Sabe Jones
2024-04-19 20:11:17 -05:00
parent 5f64b2fb25
commit 28b936e2d1
9 changed files with 190 additions and 202 deletions

View File

@@ -745,6 +745,19 @@ export const GALA_SCHEDULE = {
},
};
export const TYPE_SCHEDULE = {
timeTravelers: FIRST_RELEASE_DAY,
backgrounds: SECOND_RELEASE_DAY,
petQuests: THIRD_RELEASE_DAY,
hatchingPotionQuests: THIRD_RELEASE_DAY,
bundles: THIRD_RELEASE_DAY,
premiumHatchingPotions: FOURTH_RELEASE_DAY,
seasonalGear: GALA_SWITCHOVER_DAY,
seasonalSpells: GALA_SWITCHOVER_DAY,
seasonalQuests: GALA_SWITCHOVER_DAY,
customizations: GALA_SWITCHOVER_DAY,
};
function getDay (date) {
if (date === undefined) {
return 0;
@@ -804,6 +817,7 @@ let cacheDate = null;
function makeMatcherClass () {
return {
matchers: [],
end: new Date(),
items: [],
match (key) {
if (this.matchers.length === 0) {
@@ -818,9 +832,6 @@ function makeMatcherClass () {
}
return false;
},
getEndDate () {
return new Date();
},
};
}
@@ -846,7 +857,12 @@ export function getScheduleMatchingGroup (type, date) {
});
}
if (!cachedScheduleMatchers[type]) {
let end = moment(checkedDate).date(TYPE_SCHEDULE[type]);
if (end.date() <= checkedDate.date()) {
end = moment(end).add(1, 'months');
}
return {
end: end.toDate(),
items: [],
match () {
return true;