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

chore(import): attempt to infer server-side data for incubating pets (#3327)

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

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

代码差异

2 个文件 +30 -16
Modified src/services/importService.ts +29 -15
@@ -43,21 +43,22 @@ import type {
43 43 ILoadOutPresets
44 44 } from "../types/saveLoadoutTypes.ts";
45 45 import { slotNames } from "../types/purchaseTypes.ts";
46 import type {
47 ICrewShipMemberClient,
48 ICrewShipMemberDatabase,
49 ICrewShipMembersClient,
50 ICrewShipMembersDatabase,
51 ICrewShipWeaponClient,
52 ICrewShipWeaponDatabase,
53 ICrewShipWeaponEmplacementsClient,
54 ICrewShipWeaponEmplacementsDatabase,
55 IEquipmentClient,
56 IEquipmentDatabase,
57 IEquipmentSelectionClient,
58 IEquipmentSelectionDatabase,
59 IKubrowPetDetailsClient,
60 IKubrowPetDetailsDatabase
46 import {
47 Status,
48 type ICrewShipMemberClient,
49 type ICrewShipMemberDatabase,
50 type ICrewShipMembersClient,
51 type ICrewShipMembersDatabase,
52 type ICrewShipWeaponClient,
53 type ICrewShipWeaponDatabase,
54 type ICrewShipWeaponEmplacementsClient,
55 type ICrewShipWeaponEmplacementsDatabase,
56 type IEquipmentClient,
57 type IEquipmentDatabase,
58 type IEquipmentSelectionClient,
59 type IEquipmentSelectionDatabase,
60 type IKubrowPetDetailsClient,
61 type IKubrowPetDetailsDatabase
61 62 } from "../types/equipmentTypes.ts";
62 63 import type {
63 64 IApartmentClient,
@@ -82,6 +83,8 @@ import type {
82 83 ITailorShopDatabase
83 84 } from "../types/personalRoomsTypes.ts";
84 85 import { fromMongoDate } from "../helpers/inventoryHelpers.ts";
86 import { getRecipe } from "./itemDataService.ts";
87 import { logger } from "../utils/logger.ts";
85 88
86 89 const convertDate = (value: IMongoDate): Date => {
87 90 return new Date(parseInt(value.$date.$numberLong));
@@ -551,6 +554,17 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
551 554 if (client.Boosters !== undefined) {
552 555 replaceArray<IBooster>(db.Boosters, client.Boosters);
553 556 }
557
558 // Final sanity check over data
559 for (const pr of db.PendingRecipes) {
560 const recipe = getRecipe(pr.ItemType);
561 if (recipe?.secretIngredientAction == "SIA_CREATE_KUBROW" && !pr.KubrowPet) {
562 pr.KubrowPet = db.KubrowPets.find(x => x.Details!.Status == Status.StatusIncubating)?._id;
563 logger.debug(
564 `importing an incubating pet; associating pet ${pr.KubrowPet?.toString()} with recipe ${pr._id.toString()} (${pr.ItemType})`
565 );
566 }
567 }
554 568 };
555 569
556 570 export const importLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {
Modified src/types/inventoryTypes/inventoryTypes.ts +1 -1
@@ -921,7 +921,6 @@ export interface IPendingCouponClient {
921 921 export interface IPendingRecipeDatabase {
922 922 ItemType: string;
923 923 CompletionDate: Date;
924 ItemId: IOid;
925 924 TargetItemId?: string; // unsure what this is for
926 925 TargetFingerprint?: string;
927 926 LongGuns?: IEquipmentDatabase[];
@@ -935,6 +934,7 @@ export interface IPendingRecipeClient extends Omit<
935 934 IPendingRecipeDatabase,
936 935 "CompletionDate" | "LongGuns" | "Pistols" | "Melee" | "SuitToUnbrand" | "KubrowPet"
937 936 > {
937 ItemId: IOid;
938 938 CompletionDate: IMongoDate;
939 939 }
940 940