2024-05-04 14:44:23 +02:00
|
|
|
import { RequestHandler } from "express";
|
2024-12-23 14:37:21 +01:00
|
|
|
import { getDict, getItemName, getString } from "@/src/services/itemDataService";
|
2024-06-20 21:22:01 +02:00
|
|
|
import {
|
|
|
|
ExportArcanes,
|
2025-01-20 12:19:32 +01:00
|
|
|
ExportAvionics,
|
2024-06-20 21:22:01 +02:00
|
|
|
ExportGear,
|
2024-12-23 14:37:21 +01:00
|
|
|
ExportRecipes,
|
2024-06-20 21:22:01 +02:00
|
|
|
ExportResources,
|
2025-01-19 15:03:34 +01:00
|
|
|
ExportSentinels,
|
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-06-30 13:13:26 +02:00
|
|
|
import archonCrystalUpgrades from "@/static/fixed_responses/webuiArchonCrystalUpgrades.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;
|
2025-01-19 15:03:34 +01:00
|
|
|
exalted?: string[];
|
2024-05-04 14:44:23 +02:00
|
|
|
}
|
|
|
|
|
2025-01-19 12:29:32 +01:00
|
|
|
const getItemListsController: RequestHandler = (req, response) => {
|
2024-12-22 20:38:50 +01:00
|
|
|
const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en");
|
2025-01-19 12:29:32 +01:00
|
|
|
const res: Record<string, ListedItem[]> = {};
|
|
|
|
res.LongGuns = [];
|
|
|
|
res.Melee = [];
|
2025-01-19 15:03:34 +01:00
|
|
|
res.ModularParts = [];
|
|
|
|
res.Pistols = [];
|
|
|
|
res.Sentinels = [];
|
|
|
|
res.SentinelWeapons = [];
|
|
|
|
res.SpaceGuns = [];
|
|
|
|
res.SpaceMelee = [];
|
|
|
|
res.SpaceSuits = [];
|
|
|
|
res.Suits = [];
|
2025-01-19 12:29:32 +01:00
|
|
|
res.miscitems = [];
|
2025-01-19 15:03:34 +01:00
|
|
|
for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
|
|
|
|
if (item.productCategory == "Suits" || item.productCategory == "SpaceSuits") {
|
|
|
|
res[item.productCategory].push({
|
|
|
|
uniqueName,
|
|
|
|
name: getString(item.name, lang),
|
|
|
|
exalted: item.exalted
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportSentinels)) {
|
|
|
|
if (item.productCategory == "Sentinels") {
|
|
|
|
res[item.productCategory].push({
|
|
|
|
uniqueName,
|
|
|
|
name: getString(item.name, lang)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2024-06-18 23:10:26 +02:00
|
|
|
for (const [uniqueName, item] of Object.entries(ExportWeapons)) {
|
2025-01-19 15:03:34 +01:00
|
|
|
if (
|
|
|
|
uniqueName.split("/")[4] == "OperatorAmplifiers" ||
|
|
|
|
uniqueName.split("/")[5] == "SUModularSecondarySet1" ||
|
|
|
|
uniqueName.split("/")[5] == "SUModularPrimarySet1" ||
|
|
|
|
uniqueName.split("/")[5] == "InfKitGun" ||
|
|
|
|
uniqueName.split("/")[5] == "HoverboardParts"
|
|
|
|
) {
|
|
|
|
res.ModularParts.push({
|
|
|
|
uniqueName,
|
|
|
|
name: getString(item.name, lang)
|
|
|
|
});
|
|
|
|
if (uniqueName.split("/")[5] != "SentTrainingAmplifier") {
|
|
|
|
res.miscitems.push({
|
|
|
|
uniqueName: "MiscItems:" + uniqueName,
|
|
|
|
name: getString(item.name, lang)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else if (item.totalDamage !== 0) {
|
2025-01-19 12:29:32 +01:00
|
|
|
if (
|
|
|
|
item.productCategory == "LongGuns" ||
|
|
|
|
item.productCategory == "Pistols" ||
|
2025-01-19 15:03:34 +01:00
|
|
|
item.productCategory == "Melee" ||
|
|
|
|
item.productCategory == "SpaceGuns" ||
|
|
|
|
item.productCategory == "SpaceMelee" ||
|
|
|
|
item.productCategory == "SentinelWeapons"
|
2025-01-19 12:29:32 +01:00
|
|
|
) {
|
|
|
|
res[item.productCategory].push({
|
2024-06-18 23:10:26 +02:00
|
|
|
uniqueName,
|
2024-12-22 20:38:50 +01:00
|
|
|
name: getString(item.name, lang)
|
2024-06-18 23:10:26 +02:00
|
|
|
});
|
|
|
|
}
|
2025-01-19 12:29:32 +01:00
|
|
|
} else if (!item.excludeFromCodex) {
|
|
|
|
res.miscitems.push({
|
|
|
|
uniqueName: "MiscItems:" + uniqueName,
|
|
|
|
name: getString(item.name, lang)
|
|
|
|
});
|
2024-06-18 23:10:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportResources)) {
|
2025-01-05 02:43:22 +01:00
|
|
|
let name = getString(item.name, lang);
|
|
|
|
if ("dissectionParts" in item) {
|
|
|
|
name = getString("/Lotus/Language/Fish/FishDisplayName", lang).split("|FISH_NAME|").join(name);
|
|
|
|
if (uniqueName.indexOf("Large") != -1) {
|
|
|
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeLargeAbbrev", lang));
|
|
|
|
} else if (uniqueName.indexOf("Medium") != -1) {
|
|
|
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeMediumAbbrev", lang));
|
|
|
|
} else {
|
|
|
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang));
|
|
|
|
}
|
|
|
|
}
|
2025-01-19 12:29:32 +01:00
|
|
|
res.miscitems.push({
|
2024-10-12 23:51:45 +02:00
|
|
|
uniqueName: item.productCategory + ":" + uniqueName,
|
2025-01-05 02:43:22 +01:00
|
|
|
name: name
|
2024-06-20 21:22:01 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportGear)) {
|
2025-01-19 12:29:32 +01:00
|
|
|
res.miscitems.push({
|
2024-06-20 21:22:01 +02:00
|
|
|
uniqueName: "Consumables:" + uniqueName,
|
2024-12-22 20:38:50 +01:00
|
|
|
name: getString(item.name, lang)
|
2024-06-18 23:10:26 +02:00
|
|
|
});
|
|
|
|
}
|
2024-12-23 14:37:21 +01:00
|
|
|
const recipeNameTemplate = getString("/Lotus/Language/Items/BlueprintAndItem", lang);
|
|
|
|
for (const [uniqueName, item] of Object.entries(ExportRecipes)) {
|
2024-12-31 01:40:32 +01:00
|
|
|
if (!item.hidden) {
|
2024-12-23 14:37:21 +01:00
|
|
|
const resultName = getItemName(item.resultType);
|
|
|
|
if (resultName) {
|
2025-01-19 12:29:32 +01:00
|
|
|
res.miscitems.push({
|
2024-12-23 14:37:21 +01:00
|
|
|
uniqueName: "Recipes:" + uniqueName,
|
|
|
|
name: recipeNameTemplate.replace("|ITEM|", getString(resultName, lang))
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-18 23:10:26 +02:00
|
|
|
|
2025-01-19 12:29:32 +01:00
|
|
|
res.mods = [];
|
2024-06-22 03:01:37 +02:00
|
|
|
const badItems: Record<string, boolean> = {};
|
|
|
|
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
2025-01-19 12:29:32 +01:00
|
|
|
res.mods.push({
|
2024-06-22 23:25:17 +02:00
|
|
|
uniqueName,
|
2024-12-22 20:38:50 +01:00
|
|
|
name: getString(upgrade.name, lang),
|
2024-06-22 23:25:17 +02:00
|
|
|
fusionLimit: upgrade.fusionLimit
|
|
|
|
});
|
2024-06-22 03:01:37 +02:00
|
|
|
if (upgrade.isStarter || upgrade.isFrivolous || upgrade.upgradeEntries) {
|
|
|
|
badItems[uniqueName] = true;
|
|
|
|
}
|
|
|
|
}
|
2025-01-20 12:19:32 +01:00
|
|
|
for (const [uniqueName, upgrade] of Object.entries(ExportAvionics)) {
|
|
|
|
res.mods.push({
|
|
|
|
uniqueName,
|
|
|
|
name: getString(upgrade.name, lang),
|
|
|
|
fusionLimit: upgrade.fusionLimit
|
|
|
|
});
|
|
|
|
}
|
2024-06-22 23:25:17 +02:00
|
|
|
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
2025-01-19 12:29:32 +01:00
|
|
|
res.mods.push({
|
2024-06-22 23:25:17 +02:00
|
|
|
uniqueName,
|
2024-12-22 20:38:50 +01:00
|
|
|
name: getString(arcane.name, lang)
|
2024-06-22 23:25:17 +02:00
|
|
|
});
|
2024-07-14 23:52:42 +02:00
|
|
|
if (arcane.isFrivolous) {
|
|
|
|
badItems[uniqueName] = true;
|
|
|
|
}
|
2024-06-22 23:25:17 +02:00
|
|
|
}
|
2024-06-22 03:01:37 +02:00
|
|
|
|
2025-01-19 12:29:32 +01:00
|
|
|
response.json({
|
2024-06-30 13:13:26 +02:00
|
|
|
badItems,
|
2025-01-19 12:29:32 +01:00
|
|
|
archonCrystalUpgrades,
|
|
|
|
...res
|
2024-05-04 14:44:23 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export { getItemListsController };
|