chore: update warframe-public-export-plus to 0.2.0

This commit is contained in:
Sainan 2024-06-07 14:27:50 +02:00
parent 656e70227c
commit 6ca887fc7b
4 changed files with 21 additions and 12 deletions

8
package-lock.json generated
View File

@ -13,7 +13,7 @@
"express": "^5.0.0-beta.3",
"mongoose": "^8.1.1",
"warframe-items": "^1.1262.74",
"warframe-public-export-plus": "^0.1.0",
"warframe-public-export-plus": "^0.2.0",
"warframe-riven-info": "^0.1.0",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1"
@ -3895,9 +3895,9 @@
}
},
"node_modules/warframe-public-export-plus": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.1.0.tgz",
"integrity": "sha512-a76Be2pwPjKrin67zMux5L9U6zt9bhEtyy723tM2czGGcOZYWp1XdCZY684q3zPytWS0SmEia0C/h/4EiadBnQ=="
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.2.0.tgz",
"integrity": "sha512-JkTpkOzFWmjaK10H3CphGz4f6IAdH5higF9jyyTBbBD97U21C+3u9OGAoWav5CO8ydR2hLezcyOyRaqBAf4Abg=="
},
"node_modules/warframe-riven-info": {
"version": "0.1.0",

View File

@ -17,7 +17,7 @@
"express": "^5.0.0-beta.3",
"mongoose": "^8.1.1",
"warframe-items": "^1.1262.74",
"warframe-public-export-plus": "^0.1.0",
"warframe-public-export-plus": "^0.2.0",
"warframe-riven-info": "^0.1.0",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1"

View File

@ -21,9 +21,9 @@ function reduceItems(items: MinItem[]): ListedItem[] {
const getItemListsController: RequestHandler = (_req, res) => {
const mods = reduceItems(items.filter(item => item.category == "Mods"));
for (const arcane of ExportArcanes) {
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
mods.push({
uniqueName: arcane.uniqueName,
uniqueName: uniqueName,
name: getEnglishString(arcane.name)
});
}

View File

@ -3,7 +3,7 @@ import { logger } from "@/src/utils/logger";
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
import badItems from "@/static/json/exclude-mods.json";
import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
import exportSuits from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
import ExportWarframes from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
export type MinWarframe = Omit<Warframe, "patchlogs">;
export type MinWeapon = Omit<Weapon, "patchlogs">;
@ -136,9 +136,18 @@ export const getItemCategoryByUniqueName = (uniqueName: string) => {
return category;
};
namespace PublicExportPlus {
export interface IGenericExport {
[key: string]: any;
}
export interface IDict {
[key: string]: string | undefined;
}
}
export const getSuitByUniqueName = (uniqueName: string) => {
const suit = exportSuits.find(suit => suit.uniqueName === uniqueName);
return suit;
return (ExportWarframes as PublicExportPlus.IGenericExport)[uniqueName];
};
export const getItemByUniqueName = (uniqueName: string) => {
@ -151,6 +160,6 @@ export const getItemByName = (name: string) => {
return item;
};
export const getEnglishString = (key: string) => {
return dict_en[key as keyof typeof dict_en] ?? key;
export const getEnglishString = (key: string): string => {
return (dict_en as PublicExportPlus.IDict)[key] ?? key;
};