cleanup: fully switch to Public-Export+(#354)

Co-authored-by: Sainan <Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2024-06-22 23:25:17 +02:00 committed by GitHub
parent fda7b5f816
commit 93dce67037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 86 deletions

18
package-lock.json generated
View File

@ -12,7 +12,6 @@
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"express": "^5.0.0-beta.3", "express": "^5.0.0-beta.3",
"mongoose": "^8.1.1", "mongoose": "^8.1.1",
"warframe-items": "^1.1262.74",
"warframe-public-export-plus": "^0.3.0", "warframe-public-export-plus": "^0.3.0",
"warframe-riven-info": "^0.1.0", "warframe-riven-info": "^0.1.0",
"winston": "^3.11.0", "winston": "^3.11.0",
@ -3669,14 +3668,6 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/warframe-items": {
"version": "1.1262.74",
"resolved": "https://registry.npmjs.org/warframe-items/-/warframe-items-1.1262.74.tgz",
"integrity": "sha512-piS27vLxULdeXv1GZrac5Da18DavYnj99w5Pdmvlbyt/vPImq4SWq21PQwaLle1mkyEeqNjbcd3H7zh1I7eA1g==",
"peerDependencies": {
"warframe-worldstate-data": "^2"
}
},
"node_modules/warframe-public-export-plus": { "node_modules/warframe-public-export-plus": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.0.tgz", "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.0.tgz",
@ -3687,15 +3678,6 @@
"resolved": "https://registry.npmjs.org/warframe-riven-info/-/warframe-riven-info-0.1.0.tgz", "resolved": "https://registry.npmjs.org/warframe-riven-info/-/warframe-riven-info-0.1.0.tgz",
"integrity": "sha512-99e1HsGZomE1vHXat97V/eseccEnnQ1rv9vC0bdV9mig1wPdWiixHqCIpvIOBVUGKSEKuw2DJEErPD5Nxg+EsQ==" "integrity": "sha512-99e1HsGZomE1vHXat97V/eseccEnnQ1rv9vC0bdV9mig1wPdWiixHqCIpvIOBVUGKSEKuw2DJEErPD5Nxg+EsQ=="
}, },
"node_modules/warframe-worldstate-data": {
"version": "2.5.14",
"resolved": "https://registry.npmjs.org/warframe-worldstate-data/-/warframe-worldstate-data-2.5.14.tgz",
"integrity": "sha512-85UFs+kW0+rBW+fWcf8vCiLOIsTcH6ZkO8ANz7fiDTQfWdA5Y33jT2Z21RiVvtNDHDFXNrpZfpZtibJfhffdqA==",
"peer": true,
"engines": {
"node": ">=18.19.0"
}
},
"node_modules/webidl-conversions": { "node_modules/webidl-conversions": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",

View File

@ -16,7 +16,6 @@
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"express": "^5.0.0-beta.3", "express": "^5.0.0-beta.3",
"mongoose": "^8.1.1", "mongoose": "^8.1.1",
"warframe-items": "^1.1262.74",
"warframe-public-export-plus": "^0.3.0", "warframe-public-export-plus": "^0.3.0",
"warframe-riven-info": "^0.1.0", "warframe-riven-info": "^0.1.0",
"winston": "^3.11.0", "winston": "^3.11.0",

View File

@ -1,5 +1,5 @@
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { MinItem, items, getEnglishString } from "@/src/services/itemDataService"; import { getEnglishString } from "@/src/services/itemDataService";
import { import {
ExportArcanes, ExportArcanes,
ExportGear, ExportGear,
@ -15,16 +15,6 @@ interface ListedItem {
fusionLimit?: number; fusionLimit?: number;
} }
function reduceItems(items: MinItem[]): ListedItem[] {
return items.map((item: MinItem): ListedItem => {
return {
uniqueName: item.uniqueName,
name: item.name,
fusionLimit: (item as any).fusionLimit
};
});
}
const getItemListsController: RequestHandler = (_req, res) => { const getItemListsController: RequestHandler = (_req, res) => {
const weapons = []; const weapons = [];
const miscitems = []; const miscitems = [];
@ -56,20 +46,24 @@ const getItemListsController: RequestHandler = (_req, res) => {
}); });
} }
const mods = reduceItems(items.filter(item => item.category == "Mods")); const mods: ListedItem[] = [];
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
mods.push({
uniqueName: uniqueName,
name: getEnglishString(arcane.name)
});
}
const badItems: Record<string, boolean> = {}; const badItems: Record<string, boolean> = {};
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) { for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
mods.push({
uniqueName,
name: getEnglishString(upgrade.name),
fusionLimit: upgrade.fusionLimit
});
if (upgrade.isStarter || upgrade.isFrivolous || upgrade.upgradeEntries) { if (upgrade.isStarter || upgrade.isFrivolous || upgrade.upgradeEntries) {
badItems[uniqueName] = true; badItems[uniqueName] = true;
} }
} }
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
mods.push({
uniqueName,
name: getEnglishString(arcane.name)
});
}
res.json({ res.json({
warframes: Object.entries(ExportWarframes) warframes: Object.entries(ExportWarframes)

View File

@ -1,6 +1,5 @@
import { getIndexAfter } from "@/src/helpers/stringHelpers"; import { getIndexAfter } from "@/src/helpers/stringHelpers";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import Items, { MinimalItem, Warframe, Weapon } from "warframe-items";
import { import {
dict_en, dict_en,
ExportRecipes, ExportRecipes,
@ -10,10 +9,6 @@ import {
IRecipe IRecipe
} from "warframe-public-export-plus"; } from "warframe-public-export-plus";
export type MinWarframe = Omit<Warframe, "patchlogs">;
export type MinWeapon = Omit<Weapon, "patchlogs">;
export type MinItem = Omit<MinimalItem, "patchlogs">;
export type WeaponTypeInternal = export type WeaponTypeInternal =
| "LongGuns" | "LongGuns"
| "Pistols" | "Pistols"
@ -24,12 +19,6 @@ export type WeaponTypeInternal =
| "OperatorAmps" | "OperatorAmps"
| "SpecialItems"; | "SpecialItems";
export const items: MinItem[] = Array.from(new Items({ category: ["All"] }) as MinimalItem[]).map(item => {
const next = { ...item };
delete next.patchlogs;
return next;
});
export const getWeaponType = (weaponName: string): WeaponTypeInternal => { export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
const weaponInfo = ExportWeapons[weaponName]; const weaponInfo = ExportWeapons[weaponName];
@ -52,33 +41,6 @@ export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
return weaponType; return weaponType;
}; };
export const craftNames = Object.fromEntries(
(
new Items({
category: [
"Warframes",
"Gear",
"Melee",
"Primary",
"Secondary",
"Sentinels",
"Misc",
"Arch-Gun",
"Arch-Melee"
]
}) as Warframe[]
)
.flatMap(item => item.components || [])
.filter(item => item.drops && item.drops[0])
.map(item => [item.drops![0].type, item.uniqueName])
);
export const blueprintNames = Object.fromEntries(
Object.keys(craftNames)
.filter(name => name.includes("Blueprint"))
.map(name => [name, craftNames[name]])
);
export const getRecipe = (uniqueName: string): IRecipe | undefined => { export const getRecipe = (uniqueName: string): IRecipe | undefined => {
return ExportRecipes[uniqueName]; return ExportRecipes[uniqueName];
}; };
@ -113,16 +75,6 @@ export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined
return ExportWarframes[uniqueName]; return ExportWarframes[uniqueName];
}; };
export const getItemByUniqueName = (uniqueName: string) => {
const item = items.find(item => item.uniqueName === uniqueName);
return item;
};
export const getItemByName = (name: string) => {
const item = items.find(item => item.name === name);
return item;
};
export const getEnglishString = (key: string): string => { export const getEnglishString = (key: string): string => {
return dict_en[key] ?? key; return dict_en[key] ?? key;
}; };