fix: remove legendary core from inventory when it was used

This commit is contained in:
Sainan 2025-01-19 02:35:02 +01:00
parent d25a969269
commit 490047a652

View File

@ -2,7 +2,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers";
import { getAccountIdForRequest } from "@/src/services/loginService"; import { getAccountIdForRequest } from "@/src/services/loginService";
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { ICrewShipSalvagedWeaponSkin } from "@/src/types/inventoryTypes/inventoryTypes"; import { ICrewShipSalvagedWeaponSkin } from "@/src/types/inventoryTypes/inventoryTypes";
import { getInventory } from "@/src/services/inventoryService"; import { addMods, getInventory } from "@/src/services/inventoryService";
import { config } from "@/src/services/configService"; import { config } from "@/src/services/configService";
export const artifactsController: RequestHandler = async (req, res) => { export const artifactsController: RequestHandler = async (req, res) => {
@ -48,6 +48,15 @@ export const artifactsController: RequestHandler = async (req, res) => {
inventory.FusionPoints -= FusionPointCost; inventory.FusionPoints -= FusionPointCost;
} }
if (artifactsData.LegendaryFusion) {
addMods(inventory, [
{
ItemType: "/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser",
ItemCount: -1
}
]);
}
const changedInventory = await inventory.save(); const changedInventory = await inventory.save();
const itemId = changedInventory.toJSON().Upgrades[itemIndex]?.ItemId?.$oid; const itemId = changedInventory.toJSON().Upgrades[itemIndex]?.ItemId?.$oid;
@ -63,4 +72,5 @@ interface IArtifactsRequest {
LevelDiff: number; LevelDiff: number;
Cost: number; Cost: number;
FusionPointCost: number; FusionPointCost: number;
LegendaryFusion?: boolean;
} }