2024-05-04 14:44:23 +02:00
|
|
|
import { RequestHandler } from "express";
|
2024-06-10 14:03:03 +02:00
|
|
|
import { MinItem, MinWeapon, warframes, items, getEnglishString } from "@/src/services/itemDataService";
|
2024-06-01 12:57:27 +02:00
|
|
|
import badItems from "@/static/json/exclude-mods.json";
|
2024-06-10 14:03:03 +02:00
|
|
|
import { ExportArcanes, ExportWeapons } from "warframe-public-export-plus";
|
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"));
|
2024-06-10 14:03:03 +02:00
|
|
|
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
2024-06-02 17:37:09 +02:00
|
|
|
mods.push({
|
2024-06-10 14:03:03 +02:00
|
|
|
uniqueName: uniqueName,
|
2024-06-02 17:37:09 +02:00
|
|
|
name: getEnglishString(arcane.name)
|
|
|
|
});
|
|
|
|
}
|
2024-05-04 14:44:23 +02:00
|
|
|
res.json({
|
|
|
|
warframes: reduceItems(warframes),
|
2024-06-10 14:03:03 +02:00
|
|
|
weapons: Object.entries(ExportWeapons)
|
|
|
|
.filter(([_uniqueName, weapon]) => weapon.productCategory !== "OperatorAmps" && weapon.totalDamage !== 0)
|
|
|
|
.map(([uniqueName, weapon]) => {
|
|
|
|
return {
|
|
|
|
uniqueName,
|
|
|
|
name: getEnglishString(weapon.name)
|
|
|
|
};
|
|
|
|
}),
|
2024-06-01 12:57:27 +02:00
|
|
|
miscitems: reduceItems(
|
2024-06-06 14:23:46 +02:00
|
|
|
items.filter(
|
|
|
|
item =>
|
|
|
|
item.category == "Misc" ||
|
|
|
|
item.category == "Resources" ||
|
|
|
|
item.category == "Fish" ||
|
2024-06-18 02:03:07 +02:00
|
|
|
((item as any).productCategory == "Pistols" &&
|
|
|
|
(item as MinWeapon).totalDamage == 0 &&
|
|
|
|
!item.excludeFromCodex) // exclude Zaw Strike PvP variant
|
2024-06-06 14:23:46 +02:00
|
|
|
)
|
2024-06-01 12:57:27 +02:00
|
|
|
),
|
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 };
|