temp fix
All checks were successful
Build / build (20) (push) Successful in 35s
Build / build (18) (push) Successful in 56s
Build / build (18) (pull_request) Successful in 36s
Build / build (22) (push) Successful in 1m27s
Build / build (20) (pull_request) Successful in 55s
Build / build (22) (pull_request) Successful in 34s

This commit is contained in:
Ordis 2025-02-09 23:33:52 +01:00
parent a03c987f69
commit 8332476f1c
2 changed files with 10 additions and 7 deletions

View File

@ -30,10 +30,11 @@ export const updateQuestController: RequestHandler = async (req, res) => {
const questCompletionItems = getQuestCompletionItems(questKeyName);
logger.debug(`quest completion items`, questCompletionItems);
const inventoryChanges = await addItems(inventory, questCompletionItems);
if (questCompletionItems) {
const inventoryChanges = await addItems(inventory, questCompletionItems);
updateQuestResponse.InventoryChanges = inventoryChanges;
}
inventory.ActiveQuest = "";
updateQuestResponse.InventoryChanges = inventoryChanges;
}
//TODO: might need to parse the custom data and add the associated items to inventory

View File

@ -189,11 +189,13 @@ export const getNode = (nodeName: string): IRegion => {
};
export const getQuestCompletionItems = (questKey: string) => {
const items = (questCompletionItems as unknown as Record<string, ITypeCount[] | undefined>)[questKey];
if (!items) {
throw new Error(`Quest ${questKey} not found in questCompletionItems`);
}
const items = (questCompletionItems as unknown as Record<string, ITypeCount[]> | undefined)?.[questKey];
if (!items) {
logger.error(
`Quest ${questKey} not found in questCompletionItems, quest completion items have not been given. This is a temporary solution`
);
}
return items;
};