XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

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

Co-authored-by: Sainan <Sainan@users.noreply.github.com>

93dce670
Sainan <sainan@calamity.gg>
提交于

代码差异

4 个文件 +13 -86
Modified package-lock.json +0 -18
@@ -12,7 +12,6 @@
12 12 "copyfiles": "^2.4.1",
13 13 "express": "^5.0.0-beta.3",
14 14 "mongoose": "^8.1.1",
15 "warframe-items": "^1.1262.74",
16 15 "warframe-public-export-plus": "^0.3.0",
17 16 "warframe-riven-info": "^0.1.0",
18 17 "winston": "^3.11.0",
@@ -3669,14 +3668,6 @@
3669 3668 "node": ">= 0.8"
3670 3669 }
3671 3670 },
3672 "node_modules/warframe-items": {
3673 "version": "1.1262.74",
3674 "resolved": "https://registry.npmjs.org/warframe-items/-/warframe-items-1.1262.74.tgz",
3675 "integrity": "sha512-piS27vLxULdeXv1GZrac5Da18DavYnj99w5Pdmvlbyt/vPImq4SWq21PQwaLle1mkyEeqNjbcd3H7zh1I7eA1g==",
3676 "peerDependencies": {
3677 "warframe-worldstate-data": "^2"
3678 }
3679 },
3680 3671 "node_modules/warframe-public-export-plus": {
3681 3672 "version": "0.3.0",
3682 3673 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.0.tgz",
@@ -3687,15 +3678,6 @@
3687 3678 "resolved": "https://registry.npmjs.org/warframe-riven-info/-/warframe-riven-info-0.1.0.tgz",
3688 3679 "integrity": "sha512-99e1HsGZomE1vHXat97V/eseccEnnQ1rv9vC0bdV9mig1wPdWiixHqCIpvIOBVUGKSEKuw2DJEErPD5Nxg+EsQ=="
3689 3680 },
3690 "node_modules/warframe-worldstate-data": {
3691 "version": "2.5.14",
3692 "resolved": "https://registry.npmjs.org/warframe-worldstate-data/-/warframe-worldstate-data-2.5.14.tgz",
3693 "integrity": "sha512-85UFs+kW0+rBW+fWcf8vCiLOIsTcH6ZkO8ANz7fiDTQfWdA5Y33jT2Z21RiVvtNDHDFXNrpZfpZtibJfhffdqA==",
3694 "peer": true,
3695 "engines": {
3696 "node": ">=18.19.0"
3697 }
3698 },
3699 3681 "node_modules/webidl-conversions": {
3700 3682 "version": "7.0.0",
3701 3683 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
Modified package.json +0 -1
@@ -16,7 +16,6 @@
16 16 "copyfiles": "^2.4.1",
17 17 "express": "^5.0.0-beta.3",
18 18 "mongoose": "^8.1.1",
19 "warframe-items": "^1.1262.74",
20 19 "warframe-public-export-plus": "^0.3.0",
21 20 "warframe-riven-info": "^0.1.0",
22 21 "winston": "^3.11.0",
Modified src/controllers/custom/getItemListsController.ts +13 -19
@@ -1,5 +1,5 @@
1 1 import { RequestHandler } from "express";
2 import { MinItem, items, getEnglishString } from "@/src/services/itemDataService";
2 import { getEnglishString } from "@/src/services/itemDataService";
3 3 import {
4 4 ExportArcanes,
5 5 ExportGear,
@@ -15,16 +15,6 @@ interface ListedItem {
15 15 fusionLimit?: number;
16 16 }
17 17
18 function reduceItems(items: MinItem[]): ListedItem[] {
19 return items.map((item: MinItem): ListedItem => {
20 return {
21 uniqueName: item.uniqueName,
22 name: item.name,
23 fusionLimit: (item as any).fusionLimit
24 };
25 });
26 }
27
28 18 const getItemListsController: RequestHandler = (_req, res) => {
29 19 const weapons = [];
30 20 const miscitems = [];
@@ -56,20 +46,24 @@ const getItemListsController: RequestHandler = (_req, res) => {
56 46 });
57 47 }
58 48
59 const mods = reduceItems(items.filter(item => item.category == "Mods"));
60 for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
61 mods.push({
62 uniqueName: uniqueName,
63 name: getEnglishString(arcane.name)
64 });
65 }
66
49 const mods: ListedItem[] = [];
67 50 const badItems: Record<string, boolean> = {};
68 51 for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
52 mods.push({
53 uniqueName,
54 name: getEnglishString(upgrade.name),
55 fusionLimit: upgrade.fusionLimit
56 });
69 57 if (upgrade.isStarter || upgrade.isFrivolous || upgrade.upgradeEntries) {
70 58 badItems[uniqueName] = true;
71 59 }
72 60 }
61 for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
62 mods.push({
63 uniqueName,
64 name: getEnglishString(arcane.name)
65 });
66 }
73 67
74 68 res.json({
75 69 warframes: Object.entries(ExportWarframes)
Modified src/services/itemDataService.ts +0 -48
@@ -1,6 +1,5 @@
1 1 import { getIndexAfter } from "@/src/helpers/stringHelpers";
2 2 import { logger } from "@/src/utils/logger";
3 import Items, { MinimalItem, Warframe, Weapon } from "warframe-items";
4 3 import {
5 4 dict_en,
6 5 ExportRecipes,
@@ -10,10 +9,6 @@ import {
10 9 IRecipe
11 10 } from "warframe-public-export-plus";
12 11
13 export type MinWarframe = Omit<Warframe, "patchlogs">;
14 export type MinWeapon = Omit<Weapon, "patchlogs">;
15 export type MinItem = Omit<MinimalItem, "patchlogs">;
16
17 12 export type WeaponTypeInternal =
18 13 | "LongGuns"
19 14 | "Pistols"
@@ -24,12 +19,6 @@ export type WeaponTypeInternal =
24 19 | "OperatorAmps"
25 20 | "SpecialItems";
26 21
27 export const items: MinItem[] = Array.from(new Items({ category: ["All"] }) as MinimalItem[]).map(item => {
28 const next = { ...item };
29 delete next.patchlogs;
30 return next;
31 });
32
33 22 export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
34 23 const weaponInfo = ExportWeapons[weaponName];
35 24
@@ -52,33 +41,6 @@ export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
52 41 return weaponType;
53 42 };
54 43
55 export const craftNames = Object.fromEntries(
56 (
57 new Items({
58 category: [
59 "Warframes",
60 "Gear",
61 "Melee",
62 "Primary",
63 "Secondary",
64 "Sentinels",
65 "Misc",
66 "Arch-Gun",
67 "Arch-Melee"
68 ]
69 }) as Warframe[]
70 )
71 .flatMap(item => item.components || [])
72 .filter(item => item.drops && item.drops[0])
73 .map(item => [item.drops![0].type, item.uniqueName])
74 );
75
76 export const blueprintNames = Object.fromEntries(
77 Object.keys(craftNames)
78 .filter(name => name.includes("Blueprint"))
79 .map(name => [name, craftNames[name]])
80 );
81
82 44 export const getRecipe = (uniqueName: string): IRecipe | undefined => {
83 45 return ExportRecipes[uniqueName];
84 46 };
@@ -113,16 +75,6 @@ export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined
113 75 return ExportWarframes[uniqueName];
114 76 };
115 77
116 export const getItemByUniqueName = (uniqueName: string) => {
117 const item = items.find(item => item.uniqueName === uniqueName);
118 return item;
119 };
120
121 export const getItemByName = (name: string) => {
122 const item = items.find(item => item.name === name);
123 return item;
124 };
125
126 78 export const getEnglishString = (key: string): string => {
127 79 return dict_en[key] ?? key;
128 80 };