forked from OpenWF/SpaceNinjaServer
cleanup: fully switch to Public-Export+(#354)
Co-authored-by: Sainan <Sainan@users.noreply.github.com>
This commit is contained in:
parent
fda7b5f816
commit
93dce67037
18
package-lock.json
generated
18
package-lock.json
generated
@ -12,7 +12,6 @@
|
||||
"copyfiles": "^2.4.1",
|
||||
"express": "^5.0.0-beta.3",
|
||||
"mongoose": "^8.1.1",
|
||||
"warframe-items": "^1.1262.74",
|
||||
"warframe-public-export-plus": "^0.3.0",
|
||||
"warframe-riven-info": "^0.1.0",
|
||||
"winston": "^3.11.0",
|
||||
@ -3669,14 +3668,6 @@
|
||||
"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": {
|
||||
"version": "0.3.0",
|
||||
"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",
|
||||
"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": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||
|
@ -16,7 +16,6 @@
|
||||
"copyfiles": "^2.4.1",
|
||||
"express": "^5.0.0-beta.3",
|
||||
"mongoose": "^8.1.1",
|
||||
"warframe-items": "^1.1262.74",
|
||||
"warframe-public-export-plus": "^0.3.0",
|
||||
"warframe-riven-info": "^0.1.0",
|
||||
"winston": "^3.11.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { MinItem, items, getEnglishString } from "@/src/services/itemDataService";
|
||||
import { getEnglishString } from "@/src/services/itemDataService";
|
||||
import {
|
||||
ExportArcanes,
|
||||
ExportGear,
|
||||
@ -15,16 +15,6 @@ interface ListedItem {
|
||||
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 weapons = [];
|
||||
const miscitems = [];
|
||||
@ -56,20 +46,24 @@ const getItemListsController: RequestHandler = (_req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
const mods = reduceItems(items.filter(item => item.category == "Mods"));
|
||||
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
||||
mods.push({
|
||||
uniqueName: uniqueName,
|
||||
name: getEnglishString(arcane.name)
|
||||
});
|
||||
}
|
||||
|
||||
const mods: ListedItem[] = [];
|
||||
const badItems: Record<string, boolean> = {};
|
||||
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) {
|
||||
badItems[uniqueName] = true;
|
||||
}
|
||||
}
|
||||
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
||||
mods.push({
|
||||
uniqueName,
|
||||
name: getEnglishString(arcane.name)
|
||||
});
|
||||
}
|
||||
|
||||
res.json({
|
||||
warframes: Object.entries(ExportWarframes)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { getIndexAfter } from "@/src/helpers/stringHelpers";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import Items, { MinimalItem, Warframe, Weapon } from "warframe-items";
|
||||
import {
|
||||
dict_en,
|
||||
ExportRecipes,
|
||||
@ -10,10 +9,6 @@ import {
|
||||
IRecipe
|
||||
} 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 =
|
||||
| "LongGuns"
|
||||
| "Pistols"
|
||||
@ -24,12 +19,6 @@ export type WeaponTypeInternal =
|
||||
| "OperatorAmps"
|
||||
| "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 => {
|
||||
const weaponInfo = ExportWeapons[weaponName];
|
||||
|
||||
@ -52,33 +41,6 @@ export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
|
||||
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 => {
|
||||
return ExportRecipes[uniqueName];
|
||||
};
|
||||
@ -113,16 +75,6 @@ export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined
|
||||
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 => {
|
||||
return dict_en[key] ?? key;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user