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: sketches (#3792)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3792 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>

4120447e
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

5 个文件 +45 -4
Modified src/models/inventoryModels/inventoryModel.ts +13 -2
@@ -98,7 +98,8 @@ import type {
98 98 IChallengeInstanceStateDatabase,
99 99 IChallengeInstanceStateClient,
100 100 IParam,
101 IDialogueCounter
101 IDialogueCounter,
102 ISketch
102 103 } from "../../types/inventoryTypes/inventoryTypes.ts";
103 104 import { equipmentKeys } from "../../types/inventoryTypes/inventoryTypes.ts";
104 105 import type { IOid, ITypeCount } from "../../types/commonTypes.ts";
@@ -1551,6 +1552,14 @@ challengeInstanceStateSchema.set("toJSON", {
1551 1552 }
1552 1553 });
1553 1554
1555 const sketchSchema = new Schema<ISketch>(
1556 {
1557 decoId: { type: String, required: true },
1558 canvas: { type: String, required: false }
1559 },
1560 { _id: false }
1561 );
1562
1554 1563 const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1555 1564 {
1556 1565 accountOwnerId: Schema.Types.ObjectId,
@@ -2005,7 +2014,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
2005 2014 RetroWallpaperId: Number,
2006 2015 RetroFastTyping: Boolean,
2007 2016 RetroPlayAllConvos: Boolean,
2008 RetroDisableKissInboxMessage: Boolean
2017 RetroDisableKissInboxMessage: Boolean,
2018
2019 Sketches: { type: [sketchSchema], default: undefined }
2009 2020 },
2010 2021 { timestamps: { createdAt: "Created", updatedAt: false } }
2011 2022 );
Modified src/services/importService.ts +3 -0
@@ -573,6 +573,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
573 573 if (client.Settings !== undefined) {
574 574 db.Settings = client.Settings;
575 575 }
576 if (client.Sketches !== undefined) {
577 db.Sketches = client.Sketches;
578 }
576 579
577 580 // Final sanity check over data
578 581 for (const pr of db.PendingRecipes) {
Modified src/services/saveLoadoutService.ts +5 -1
@@ -14,7 +14,7 @@ import { Types } from "mongoose";
14 14 import { isEmptyObject } from "../helpers/general.ts";
15 15 import { convertLegacyColorsToIColor, fromOid, toObjectId, version_compare } from "../helpers/inventoryHelpers.ts";
16 16 import { logger } from "../utils/logger.ts";
17 import type { TEquipmentKey } from "../types/inventoryTypes/inventoryTypes.ts";
17 import type { ISketch, TEquipmentKey } from "../types/inventoryTypes/inventoryTypes.ts";
18 18 import { equipmentKeys } from "../types/inventoryTypes/inventoryTypes.ts";
19 19 import type { IItemConfig, IItemConfigDatabase } from "../types/inventoryTypes/commonInventoryTypes.ts";
20 20 import { importCrewShipMembers, importCrewShipWeapon, importLoadOutConfig } from "./importService.ts";
@@ -200,6 +200,10 @@ export const handleInventoryItemConfigChange = async (
200 200 inventory.UseAdultOperatorLoadout = equipment as boolean;
201 201 break;
202 202 }
203 case "Sketches": {
204 inventory.Sketches = equipment as ISketch[];
205 break;
206 }
203 207 case "FocusLoadouts": {
204 208 const raw = equipment as unknown;
205 209 const focusLoadouts: unknown[] = Array.isArray(raw)
Modified src/types/inventoryTypes/inventoryTypes.ts +22 -0
@@ -514,6 +514,7 @@ export interface IInventoryClient
514 514 RetroFastTyping?: boolean;
515 515 RetroPlayAllConvos?: boolean;
516 516 RetroDisableKissInboxMessage?: boolean;
517 Sketches?: ISketch[];
517 518 }
518 519
519 520 export interface IAffiliation {
@@ -1357,3 +1358,24 @@ export interface INokkoColony {
1357 1358 FeedLevel: number;
1358 1359 JournalEntries: IJournalEntry[];
1359 1360 }
1361
1362 export type TSketches =
1363 | "ExplosiveBarrel"
1364 | "ArcTrap"
1365 | "RocketLauncher"
1366 | "Amphor"
1367 | "DeathOrb"
1368 | "TetherTurret"
1369 | "LohkSurge"
1370 | "AmmoGenerator"
1371 | "JumpPad"
1372 | "TreasureHunt"
1373 | "LifeSupport"
1374 | "PowerCell"
1375 | "DefenseObjective"
1376 | "ConduitKey";
1377
1378 export interface ISketch {
1379 decoId: TSketches;
1380 canvas?: string;
1381 }
Modified src/types/saveLoadoutTypes.ts +2 -1
@@ -14,7 +14,7 @@ import type {
14 14 IEquipmentSelectionClient,
15 15 IEquipmentSelectionDatabase
16 16 } from "./equipmentTypes.ts";
17 import type { IFocusLoadoutClient } from "./inventoryTypes/inventoryTypes.ts";
17 import type { IFocusLoadoutClient, ISketch } from "./inventoryTypes/inventoryTypes.ts";
18 18
19 19 export interface ISaveLoadoutRequest {
20 20 LoadOuts: ILoadoutClient | ILoadoutConfigClientLegacy;
@@ -58,6 +58,7 @@ export interface ISaveLoadoutRequest {
58 58 WeaponSkins: IItemEntry;
59 59 LotusCustomization: ILotusCustomization;
60 60 FocusLoadouts?: IFocusLoadoutClient[];
61 Sketches?: ISketch[];
61 62 }
62 63
63 64 export type ISaveLoadoutRequestNoUpgradeVer = Omit<ISaveLoadoutRequest, "UpgradeVer">;