From 77c7522023b21ad9fa5d5a77d816d8a4f213b604 Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 23 Dec 2024 14:37:21 +0100 Subject: [PATCH] feat(webui): ability to add recipes via "add items" (#617) --- package-lock.json | 8 ++--- package.json | 2 +- .../custom/getItemListsController.ts | 15 +++++++- src/services/itemDataService.ts | 34 +++++++++++++++++++ 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 36b5e4af..fd1ea230 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "copyfiles": "^2.4.1", "express": "^5", "mongoose": "^8.9.2", - "warframe-public-export-plus": "^0.5.11", + "warframe-public-export-plus": "^0.5.13", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0" @@ -3877,9 +3877,9 @@ } }, "node_modules/warframe-public-export-plus": { - "version": "0.5.11", - "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.11.tgz", - "integrity": "sha512-NJx5l6FsC8rwh9KcWrvu3Owvxtw6DFuk1ZEfsCXl5OGhnyqdd/9U0K9kDY+5T8aIoad7/7ftU1PmbVu4KOKGTA==" + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.13.tgz", + "integrity": "sha512-iyiaEsgZGQMU29jDag+Pq1z2q0/Zj4bCzTMtoZCSFtNUiZOPYwzjBmbYsDN0FO/yUoHu2dboW0lEYsdaofTEDQ==" }, "node_modules/warframe-riven-info": { "version": "0.1.2", diff --git a/package.json b/package.json index 5fa9a44e..d0941590 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "copyfiles": "^2.4.1", "express": "^5", "mongoose": "^8.9.2", - "warframe-public-export-plus": "^0.5.11", + "warframe-public-export-plus": "^0.5.13", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0" diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 914bd5cc..e3fa95a1 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -1,8 +1,9 @@ import { RequestHandler } from "express"; -import { getDict, getString } from "@/src/services/itemDataService"; +import { getDict, getItemName, getString } from "@/src/services/itemDataService"; import { ExportArcanes, ExportGear, + ExportRecipes, ExportResources, ExportUpgrades, ExportWarframes, @@ -47,6 +48,18 @@ const getItemListsController: RequestHandler = (req, res) => { name: getString(item.name, lang) }); } + const recipeNameTemplate = getString("/Lotus/Language/Items/BlueprintAndItem", lang); + for (const [uniqueName, item] of Object.entries(ExportRecipes)) { + if (!item.secretIngredientAction) { + const resultName = getItemName(item.resultType); + if (resultName) { + miscitems.push({ + uniqueName: "Recipes:" + uniqueName, + name: recipeNameTemplate.replace("|ITEM|", getString(resultName, lang)) + }); + } + } + } const mods: ListedItem[] = []; const badItems: Record = {}; diff --git a/src/services/itemDataService.ts b/src/services/itemDataService.ts index ca9c0b0b..b1c8be02 100644 --- a/src/services/itemDataService.ts +++ b/src/services/itemDataService.ts @@ -16,7 +16,13 @@ import { dict_tr, dict_uk, dict_zh, + ExportArcanes, + ExportCustoms, + ExportGear, + ExportKeys, ExportRecipes, + ExportResources, + ExportSentinels, ExportWarframes, ExportWeapons, IPowersuit, @@ -84,6 +90,34 @@ export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined return ExportWarframes[uniqueName]; }; +export const getItemName = (uniqueName: string): string | undefined => { + if (uniqueName in ExportArcanes) { + return ExportArcanes[uniqueName].name; + } + if (uniqueName in ExportCustoms) { + return ExportCustoms[uniqueName].name; + } + if (uniqueName in ExportKeys) { + return ExportKeys[uniqueName].name; + } + if (uniqueName in ExportGear) { + return ExportGear[uniqueName].name; + } + if (uniqueName in ExportResources) { + return ExportResources[uniqueName].name; + } + if (uniqueName in ExportSentinels) { + return ExportSentinels[uniqueName].name; + } + if (uniqueName in ExportWarframes) { + return ExportWarframes[uniqueName].name; + } + if (uniqueName in ExportWeapons) { + return ExportWeapons[uniqueName].name; + } + return undefined; +}; + export const getDict = (lang: string): Record => { switch (lang) { case "de":