From 00a75a33fa2cd60e1b279ded287c61294955398e Mon Sep 17 00:00:00 2001 From: Sainan Date: Wed, 19 Feb 2025 12:42:21 -0800 Subject: [PATCH] fix: don't use path-based matching to add QuestKeys (#967) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/967 Co-authored-by: Sainan Co-committed-by: Sainan --- src/services/inventoryService.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index 1241d61c1..65ccd2d03 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -38,6 +38,7 @@ import { ExportCustoms, ExportFlavour, ExportGear, + ExportKeys, ExportRecipes, ExportResources, ExportSentinels, @@ -365,6 +366,19 @@ export const addItem = async ( } }; } + if (typeName in ExportKeys) { + // Note: "/Lotus/Types/Keys/" contains some EmailItems and ShipFeatureItems + inventory.QuestKeys.push({ ItemType: typeName }); + return { + InventoryChanges: { + QuestKeys: [ + { + ItemType: typeName + } + ] + } + }; + } // Path-based duck typing switch (typeName.substr(1).split("/")[1]) { @@ -481,18 +495,6 @@ export const addItem = async ( } break; } - case "Keys": { - inventory.QuestKeys.push({ ItemType: typeName }); - return { - InventoryChanges: { - QuestKeys: [ - { - ItemType: typeName - } - ] - } - }; - } case "NeutralCreatures": { const horseIndex = inventory.Horses.push({ ItemType: typeName }); return {