combine conditions
All checks were successful
Build / build (pull_request) Successful in 1m28s

This commit is contained in:
Sainan 2025-06-23 22:20:36 +02:00
parent 29a465b183
commit 917d82c707

View File

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