返回提交历史
Modified
src/services/shipCustomizationsService.ts
+5
-10
XFEstudio/XFESpaceNinjaServer
fix: placing decorations in apartment in newer game versions (#2515)
Newer game versions use BootLocation instead of IsApartment Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2515 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
56aa3e33
代码差异
1 个文件
+5
-10
@@ -52,12 +52,7 @@ export const handleSetShipDecorations = async (
52
52
): Promise<IShipDecorationsResponse> => {
53
53
const personalRooms = await getPersonalRooms(accountId);
54
54
55
const rooms =
56
placedDecoration.BootLocation == "SHOP"
57
? personalRooms.TailorShop.Rooms
58
: placedDecoration.IsApartment
59
? personalRooms.Apartment.Rooms
60
: personalRooms.Ship.Rooms;
55
const rooms = getRoomsForBootLocation(personalRooms, placedDecoration);
61
56
62
57
const roomToPlaceIn = rooms.find(room => room.Name === placedDecoration.Room);
63
58
@@ -192,12 +187,12 @@ export const handleSetShipDecorations = async (
192
187
193
188
const getRoomsForBootLocation = (
194
189
personalRooms: TPersonalRoomsDatabaseDocument,
195
bootLocation: TBootLocation | undefined
190
request: { BootLocation?: TBootLocation; IsApartment?: boolean }
196
191
): RoomsType[] => {
197
if (bootLocation == "SHOP") {
192
if (request.BootLocation == "SHOP") {
198
193
return personalRooms.TailorShop.Rooms;
199
194
}
200
if (bootLocation == "APARTMENT") {
195
if (request.BootLocation == "APARTMENT" || request.IsApartment) {
201
196
return personalRooms.Apartment.Rooms;
202
197
}
203
198
return personalRooms.Ship.Rooms;
@@ -217,7 +212,7 @@ export const handleSetPlacedDecoInfo = async (accountId: string, req: ISetPlaced
217
212
218
213
const personalRooms = await getPersonalRooms(accountId);
219
214
220
const room = getRoomsForBootLocation(personalRooms, req.BootLocation).find(room => room.Name === req.Room);
215
const room = getRoomsForBootLocation(personalRooms, req).find(room => room.Name === req.Room);
221
216
if (!room) {
222
217
throw new Error(`unknown room: ${req.Room}`);
223
218
}