From 4d88776bc9fd0f74366f43fa440d04dfd33b00f9 Mon Sep 17 00:00:00 2001 From: Master Date: Sat, 29 Jun 2024 14:18:48 +0800 Subject: [PATCH] fix VorBoltRemoverFakeItem --- src/services/inventoryService.ts | 50 ++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index b1ab7d27..4bf3c695 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -30,7 +30,16 @@ import { logger } from "@/src/utils/logger"; import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService"; import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes"; import { IEquipmentClient, IEquipmentDatabase } from "../types/inventoryTypes/commonInventoryTypes"; -import { ExportArcanes, ExportCustoms, ExportFlavour, ExportFusionBundles, ExportRecipes, ExportResources, ExportSentinels, ExportUpgrades } from "warframe-public-export-plus"; +import { + ExportArcanes, + ExportCustoms, + ExportFlavour, + ExportFusionBundles, + ExportRecipes, + ExportResources, + ExportSentinels, + ExportUpgrades +} from "warframe-public-export-plus"; import { updateQuestKeys } from "./questService"; import { toOid } from "../helpers/inventoryHelpers"; @@ -72,6 +81,8 @@ export const getInventory = async (accountOwnerId: string) => { return inventory; }; +export const miscItems = ["/Lotus/Types/Recipes/Components/VorBoltRemoverFakeItem"]; + export const addItem = async ( accountId: string, typeName: string, @@ -175,7 +186,7 @@ export const addItem = async ( } }; } - + if (typeName in ExportFusionBundles) { const inventory = await getInventory(accountId); inventory.FusionPoints += ExportFusionBundles[typeName].fusionPoints; @@ -339,7 +350,8 @@ export const addItem = async ( } } } - case "Restoratives": // Codex Scanner, Remote Observer, Starburst + case "Restoratives": { + // Codex Scanner, Remote Observer, Starburst const inventory = await getInventory(accountId); const consumablesChanges = [ { @@ -354,9 +366,26 @@ export const addItem = async ( Consumables: consumablesChanges } }; + } } break; } + if (typeName in miscItems) { + const miscItemChanges = [ + { + ItemType: typeName, + ItemCount: quantity + } satisfies IMiscItem + ]; + const inventory = await getInventory(accountId); + addMiscItems(inventory, miscItemChanges); + await inventory.save(); + return { + InventoryChanges: { + MiscItems: miscItemChanges + } + }; + } const errorMessage = `unable to add item: ${typeName}`; logger.error(errorMessage); throw new Error(errorMessage); @@ -725,8 +754,17 @@ const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Comple const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const; export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => { - const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, FusionPoints, Consumables, Recipes, Missions, QuestKeys } = - data; + const { + RawUpgrades, + MiscItems, + RegularCredits, + ChallengeProgress, + FusionPoints, + Consumables, + Recipes, + Missions, + QuestKeys + } = data; const inventory = await getInventory(accountId); // credits @@ -781,7 +819,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques if (Missions) { addMissionComplete(inventory, Missions); } - if(QuestKeys) { + if (QuestKeys) { await updateQuestKeys(inventory, QuestKeys); }