add getDefaultUpgrades
This commit is contained in:
parent
675d445b93
commit
7106a60c64
@ -11,8 +11,8 @@ import {
|
|||||||
occupySlot,
|
occupySlot,
|
||||||
productCategoryToInventoryBin
|
productCategoryToInventoryBin
|
||||||
} from "@/src/services/inventoryService";
|
} from "@/src/services/inventoryService";
|
||||||
import { ExportWeapons } from "warframe-public-export-plus";
|
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
|
import { getDefaultUpgrades } from "@/src/services/itemDataService";
|
||||||
|
|
||||||
const modularWeaponTypes: Record<string, TEquipmentKey> = {
|
const modularWeaponTypes: Record<string, TEquipmentKey> = {
|
||||||
"/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary": "LongGuns",
|
"/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary": "LongGuns",
|
||||||
@ -46,8 +46,7 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
|
|||||||
const category = modularWeaponTypes[data.WeaponType];
|
const category = modularWeaponTypes[data.WeaponType];
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
const configs = applyDefaultUpgrades(inventory, getDefaultUpgrades(data.Parts));
|
||||||
const configs = applyDefaultUpgrades(inventory, ExportWeapons[data.Parts[0]]?.defaultUpgrades);
|
|
||||||
|
|
||||||
// Give weapon
|
// Give weapon
|
||||||
const inventoryChanges: IInventoryChanges = {
|
const inventoryChanges: IInventoryChanges = {
|
||||||
|
@ -29,6 +29,7 @@ import {
|
|||||||
ExportSentinels,
|
ExportSentinels,
|
||||||
ExportWarframes,
|
ExportWarframes,
|
||||||
ExportWeapons,
|
ExportWeapons,
|
||||||
|
IDefaultUpgrade,
|
||||||
IInboxMessage,
|
IInboxMessage,
|
||||||
IMissionReward,
|
IMissionReward,
|
||||||
IPowersuit,
|
IPowersuit,
|
||||||
@ -256,3 +257,15 @@ export const toStoreItem = (type: string): string => {
|
|||||||
export const fromStoreItem = (type: string): string => {
|
export const fromStoreItem = (type: string): string => {
|
||||||
return "/Lotus/" + type.substring("/Lotus/StoreItems/".length);
|
return "/Lotus/" + type.substring("/Lotus/StoreItems/".length);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getDefaultUpgrades = (parts: string[]): IDefaultUpgrade[] | undefined => {
|
||||||
|
const allDefaultUpgrades: IDefaultUpgrade[] = [];
|
||||||
|
for (const part of parts) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
|
const defaultUpgrades = ExportWeapons[part]?.defaultUpgrades;
|
||||||
|
if (defaultUpgrades) {
|
||||||
|
allDefaultUpgrades.push(...defaultUpgrades);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allDefaultUpgrades.length == 0 ? undefined : allDefaultUpgrades;
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user