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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

fix: ensure transmutation .filter logic doesn't error (#4362)

Closes #4361 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4362 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

5893f0b0
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

4 个文件 +18 -5
Modified package-lock.json +4 -4
@@ -17,7 +17,7 @@
17 17 "mongoose": "^9.6.2",
18 18 "morgan": "^1.10.0",
19 19 "undici": "^7.10.0",
20 "warframe-public-export-plus": "^0.6.3",
20 "warframe-public-export-plus": "^0.6.4",
21 21 "warframe-riven-info": "^0.1.2",
22 22 "winston": "^3.17.0",
23 23 "winston-daily-rotate-file": "^5.0.0",
@@ -4890,9 +4890,9 @@
4890 4890 }
4891 4891 },
4892 4892 "node_modules/warframe-public-export-plus": {
4893 "version": "0.6.3",
4894 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.6.3.tgz",
4895 "integrity": "sha512-JpRj+F8fCSthOI81CxGUHZHFL329x3SsNdP8GbDh1mrlPIfHMtRESEJq5gwu7WKXUGLpU5Yw2TzZSqCXLLpPaQ=="
4893 "version": "0.6.4",
4894 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.6.4.tgz",
4895 "integrity": "sha512-L/3JREMILShyOiGigcKaAj/qaZpFyeBV2J9QNuJr9oNwBkKIOxT7GF6Y9SHH2hcz0n80TG8b6yaZp63oz9d02g=="
4896 4896 },
4897 4897 "node_modules/warframe-riven-info": {
4898 4898 "version": "0.1.2",
Modified package.json +1 -1
@@ -37,7 +37,7 @@
37 37 "mongoose": "^9.6.2",
38 38 "morgan": "^1.10.0",
39 39 "undici": "^7.10.0",
40 "warframe-public-export-plus": "^0.6.3",
40 "warframe-public-export-plus": "^0.6.4",
41 41 "warframe-riven-info": "^0.1.2",
42 42 "winston": "^3.17.0",
43 43 "winston-daily-rotate-file": "^5.0.0",
Modified src/controllers/api/artifactTransmutationController.ts +11 -0
@@ -14,6 +14,7 @@ import type { IUpgradeFromClient } from "../../types/inventoryTypes/inventoryTyp
14 14 import type { RequestHandler } from "express";
15 15 import type { TRarity } from "warframe-public-export-plus";
16 16 import { ExportBoosterPacks, ExportUpgrades } from "warframe-public-export-plus";
17 import { logger } from "../../utils/logger.ts";
17 18
18 19 export const artifactTransmutationController: RequestHandler = async (req, res) => {
19 20 const account = await getAccountForRequest(req);
@@ -119,6 +120,7 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
119 120
120 121 const options = ExportBoosterPacks["/Lotus/Types/BoosterPacks/ModFuserResult"].components.filter(
121 122 ({ Item }) => {
123 // When changing this logic, please ensure the self-test below stays useful.
122 124 const meta = getUpgrade(Item)!;
123 125 if ((forcedPolarity && meta.polarity != forcedPolarity) || !meta.introducedAt) {
124 126 return false;
@@ -198,3 +200,12 @@ const specialModSets: string[][] = [
198 200 "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusSmallOnSingleUseMod"
199 201 ]
200 202 ];
203
204 export const selfTestTransmutation = (): void => {
205 // Ensure we don't error during the .filter logic above.
206 for (const { Item } of ExportBoosterPacks["/Lotus/Types/BoosterPacks/ModFuserResult"].components) {
207 if (!getUpgrade(Item)) {
208 logger.warn(`Transmutation result is not a known upgrade: ${Item}`);
209 }
210 }
211 };
Modified src/services/selfTestService.ts +2 -0
@@ -1,7 +1,9 @@
1 import { selfTestTransmutation } from "../controllers/api/artifactTransmutationController.ts";
1 2 import { selfTestGuildTech } from "../controllers/api/guildTechController.ts";
2 3 import { selfTestServersideVendors } from "./serversideVendorsService.ts";
3 4
4 5 export const runSelfTests = (): void => {
5 6 selfTestServersideVendors();
6 7 selfTestGuildTech();
8 selfTestTransmutation();
7 9 };