fix: add missing quest keys at updateQuestKey #958
@ -22,10 +22,10 @@ export const updateQuestKey = (
|
||||
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) {
|
||||
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user