feat(webui): ability to add recipes via "add items"

This commit is contained in:
Sainan 2024-12-23 04:23:36 +01:00
parent 68335aa91b
commit a071496c4e
4 changed files with 53 additions and 6 deletions

8
package-lock.json generated
View File

@ -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",

View File

@ -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"

View File

@ -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<string, boolean> = {};

View File

@ -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<string, string> => {
switch (lang) {
case "de":