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

feat: vessel customization (#4394)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4394 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>

2d8f2557
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

7 个文件 +54 -3
Added src/controllers/api/saveMiscDataController.ts +20 -0
@@ -0,0 +1,20 @@
1 import { getAccountIdForRequest } from "../../services/loginService.ts";
2 import { getJSONfromString } from "../../helpers/stringHelpers.ts";
3 import { getInventory } from "../../services/inventoryService.ts";
4 import type { RequestHandler } from "express";
5 import type { IMiscAccountData } from "../../types/inventoryTypes/inventoryTypes.ts";
6
7 export const saveMiscDataController: RequestHandler = async (req, res) => {
8 const accountId = await getAccountIdForRequest(req);
9 const payload = getJSONfromString<IMiscAccountData>(String(req.body));
10 const inventory = await getInventory(accountId, "MiscAccountData");
11 inventory.MiscAccountData ??= [];
12 const index = inventory.MiscAccountData.findIndex(d => d.PropertyName == payload.PropertyName);
13 if (index !== -1) {
14 inventory.MiscAccountData[index].Json = payload.Json;
15 } else {
16 inventory.MiscAccountData.push(payload);
17 }
18 await inventory.save();
19 res.json({});
20 };
Modified src/models/inventoryModels/inventoryModel.ts +13 -2
@@ -102,7 +102,8 @@ import type {
102 102 ISketch,
103 103 IHybridFusionTreasure,
104 104 IWeeklyGuildVaultBonus,
105 IWeekGuildVaultBonusReward
105 IWeekGuildVaultBonusReward,
106 IMiscAccountData
106 107 } from "../../types/inventoryTypes/inventoryTypes.ts";
107 108 import { equipmentKeys } from "../../types/inventoryTypes/inventoryTypes.ts";
108 109 import type { IOid, ITypeCount } from "../../types/commonTypes.ts";
@@ -1597,6 +1598,14 @@ const weeklyGuildVaultBonusSchema = new Schema<IWeeklyGuildVaultBonus>(
1597 1598 { _id: false }
1598 1599 );
1599 1600
1601 const miscAccountDataSchema = new Schema<IMiscAccountData>(
1602 {
1603 PropertyName: { type: String, required: true },
1604 Json: { type: String, required: true }
1605 },
1606 { _id: false }
1607 );
1608
1600 1609 const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1601 1610 {
1602 1611 accountOwnerId: Schema.Types.ObjectId,
@@ -2061,7 +2070,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
2061 2070
2062 2071 Sketches: { type: [sketchSchema], default: undefined },
2063 2072
2064 WeeklyGuildVaultBonusInfo: { type: [weeklyGuildVaultBonusSchema], default: undefined }
2073 WeeklyGuildVaultBonusInfo: { type: [weeklyGuildVaultBonusSchema], default: undefined },
2074
2075 MiscAccountData: { type: [miscAccountDataSchema], default: undefined }
2065 2076 },
2066 2077 { timestamps: { createdAt: "Created", updatedAt: false } }
2067 2078 );
Modified src/routes/api.ts +2 -0
@@ -138,6 +138,7 @@ import { retrievePetFromStasisController } from "../controllers/api/retrievePetF
138 138 import { reverseQuestProgressController } from "../controllers/api/reverseQuestProgressController.ts";
139 139 import { saveDialogueController } from "../controllers/api/saveDialogueController.ts";
140 140 import { saveLoadoutController } from "../controllers/api/saveLoadoutController.ts";
141 import { saveMiscDataController } from "../controllers/api/saveMiscDataController.ts";
141 142 import { saveSettingsController } from "../controllers/api/saveSettingsController.ts";
142 143 import { saveVaultAutoContributeController } from "../controllers/api/saveVaultAutoContributeController.ts";
143 144 import { sellController } from "../controllers/api/sellController.ts";
@@ -384,6 +385,7 @@ apiRouter.post("/retrievePetFromStasis.php", retrievePetFromStasisController);
384 385 apiRouter.post("/reverseQuestProgress.php", reverseQuestProgressController);
385 386 apiRouter.post("/saveDialogue.php", saveDialogueController);
386 387 apiRouter.post("/saveLoadout.php", saveLoadoutController);
388 apiRouter.post("/saveMiscData.php", saveMiscDataController);
387 389 apiRouter.post("/saveSettings.php", saveSettingsController);
388 390 apiRouter.post("/saveVaultAutoContribute.php", saveVaultAutoContributeController);
389 391 apiRouter.post("/sell.php", sellController);
Modified src/services/inventoryService.ts +8 -0
@@ -2019,6 +2019,14 @@ export const updateGeneric = async (
2019 2019 }
2020 2020 ];
2021 2021 addShipDecorations(inventory, inventoryChanges.ShipDecorations);
2022 } else if (node == "TC2026") {
2023 inventoryChanges.ShipDecorations = [
2024 {
2025 ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropCleaningDroneGrineer",
2026 ItemCount: 1
2027 }
2028 ];
2029 addShipDecorations(inventory, inventoryChanges.ShipDecorations);
2022 2030 } else if (node == "KayaFirstVisitPack") {
2023 2031 inventoryChanges.MiscItems = [
2024 2032 {
Modified src/services/worldStateService.ts +3 -1
@@ -4744,7 +4744,9 @@ export const getWorldState = (
4744 4744 c: hexConquest.Missions.map(x => x.difficulties[1].risks),
4745 4745 fv: hexConquest.Variables
4746 4746 },
4747 sfn: [550, 553, 554, 555][halfHour % 4]
4747 sfn: [550, 553, 554, 555][halfHour % 4],
4748 tcend26: true,
4749 tcaz: 3
4748 4750 };
4749 4751 if (Array.isArray(config.worldState?.circuitGameModes)) {
4750 4752 tmp.edg = config.worldState.circuitGameModes as TCircuitGameMode[];
Modified src/types/inventoryTypes/inventoryTypes.ts +6 -0
@@ -562,6 +562,7 @@ export interface IInventoryClient
562 562 RetroDisableKissInboxMessage?: boolean;
563 563 Sketches?: ISketch[];
564 564 WeeklyGuildVaultBonusInfo?: IWeeklyGuildVaultBonus[] | IWeeklyGuildVaultBonus; // should be an array
565 MiscAccountData?: IMiscAccountData[];
565 566 }
566 567
567 568 export interface IAffiliation {
@@ -1424,3 +1425,8 @@ export interface IWeekGuildVaultBonusReward {
1424 1425 ItemCount: number;
1425 1426 Reward: string;
1426 1427 }
1428
1429 export interface IMiscAccountData {
1430 PropertyName: string;
1431 Json: string;
1432 }
Modified src/types/worldStateTypes.ts +2 -0
@@ -657,6 +657,8 @@ export interface ITmp {
657 657 hqo?: IConquestOverride;
658 658 sfn: number;
659 659 edg?: TCircuitGameMode[]; // The Circuit game modes overwrite
660 tcend26?: boolean; // TC 2026 demo ended, unlock vessel customization
661 tcaz?: number; // Somehow related to domestic drone acquisition on TC2026 demo relay, without it game don't send request to receive it, set to 3 on live
660 662 }
661 663
662 664 interface IPgr {