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

chore: improve detection for personal research in Contribute request (#4315)

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

65e658ad
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +26 -3
Modified src/controllers/api/guildTechController.ts +17 -1
@@ -154,7 +154,10 @@ export const guildTechController: RequestHandler = async (req, res) => {
154 154 });
155 155 }
156 156 } else if (data.Action == "Contribute") {
157 if ("guildId" in req.query && (req.query.guildId as string) == "000000000000000000000000") {
157 if (
158 ("guildId" in req.query && (req.query.guildId as string) == "000000000000000000000000") ||
159 (data.RecipeType && isPersonalResearch(data.RecipeType)) // For U28: https://onlyg.it/OpenWF/SpaceNinjaServer/issues/4312
160 ) {
158 161 const inventory = await getInventory2(
159 162 accountId,
160 163 "PersonalTechProjects",
@@ -502,6 +505,13 @@ interface IGuildTechContributeRequest {
502 505 VaultMiscItems?: IMiscItem[];
503 506 }
504 507
508 const isPersonalResearch = (uniqueName: string): boolean | null => {
509 if (!(uniqueName in ExportDojoRecipes.research)) {
510 return null;
511 }
512 return uniqueName in ExportDojoRecipes.fabrications || !!ExportDojoRecipes.research[uniqueName].resultType;
513 };
514
505 515 const getSalvageCategory = (
506 516 category: "CrewShipWeapons" | "CrewShipWeaponSkins"
507 517 ): "CrewShipSalvagedWeapons" | "CrewShipSalvagedWeaponSkins" => {
@@ -567,3 +577,9 @@ const finishComponentRepair = (
567 577
568 578 return inventoryChanges;
569 579 };
580
581 export const selfTestGuildTech = (): void => {
582 if (isPersonalResearch("/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItemBlueprint") !== true) {
583 logger.warn(`isPersonalResearch self-test failed for RailjackHullFeatureItemBlueprint`);
584 }
585 };
Modified src/index.ts +2 -2
@@ -11,7 +11,7 @@ import { updateWorldStateCollections } from "./services/worldStateService.ts";
11 11 import { repoDir } from "./helpers/pathHelper.ts";
12 12 import { MongoMemoryServer } from "mongodb-memory-server-core";
13 13 import { args } from "./helpers/commandLineArguments.ts";
14 import { selfTestServersideVendors } from "./services/serversideVendorsService.ts";
14 import { runSelfTests } from "./services/selfTestService.ts";
15 15
16 16 try {
17 17 loadConfig();
@@ -121,7 +121,7 @@ if (args.dev) {
121 121 logger.info(
122 122 "Developer mode is enabled. Note that this project is where it is now due to code contributions; please pay it forward with pull requests."
123 123 );
124 selfTestServersideVendors();
124 runSelfTests();
125 125 }
126 126
127 127 void updateWorldStateCollections();
Added src/services/selfTestService.ts +7 -0
@@ -0,0 +1,7 @@
1 import { selfTestGuildTech } from "../controllers/api/guildTechController.ts";
2 import { selfTestServersideVendors } from "./serversideVendorsService.ts";
3
4 export const runSelfTests = (): void => {
5 selfTestServersideVendors();
6 selfTestGuildTech();
7 };