Closes #1984 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: #2287 Reviewed-by: Sainan <sainan@calamity.inc> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
import { getInventory, addRecipes } from "@/src/services/inventoryService";
|
|
import { RequestHandler } from "express";
|
|
import { ExportRecipes } from "warframe-public-export-plus";
|
|
|
|
export const addMissingHelminthBlueprintsController: RequestHandler = async (req, res) => {
|
|
const accountId = await getAccountIdForRequest(req);
|
|
const inventory = await getInventory(accountId, "Recipes");
|
|
const allHelminthRecipes = Object.keys(ExportRecipes).filter(
|
|
key => ExportRecipes[key].secretIngredientAction === "SIA_WARFRAME_ABILITY"
|
|
);
|
|
const inventoryHelminthRecipes = inventory.Recipes.filter(recipe =>
|
|
recipe.ItemType.startsWith("/Lotus/Types/Recipes/AbilityOverrides/")
|
|
).map(recipe => recipe.ItemType);
|
|
|
|
const missingHelminthRecipes = allHelminthRecipes
|
|
.filter(key => !inventoryHelminthRecipes.includes(key))
|
|
.map(ItemType => ({ ItemType, ItemCount: 1 }));
|
|
|
|
addRecipes(inventory, missingHelminthRecipes);
|
|
|
|
await inventory.save();
|
|
res.end();
|
|
};
|