XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

fix: don't throw an error if questKey already exists (#1003)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1003 Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>

42116498
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

2 个文件 +3 -4
Modified src/services/inventoryService.ts +2 -3
@@ -331,9 +331,8 @@ export const addItem = async (
331 331
332 332 if (key.chainStages) {
333 333 const key = addQuestKey(inventory, { ItemType: typeName });
334 if (key) {
335 return { InventoryChanges: { QuestKeys: [key] } };
336 }
334 if (!key) return { InventoryChanges: {} };
335 return { InventoryChanges: { QuestKeys: [key] } };
337 336 } else {
338 337 const key = { ItemType: typeName, ItemCount: quantity };
339 338
Modified src/services/questService.ts +1 -1
@@ -77,7 +77,7 @@ export const updateQuestStage = (
77 77
78 78 export const addQuestKey = (inventory: TInventoryDatabaseDocument, questKey: IQuestKeyDatabase) => {
79 79 if (inventory.QuestKeys.some(q => q.ItemType === questKey.ItemType)) {
80 logger.error(`quest key ${questKey.ItemType} already exists`);
80 logger.warn(`Quest key ${questKey.ItemType} already exists. It will not be added`);
81 81 return;
82 82 }
83 83 const index = inventory.QuestKeys.push(questKey);