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(import): handle ship features being in inventory (#2688)

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

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

代码差异

2 个文件 +6 -2
Modified src/controllers/custom/importController.ts +5 -1
@@ -21,7 +21,11 @@ export const importController: RequestHandler = async (req, res) => {
21 21 await loadout.save();
22 22 }
23 23
24 if ("Ship" in request.inventory || "Apartment" in request.inventory || "TailorShop" in request.inventory) {
24 if (
25 request.inventory.Ship?.Rooms || // very old accounts may have Ship with { Features: [ ... ] }
26 "Apartment" in request.inventory ||
27 "TailorShop" in request.inventory
28 ) {
25 29 const personalRooms = await getPersonalRooms(accountId);
26 30 importPersonalRooms(personalRooms, request.inventory);
27 31 await personalRooms.save();
Modified src/services/importService.ts +1 -1
@@ -570,7 +570,7 @@ const convertTailorShop = (client: ITailorShop): ITailorShopDatabase => {
570 570 };
571 571
572 572 export const importPersonalRooms = (db: IPersonalRoomsDatabase, client: Partial<IGetShipResponse>): void => {
573 if (client.Ship !== undefined) db.Ship = convertShip(client.Ship);
573 if (client.Ship?.Rooms) db.Ship = convertShip(client.Ship);
574 574 if (client.Apartment !== undefined) db.Apartment = convertApartment(client.Apartment);
575 575 if (client.TailorShop !== undefined) db.TailorShop = convertTailorShop(client.TailorShop);
576 576 };