Compare commits

..

9 Commits

Author SHA1 Message Date
c0bf3a2db5 lint
Some checks are pending
Build / build (18) (push) Waiting to run
Build / build (20) (push) Waiting to run
Build / build (22) (push) Waiting to run
Build / build (20) (pull_request) Successful in 34s
Build / build (22) (pull_request) Successful in 35s
Build / build (18) (pull_request) Successful in 1m2s
2025-02-19 01:35:57 +01:00
47bb5065f2 remove unused imports 2025-02-19 01:35:57 +01:00
bb32fa2267 update translations 2025-02-19 01:35:57 +01:00
4ffed8c09d add Progress 2025-02-19 01:35:57 +01:00
e607678b6f reset properly 2025-02-19 01:35:57 +01:00
4c620d948a fix 2025-02-19 01:35:57 +01:00
cebd96a521 remove cheats 2025-02-19 01:35:57 +01:00
4256e25fdd stable 2025-02-19 01:35:57 +01:00
87cc2594c8 fix: add missing quest keys at updateQuestKey (#958)
All checks were successful
Build Docker image / docker (push) Successful in 37s
Build / build (20) (push) Successful in 36s
Build / build (18) (push) Successful in 59s
Build / build (22) (push) Successful in 1m7s
it's possible the quest key was not in already in the inventory but the quest was still available due to unlockAllQuests

Closes #957

Reviewed-on: #958
2025-02-18 13:48:21 -08:00

View File

@ -3,6 +3,7 @@ import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/invento
import { IInventoryDatabase, IQuestKeyDatabase, IQuestStage } from "@/src/types/inventoryTypes/inventoryTypes"; import { IInventoryDatabase, IQuestKeyDatabase, IQuestStage } from "@/src/types/inventoryTypes/inventoryTypes";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { HydratedDocument } from "mongoose"; import { HydratedDocument } from "mongoose";
import { config } from "@/src/services/configService";
export interface IUpdateQuestRequest { export interface IUpdateQuestRequest {
QuestKeys: Omit<IQuestKeyDatabase, "CompletionDate">[]; QuestKeys: Omit<IQuestKeyDatabase, "CompletionDate">[];
@ -22,10 +23,10 @@ export const updateQuestKey = (
throw new Error("more than 1 quest key not supported"); throw new Error("more than 1 quest key not supported");
} }
const questKeyIndex = inventory.QuestKeys.findIndex(questKey => questKey.ItemType === questKeyUpdate[0].ItemType); let questKeyIndex = inventory.QuestKeys.findIndex(questKey => questKey.ItemType === questKeyUpdate[0].ItemType);
if (questKeyIndex === -1) { if (questKeyIndex === -1) {
throw new Error(`quest key ${questKeyUpdate[0].ItemType} not found`); if (!config.unlockAllQuests) throw new Error(`quest key ${questKeyUpdate[0].ItemType} not found`);
questKeyIndex = inventory.QuestKeys.push({ ItemType: questKeyUpdate[0].ItemType }) - 1;
} }
inventory.QuestKeys[questKeyIndex] = questKeyUpdate[0]; inventory.QuestKeys[questKeyIndex] = questKeyUpdate[0];