fix VorBoltRemoverFakeItem

This commit is contained in:
Master 2024-06-29 14:18:48 +08:00
parent 013fdb5cf7
commit 4d88776bc9

View File

@ -30,7 +30,16 @@ import { logger } from "@/src/utils/logger";
import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService"; import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService";
import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes"; import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes";
import { IEquipmentClient, IEquipmentDatabase } from "../types/inventoryTypes/commonInventoryTypes"; 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 { updateQuestKeys } from "./questService";
import { toOid } from "../helpers/inventoryHelpers"; import { toOid } from "../helpers/inventoryHelpers";
@ -72,6 +81,8 @@ export const getInventory = async (accountOwnerId: string) => {
return inventory; return inventory;
}; };
export const miscItems = ["/Lotus/Types/Recipes/Components/VorBoltRemoverFakeItem"];
export const addItem = async ( export const addItem = async (
accountId: string, accountId: string,
typeName: string, typeName: string,
@ -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 inventory = await getInventory(accountId);
const consumablesChanges = [ const consumablesChanges = [
{ {
@ -354,9 +366,26 @@ export const addItem = async (
Consumables: consumablesChanges Consumables: consumablesChanges
} }
}; };
}
} }
break; 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}`; const errorMessage = `unable to add item: ${typeName}`;
logger.error(errorMessage); logger.error(errorMessage);
throw new Error(errorMessage); throw new Error(errorMessage);
@ -725,8 +754,17 @@ const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Comple
const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const; const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const;
export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => { export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, FusionPoints, Consumables, Recipes, Missions, QuestKeys } = const {
data; RawUpgrades,
MiscItems,
RegularCredits,
ChallengeProgress,
FusionPoints,
Consumables,
Recipes,
Missions,
QuestKeys
} = data;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
// credits // credits
@ -781,7 +819,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
if (Missions) { if (Missions) {
addMissionComplete(inventory, Missions); addMissionComplete(inventory, Missions);
} }
if(QuestKeys) { if (QuestKeys) {
await updateQuestKeys(inventory, QuestKeys); await updateQuestKeys(inventory, QuestKeys);
} }