fix: don't throw an error if questKey already exists
All checks were successful
Build / build (22) (pull_request) Successful in 37s
Build / build (18) (pull_request) Successful in 1m9s
Build / build (20) (pull_request) Successful in 1m3s

This commit is contained in:
AMelonInsideLemon 2025-02-24 18:39:37 +01:00
parent 045d933458
commit 9a646e0022
2 changed files with 2 additions and 2 deletions

View File

@ -333,7 +333,7 @@ export const addItem = async (
const key = addQuestKey(inventory, { ItemType: typeName });
if (key) {
return { InventoryChanges: { QuestKeys: [key] } };
}
} else return { InventoryChanges: {} };
} else {
const key = { ItemType: typeName, ItemCount: quantity };

View File

@ -77,7 +77,7 @@ export const updateQuestStage = (
export const addQuestKey = (inventory: TInventoryDatabaseDocument, questKey: IQuestKeyDatabase) => {
if (inventory.QuestKeys.some(q => q.ItemType === questKey.ItemType)) {
logger.error(`quest key ${questKey.ItemType} already exists`);
logger.warn(`Quest key ${questKey.ItemType} already exists. It will not be added`);
return;
}
const index = inventory.QuestKeys.push(questKey);