Squashed commit of the following:

commit bde71cc45d886517a111802976c5e3fd9994eeb3
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Thu Mar 20 15:25:11 2025 -0500

    fix(potions): add missing Cryptid release date

commit 1a50413402cc4191be99d566b76061ef794a7b7d
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Tue Mar 18 16:52:19 2025 -0500

    fix(wacky): revise text, address linting

commit 2d49a16f5505329c90e9f6898108420f7da9f414
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Mar 18 16:05:17 2025 +0100

    Fix displaying countdown for recurring event items

commit cf20b30975b1a3ec10a50263cd87a96b6ea2be80
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Fri Mar 14 18:01:37 2025 -0500

    fix(lint): line length

commit e39e490e41dd77da925114d121ed190df3df5900
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Fri Mar 14 17:55:12 2025 -0500

    fix(foolin): correct animation and end date of potions

commit 164e2eefdd5b187f9148a09ff62b741cfd36b5d1
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Thu Mar 13 17:25:14 2025 -0500

    fix(event): Panda Cub typo, shift start date

commit 394c922287924d684dd707cc3eb6a36adfc32101
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Thu Mar 13 17:02:12 2025 -0500

    fix(test): account for addition of Cryptid

commit bea9e4033802f85715146b909115a1e2f35687a3
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Thu Mar 13 16:52:37 2025 -0500

    feat(event): April Fools 2025
