fix: add missing quest keys at updateQuestKey
All checks were successful
Build / build (20) (pull_request) Successful in 59s
Build / build (22) (pull_request) Successful in 1m4s
Build / build (20) (push) Successful in 35s
Build / build (18) (push) Successful in 1m4s
Build / build (22) (push) Successful in 1m7s
Build / build (18) (pull_request) Successful in 35s

it's possible the quest key was not in already in the inventory but the quest was still available due to unlockAllQuests
This commit is contained in:
Sainan 2025-02-18 00:43:48 +01:00
parent 0e7c124d26
commit 0b29d33652

View File

@ -22,10 +22,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`); // it's possible the quest key was not in already in the inventory but the quest was still available due to unlockAllQuests
questKeyIndex = inventory.QuestKeys.push({ ItemType: questKeyUpdate[0].ItemType }) - 1;
} }
inventory.QuestKeys[questKeyIndex] = questKeyUpdate[0]; inventory.QuestKeys[questKeyIndex] = questKeyUpdate[0];