2024-05-04 14:44:23 +02:00
|
|
|
import { RequestHandler } from "express";
|
2024-06-22 23:25:17 +02:00
|
|
|
import { getEnglishString } from "@/src/services/itemDataService";
|
2024-06-20 21:22:01 +02:00
|
|
|
import {
|
|
|
|
ExportArcanes,
|
|
|
|
ExportGear,
|
|
|
|
ExportResources,
|
2024-06-22 03:01:37 +02:00
|
|
|
ExportUpgrades,
|
2024-06-20 21:22:01 +02:00
|
|
|
ExportWarframes,
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
const getItemListsController: RequestHandler = (_req, res) => {
|
2024-06-18 23:10:26 +02:00
|
|
|
const weapons = [];
|
|
|
|
const miscitems = [];
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportWeapons)) {
|
|
|
|
if (item.productCategory !== "OperatorAmps") {
|
|
|
|
if (item.totalDamage !== 0) {
|
|
|
|
weapons.push({
|
|
|
|
uniqueName,
|
|
|
|
name: getEnglishString(item.name)
|
|
|
|
});
|
|
|
|
} else if (!item.excludeFromCodex) {
|
|
|
|
miscitems.push({
|
2024-06-20 21:22:01 +02:00
|
|
|
uniqueName: "MiscItems:" + uniqueName,
|
2024-06-18 23:10:26 +02:00
|
|
|
name: getEnglishString(item.name)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportResources)) {
|
|
|
|
miscitems.push({
|
2024-06-20 21:22:01 +02:00
|
|
|
uniqueName: "MiscItems:" + uniqueName,
|
|
|
|
name: getEnglishString(item.name)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportGear)) {
|
|
|
|
miscitems.push({
|
|
|
|
uniqueName: "Consumables:" + uniqueName,
|
2024-06-18 23:10:26 +02:00
|
|
|
name: getEnglishString(item.name)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-06-22 23:25:17 +02:00
|
|
|
const mods: ListedItem[] = [];
|
2024-06-22 03:01:37 +02:00
|
|
|
const badItems: Record<string, boolean> = {};
|
|
|
|
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
2024-06-22 23:25:17 +02:00
|
|
|
mods.push({
|
|
|
|
uniqueName,
|
|
|
|
name: getEnglishString(upgrade.name),
|
|
|
|
fusionLimit: upgrade.fusionLimit
|
|
|
|
});
|
2024-06-22 03:01:37 +02:00
|
|
|
if (upgrade.isStarter || upgrade.isFrivolous || upgrade.upgradeEntries) {
|
|
|
|
badItems[uniqueName] = true;
|
|
|
|
}
|
|
|
|
}
|
2024-06-22 23:25:17 +02:00
|
|
|
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
|
|
|
mods.push({
|
|
|
|
uniqueName,
|
|
|
|
name: getEnglishString(arcane.name)
|
|
|
|
});
|
|
|
|
}
|
2024-06-22 03:01:37 +02:00
|
|
|
|
2024-05-04 14:44:23 +02:00
|
|
|
res.json({
|
2024-06-18 23:10:26 +02:00
|
|
|
warframes: Object.entries(ExportWarframes)
|
|
|
|
.filter(([_uniqueName, warframe]) => warframe.productCategory == "Suits")
|
|
|
|
.map(([uniqueName, warframe]) => {
|
2024-06-10 14:03:03 +02:00
|
|
|
return {
|
|
|
|
uniqueName,
|
2024-06-18 23:10:26 +02:00
|
|
|
name: getEnglishString(warframe.name)
|
2024-06-10 14:03:03 +02:00
|
|
|
};
|
|
|
|
}),
|
2024-06-18 23:10:26 +02:00
|
|
|
weapons,
|
|
|
|
miscitems,
|
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 };
|