This commit is contained in:
Kalista Payne
2025-03-21 15:02:31 -05:00
parent 01881b2fd8
commit f3029953dc
15 changed files with 194 additions and 107 deletions
@@ -50,8 +50,13 @@ export const REPEATING_EVENTS = {
end: new Date('1970-03-16T03:59-04:00'),
foodSeason: 'Pie',
},
aprilFools: {
start: new Date('1970-04-01T04:00-04:00'),
end: new Date('1970-04-02T03:59-04:00'),
aprilFools: 'Cryptid',
},
aprilFoolsResale: {
start: new Date('1970-04-07T04:00-04:00'),
start: new Date('1970-04-03T04:00-04:00'),
end: new Date('1970-05-01T03:59-04:00'),
content: [
{
@@ -65,6 +70,7 @@ export const REPEATING_EVENTS = {
{
type: 'premiumHatchingPotions',
items: [
'Cryptid',
'Veggie',
'TeaShop',
],
@@ -146,7 +152,6 @@ export const EVENTS = {
start: '2024-04-09T08:00-04:00',
end: '2024-04-30T23:59-04:00',
},
aprilFools2024: {
start: '2024-04-01T00:00-04:00',
end: '2024-04-02T08:00-04:00',
@@ -1,41 +1,40 @@
export default [
'head_special_1',
'broad_armor_special_1',
'slim_armor_special_1',
'head_special_0',
'slim_armor_special_0',
'broad_armor_special_0',
'weapon_special_critical',
'weapon_special_0',
'shield_special_0',
'Pet-Wolf-Cerberus',
'stable_Pet-Wolf-Cerberus',
'armor_special_ks2019',
'slim_armor_special_ks2019',
'back_special_heroicAureole',
'background_airship',
'background_clocktower',
'background_steamworks',
'broad_armor_special_0',
'broad_armor_special_1',
'broad_armor_special_ks2019',
'eyewear_special_ks2019',
'head_special_0',
'head_special_1',
'head_special_ks2019',
'shield_special_ks2019',
'weapon_special_ks2019',
'Pet-Gryphon-Gryphatrice',
'stable_Pet-Gryphon-Gryphatrice',
'Mount_Head_Gryphon-Gryphatrice',
'Mount_Body_Gryphon-Gryphatrice',
'background_clocktower',
'background_airship',
'background_steamworks',
'Pet_HatchingPotion_Veggie',
'Mount_Head_Gryphon-Gryphatrice',
'Pet_HatchingPotion_Cryptid',
'Pet_HatchingPotion_Dessert',
'Pet-HatchingPotion-Dessert',
'quest_windup',
'Pet-HatchingPotion_Windup',
'Pet_HatchingPotion_Fungi',
'Pet_HatchingPotion_Veggie',
'Pet_HatchingPotion_VirtualPet',
'Pet_HatchingPotion_Windup',
'Pet-Gryphatrice-Jubilant',
'Pet-Gryphon-Gryphatrice',
'Pet-Wolf-Cerberus',
'quest_solarSystem',
'quest_virtualpet',
'Pet_HatchingPotion_VirtualPet',
'Pet-Gryphatrice-Jubilant',
'stable_Pet-Gryphatrice-Jubilant',
'back_special_heroicAureole',
'Pet-HatchingPotion-Funghi',
'quest_windup',
'shield_special_0',
'shield_special_ks2019',
'shop_armoire',
'slim_armor_special_0',
'slim_armor_special_1',
'slim_armor_special_ks2019',
'stable_Pet-Gryphatrice-Jubilant',
'stable_Pet-Gryphon-Gryphatrice',
'stable_Pet-Wolf-Cerberus',
'weapon_special_0',
'weapon_special_critical',
'weapon_special_ks2019',
];
@@ -36,5 +36,6 @@ export const HATCHING_POTIONS_RELEASE_DATES = {
Koi: { year: 2024, month: 6, day: 1 },
Gingerbread: { year: 2024, month: 12, day: 21 },
Jade: { year: 2025, month: 3, day: 14 },
Cryptid: { year: 2025, month: 4, day: 3 },
Balloon: { year: 2025, month: 4, day: 21 },
};
@@ -841,6 +841,30 @@ function getGalaIndex (date) {
return parseInt((galaCount / 12) * galaMonth, 10);
}
function makeEndDate (checkedDate, matcher) {
let end = moment.utc(checkedDate);
end.hour(SWITCHOVER_TIME);
end.minute(0);
end.second(0);
if (matcher.end !== undefined) {
end.date(matcher.end.getDate());
end.month(matcher.end.getMonth());
} else {
end.date(TYPE_SCHEDULE[matcher.type]);
if (matcher.endMonth !== undefined) {
if (matcher.startMonth
&& matcher.startMonth > matcher.endMonth
&& checkedDate.getMonth() > matcher.endMonth) {
end.year(checkedDate.getFullYear() + 1);
}
end.month(matcher.endMonth);
} else if (end.valueOf() <= checkedDate.getTime()) {
end = moment(end).add(1, 'months');
}
}
return end.toDate();
}
export function assembleScheduledMatchers (date) {
const items = [];
const month = getMonth(date);
@@ -865,7 +889,14 @@ export function assembleScheduledMatchers (date) {
items.push(...galaMatchers);
getRepeatingEvents(date).forEach(event => {
if (event.content) {
items.push(...event.content);
const { content } = event;
const end = makeEndDate(date, event);
const m = content.map(matcher => {
const newMatcher = { ...matcher };
newMatcher.end = end;
return newMatcher;
});
items.push(...m);
}
});
return items;
@@ -878,8 +909,15 @@ function makeMatcherClass (date) {
return {
matchers: [],
end: new Date(),
specialEnds: {},
items: [],
matchingDate: date,
getEnd (key) {
if (this.specialEnds[key]) {
return this.specialEnds[key];
}
return this.end;
},
match (key) {
if (this.matchers.length === 0) {
if (this.items.length > 0) {
@@ -896,25 +934,6 @@ function makeMatcherClass (date) {
};
}
function makeEndDate (checkedDate, matcher) {
let end = moment.utc(checkedDate);
end.date(TYPE_SCHEDULE[matcher.type]);
end.hour(SWITCHOVER_TIME);
end.minute(0);
end.second(0);
if (matcher.endMonth !== undefined) {
if (matcher.startMonth
&& matcher.startMonth > matcher.endMonth
&& checkedDate.getMonth() > matcher.endMonth) {
end.year(checkedDate.getFullYear() + 1);
}
end.month(matcher.endMonth);
} else if (end.valueOf() <= checkedDate.getTime()) {
end = moment(end).add(1, 'months');
}
return end.toDate();
}
export function clearCachedMatchers () {
cacheDate = null;
cachedScheduleMatchers = null;
@@ -939,11 +958,19 @@ export function getAllScheduleMatchingGroups (date) {
if (!cachedScheduleMatchers[matcher.type]) {
cachedScheduleMatchers[matcher.type] = makeMatcherClass(adjustedDate);
}
cachedScheduleMatchers[matcher.type].end = makeEndDate(checkedDate, matcher);
if (matcher.end === undefined) {
// we want the default end date to be for matcher type
cachedScheduleMatchers[matcher.type].end = makeEndDate(checkedDate, matcher);
}
if (matcher.matcher instanceof Function) {
cachedScheduleMatchers[matcher.type].matchers.push(matcher.matcher);
} else if (matcher.items instanceof Array) {
cachedScheduleMatchers[matcher.type].items.push(...matcher.items);
if (matcher.end !== undefined) {
matcher.items.forEach(item => {
cachedScheduleMatchers[matcher.type].specialEnds[item] = matcher.end;
});
}
}
});
}