XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

fix: handle CurrentLoadOutIds missing LoadOuts in missionInventoryUpdate (#1421)

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

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

代码差异

2 个文件 +13 -11
Modified src/services/missionInventoryUpdateService.ts +12 -10
@@ -414,17 +414,19 @@ export const addMissionInventoryUpdates = async (
414 414 break;
415 415 }
416 416 case "CurrentLoadOutIds": {
417 const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId });
418 if (loadout) {
419 for (const [loadoutId, loadoutConfig] of Object.entries(value.LoadOuts.NORMAL)) {
420 const { ItemId, ...loadoutConfigItemIdRemoved } = loadoutConfig;
421 const loadoutConfigDatabase: ILoadoutConfigDatabase = {
422 _id: new Types.ObjectId(ItemId.$oid),
423 ...loadoutConfigItemIdRemoved
424 };
425 loadout.NORMAL.id(loadoutId)!.overwrite(loadoutConfigDatabase);
417 if (value.LoadOuts) {
418 const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId });
419 if (loadout) {
420 for (const [loadoutId, loadoutConfig] of Object.entries(value.LoadOuts.NORMAL)) {
421 const { ItemId, ...loadoutConfigItemIdRemoved } = loadoutConfig;
422 const loadoutConfigDatabase: ILoadoutConfigDatabase = {
423 _id: new Types.ObjectId(ItemId.$oid),
424 ...loadoutConfigItemIdRemoved
425 };
426 loadout.NORMAL.id(loadoutId)!.overwrite(loadoutConfigDatabase);
427 }
428 await loadout.save();
426 429 }
427 await loadout.save();
428 430 }
429 431 break;
430 432 }
Modified src/types/requestTypes.ts +1 -1
@@ -114,7 +114,7 @@ export type IMissionInventoryUpdateRequest = {
114 114 UnlockWeapons?: boolean; // sent when recovered weapons from zanuka capture
115 115 IncHarvester?: boolean; // sent when recovered weapons from zanuka capture
116 116 CurrentLoadOutIds?: {
117 LoadOuts: ILoadOutPresets; // sent when recovered weapons from zanuka capture
117 LoadOuts?: ILoadOutPresets; // sent when recovered weapons from zanuka capture
118 118 };
119 119 } & {
120 120 [K in TEquipmentKey]?: IEquipmentClient[];