返回提交历史
Modified
src/controllers/custom/getItemListsController.ts
+12
-7
XFEstudio/XFESpaceNinjaServer
chore(webui): better locale support for relics (#2764)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2764 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
01b8f7ac
代码差异
1 个文件
+12
-7
@@ -64,14 +64,14 @@ interface ItemLists {
64
64
65
65
const relicQualitySuffixes: Record<TRelicQuality, string> = {
66
66
VPQ_BRONZE: "",
67
VPQ_SILVER: " [Exceptional]",
68
VPQ_GOLD: " [Flawless]",
69
VPQ_PLATINUM: " [Radiant]"
67
VPQ_SILVER: "/Lotus/Language/Relics/VoidProjectionQuality_Silver",
68
VPQ_GOLD: "/Lotus/Language/Relics/VoidProjectionQuality_Gold",
69
VPQ_PLATINUM: "/Lotus/Language/Relics/VoidProjectionQuality_Platinum"
70
70
};
71
71
72
/*const toTitleCase = (str: string): string => {
72
const toTitleCase = (str: string): string => {
73
73
return str.replace(/[^\s-]+/g, word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase());
74
};*/
74
};
75
75
76
76
const getItemListsController: RequestHandler = (req, response) => {
77
77
const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en");
@@ -232,14 +232,19 @@ const getItemListsController: RequestHandler = (req, response) => {
232
232
}
233
233
}
234
234
for (const [uniqueName, item] of Object.entries(ExportRelics)) {
235
const qualitySuffix =
236
item.quality !== "VPQ_BRONZE"
237
? ` [${toTitleCase(getString(relicQualitySuffixes[item.quality], lang))}]`
238
: "";
239
235
240
res.miscitems.push({
236
241
uniqueName: uniqueName,
237
242
name:
238
243
getString("/Lotus/Language/Relics/VoidProjectionName", lang)
239
244
.split("|ERA|")
240
.join(item.era)
245
.join(getString(`/Lotus/Language/Relics/Era_${item.era.toUpperCase()}`, lang))
241
246
.split("|CATEGORY|")
242
.join(item.category) + relicQualitySuffixes[item.quality]
247
.join(item.category) + qualitySuffix
243
248
});
244
249
}
245
250
for (const [uniqueName, item] of Object.entries(ExportGear)) {