2024-05-04 14:44:23 +02:00
|
|
|
import { RequestHandler } from "express";
|
2024-06-02 17:37:09 +02:00
|
|
|
import { MinItem, warframes, weapons, items, getEnglishString } from "@/src/services/itemDataService";
|
2024-06-01 12:57:27 +02:00
|
|
|
import badItems from "@/static/json/exclude-mods.json";
|
2024-06-02 17:37:09 +02:00
|
|
|
import ExportArcanes from "@/node_modules/warframe-public-export-plus/ExportArcanes.json";
|
2024-05-04 14:44:23 +02:00
|
|
|
|
|
|
|
interface ListedItem {
|
|
|
|
uniqueName: string;
|
|
|
|
name: string;
|
2024-06-01 12:57:27 +02:00
|
|
|
fusionLimit?: number;
|
2024-05-04 14:44:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function reduceItems(items: MinItem[]): ListedItem[] {
|
|
|
|
return items.map((item: MinItem): ListedItem => {
|
|
|
|
return {
|
|
|
|
uniqueName: item.uniqueName,
|
2024-06-01 12:57:27 +02:00
|
|
|
name: item.name,
|
|
|
|
fusionLimit: (item as any).fusionLimit
|
2024-05-04 14:44:23 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const getItemListsController: RequestHandler = (_req, res) => {
|
2024-06-02 17:37:09 +02:00
|
|
|
const mods = reduceItems(items.filter(item => item.category == "Mods"));
|
|
|
|
for (const arcane of ExportArcanes) {
|
|
|
|
mods.push({
|
|
|
|
uniqueName: arcane.uniqueName,
|
|
|
|
name: getEnglishString(arcane.name)
|
|
|
|
});
|
|
|
|
}
|
2024-05-04 14:44:23 +02:00
|
|
|
res.json({
|
|
|
|
warframes: reduceItems(warframes),
|
2024-05-09 22:34:47 +02:00
|
|
|
weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps")),
|
2024-06-01 12:57:27 +02:00
|
|
|
miscitems: reduceItems(
|
|
|
|
items.filter(item => item.category == "Misc" || item.category == "Resources" || item.category == "Fish")
|
|
|
|
),
|
2024-06-02 17:37:09 +02:00
|
|
|
mods,
|
2024-06-01 12:57:27 +02:00
|
|
|
badItems
|
2024-05-04 14:44:23 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export { getItemListsController };
|