fix: use shared count for calendar day indecies #2265

Merged
OrdisPrime merged 5 commits from cal-fix-ii into main 2025-06-23 15:02:31 -07:00
Showing only changes of commit 917d82c707 - Show all commits

View File

@ -14,10 +14,10 @@ export const completeCalendarEventController: RequestHandler = async (req, res)
let inventoryChanges: IInventoryChanges = {};
const dayIndex = calendarProgress.SeasonProgress.LastCompletedDayIdx + 1;
const day = currentSeason.Days[dayIndex];
if (day.events.length != 0 && day.events[0].type == "CET_CHALLENGE") {
if (day.events.length != 0) {
if (day.events[0].type == "CET_CHALLENGE") {
throw new Error(`completeCalendarEvent should not be used for challenges`);
}
if (day.events.length != 0) {
const selection = day.events[parseInt(req.query.CompletedEventIdx as string)];
if (selection.type == "CET_REWARD") {
inventoryChanges = (await handleStoreItemAcquisition(selection.reward!, inventory)).InventoryChanges;