fix: don't throw an error if questKey already exists (#1003)
Reviewed-on: OpenWF/SpaceNinjaServer#1003 Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
This commit is contained in:
parent
045d933458
commit
421164986a
@ -331,9 +331,8 @@ export const addItem = async (
|
||||
|
||||
if (key.chainStages) {
|
||||
const key = addQuestKey(inventory, { ItemType: typeName });
|
||||
if (key) {
|
||||
if (!key) return { InventoryChanges: {} };
|
||||
return { InventoryChanges: { QuestKeys: [key] } };
|
||||
}
|
||||
} else {
|
||||
const key = { ItemType: typeName, ItemCount: quantity };
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user