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

fix: save tailorshop customisations (#927)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/927 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>

3d62fc42
Sainan <sainan@calamity.inc>
提交于

代码差异

3 个文件 +13 -3
Modified src/models/personalRoomsModel.ts +1 -0
@@ -125,6 +125,7 @@ favouriteLoadoutSchema.set("toJSON", {
125 125 const tailorShopSchema = new Schema<ITailorShopDatabase>(
126 126 {
127 127 FavouriteLoadouts: [favouriteLoadoutSchema],
128 Colors: { type: colorSchema, required: false },
128 129 CustomJson: String,
129 130 LevelDecosVisible: Boolean,
130 131 Rooms: [roomSchema]
Modified src/services/shipCustomizationsService.ts +7 -1
@@ -28,7 +28,13 @@ export const setShipCustomizations = async (
28 28 }
29 29 } else {
30 30 const personalRooms = await getPersonalRooms(accountId);
31 personalRooms.ShipInteriorColors = shipCustomization.Customization.Colors;
31 if (shipCustomization.IsShop) {
32 personalRooms.TailorShop.Colors = shipCustomization.Customization.Colors;
33 personalRooms.TailorShop.LevelDecosVisible = shipCustomization.Customization.LevelDecosVisible;
34 personalRooms.TailorShop.CustomJson = shipCustomization.Customization.CustomJson;
35 } else {
36 personalRooms.ShipInteriorColors = shipCustomization.Customization.Colors;
37 }
32 38 await personalRooms.save();
33 39 }
34 40 };
Modified src/types/shipTypes.ts +5 -2
@@ -84,12 +84,15 @@ export interface ISetShipCustomizationsRequest {
84 84 Customization: Customization;
85 85 IsExterior: boolean;
86 86 AirSupportPower?: string;
87 IsShop?: boolean;
87 88 }
88 89
89 90 export interface Customization {
90 91 SkinFlavourItem: string;
91 92 Colors: IColor;
92 93 ShipAttachments: ShipAttachments;
94 LevelDecosVisible: boolean;
95 CustomJson: string;
93 96 }
94 97
95 98 //TODO: check for more attachments
@@ -155,12 +158,12 @@ export interface IFavouriteLoadoutDatabase {
155 158
156 159 export interface ITailorShopDatabase {
157 160 FavouriteLoadouts: IFavouriteLoadoutDatabase[];
158 CustomJson: "{}"; // ???
161 Colors?: IColor;
162 CustomJson: string;
159 163 LevelDecosVisible: boolean;
160 164 Rooms: IRoom[];
161 165 }
162 166
163 167 export interface ITailorShop extends Omit<ITailorShopDatabase, "FavouriteLoadouts"> {
164 168 FavouriteLoadouts: IFavouriteLoadout[];
165 Colors?: []; // ???
166 169 }