XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

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

77c75220
Sainan <sainan@calamity.inc>
提交于

代码差异

4 个文件 +53 -6
Modified package-lock.json +4 -4
@@ -12,7 +12,7 @@
12 12 "copyfiles": "^2.4.1",
13 13 "express": "^5",
14 14 "mongoose": "^8.9.2",
15 "warframe-public-export-plus": "^0.5.11",
15 "warframe-public-export-plus": "^0.5.13",
16 16 "warframe-riven-info": "^0.1.2",
17 17 "winston": "^3.17.0",
18 18 "winston-daily-rotate-file": "^5.0.0"
@@ -3877,9 +3877,9 @@
3877 3877 }
3878 3878 },
3879 3879 "node_modules/warframe-public-export-plus": {
3880 "version": "0.5.11",
3881 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.11.tgz",
3882 "integrity": "sha512-NJx5l6FsC8rwh9KcWrvu3Owvxtw6DFuk1ZEfsCXl5OGhnyqdd/9U0K9kDY+5T8aIoad7/7ftU1PmbVu4KOKGTA=="
3880 "version": "0.5.13",
3881 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.13.tgz",
3882 "integrity": "sha512-iyiaEsgZGQMU29jDag+Pq1z2q0/Zj4bCzTMtoZCSFtNUiZOPYwzjBmbYsDN0FO/yUoHu2dboW0lEYsdaofTEDQ=="
3883 3883 },
3884 3884 "node_modules/warframe-riven-info": {
3885 3885 "version": "0.1.2",
Modified package.json +1 -1
@@ -16,7 +16,7 @@
16 16 "copyfiles": "^2.4.1",
17 17 "express": "^5",
18 18 "mongoose": "^8.9.2",
19 "warframe-public-export-plus": "^0.5.11",
19 "warframe-public-export-plus": "^0.5.13",
20 20 "warframe-riven-info": "^0.1.2",
21 21 "winston": "^3.17.0",
22 22 "winston-daily-rotate-file": "^5.0.0"
Modified src/controllers/custom/getItemListsController.ts +14 -1
@@ -1,8 +1,9 @@
1 1 import { RequestHandler } from "express";
2 import { getDict, getString } from "@/src/services/itemDataService";
2 import { getDict, getItemName, getString } from "@/src/services/itemDataService";
3 3 import {
4 4 ExportArcanes,
5 5 ExportGear,
6 ExportRecipes,
6 7 ExportResources,
7 8 ExportUpgrades,
8 9 ExportWarframes,
@@ -47,6 +48,18 @@ const getItemListsController: RequestHandler = (req, res) => {
47 48 name: getString(item.name, lang)
48 49 });
49 50 }
51 const recipeNameTemplate = getString("/Lotus/Language/Items/BlueprintAndItem", lang);
52 for (const [uniqueName, item] of Object.entries(ExportRecipes)) {
53 if (!item.secretIngredientAction) {
54 const resultName = getItemName(item.resultType);
55 if (resultName) {
56 miscitems.push({
57 uniqueName: "Recipes:" + uniqueName,
58 name: recipeNameTemplate.replace("|ITEM|", getString(resultName, lang))
59 });
60 }
61 }
62 }
50 63
51 64 const mods: ListedItem[] = [];
52 65 const badItems: Record<string, boolean> = {};
Modified src/services/itemDataService.ts +34 -0
@@ -16,7 +16,13 @@ import {
16 16 dict_tr,
17 17 dict_uk,
18 18 dict_zh,
19 ExportArcanes,
20 ExportCustoms,
21 ExportGear,
22 ExportKeys,
19 23 ExportRecipes,
24 ExportResources,
25 ExportSentinels,
20 26 ExportWarframes,
21 27 ExportWeapons,
22 28 IPowersuit,
@@ -84,6 +90,34 @@ export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined
84 90 return ExportWarframes[uniqueName];
85 91 };
86 92
93 export const getItemName = (uniqueName: string): string | undefined => {
94 if (uniqueName in ExportArcanes) {
95 return ExportArcanes[uniqueName].name;
96 }
97 if (uniqueName in ExportCustoms) {
98 return ExportCustoms[uniqueName].name;
99 }
100 if (uniqueName in ExportKeys) {
101 return ExportKeys[uniqueName].name;
102 }
103 if (uniqueName in ExportGear) {
104 return ExportGear[uniqueName].name;
105 }
106 if (uniqueName in ExportResources) {
107 return ExportResources[uniqueName].name;
108 }
109 if (uniqueName in ExportSentinels) {
110 return ExportSentinels[uniqueName].name;
111 }
112 if (uniqueName in ExportWarframes) {
113 return ExportWarframes[uniqueName].name;
114 }
115 if (uniqueName in ExportWeapons) {
116 return ExportWeapons[uniqueName].name;
117 }
118 return undefined;
119 };
120
87 121 export const getDict = (lang: string): Record<string, string> => {
88 122 switch (lang) {
89 123 case "de":