返回提交历史
Modified
src/controllers/custom/addMissingHelminthBlueprintsController.ts
+18
-11
XFEstudio/SpaceNinjaServer
chore: add flowers to helminth with "add missing subsumed abilities" (#4004)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4004 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: BanLanGen <200+banlangen@noreply.localhost> Co-committed-by: BanLanGen <200+banlangen@noreply.localhost>
7ab33461
代码差异
1 个文件
+18
-11
@@ -6,19 +6,26 @@ import { broadcastInventoryUpdate } from "../../services/wsService.ts";
6
6
7
7
export const addMissingHelminthBlueprintsController: RequestHandler = async (req, res) => {
8
8
const accountId = await getAccountIdForRequest(req);
9
const inventory = await getInventory(accountId, "Recipes");
10
const allHelminthRecipes = Object.keys(ExportRecipes).filter(
11
key => ExportRecipes[key].secretIngredientAction === "SIA_WARFRAME_ABILITY"
12
);
13
const inventoryHelminthRecipes = inventory.Recipes.filter(recipe =>
14
recipe.ItemType.startsWith("/Lotus/Types/Recipes/AbilityOverrides/")
15
).map(recipe => recipe.ItemType);
9
const inventory = await getInventory(accountId, "Recipes InfestedFoundry");
16
10
17
const missingHelminthRecipes = allHelminthRecipes
18
.filter(key => !inventoryHelminthRecipes.includes(key))
19
.map(ItemType => ({ ItemType, ItemCount: 1 }));
11
for (const [recipeType, recipe] of Object.entries(ExportRecipes)) {
12
if (recipe.secretIngredientAction == "SIA_WARFRAME_ABILITY") {
13
if (!inventory.Recipes.some(recipe => recipe.ItemType == recipeType)) {
14
//logger.debug(`adding recipe: ${recipeType}`);
15
addRecipes(inventory, [{ ItemType: recipeType, ItemCount: 1 }]);
20
16
21
addRecipes(inventory, missingHelminthRecipes);
17
const suitType = recipe.secretIngredients!.find(x =>
18
x.ItemType.startsWith("/Lotus/Powersuits")
19
)?.ItemType;
20
if (suitType) {
21
//logger.debug(`adding consumed suit: ${suitType}`);
22
inventory.InfestedFoundry ??= {};
23
inventory.InfestedFoundry.ConsumedSuits ??= [];
24
inventory.InfestedFoundry.ConsumedSuits.push({ s: suitType });
25
}
26
}
27
}
28
}
22
29
23
30
await inventory.save();
24
31
res.end();