diff --git a/project/src/controllers/InsuranceController.ts b/project/src/controllers/InsuranceController.ts index 6e903a5c..b07b7292 100644 --- a/project/src/controllers/InsuranceController.ts +++ b/project/src/controllers/InsuranceController.ts @@ -196,7 +196,7 @@ export class InsuranceController !this.itemHelper.isAttachmentAttached(item) ); - // Process all items that are not attached, attachments. Those are handled separately, by value. + // Process all items that are not attached, attachments; those are handled separately, by value. if (hasRegularItems) { this.processRegularItems(insured, toDelete, parentAttachmentsMap); diff --git a/project/tests/__factories__/ProfileInsurance.factory.ts b/project/tests/__factories__/ProfileInsurance.factory.ts index 83ea5629..66679c11 100644 --- a/project/tests/__factories__/ProfileInsurance.factory.ts +++ b/project/tests/__factories__/ProfileInsurance.factory.ts @@ -24,7 +24,7 @@ export class ProfileInsuranceFactory } /** - * Adjusts the scheduledTime and messageContent.systemData.date and messageContent.systemData.time, otherwise the + * Adjusts the scheduledTime, messageContent.systemData.date, and messageContent.systemData.time, otherwise the * dates in the original fixture will likely be expired. */ public adjustPackageDates(dateInput?: DateInput): this @@ -45,8 +45,8 @@ export class ProfileInsuranceFactory } insurance.scheduledTime = date; - insurance.messageContent.systemData.date = format(date, "MM.dd.yyyy"); - insurance.messageContent.systemData.time = format(date, "HH:mm"); + insurance.systemData.date = format(date, "MM.dd.yyyy"); + insurance.systemData.time = format(date, "HH:mm"); return insurance; }); diff --git a/project/tests/__fixture__/profileInsurance.fixture.ts b/project/tests/__fixture__/profileInsurance.fixture.ts index dd26a560..348194e0 100644 --- a/project/tests/__fixture__/profileInsurance.fixture.ts +++ b/project/tests/__fixture__/profileInsurance.fixture.ts @@ -1,747 +1,1388 @@ import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile"; export const profileInsuranceFixture: Insurance[] = [{ - scheduledTime: 1698945140, - traderId: "54cb50c76803fa8b248b4571", // Prapor - messageContent: { - templateId: "58fe0e4586f774728248ca13 4", - type: 8, - maxStorageTime: 345600, - text: "", - profileChangeEvents: [], - systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" }, - }, + scheduledTime: 1712950044.4, + traderId: "54cb50c76803fa8b248b4571", + maxStorageTime: 345600, + systemData: { date: "11.04.2024", time: "18:59", location: "factory4_day" }, + messageType: 8, + messageTemplateId: "58fe0e4586f774728248ca13 0", items: [{ - _id: "3679078e05f5b14466d6a730", - _tpl: "5d6d3716a4b9361bc8618872", - parentId: "5fe49444ae6628187a2e77b8", + _id: "35111c9b72a87b6b7d95ad35", + _tpl: "58948c8e86f77409493f7266", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", - upd: { StackObjectsCount: 1, Repairable: { Durability: 55, MaxDurability: 55 } }, + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { - _id: "911a0f04d5d9c7e239807ae0", - _tpl: "5644bd2b4bdc2d3b4c8b4572", - parentId: "5fe49444ae6628187a2e77b8", + _id: "d45436a159654f43ca3aa52f", + _tpl: "5580223e4bdc2d1c128b457f", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", - upd: { StackObjectsCount: 1, Repairable: { Durability: 97.7862549, MaxDurability: 100 } }, + upd: { + FireMode: { FireMode: "single" }, + StackObjectsCount: 1, + Repairable: { Durability: 100, MaxDurability: 100 }, + }, }, { - _id: "695b13896108f765e8985698", - _tpl: "5648a69d4bdc2ded0b8b457b", - parentId: "5fe49444ae6628187a2e77b8", + _id: "2c60ad9b6051f059ab796aa6", + _tpl: "5a7ae0c351dfba0017554310", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + }, { + _id: "a5c86cef7d25f57bf0fb593c", + _tpl: "5b432f3d5acfc4704b4a1dfb", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "bb49d6ceb3e87d8563a06455", - _tpl: "5df8a4d786f77412672a1e3b", - parentId: "5fe49444ae6628187a2e77b8", + _id: "8ac63abcbaf95d09a4d50c02", + _tpl: "5ea17ca01412a1425304d1c0", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "631f8492de748dec852f7ddf", - _tpl: "64abd93857958b4249003418", - parentId: "5fe49444ae6628187a2e77b8", + _id: "33c99e86f72af509da01dc9a", + _tpl: "657f9a55c6679fefb3051e19", + parentId: "8ac63abcbaf95d09a4d50c02", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 24, MaxDurability: 24 } }, + }, { + _id: "426902ae3d7efa5f8c78acf7", + _tpl: "657f9a94ada5fadd1f07a589", + parentId: "8ac63abcbaf95d09a4d50c02", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 24, MaxDurability: 24 } }, + }, { + _id: "5d2be23efb34d0d1da9d3701", + _tpl: "603648ff5a45383c122086ac", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", - upd: { StackObjectsCount: 1, Repairable: { Durability: 49.2865, MaxDurability: 60 } }, - }, { - _id: "a2b0c716162c5e31ec28c55a", - _tpl: "5a16b8a9fcdbcb00165aa6ca", - parentId: "3679078e05f5b14466d6a730", - slotId: "mod_nvg", upd: { StackObjectsCount: 1 }, }, { - _id: "dc565f750342cb2d19eeda06", - _tpl: "5d6d3be5a4b9361bc73bc763", - parentId: "3679078e05f5b14466d6a730", - slotId: "mod_equipment_001", - upd: { StackObjectsCount: 1, Repairable: { Durability: 29.33, MaxDurability: 29.33 } }, - }, { - _id: "e9ff62601669d9e2ea9c2fbb", - _tpl: "5d6d3943a4b9360dbc46d0cc", - parentId: "3679078e05f5b14466d6a730", - slotId: "mod_equipment_002", + _id: "9f601faab37dcc58190898ac", + _tpl: "618bb76513f5097c8d5aa2d5", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "ac134d7cf6c9d8e25edd0015", - _tpl: "5c11046cd174af02a012e42b", - parentId: "a2b0c716162c5e31ec28c55a", - slotId: "mod_nvg", + _id: "f74d377063e65d350e0099be", + _tpl: "5c0e5bab86f77461f55ed1f3", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "22274b895ecc80d51c3cba1c", - _tpl: "5c110624d174af029e69734c", - parentId: "ac134d7cf6c9d8e25edd0015", - slotId: "mod_nvg", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 }, Togglable: { On: true } }, + _id: "0ab2a81fc507ac846f43b15f", + _tpl: "6571b27a6d84a2b8b6007f92", + parentId: "f74d377063e65d350e0099be", + slotId: "Soft_armor_front", + upd: { Repairable: { Durability: 50.88512, MaxDurability: 52 } }, }, { - _id: "c9278dd8251e99578bf7a274", - _tpl: "59c6633186f7740cf0493bb9", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_gas_block", + _id: "2ca1b6606d918483ed6b70a5", + _tpl: "6571baa74cb80d995d0a1490", + parentId: "f74d377063e65d350e0099be", + slotId: "Soft_armor_back", + upd: { Repairable: { Durability: 49, MaxDurability: 52 } }, + }, { + _id: "5658a9d10f9d44112a991561", + _tpl: "6571baac6d84a2b8b6007fa3", + parentId: "f74d377063e65d350e0099be", + slotId: "Soft_armor_left", + upd: { Repairable: { Durability: 8, MaxDurability: 8 } }, + }, { + _id: "8d0ba4d12fa601312b71d3d7", + _tpl: "6571bab0f41985531a038091", + parentId: "f74d377063e65d350e0099be", + slotId: "soft_armor_right", + upd: { Repairable: { Durability: 8, MaxDurability: 8 } }, + }, { + _id: "45d19bbff6d42c8f781abb38", + _tpl: "6571babb4076795e5e07383f", + parentId: "f74d377063e65d350e0099be", + slotId: "Collar", + upd: { Repairable: { Durability: 14, MaxDurability: 14 } }, + }, { + _id: "cf2ba30bab4d8e80393a8ffe", + _tpl: "6571bac34076795e5e073843", + parentId: "f74d377063e65d350e0099be", + slotId: "Groin", + upd: { Repairable: { Durability: 10, MaxDurability: 10 } }, + }, { + _id: "a3f866e60ccd9c29e77eb5ef", + _tpl: "6571babf4cb80d995d0a1494", + parentId: "f74d377063e65d350e0099be", + slotId: "Groin_back", + upd: { Repairable: { Durability: 12, MaxDurability: 12 } }, + }, { + _id: "a3287a706e1b77b44db82fa1", + _tpl: "5aa2ba71e5b5b000137b758f", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "677c209ebb45445ebb42c405", - _tpl: "5649ab884bdc2ded0b8b457f", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_muzzle", + _id: "c6ad1be7e8401755de69d6a0", + _tpl: "5d6d2ef3a4b93618084f58bd", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "8ada5c9cc26585281577c6eb", - _tpl: "5649ae4a4bdc2d1b2b8b4588", - parentId: "911a0f04d5d9c7e239807ae0", + _id: "7c42d3dce0ddbc4806bce48b", + _tpl: "5894a51286f77426d13baf02", + parentId: "35111c9b72a87b6b7d95ad35", slotId: "mod_pistol_grip", - upd: { StackObjectsCount: 1 }, + upd: {}, }, { - _id: "4bd10f89836fd9f86aedcac1", - _tpl: "5649af094bdc2df8348b4586", - parentId: "911a0f04d5d9c7e239807ae0", + _id: "10b97872c5f4e0e1949a0369", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "35111c9b72a87b6b7d95ad35", + slotId: "mod_magazine", + }, { + _id: "a6cd9986dde4cabddcd2dce2", + _tpl: "5894a5b586f77426d2590767", + parentId: "35111c9b72a87b6b7d95ad35", slotId: "mod_reciever", - upd: { StackObjectsCount: 1 }, + upd: {}, }, { - _id: "8b1327270791b142ac341b03", - _tpl: "5649d9a14bdc2d79388b4580", - parentId: "911a0f04d5d9c7e239807ae0", + _id: "b65635b515712f990fdcc201", + _tpl: "58ac1bf086f77420ed183f9f", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "35111c9b72a87b6b7d95ad35", + slotId: "mod_stock", + }, { + _id: "0e11045873efe3625695c1ae", + _tpl: "5c5db6b32e221600102611a0", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "35111c9b72a87b6b7d95ad35", + slotId: "mod_charge", + }, { + _id: "94c4161abe8bf654fb986063", + _tpl: "57adff4f24597737f373b6e6", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "a6cd9986dde4cabddcd2dce2", + slotId: "mod_scope", + }, { + _id: "9b284ccfd0d535acec1ff58b", + _tpl: "5c5db5c62e22160012542255", + parentId: "a6cd9986dde4cabddcd2dce2", + slotId: "mod_barrel", + upd: {}, + }, { + _id: "d730caa83a11fd01250a7261", + _tpl: "5c5db63a2e2216000f1b284a", + parentId: "a6cd9986dde4cabddcd2dce2", + slotId: "mod_handguard", + upd: {}, + }, { + _id: "24291c7bcf91e362adb6d68b", + _tpl: "5fb6564947ce63734e3fa1da", + parentId: "a6cd9986dde4cabddcd2dce2", slotId: "mod_sight_rear", upd: { StackObjectsCount: 1 }, }, { - _id: "566335b3df586f34b47f5e35", - _tpl: "5649b2314bdc2d79388b4576", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_stock", - upd: { StackObjectsCount: 1 }, - }, { - _id: "da8cde1b3024c336f6e06152", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "911a0f04d5d9c7e239807ae0", - slotId: "mod_magazine", + _id: "0d98fd0769cce8e473bbe540", + _tpl: "58d2664f86f7747fec5834f6", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "94c4161abe8bf654fb986063", + slotId: "mod_scope", }, { - _id: "1e0b177df108c0c117028812", - _tpl: "57cffddc24597763133760c6", - parentId: "c9278dd8251e99578bf7a274", - slotId: "mod_handguard", + _id: "11b174510f039e8217fbd202", + _tpl: "58d268fc86f774111273f8c2", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "0d98fd0769cce8e473bbe540", + slotId: "mod_scope", + }, { + _id: "c435230e530574b1d7c32300", + _tpl: "5c7e8fab2e22165df16b889b", + parentId: "9b284ccfd0d535acec1ff58b", + slotId: "mod_muzzle", + upd: {}, + }, { + _id: "15666fe6fd2d95206612e418", + _tpl: "6269220d70b6c02e665f2635", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_mount_000", upd: { StackObjectsCount: 1 }, }, { - _id: "bc041c0011d76f714b898400", - _tpl: "57cffcd624597763133760c5", - parentId: "1e0b177df108c0c117028812", + _id: "a54de8b9014eee71fdf1d01d", + _tpl: "6269220d70b6c02e665f2635", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_mount_001", + upd: { StackObjectsCount: 1 }, + }, { + _id: "c34555bc95a9a7a23150a36f", + _tpl: "6269220d70b6c02e665f2635", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_mount_002", + upd: { StackObjectsCount: 1 }, + }, { + _id: "91cae4ae30d1366b87158238", + _tpl: "6269220d70b6c02e665f2635", + parentId: "d730caa83a11fd01250a7261", slotId: "mod_mount_003", upd: { StackObjectsCount: 1 }, }, { - _id: "9f8d7880a6e0a47a211ec5d3", - _tpl: "58491f3324597764bc48fa02", - parentId: "8b1327270791b142ac341b03", - slotId: "mod_scope", + _id: "48f23df4509164cf397b9ab5", + _tpl: "6269220d70b6c02e665f2635", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_mount_004", upd: { StackObjectsCount: 1 }, }, { - _id: "402b4086535a50ef7d9cef88", - _tpl: "5649be884bdc2d79388b4577", - parentId: "566335b3df586f34b47f5e35", - slotId: "mod_stock", + _id: "a55f05f689978ac65c7da654", + _tpl: "5b7be4895acfc400170e2dd5", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_foregrip", + upd: {}, + }, { + _id: "8ae4ea81a2d6074162d87a9c", + _tpl: "5b7be47f5acfc400170e2dd2", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_mount_005", + upd: {}, + }, { + _id: "312cc0f6687963305457235e", + _tpl: "5b7be47f5acfc400170e2dd2", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_mount_006", + upd: {}, + }, { + _id: "e1e5aaf474b7282a52ac9a14", + _tpl: "5fb6567747ce63734e3fa1dc", + parentId: "d730caa83a11fd01250a7261", + slotId: "mod_sight_front", upd: { StackObjectsCount: 1 }, }, { - _id: "db2ef9442178910eba985b51", - _tpl: "58d2946386f774496974c37e", - parentId: "402b4086535a50ef7d9cef88", - slotId: "mod_stock_000", - upd: { StackObjectsCount: 1 }, - }, { - _id: "3c32b7d47ad80e83749fa906", - _tpl: "58d2912286f7744e27117493", - parentId: "db2ef9442178910eba985b51", - slotId: "mod_stock", - upd: { StackObjectsCount: 1 }, - }, { - _id: "574a9b5535585255cde19570", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", - slotId: "1", - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + _id: "bb9a34648e08f005db5d7484", + _tpl: "5cc9c20cd7f00c001336c65d", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "15666fe6fd2d95206612e418", + slotId: "mod_tactical", }, { - _id: "696835b2badfb96623ea887c", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", + _id: "dd9ac99d3ea4c9656221bcc9", + _tpl: "5cc9c20cd7f00c001336c65d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "a54de8b9014eee71fdf1d01d", + slotId: "mod_tactical", + }, { + _id: "b22748de8da5f3c1362dd8e0", + _tpl: "5cc9c20cd7f00c001336c65d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "c34555bc95a9a7a23150a36f", + slotId: "mod_tactical", + }, { + _id: "e3cc1be8954c4889f94b435a", + _tpl: "5cc9c20cd7f00c001336c65d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "91cae4ae30d1366b87158238", + slotId: "mod_tactical", + }, { + _id: "e73f05be5a306168e847da82", + _tpl: "5cc9c20cd7f00c001336c65d", + parentId: "48f23df4509164cf397b9ab5", + slotId: "mod_tactical", + upd: { StackObjectsCount: 1 }, + }, { + _id: "847cf35ec92d8af8e4814ea8", + _tpl: "5c1cd46f2e22164bef5cfedb", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "a55f05f689978ac65c7da654", + slotId: "mod_foregrip", + }, { + _id: "bb4b7a4475fea0f0135305f6", + _tpl: "5cc9c20cd7f00c001336c65d", + parentId: "8ae4ea81a2d6074162d87a9c", + slotId: "mod_tactical", + upd: { StackObjectsCount: 1 }, + }, { + _id: "d0ac8e688a0bb17668589909", + _tpl: "5cc9c20cd7f00c001336c65d", + parentId: "312cc0f6687963305457235e", + slotId: "mod_tactical", + upd: { StackObjectsCount: 1 }, + }, { + _id: "5dbcf8cbbb3f8ef669836320", + _tpl: "5c793fc42e221600114ca25d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "b65635b515712f990fdcc201", + slotId: "mod_stock", + }, { + _id: "f996645c809968f8033593a6", + _tpl: "5fc2369685fd526b824a5713", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5dbcf8cbbb3f8ef669836320", + slotId: "mod_stock_000", + }, { + _id: "7d959c20811fdc440387f0a4", + _tpl: "55d447bb4bdc2d892f8b456f", + parentId: "d45436a159654f43ca3aa52f", + slotId: "mod_barrel", + upd: {}, + }, { + _id: "16969c588bd20e223d93e65a", + _tpl: "611a31ce5b7ffe001b4649d1", + parentId: "d45436a159654f43ca3aa52f", + slotId: "mod_stock", + upd: {}, + }, { + _id: "d3a31aa632d852bfe57d7aca", + _tpl: "5a6b5f868dc32e000a311389", + parentId: "2c60ad9b6051f059ab796aa6", + slotId: "mod_barrel", + upd: {}, + }, { + _id: "fdba343644672594e7c73f47", + _tpl: "5a7b4960e899ef197b331a2d", + parentId: "2c60ad9b6051f059ab796aa6", + slotId: "mod_pistol_grip", + upd: {}, + }, { + _id: "5f47943e00d184b3c8f9c2b5", + _tpl: "5a6f5e048dc32e00094b97da", + parentId: "2c60ad9b6051f059ab796aa6", + slotId: "mod_reciever", + upd: {}, + }, { + _id: "f616853cb3b860d670252e66", + _tpl: "5a718b548dc32e000d46d262", + parentId: "2c60ad9b6051f059ab796aa6", + slotId: "mod_magazine", + upd: {}, + }, { + _id: "5153ee12f6d4abc4856dd4ae", + _tpl: "5a7ad74e51dfba0015068f45", + parentId: "2c60ad9b6051f059ab796aa6", + slotId: "mod_tactical", + upd: {}, + }, { + _id: "aa5dc438d849a311e335667b", + _tpl: "5a7d9122159bd4001438dbf4", + parentId: "5f47943e00d184b3c8f9c2b5", + slotId: "mod_sight_rear", + upd: {}, + }, { + _id: "79a1dfa8bff1b7ca118d6b0f", + _tpl: "5a7d90eb159bd400165484f1", + parentId: "5f47943e00d184b3c8f9c2b5", + slotId: "mod_sight_front", + upd: {}, + }, { + _id: "e784a6d774f9a885bf5ed847", + _tpl: "5a7b483fe899ef0016170d15", + parentId: "5153ee12f6d4abc4856dd4ae", + slotId: "mod_tactical", + upd: {}, + }, { + _id: "fd79789b0e394e2cc1299ab1", + _tpl: "5c5db6742e2216000f1b2852", + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "1", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "a19f5e338bfd32f1c1f3fb73", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", slotId: "2", location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { - _id: "c2d5e23c7886e8ff02010731", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", + _id: "9e709808929c226f7bdbf57a", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", slotId: "3", location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { - _id: "306de2f475a559610a4f6f1d", - _tpl: "55d482194bdc2d1d4e8b456b", - parentId: "695b13896108f765e8985698", + _id: "9fe70bf25a2db7f8c1b23502", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", slotId: "4", location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { - _id: "eb0445b49a97e84e27d47f3c", - _tpl: "5aa2ba71e5b5b000137b758f", - parentId: "695b13896108f765e8985698", + _id: "4519dc962deebb2dbfc9e70c", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "5", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "a94275912f1cbcd483563916", + _tpl: "5c5db6742e2216000f1b2852", + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "6", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "7f2ae8c0685bf3a2195185dd", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "7", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "53a9f3dc5c08cbd02ff31b12", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "8", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "e0ab45585b1a874dbaa68fb3", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "9", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "3f66f7abde039a848f8b4cf0", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5d2be23efb34d0d1da9d3701", + slotId: "10", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "04a202a45f8a39b61a58a05a", + _tpl: "544a5caa4bdc2d1a388b4568", + parentId: "9f601faab37dcc58190898ac", + slotId: "main", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "d5f6e03c07ede944e89fb407", + _tpl: "6570e83223c1f638ef0b0ede", + parentId: "04a202a45f8a39b61a58a05a", + slotId: "Soft_armor_front", + upd: { Repairable: { Durability: 42, MaxDurability: 42 } }, + }, { + _id: "5433cbf0f07a68651e888c74", + _tpl: "6570e87c23c1f638ef0b0ee2", + parentId: "04a202a45f8a39b61a58a05a", + slotId: "Soft_armor_back", + upd: { Repairable: { Durability: 42, MaxDurability: 42 } }, + }, { + _id: "da91bed43f688a80b627ad4d", + _tpl: "6570e90b3a5689d85f08db97", + parentId: "04a202a45f8a39b61a58a05a", + slotId: "Groin", + upd: { Repairable: { Durability: 28, MaxDurability: 28 } }, + }, { + _id: "ad7f524f3de9ad544df8c0b8", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "9f601faab37dcc58190898ac", + slotId: "main", + location: { x: 3, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "0844cf6b7a89c13454b6e3db", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "9f601faab37dcc58190898ac", + slotId: "main", + location: { x: 4, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "c3f58f44366d0a06d29d66ba", + _tpl: "5a38e6bac4a2826c6e06d79b", + parentId: "9f601faab37dcc58190898ac", + slotId: "main", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + location: { x: 0, y: 4, r: "Horizontal", isSearched: true }, + }, { + _id: "d46e16faba780c68e0600532", + _tpl: "656fa0fb498d1b7e3e071d9c", + parentId: "9f601faab37dcc58190898ac", + slotId: "main", + upd: { StackObjectsCount: 1, Repairable: { Durability: 45, MaxDurability: 45 } }, + location: { x: 3, y: 2, r: "Horizontal", isSearched: true }, + }, { + _id: "26598f88d49198c4a0a9391c", + _tpl: "571a12c42459771f627b58a0", + parentId: "9f601faab37dcc58190898ac", + slotId: "main", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + location: { x: 3, y: 4, r: "Horizontal", isSearched: true }, + }, { + _id: "5ee8e16837809adc34caae00", + _tpl: "656f9fa0498d1b7e3e071d98", + parentId: "04a202a45f8a39b61a58a05a", + slotId: "Front_plate", + upd: { Repairable: { Durability: 50, MaxDurability: 50 } }, + }, { + _id: "de042f9ebf0fd9ad451033d4", + _tpl: "656f9fa0498d1b7e3e071d98", + parentId: "04a202a45f8a39b61a58a05a", + slotId: "Back_plate", + upd: { Repairable: { Durability: 50, MaxDurability: 50 } }, + }, { + _id: "03de471c2a3faa359aca7486", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "04a202a45f8a39b61a58a05a", + slotId: "1", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "091c85804613176da9478edd", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "04a202a45f8a39b61a58a05a", + slotId: "2", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "5482888e242a98ff154c0ee8", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "04a202a45f8a39b61a58a05a", + slotId: "3", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "3c8e206a2c2e9b0fee45b56b", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "04a202a45f8a39b61a58a05a", + slotId: "4", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "b2405216e5730f3511884a10", + _tpl: "5ea17ca01412a1425304d1c0", + parentId: "04a202a45f8a39b61a58a05a", slotId: "5", upd: { StackObjectsCount: 1 }, location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, }, { - _id: "fad89a5bdfd23e3248123346", - _tpl: "5fc5396e900b1d5091531e72", - parentId: "695b13896108f765e8985698", + _id: "7a0675280dbbad69ce592d74", + _tpl: "657f9a55c6679fefb3051e19", + parentId: "b2405216e5730f3511884a10", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 24, MaxDurability: 24 } }, + }, { + _id: "c0c182942f54d3c183f0e179", + _tpl: "657f9a94ada5fadd1f07a589", + parentId: "b2405216e5730f3511884a10", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 24, MaxDurability: 24 } }, + }, { + _id: "8ec4534a4fe96f89ea88c107", + _tpl: "5c165d832e2216398b5a7e36", + parentId: "04a202a45f8a39b61a58a05a", slotId: "6", - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, upd: { StackObjectsCount: 1 }, - }, { - _id: "b16c2a938954cd69c687c51a", - _tpl: "5b4736b986f77405cb415c10", - parentId: "695b13896108f765e8985698", - slotId: "7", location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { - _id: "a2b3019ac8d340eeb068d429", + _id: "0d91ed3d44881d33b1fd94ec", + _tpl: "5c5db6742e2216000f1b2852", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "04a202a45f8a39b61a58a05a", + slotId: "11", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "f7066fdfeefb29eca1d2dbeb", _tpl: "5ea18c84ecf1982c7712d9a2", - parentId: "695b13896108f765e8985698", - slotId: "10", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 29, MaxDurability: 33 } }, + upd: { StackObjectsCount: 1, Repairable: { Durability: 22, MaxDurability: 25 } }, + parentId: "b2405216e5730f3511884a10", + slotId: "mod_nvg", }, { - _id: "0b3c5d183e8b506d655f85c4", - _tpl: "644a3df63b0b6f03e101e065", - parentId: "fad89a5bdfd23e3248123346", - slotId: "mod_tactical", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "757211a0b648fe27b0475ded", - _tpl: "59f8a37386f7747af3328f06", - parentId: "b16c2a938954cd69c687c51a", - slotId: "mod_foregrip", + _id: "ee0ec86e9608abe773175e3a", + _tpl: "5c0558060db834001b735271", + parentId: "f7066fdfeefb29eca1d2dbeb", + slotId: "mod_nvg", upd: { StackObjectsCount: 1 }, }, { - _id: "870a887c63ca30fb15736b3d", - _tpl: "62a1b7fbc30cfa1d366af586", - parentId: "bb49d6ceb3e87d8563a06455", - slotId: "main", - upd: { StackObjectsCount: 1 }, - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - }, { - _id: "f3de631a1bb2b74bd0160d9a", - _tpl: "5d6d3be5a4b9361bc73bc763", - parentId: "bb49d6ceb3e87d8563a06455", - slotId: "main", - location: { x: 5, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 22.41, MaxDurability: 22.41 } }, - }, { - _id: "351180f3248d45c71cb2ebdc", - _tpl: "57c44b372459772d2b39b8ce", - parentId: "870a887c63ca30fb15736b3d", - slotId: "main", - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "7237f722106866f2df8dc8d1", - _tpl: "56e33680d2720be2748b4576", - parentId: "870a887c63ca30fb15736b3d", - slotId: "main", - location: { x: 0, y: 3, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "d0cf00aff56ea520cdd94330", - _tpl: "57c44dd02459772d2e0ae249", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_muzzle", - upd: { StackObjectsCount: 1 }, - }, { - _id: "5119653b2c66d57ee219e26f", - _tpl: "57c44f4f2459772d2c627113", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_reciever", - upd: { StackObjectsCount: 1 }, - }, { - _id: "ed1ac0183a8af587110aa74e", - _tpl: "5a9e81fba2750c00164f6b11", - parentId: "351180f3248d45c71cb2ebdc", + _id: "0515d1e589fd626b504e59cd", + _tpl: "5a38ee51c4a282000c5a955c", + parentId: "c3f58f44366d0a06d29d66ba", slotId: "mod_magazine", - upd: { StackObjectsCount: 1 }, + upd: {}, }, { - _id: "310a7d1bb07ae0e522f3f8e3", - _tpl: "5a69a2ed8dc32e000d46d1f1", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_pistol_grip", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "8a7e3489197b3b98126447fd", - _tpl: "6130ca3fd92c473c77020dbd", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_charge", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "e818616e11ae07aa05388759", - _tpl: "5dff8db859400025ea5150d4", - parentId: "351180f3248d45c71cb2ebdc", - slotId: "mod_mount_000", - upd: { StackObjectsCount: 1 }, - }, { - _id: "768812984debf2756bece089", - _tpl: "57c44e7b2459772d28133248", - parentId: "d0cf00aff56ea520cdd94330", - slotId: "mod_sight_rear", - upd: { StackObjectsCount: 1 }, - }, { - _id: "67c610585ed668baf4604931", - _tpl: "59eb7ebe86f7740b373438ce", - parentId: "d0cf00aff56ea520cdd94330", - slotId: "mod_mount_000", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "80e9dffa49bfe263ab0128c7", - _tpl: "6267c6396b642f77f56f5c1c", - parentId: "67c610585ed668baf4604931", - slotId: "mod_tactical_000", - upd: { StackObjectsCount: 1 }, - }, { - _id: "dee323443ce23ba8c54b9f1c", - _tpl: "5cc9c20cd7f00c001336c65d", - parentId: "67c610585ed668baf4604931", - slotId: "mod_tactical_001", - upd: { StackObjectsCount: 1 }, - }, { - _id: "3008088022dd55f1c99e5a32", - _tpl: "5c1cd46f2e22164bef5cfedb", - parentId: "67c610585ed668baf4604931", - slotId: "mod_foregrip", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "71e9f8d005c72940d857fe64", - _tpl: "59d790f486f77403cb06aec6", - parentId: "80e9dffa49bfe263ab0128c7", - slotId: "mod_flashlight", - upd: { StackObjectsCount: 1 }, - }, { - _id: "8c610c6cc67115a5fc1662ff", - _tpl: "56eabf3bd2720b75698b4569", - parentId: "310a7d1bb07ae0e522f3f8e3", - slotId: "mod_stock_000", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "9bf01177f0c1e346b2d65373", - _tpl: "58d2912286f7744e27117493", - parentId: "8c610c6cc67115a5fc1662ff", + _id: "cb30ae6f997a2e6d119f2186", + _tpl: "5a38ef1fc4a282000b1521f6", + parentId: "c3f58f44366d0a06d29d66ba", slotId: "mod_stock", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + upd: { Foldable: { Folded: true } }, }, { - _id: "7dd43ffa6e03c2da6cddc56e", - _tpl: "6171407e50224f204c1da3c5", - parentId: "e818616e11ae07aa05388759", - slotId: "mod_scope", - upd: { StackObjectsCount: 1 }, + _id: "be57a04835a8c1ae85811949", + _tpl: "5a38eecdc4a282329a73b512", + parentId: "cb30ae6f997a2e6d119f2186", + slotId: "mod_pistol_grip", + upd: {}, }, { - _id: "fa9da4ccf3630cb173c293f9", - _tpl: "5b3b99475acfc432ff4dcbee", - parentId: "7dd43ffa6e03c2da6cddc56e", - slotId: "mod_scope_000", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + _id: "fd6ef6e377e6280ca9386dbc", + _tpl: "571a26d524597720680fbe8a", + parentId: "26598f88d49198c4a0a9391c", + slotId: "mod_barrel", + upd: {}, }, { - _id: "6e2727806fb12e12123e9a57", - _tpl: "616554fe50224f204c1da2aa", - parentId: "7dd43ffa6e03c2da6cddc56e", - slotId: "mod_scope_001", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + _id: "5c40aff0d1c5d4f206123b83", + _tpl: "571a282c2459771fb2755a69", + parentId: "26598f88d49198c4a0a9391c", + slotId: "mod_pistol_grip", + upd: {}, }, { - _id: "2c868d4676adc934f897e9a7", - _tpl: "61605d88ffa6e502ac5e7eeb", - parentId: "7dd43ffa6e03c2da6cddc56e", - slotId: "mod_scope_002", - upd: { StackObjectsCount: 1 }, + _id: "34b2c7cf0f6b8f484411cebf", + _tpl: "571a29dc2459771fb2755a6a", + parentId: "26598f88d49198c4a0a9391c", + slotId: "mod_magazine", + upd: {}, }, { - _id: "1b159fdc14c350f8a4a7e19e", - _tpl: "58d39b0386f77443380bf13c", - parentId: "6e2727806fb12e12123e9a57", - slotId: "mod_scope", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + _id: "9932dd0e1339053e27d54a41", + _tpl: "654a4dea7c17dec2f50cc86a", + parentId: "f74d377063e65d350e0099be", + slotId: "Front_plate", + upd: { Repairable: { Durability: 50, MaxDurability: 50 } }, }, { - _id: "7691790ffc5290da292cab99", - _tpl: "61657230d92c473c770213d7", - parentId: "1b159fdc14c350f8a4a7e19e", - slotId: "mod_scope", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "012a11e7dcb1280a1ab9d2f6", - _tpl: "618168b350224f204c1da4d8", - parentId: "7237f722106866f2df8dc8d1", - slotId: "main", - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "38ca7415a458c4d22ba2f3c3", - _tpl: "6130c43c67085e45ef1405a1", - parentId: "012a11e7dcb1280a1ab9d2f6", - slotId: "mod_muzzle", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "c5a0621ebf856ce1b0945efc", - _tpl: "61816fcad92c473c770215cc", - parentId: "012a11e7dcb1280a1ab9d2f6", - slotId: "mod_sight_front", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "a74677b17c1c49edc002df9b", - _tpl: "5dfa3d2b0dee1b22f862eade", - parentId: "38ca7415a458c4d22ba2f3c3", - slotId: "mod_muzzle", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + _id: "0f69c261881206320d8f583d", + _tpl: "657b22485f444d6dff0c6c2f", + parentId: "f74d377063e65d350e0099be", + slotId: "Back_plate", + upd: { StackObjectsCount: 1, Repairable: { Durability: 4.681114, MaxDurability: 40 } }, }], }, { - scheduledTime: 1698945140, - traderId: "54cb57776803fa99248b456e", // Therapist - messageContent: { - templateId: "58fe0e3486f77471f772c3f2 2", - type: 8, - maxStorageTime: 518400, - text: "", - profileChangeEvents: [], - systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" }, - }, + scheduledTime: 1712896726, + traderId: "54cb57776803fa99248b456e", + maxStorageTime: 518400, + systemData: { date: "11.04.2024", time: "19:19", location: "factory4_day" }, + messageType: 8, + messageTemplateId: "58fe0e3486f77471f772c3f2 3", items: [{ - _id: "5ae1c2b99a0a339adc620148", - _tpl: "5cebec38d7f00c00110a652a", - parentId: "ad018df9da0cbf2726394ef1", - slotId: "mod_mount_000", - upd: { StackObjectsCount: 1 }, - }, { - _id: "30f4bcb87bcc4604e27c02c1", - _tpl: "5cc70146e4a949000d73bf6b", - parentId: "ad018df9da0cbf2726394ef1", - slotId: "mod_mount_001", - upd: { StackObjectsCount: 1 }, - }, { - _id: "ad018df9da0cbf2726394ef1", - _tpl: "5cc70102e4a949035e43ba74", - parentId: "3bc4ff5bd99f165dc75cbd25", - slotId: "main", - upd: { StackObjectsCount: 1 }, - location: { x: 3, y: 0, r: "Horizontal", isSearched: true }, - }, { - _id: "12c243bd6b3e486e61325f81", - _tpl: "5cc82d76e24e8d00134b4b83", - parentId: "5fe49444ae6628187a2e77b8", + _id: "5cfe91bfe022641c19bc8c60", + _tpl: "5aafa857e5b5b00018480968", + upd: { + StackObjectsCount: 1, + sptPresetId: "5ac4ad3686f774181345c3da", + Repairable: { Durability: 98.33, MaxDurability: 98.33 }, + }, + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", - upd: { StackObjectsCount: 1, Repairable: { Durability: 99.93771, MaxDurability: 100 } }, }, { - _id: "760652d86ee78eed513e0ad7", - _tpl: "5ab8f39486f7745cd93a1cca", - parentId: "5fe49444ae6628187a2e77b8", + _id: "a5063619e7f4db123ca07fcc", + _tpl: "60db29ce99594040e04c4a27", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { + FireMode: { FireMode: "single" }, + StackObjectsCount: 1, + Repairable: { Durability: 100, MaxDurability: 100 }, + }, + }, { + _id: "3702c30b6333e28d6a15d62c", + _tpl: "56e0598dd2720bb5668b45a6", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + }, { + _id: "387c9f2b44d2da266f856b31", + _tpl: "6571bde39837cc51b800c212", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "61ab4afefac354dfc64c7874", - _tpl: "5b432d215acfc4771e1c6624", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { StackObjectsCount: 1, Repairable: { Durability: 30, MaxDurability: 30 } }, - }, { - _id: "285e9d9ae196ae4e336cd04f", - _tpl: "5d5d87f786f77427997cfaef", - parentId: "5fe49444ae6628187a2e77b8", - slotId: "hideout", - upd: { StackObjectsCount: 1, Repairable: { Durability: 75, MaxDurability: 80 } }, - }, { - _id: "3bc4ff5bd99f165dc75cbd25", - _tpl: "5f5e467b0bc58666c37e7821", - parentId: "5fe49444ae6628187a2e77b8", + _id: "275f046ea1a7b40046cd54fa", + _tpl: "5b40e4035acfc47a87740943", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "6bf5d8ee81a3c9aec21bbbad", - _tpl: "5d5fca1ea4b93635fd598c07", - parentId: "5fe49444ae6628187a2e77b8", + _id: "f30858ff9924b1fe211dd1f7", + _tpl: "657f95bff92cd718b701550c", + parentId: "275f046ea1a7b40046cd54fa", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 10.3212032, MaxDurability: 18 } }, + }, { + _id: "eec1072ac0cc44984e1ed43b", + _tpl: "657f9605f4c82973640b2358", + parentId: "275f046ea1a7b40046cd54fa", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 13.3160009, MaxDurability: 18 } }, + }, { + _id: "b82495b01ad0bfe5dd7e864d", + _tpl: "5c0e746986f7741453628fe5", + parentId: "d2b3b859f667d4fd8b35bc96", slotId: "hideout", upd: { StackObjectsCount: 1 }, }, { - _id: "2371438cf809b5e483bf5d85", - _tpl: "5cc70093e4a949033c734312", - parentId: "12c243bd6b3e486e61325f81", + _id: "31531773990cd1aefa751db7", + _tpl: "6570df294cc0d2ab1e05ed74", + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "Soft_armor_front", + upd: { Repairable: { Durability: 31.0571022, MaxDurability: 35 } }, + }, { + _id: "eb8c6c7c671d2a2490454e7c", + _tpl: "6570df9c615f54368b04fca9", + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "Soft_armor_back", + upd: { Repairable: { Durability: 30.8, MaxDurability: 35 } }, + }, { + _id: "f9cc99048aa37c5a4a837ef9", + _tpl: "5ca20d5986f774331e7c9602", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1 }, + }, { + _id: "bd8a4a3783d80b81cc8655ee", + _tpl: "5aa2ba71e5b5b000137b758f", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1 }, + }, { + _id: "025748ec34dcd1bfb2529537", + _tpl: "5c0d32fcd174af02a1659c75", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1 }, + }, { + _id: "9c552e79f1ae38350afb3723", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5cfe91bfe022641c19bc8c60", slotId: "mod_magazine", - upd: { StackObjectsCount: 1 }, }, { - _id: "7f890346ea5b2cbc68c3170f", - _tpl: "5cc700b9e4a949000f0f0f25", - parentId: "12c243bd6b3e486e61325f81", + _id: "14cb5b7c9789876325670163", + _tpl: "5aaf8e43e5b5b00015693246", + parentId: "5cfe91bfe022641c19bc8c60", slotId: "mod_stock", - upd: { StackObjectsCount: 1 }, + upd: {}, }, { - _id: "12fb79a9c4929009ff8d89e1", - _tpl: "5cc700ede4a949033c734315", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_reciever", - upd: { StackObjectsCount: 1 }, - }, { - _id: "d4c5274082ed716e19447f46", - _tpl: "5cc701d7e4a94900100ac4e7", - parentId: "12c243bd6b3e486e61325f81", + _id: "0e4c9e11000589751523a62c", + _tpl: "5addbac75acfc400194dbc56", + parentId: "5cfe91bfe022641c19bc8c60", slotId: "mod_barrel", upd: { StackObjectsCount: 1 }, }, { - _id: "d819dd4d2b13de10e9d6d805", - _tpl: "5cc6ea85e4a949000e1ea3c3", - parentId: "12c243bd6b3e486e61325f81", - slotId: "mod_charge", - upd: { StackObjectsCount: 1 }, - }, { - _id: "fc9a664cacc477c4e725a81a", - _tpl: "5cc700d4e4a949000f0f0f28", - parentId: "7f890346ea5b2cbc68c3170f", - slotId: "mod_stock_000", - upd: { StackObjectsCount: 1 }, - }, { - _id: "372891c593cf14e176b93ce2", - _tpl: "5cc7012ae4a949001252b43e", - parentId: "12fb79a9c4929009ff8d89e1", - slotId: "mod_mount_000", - upd: { StackObjectsCount: 1 }, - }, { - _id: "bd196435a57bdc433df1e49d", - _tpl: "5cc7012ae4a949001252b43e", - parentId: "12fb79a9c4929009ff8d89e1", - slotId: "mod_mount_001", - upd: { StackObjectsCount: 1 }, - }, { - _id: "ea3349d29797354d835c2192", - _tpl: "58491f3324597764bc48fa02", - parentId: "12fb79a9c4929009ff8d89e1", - slotId: "mod_scope", + _id: "a63cf65e9646a04944d18106", + _tpl: "5abcbb20d8ce87001773e258", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5cfe91bfe022641c19bc8c60", + slotId: "mod_sight_rear", }, { - _id: "4ccf7c74ca7d2167deb0ae5c", - _tpl: "626becf9582c3e319310b837", - parentId: "372891c593cf14e176b93ce2", - slotId: "mod_tactical", - upd: { StackObjectsCount: 1 }, - }, { - _id: "adfd3640fc93daf21c721ca6", - _tpl: "5cc9c20cd7f00c001336c65d", - parentId: "bd196435a57bdc433df1e49d", - slotId: "mod_tactical", - upd: { StackObjectsCount: 1 }, - }, { - _id: "deeb36b1812790b0145d2532", - _tpl: "5a16badafcdbcb001865f72d", - parentId: "61ab4afefac354dfc64c7874", - slotId: "mod_equipment_000", - upd: { StackObjectsCount: 1, Repairable: { Durability: 12, MaxDurability: 25 } }, - }, { - _id: "4c0e0548df904c384569190c", - _tpl: "5ea058e01dbce517f324b3e2", - parentId: "61ab4afefac354dfc64c7874", - slotId: "mod_nvg", - upd: { StackObjectsCount: 1, Repairable: { Durability: 3, MaxDurability: 39 } }, - }, { - _id: "da82c293cabc705b30fef93a", - _tpl: "5a398ab9c4a282000c5a9842", - parentId: "61ab4afefac354dfc64c7874", + _id: "f67388e02546cd97c976d479", + _tpl: "5addbfe15acfc4001a5fc58b", + parentId: "5cfe91bfe022641c19bc8c60", slotId: "mod_mount", + upd: { StackObjectsCount: 1 }, + }, { + _id: "bed3b1a2f866e18743db2a63", + _tpl: "5addbfbb5acfc400194dbcf7", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "14cb5b7c9789876325670163", + slotId: "mod_mount", }, { - _id: "b8fc94611def6e9ba534a8b3", - _tpl: "5a16b8a9fcdbcb00165aa6ca", - parentId: "4c0e0548df904c384569190c", - slotId: "mod_nvg", + _id: "821a4953b87f562b3f435fd7", + _tpl: "5649a2464bdc2d91118b45a8", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "bed3b1a2f866e18743db2a63", + slotId: "mod_scope", }, { - _id: "20d6193c1f399e6326ebbc10", - _tpl: "5a16b93dfcdbcbcae6687261", - parentId: "b8fc94611def6e9ba534a8b3", - slotId: "mod_nvg", + _id: "24813deb9b9a6ec3ca8376ef", + _tpl: "5d10b49bd7ad1a1a560708b0", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "065c4f13b2bd8be266e1e809", - _tpl: "57235b6f24597759bf5a30f1", - parentId: "20d6193c1f399e6326ebbc10", - slotId: "mod_nvg", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 }, Togglable: { On: true } }, - }, { - _id: "1883b955ab202fa099809278", - _tpl: "57d17c5e2459775a5c57d17d", - parentId: "da82c293cabc705b30fef93a", - slotId: "mod_flashlight", - upd: { StackObjectsCount: 1 }, - }, { - _id: "e3c9e50ce31900c950b4ff6f", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "1", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "193259b5eb848af4d036bee5", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "2", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "f97ce69443f63bbe8f8097a7", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "3", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "5d1c154a8abcfa934e477ac4", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "4", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "289f7af841690c5388095477", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "5", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "3e6d578165b61aef9865f677", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "6", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "338682523f8504f97f84f3ab", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "7", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "6d18ac01aa04b16e4f0d5d2f", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "8", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "ac4ed54d61daa0c5219f8522", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "9", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "2460460ef3d3df5c1ce07edb", - _tpl: "5cc70093e4a949033c734312", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "10", - location: { x: 0, y: 0, r: "Vertical", isSearched: true }, - upd: { StackObjectsCount: 1 }, - }, { - _id: "3aeb18aac0b532f34255f162", - _tpl: "5cc70146e4a949000d73bf6b", - parentId: "285e9d9ae196ae4e336cd04f", - slotId: "11", - upd: { StackObjectsCount: 1 }, - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - }, { - _id: "bdb46107abbf1d92edaaf14e", - _tpl: "6272379924e29f06af4d5ecb", - parentId: "3aeb18aac0b532f34255f162", + parentId: "bed3b1a2f866e18743db2a63", slotId: "mod_tactical", - upd: { StackObjectsCount: 1 }, }, { - _id: "0caadd8507a36d9ea871e88e", - _tpl: "5ab8f04f86f774585f4237d8", - parentId: "3bc4ff5bd99f165dc75cbd25", - slotId: "main", - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { StackObjectsCount: 1 }, + _id: "4194116ceb7e9e623cba4e89", + _tpl: "609bab8b455afd752b2e6138", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "821a4953b87f562b3f435fd7", + slotId: "mod_scope", }, { - _id: "240046eebc9040c1d7e58611", - _tpl: "5ac66d015acfc400180ae6e4", - parentId: "0caadd8507a36d9ea871e88e", - slotId: "main", - location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { Durability: 32, MaxDurability: 59 }, - Foldable: { Folded: true }, - }, - }, { - _id: "70b23c628fa17699d9a71e94", - _tpl: "59c6633186f7740cf0493bb9", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_gas_block", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { Durability: 32, MaxDurability: 59 }, - }, - }, { - _id: "7cc2e24dc6bc0716bdddc472", - _tpl: "5943ee5a86f77413872d25ec", - parentId: "240046eebc9040c1d7e58611", + _id: "3bd8b76ba1ff8f1cf954af91", + _tpl: "59bffc1f86f77435b128b872", + parentId: "0e4c9e11000589751523a62c", slotId: "mod_muzzle", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, - }, { - _id: "7a51ebbad703082660d59d27", - _tpl: "5649ade84bdc2d1b2b8b4587", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_pistol_grip", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { Durability: 32, MaxDurability: 59 }, - }, - }, { - _id: "b481bc57436ed9a0c3abe7f3", - _tpl: "5d2c76ed48f03532f2136169", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_reciever", upd: { StackObjectsCount: 1 }, }, { - _id: "5774ef80597c7f91bff40dbb", - _tpl: "5ac50c185acfc400163398d4", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_stock", - upd: { - StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { Durability: 32, MaxDurability: 59 }, - }, + _id: "3d953b4a4283363d0494d614", + _tpl: "59bffbb386f77435b379b9c2", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "3bd8b76ba1ff8f1cf954af91", + slotId: "mod_muzzle", }, { - _id: "8b7c8e6ba172ac390c99a2ae", - _tpl: "5ac66c5d5acfc4001718d314", - parentId: "240046eebc9040c1d7e58611", + _id: "4b2c9fb752a7c3458e07a35d", + _tpl: "626bb8532c923541184624b4", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "f67388e02546cd97c976d479", + slotId: "mod_scope", + }, { + _id: "ce39864f056a3ad649d77243", + _tpl: "60dc519adf4c47305f6d410d", + parentId: "a5063619e7f4db123ca07fcc", slotId: "mod_magazine", - upd: { StackObjectsCount: 1 }, + upd: {}, }, { - _id: "1ed3a416b1fc7adbed1160df", - _tpl: "6130ca3fd92c473c77020dbd", - parentId: "240046eebc9040c1d7e58611", - slotId: "mod_charge", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + _id: "4ffc8f4e80708f6b9336c224", + _tpl: "612368f58b401f4f51239b33", + parentId: "a5063619e7f4db123ca07fcc", + slotId: "mod_barrel", + upd: {}, }, { - _id: "bbe087661947c0d9c1cde146", - _tpl: "5648b1504bdc2d9d488b4584", - parentId: "70b23c628fa17699d9a71e94", + _id: "b401a4ce551dfcb0602e4073", + _tpl: "612781056f3d944a17348d60", + parentId: "a5063619e7f4db123ca07fcc", + slotId: "mod_stock", + upd: {}, + }, { + _id: "b206761507a97037d05f0268", + _tpl: "6123649463849f3d843da7c4", + parentId: "a5063619e7f4db123ca07fcc", slotId: "mod_handguard", + upd: {}, + }, { + _id: "25af8615f5c902fd5920965f", + _tpl: "619d36da53b4d42ee724fae4", + parentId: "4ffc8f4e80708f6b9336c224", + slotId: "mod_muzzle", + upd: {}, + }, { + _id: "38c5e9751e1d69d4d0804a49", + _tpl: "5448c12b4bdc2d02308b456f", + parentId: "3702c30b6333e28d6a15d62c", + slotId: "mod_magazine", + upd: {}, + }, { + _id: "54da5dc9656bb9477eb16c88", + _tpl: "56e05b06d2720bb2668b4586", + parentId: "3702c30b6333e28d6a15d62c", + slotId: "mod_muzzle", + upd: {}, + }, { + _id: "ad690f7145984b942288457f", + _tpl: "56e05a6ed2720bd0748b4567", + parentId: "3702c30b6333e28d6a15d62c", + slotId: "mod_pistolgrip", + upd: {}, + }, { + _id: "c4ffff33f0a5f48c9500699a", + _tpl: "656fa0fb498d1b7e3e071d9c", + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "Front_plate", + upd: { Repairable: { Durability: 31.1713047, MaxDurability: 45 } }, + }, { + _id: "8453961a28b572039197e140", + _tpl: "656fa0fb498d1b7e3e071d9c", + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "Back_plate", + upd: { Repairable: { Durability: 32.4, MaxDurability: 45 } }, + }, { + _id: "43e7482d78b276a5db4f4fef", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "1", + location: { x: 0, y: 1, r: "Horizontal", isSearched: true }, + }, { + _id: "7372a194a2de632f5941b701", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "2", + location: { x: 0, y: 1, r: "Horizontal", isSearched: true }, + }, { + _id: "624555830937dfa5190a11bf", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "3", + location: { x: 0, y: 1, r: "Horizontal", isSearched: true }, + }, { + _id: "05aedd00b683ce0d00ac5c74", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "4", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "8c3eccca9f25989d68d90e59", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "5", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "b8b2e1651d7dbb891053b514", + _tpl: "5aa7e454e5b5b0214e506fa2", + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "8", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "f9b891b8a5cf948b858a7b1b", + _tpl: "657f925dada5fadd1f07a57a", + parentId: "b8b2e1651d7dbb891053b514", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "8b66bc46287219eb0e7c190d", + _tpl: "657f92acada5fadd1f07a57e", + parentId: "b8b2e1651d7dbb891053b514", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "24cd31ecc0fdac526c8bd21d", + _tpl: "657f92e7f4c82973640b2354", + parentId: "b8b2e1651d7dbb891053b514", + slotId: "Helmet_ears", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "c6125558f051cd10cfaf77e0", + _tpl: "5d6d3716a4b9361bc8618872", + parentId: "b82495b01ad0bfe5dd7e864d", + slotId: "9", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "ee92a87a762b35b45f9d7fa7", + _tpl: "657fa009d4caf976440afe3a", + parentId: "c6125558f051cd10cfaf77e0", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 33, MaxDurability: 33 } }, + }, { + _id: "be9a15c5ab850ae0437315bb", + _tpl: "657fa04ac6679fefb3051e24", + parentId: "c6125558f051cd10cfaf77e0", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 33, MaxDurability: 33 } }, + }, { + _id: "65c9ceccbebe5f2813a8c70e", + _tpl: "657fa07387e11c61f70bface", + parentId: "c6125558f051cd10cfaf77e0", + slotId: "Helmet_ears", + upd: { Repairable: { Durability: 33, MaxDurability: 33 } }, + }, { + _id: "769eab07773ecfaa6e12e4c4", + _tpl: "5aa7e3abe5b5b000171d064d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 50, MaxDurability: 50 }, Togglable: { On: true } }, + parentId: "b8b2e1651d7dbb891053b514", + slotId: "mod_equipment", + }, { + _id: "82aa530739c59be8dd5a0911", + _tpl: "5d6d3829a4b9361bc8618943", + upd: { StackObjectsCount: 1, Repairable: { Durability: 50, MaxDurability: 50 }, Togglable: { On: true } }, + parentId: "c6125558f051cd10cfaf77e0", + slotId: "mod_equipment_000", + }, { + _id: "996a6f0f8e90cb31f758c801", + _tpl: "5d6d3be5a4b9361bc73bc763", + upd: { StackObjectsCount: 1, Repairable: { Durability: 10, MaxDurability: 24 } }, + parentId: "c6125558f051cd10cfaf77e0", + slotId: "mod_equipment_001", + }, { + _id: "8c43cca672e16a931590945f", + _tpl: "5d6d3943a4b9360dbc46d0cc", + upd: { StackObjectsCount: 1, Repairable: { Durability: 1, MaxDurability: 1 } }, + parentId: "c6125558f051cd10cfaf77e0", + slotId: "mod_equipment_002", + }, { + _id: "5858b72da0ca732b2fb5ed95", + _tpl: "544a5caa4bdc2d1a388b4568", + parentId: "f9cc99048aa37c5a4a837ef9", + slotId: "main", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Vertical", isSearched: true }, + }, { + _id: "43ef5a5e1c93ba3ab032811f", + _tpl: "6570e83223c1f638ef0b0ede", + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "Soft_armor_front", + upd: { Repairable: { Durability: 42, MaxDurability: 42 } }, + }, { + _id: "e1f16c6d9e853f2735948665", + _tpl: "6570e87c23c1f638ef0b0ee2", + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "Soft_armor_back", + upd: { Repairable: { Durability: 42, MaxDurability: 42 } }, + }, { + _id: "d9bdf684a8264ac1fb3208bf", + _tpl: "6570e90b3a5689d85f08db97", + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "Groin", + upd: { Repairable: { Durability: 28, MaxDurability: 28 } }, + }, { + _id: "e4b484ba7209d770482732c8", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "f9cc99048aa37c5a4a837ef9", + slotId: "main", + location: { x: 0, y: 3, r: "Horizontal", isSearched: true }, + }, { + _id: "ddc3945694d52dcdae9cba4d", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "f9cc99048aa37c5a4a837ef9", + slotId: "main", + location: { x: 1, y: 3, r: "Horizontal", isSearched: true }, + }, { + _id: "59923cfba8be35031e5d95e6", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "f9cc99048aa37c5a4a837ef9", + slotId: "main", + location: { x: 2, y: 3, r: "Horizontal", isSearched: true }, + }, { + _id: "95cf47373df5c4f07f458a93", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "f9cc99048aa37c5a4a837ef9", + slotId: "main", + location: { x: 3, y: 3, r: "Horizontal", isSearched: true }, + }, { + _id: "98661f27ea826095d0cdd609", + _tpl: "656f9fa0498d1b7e3e071d98", + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "Front_plate", + upd: { Repairable: { Durability: 50, MaxDurability: 50 } }, + }, { + _id: "525179b06d14baaddb2b04fb", + _tpl: "656f9fa0498d1b7e3e071d98", + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "Back_plate", + upd: { Repairable: { Durability: 50, MaxDurability: 50 } }, + }, { + _id: "353638d16450339e40f5b5eb", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "1", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "fa4a5c3e4e3c2f017e35eb1a", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "2", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "7554a8ddb30e0306de7b7d80", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "3", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "4c73b93f4d9f17a05a5782fa", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "4", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "8ce190fcd2ffe5f1f9ad345a", + _tpl: "5aa7e4a4e5b5b000137b76f2", + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "5", + upd: { StackObjectsCount: 1 }, + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "6607b1b9d73f83e559304208", + _tpl: "657f925dada5fadd1f07a57a", + parentId: "8ce190fcd2ffe5f1f9ad345a", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "41912d06dac91585499c05a2", + _tpl: "657f92acada5fadd1f07a57e", + parentId: "8ce190fcd2ffe5f1f9ad345a", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "db24f69de28bddd7f09b9c3e", + _tpl: "657f92e7f4c82973640b2354", + parentId: "8ce190fcd2ffe5f1f9ad345a", + slotId: "Helmet_ears", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "6c578731bc0c3f91c8089116", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "6", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "aa7b1ce4897aa7e64309ce86", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "6", + location: { x: 1, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "7e5e5dbe18de6aea779d904d", + _tpl: "5addccf45acfc400185c2989", + upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + parentId: "5858b72da0ca732b2fb5ed95", + slotId: "11", + location: { x: 0, y: 0, r: "Horizontal", isSearched: true }, + }, { + _id: "b50b5052892729841e26934f", + _tpl: "5aa7e3abe5b5b000171d064d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 47, MaxDurability: 47 }, Togglable: { On: true } }, + parentId: "8ce190fcd2ffe5f1f9ad345a", + slotId: "mod_equipment", + }], +}, { + scheduledTime: 1712960777.6, + traderId: "54cb50c76803fa8b248b4571", + maxStorageTime: 345600, + systemData: { date: "11.04.2024", time: "19:30", location: "factory4_day" }, + messageType: 8, + messageTemplateId: "58fe0e4586f774728248ca13 4", + items: [{ + _id: "b29c463afe52421ba72b1816", + _tpl: "5aa7e3abe5b5b000171d064d", + upd: { StackObjectsCount: 1, Repairable: { Durability: 50, MaxDurability: 50 } }, + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + }, { + _id: "1813e676a1bceefd5424b4bb", + _tpl: "5ac7655e5acfc40016339a19", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "a58746a7e98ac16ba9105fc9", + _tpl: "5cf50850d7f00c056e24104c", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "70acf65d9944b19d17d92b19", + _tpl: "55d480c04bdc2d1d4e8b456a", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "e3a54ae66a2970372eee1888", + _tpl: "602e63fb6335467b0c5ac94d", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "a4b1cb12dc5ece274d348e2b", + _tpl: "6033749e88382f4fab3fd2c5", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "e3c2162f4001a0d6ed2a199d", + _tpl: "602f85fd9b513876d4338d9c", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "548a111c4e48fb058e7a5c09", + _tpl: "603372b4da11d6478d5a07ff", + parentId: "e3a54ae66a2970372eee1888", + slotId: "mod_barrel", + upd: {}, + }, { + _id: "d58db125fdd3f3b15a9798ca", + _tpl: "602e620f9b513876d4338d9a", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "f85ba56791757174e3447c55", + _tpl: "630764fea987397c0816d219", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "e3c409642a067f980ca168b7", + _tpl: "63075cc5962d0247b029dc2a", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "5ff60d8b2b61c9f20ee8e91b", + _tpl: "63076701a987397c0816d21b", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "b212acf3c8f09f48b4beaa0d", + _tpl: "5648a69d4bdc2ded0b8b457b", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1 }, + }], +}, { + scheduledTime: 1712920104.8, + traderId: "54cb57776803fa99248b456e", + maxStorageTime: 518400, + systemData: { date: "11.04.2024", time: "19:30", location: "factory4_day" }, + messageType: 8, + messageTemplateId: "58fe0e3486f77471f772c3f2 0", + items: [{ + _id: "203161dde59c5a2fdd362da9", + _tpl: "5aa7e4a4e5b5b000137b76f2", + upd: { StackObjectsCount: 1, sptPresetId: "657fa87fc6679fefb3051e32" }, + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + }, { + _id: "37c9968cfc4372c968f57c42", + _tpl: "657f925dada5fadd1f07a57a", + parentId: "203161dde59c5a2fdd362da9", + slotId: "Helmet_top", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "5517446f3cd41cf75d3a9cd2", + _tpl: "657f92acada5fadd1f07a57e", + parentId: "203161dde59c5a2fdd362da9", + slotId: "Helmet_back", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "0fdc8f25f7dfc61678cdef01", + _tpl: "657f92e7f4c82973640b2354", + parentId: "203161dde59c5a2fdd362da9", + slotId: "Helmet_ears", + upd: { Repairable: { Durability: 21, MaxDurability: 21 } }, + }, { + _id: "e2cba41b10edfc595e2bb574", + _tpl: "628b916469015a4e1711ed8d", + parentId: "6c5ef8a5fb3b88641420e9a0", + slotId: "mod_handguard", + upd: {}, + }, { + _id: "dd3aa187f853187198860933", + _tpl: "628b9be6cff66b70c002b14c", + parentId: "e2cba41b10edfc595e2bb574", + slotId: "mod_reciever", + upd: {}, + }, { + _id: "13d29ea647b01f0ecb774a54", + _tpl: "628b9471078f94059a4b9bfb", + parentId: "dd3aa187f853187198860933", + slotId: "mod_sight_rear", + upd: {}, + }, { + _id: "6c5ef8a5fb3b88641420e9a0", + _tpl: "628b8d83717774443b15e248", + parentId: "afcef56bf4fa36d0ec1f4166", + slotId: "mod_gas_block", + upd: {}, + }, { + _id: "7980e04a92db0858cb7f4bfa", + _tpl: "55d4ae6c4bdc2d8b2f8b456e", + parentId: "929c1577ba7390558c59d8a5", + slotId: "mod_stock", + upd: {}, + }, { + _id: "929c1577ba7390558c59d8a5", + _tpl: "628b9a40717774443b15e9f2", + parentId: "afcef56bf4fa36d0ec1f4166", + slotId: "mod_stock_000", + upd: {}, + }, { + _id: "afcef56bf4fa36d0ec1f4166", + _tpl: "628b5638ad252a16da6dd245", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", upd: { + FireMode: { FireMode: "single" }, StackObjectsCount: 1, - sptPresetId: "5acf7dfc86f774401e19c390", - Repairable: { Durability: 32, MaxDurability: 59 }, + Repairable: { Durability: 100, MaxDurability: 100 }, }, }, { - _id: "724388f8110434efccd79b3a", - _tpl: "544a3a774bdc2d3a388b4567", - parentId: "b481bc57436ed9a0c3abe7f3", - slotId: "mod_scope", + _id: "a94905f708670fca5de11e7e", + _tpl: "60339954d62c9b14ed777c06", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { + FireMode: { FireMode: "single" }, + StackObjectsCount: 1, + Repairable: { Durability: 100, MaxDurability: 100 }, + }, + }, { + _id: "8f5ce6d3c7730240c3ae78ad", + _tpl: "602e71bd53a60014f9705bfa", + parentId: "a94905f708670fca5de11e7e", + slotId: "mod_pistol_grip", + upd: {}, + }, { + _id: "c320122de049da2880d0a235", + _tpl: "5a7ad2e851dfba0016153692", + parentId: "a94905f708670fca5de11e7e", + slotId: "mod_magazine", + upd: {}, + }, { + _id: "d2923c8984f26f68f01d20d7", + _tpl: "602e3f1254072b51b239f713", + parentId: "a94905f708670fca5de11e7e", + slotId: "mod_stock_001", + upd: {}, + }, { + _id: "ecd363cddbb5361670d531b0", + _tpl: "60337f5dce399e10262255d1", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "704c139d092f1bd3e3d18df2", + _tpl: "6034e3cb0ddce744014cb870", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "72bd97cb21996a2282ff7bcd", + _tpl: "630765cb962d0247b029dc45", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "44e3df51e01d5b23445fb95f", + _tpl: "630765777d50ff5e8a1ea718", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: {}, + }, { + _id: "1cb0900a4bd068b04ca05db1", + _tpl: "63088377b5cd696784087147", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, }, { - _id: "8581038b0f795618a3d26c94", - _tpl: "58d268fc86f774111273f8c2", - parentId: "724388f8110434efccd79b3a", - slotId: "mod_scope", - upd: { StackObjectsCount: 1, Repairable: { Durability: 100, MaxDurability: 100 } }, + _id: "379ca7cd56ebb1434bd89d62", + _tpl: "656f9d5900d62bcd2e02407c", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "Front_plate", + upd: { Repairable: { Durability: 32.4841042, MaxDurability: 45 } }, + }, { + _id: "d700aaa1d7a15644f6b91dc7", + _tpl: "656f9d5900d62bcd2e02407c", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "Back_plate", + upd: { Repairable: { Durability: 45, MaxDurability: 45 } }, + }, { + _id: "eb3bbc6cb084a53ff48b672d", + _tpl: "5b44d22286f774172b0c9de8", + parentId: "d2b3b859f667d4fd8b35bc96", + slotId: "hideout", + upd: { StackObjectsCount: 1 }, + }, { + _id: "6a3d83c5230d1779060e17a9", + _tpl: "65704de13e7bba58ea0285c8", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "Soft_armor_front", + upd: { Repairable: { Durability: 37.4214172, MaxDurability: 56 } }, + }, { + _id: "9fba54de64b37902dd14b6e5", + _tpl: "65705c3c14f2ed6d7d0b7738", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "Soft_armor_back", + upd: { Repairable: { Durability: 49.93156, MaxDurability: 56 } }, + }, { + _id: "2b534b3af5f240c625a77424", + _tpl: "65705c777260e1139e091408", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "Soft_armor_left", + upd: { Repairable: { Durability: 12, MaxDurability: 12 } }, + }, { + _id: "e046688c9167ceaced5af3a7", + _tpl: "65705cb314f2ed6d7d0b773c", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "soft_armor_right", + upd: { Repairable: { Durability: 12, MaxDurability: 12 } }, + }, { + _id: "6c612d370959e61b6c10b7bf", + _tpl: "65705cea4916448ae1050897", + parentId: "eb3bbc6cb084a53ff48b672d", + slotId: "Collar", + upd: { Repairable: { Durability: 14, MaxDurability: 14 } }, }], }]; diff --git a/project/tests/controllers/InsuranceController.test.ts b/project/tests/controllers/InsuranceController.test.ts index ba0cbed5..205d9160 100644 --- a/project/tests/controllers/InsuranceController.test.ts +++ b/project/tests/controllers/InsuranceController.test.ts @@ -122,9 +122,7 @@ describe("InsuranceController", () => // Verify that the correct methods were called. expect(mockGetProfile).toBeCalledTimes(1); - expect(mockLoggerDebug).toBeCalledWith( - `Found ${insuranceFixture.length} insurance packages in profile ${sessionID}`, - ); + expect(mockLoggerDebug).toBeCalledTimes(1); expect(insuredFiltered.length).toBe(insuranceFixture.length); }); @@ -147,9 +145,7 @@ describe("InsuranceController", () => // Verify that the correct methods were called. expect(mockGetProfile).toBeCalledTimes(1); - expect(mockLoggerDebug).toBeCalledWith( - `Found ${insuranceFixture.length} insurance packages in profile ${sessionID}`, - ); + expect(mockLoggerDebug).toBeCalledTimes(1); expect(insuredFiltered.length).toBe(insuranceFixture.length - 1); // Should be 1 less than the original fixture. }); @@ -173,9 +169,7 @@ describe("InsuranceController", () => // Verify that the correct methods were called. expect(mockGetProfile).toBeCalledTimes(1); - expect(mockLoggerDebug).toBeCalledWith( - `Found ${insuranceFixture.length} insurance packages in profile ${sessionID}`, - ); + expect(mockLoggerDebug).toBeCalledTimes(1); // Verify that the returned array is empty. expect(insuredFiltered.length).toBe(0); @@ -187,12 +181,14 @@ describe("InsuranceController", () => it("should log information about the insurance package", () => { const sessionId = "session-id"; + const numberOfItems = 666; // Spy on the logger.debug method. const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug"); + vi.spyOn(insuranceController, "countAllInsuranceItems").mockReturnValue(numberOfItems); vi.spyOn(insuranceController, "findItemsToDelete").mockImplementation(vi.fn()); vi.spyOn(insuranceController, "removeItemsFromInsurance").mockImplementation(vi.fn()); - vi.spyOn(insuranceController, "adoptOrphanedItems").mockImplementation(vi.fn()); + vi.spyOn(insuranceController.itemHelper, "adoptOrphanedItems").mockImplementation(vi.fn()); vi.spyOn(insuranceController, "sendMail").mockImplementation(vi.fn()); vi.spyOn(insuranceController, "removeInsurancePackageFromProfile").mockImplementation(vi.fn()); @@ -201,9 +197,7 @@ describe("InsuranceController", () => // Verify that the log was written. expect(mockLoggerDebug).toBeCalledWith( - `Processing ${insuranceFixture.length} insurance packages, which includes a total of ${ - insuranceController.countAllInsuranceItems(insuranceFixture) - } items, in profile ${sessionId}`, + `Processing ${insuranceFixture.length} insurance packages, which includes a total of ${numberOfItems} items, in profile ${sessionId}`, ); }); @@ -218,9 +212,8 @@ describe("InsuranceController", () => ); const mockRemoveItemsFromInsurance = vi.spyOn(insuranceController, "removeItemsFromInsurance") .mockImplementation(vi.fn()); - const mockAdoptOrphanedItems = vi.spyOn(insuranceController, "adoptOrphanedItems").mockImplementation( - vi.fn(), - ); + const mockAdoptOrphanedItems = vi.spyOn(insuranceController.itemHelper, "adoptOrphanedItems") + .mockImplementation(vi.fn()); const mockSendMail = vi.spyOn(insuranceController, "sendMail").mockImplementation(vi.fn()); const mockRemoveInsurancePackageFromProfile = vi.spyOn( insuranceController, @@ -295,12 +288,17 @@ describe("InsuranceController", () => it("should remove the specified insurance package from the profile", () => { const sessionID = "session-id"; - const packageToRemove = { date: "01.11.2023", time: "10:51", location: "factory4_day" }; + const packageToRemove = { + traderId: "54cb50c76803fa8b248b4571", + systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" }, + }; const profile = { insurance: [{ - messageContent: { systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" } }, - }, { // This one should be removed - messageContent: { systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" } }, + traderId: "54cb50c76803fa8b248b4571", + systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" }, + }, { + traderId: "54cb57776803fa99248b456e", + systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" }, }], }; @@ -312,20 +310,23 @@ describe("InsuranceController", () => // Verify that the specified insurance package was removed. expect(profile.insurance.length).toBe(1); - expect(profile.insurance[0].messageContent.systemData).toStrictEqual({ - date: "01.11.2023", - time: "11:18", - location: "factory4_day", - }); + expect(profile.insurance).toStrictEqual([{ + traderId: "54cb57776803fa99248b456e", + systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" }, + }]); }); it("should log a message indicating that the package was removed", () => { const sessionID = "session-id"; - const packageToRemove = { date: "01.11.2023", time: "10:51", location: "factory4_day" }; + const packageToRemove = { + traderId: "54cb50c76803fa8b248b4571", + systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" }, + }; const profile = { insurance: [{ - messageContent: { systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" } }, + traderId: "54cb50c76803fa8b248b4571", + systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" }, }], }; @@ -340,17 +341,24 @@ describe("InsuranceController", () => // Verify that the log was written. expect(mockLoggerDebug).toBeCalledWith( - `Removed insurance package with date: ${packageToRemove.date}, time: ${packageToRemove.time}, and location: ${packageToRemove.location} from profile ${sessionID}. Remaining packages: ${profile.insurance.length}`, + `Removed processed insurance package. Remaining packages: ${profile.insurance.length}`, ); }); it("should not remove any packages if the specified package is not found", () => { const sessionID = "session-id"; - const packageToRemove = { date: "01.11.2023", time: "10:51", location: "factory4_day" }; + const packageToRemove = { + traderId: "54cb50c76803fa8b248b4571", + systemData: { date: "01.11.2023", time: "11:25", location: "factory4_day" }, + }; const profile = { insurance: [{ - messageContent: { systemData: { date: "02.11.2023", time: "10:50", location: "factory4_night" } }, + traderId: "54cb50c76803fa8b248b4571", + systemData: { date: "01.11.2023", time: "11:18", location: "factory4_day" }, + }, { + traderId: "54cb57776803fa99248b456e", + systemData: { date: "01.11.2023", time: "10:51", location: "factory4_day" }, }], }; @@ -360,8 +368,8 @@ describe("InsuranceController", () => // Execute the method. insuranceController.removeInsurancePackageFromProfile(sessionID, packageToRemove); - // Verify that no packages were removed. - expect(profile.insurance.length).toBe(1); + // Verify that the specified insurance package was removed. + expect(profile.insurance.length).toBe(2); }); }); @@ -373,7 +381,10 @@ describe("InsuranceController", () => insurancePackage.items = []; // Execute the method. - const result = insuranceController.findItemsToDelete(insurancePackage); + const result = insuranceController.findItemsToDelete( + insuranceController.hashUtil.generate(), + insurancePackage, + ); // Verify that the result is correct. expect(result.size).toBe(0); @@ -387,7 +398,6 @@ describe("InsuranceController", () => const numberOfItems = insured.items.length; // Mock helper methods. - const mockPopulateItemsMap = vi.spyOn(insuranceController, "populateItemsMap"); const mockPopulateParentAttachmentsMap = vi.spyOn(insuranceController, "populateParentAttachmentsMap"); const mockIsAttachmentAttached = vi.spyOn(insuranceController.itemHelper, "isAttachmentAttached"); const mockProcessAttachments = vi.spyOn(insuranceController, "processAttachments").mockImplementation( @@ -405,12 +415,11 @@ describe("InsuranceController", () => vi.spyOn(insuranceController, "processRegularItems").mockImplementation(mockProcessRegularItems); // Execute the method. - const result = insuranceController.findItemsToDelete(insured); + const result = insuranceController.findItemsToDelete(insuranceController.hashUtil.generate(), insured); // Verify that the correct methods were called. - expect(mockPopulateItemsMap).toHaveBeenCalledTimes(1); expect(mockPopulateParentAttachmentsMap).toHaveBeenCalledTimes(1); - expect(mockIsAttachmentAttached).toHaveBeenCalledTimes(numberOfItems + 1); // Once for each item, plus once more + expect(mockIsAttachmentAttached).toHaveBeenCalled(); expect(mockProcessRegularItems).toHaveBeenCalledTimes(1); expect(mockProcessAttachments).not.toHaveBeenCalled(); @@ -426,7 +435,6 @@ describe("InsuranceController", () => const insured = insuranceFixture[0]; // Mock helper methods. - const mockPopulateItemsMap = vi.spyOn(insuranceController, "populateItemsMap"); const mockProcessRegularItems = vi.spyOn(insuranceController, "processRegularItems"); const mockProcessAttachments = vi.spyOn(insuranceController, "processAttachments"); @@ -440,10 +448,9 @@ describe("InsuranceController", () => ); // Execute the method. - const result = insuranceController.findItemsToDelete(insured); + const result = insuranceController.findItemsToDelete(insuranceController.hashUtil.generate(), insured); // Verify that the correct methods were called. - expect(mockPopulateItemsMap).toHaveBeenCalled(); expect(mockPopulateParentAttachmentsMap).toHaveBeenCalled(); expect(mockProcessRegularItems).not.toHaveBeenCalled(); expect(mockProcessAttachments).not.toHaveBeenCalled(); @@ -459,7 +466,6 @@ describe("InsuranceController", () => const numberOfItems = insured.items.length; // Mock helper methods. - const mockPopulateItemsMap = vi.spyOn(insuranceController, "populateItemsMap"); const mockPopulateParentAttachmentsMap = vi.spyOn(insuranceController, "populateParentAttachmentsMap"); // Add all items to the toDelete set. Not realistic, but it's fine for this test. @@ -481,10 +487,9 @@ describe("InsuranceController", () => vi.spyOn(insuranceController, "processAttachments").mockImplementation(mockProcessAttachments); // Execute the method. - const result = insuranceController.findItemsToDelete(insured); + const result = insuranceController.findItemsToDelete(insuranceController.hashUtil.generate(), insured); // Verify that the correct methods were called. - expect(mockPopulateItemsMap).toHaveBeenCalled(); expect(mockPopulateParentAttachmentsMap).toHaveBeenCalled(); expect(mockProcessRegularItems).toHaveBeenCalled(); expect(mockProcessAttachments).toHaveBeenCalled(); @@ -499,7 +504,6 @@ describe("InsuranceController", () => const insured = insuranceFixture[0]; // Mock helper methods. - const mockPopulateItemsMap = vi.spyOn(insuranceController, "populateItemsMap"); const mockPopulateParentAttachmentsMap = vi.spyOn(insuranceController, "populateParentAttachmentsMap"); // Don't add any items to the toDelete set. @@ -511,10 +515,9 @@ describe("InsuranceController", () => ); // Execute the method. - const result = insuranceController.findItemsToDelete(insured); + const result = insuranceController.findItemsToDelete(insuranceController.hashUtil.generate(), insured); // Verify that the correct methods were called. - expect(mockPopulateItemsMap).toHaveBeenCalled(); expect(mockPopulateParentAttachmentsMap).toHaveBeenCalled(); expect(mockProcessRegularItems).toHaveBeenCalled(); expect(mockProcessAttachments).toHaveBeenCalled(); @@ -551,7 +554,7 @@ describe("InsuranceController", () => vi.spyOn(insuranceController, "processAttachments").mockImplementation(mockProcessAttachments); // Execute the method. - const result = insuranceController.findItemsToDelete(insured); + const result = insuranceController.findItemsToDelete(insuranceController.hashUtil.generate(), insured); // Verify that the result is the correct size, and the size is logged. expect(result.size).toBe(numberOfItems); @@ -566,26 +569,54 @@ describe("InsuranceController", () => const insured = insuranceFixture[0]; // Generate the items map. - const itemsMap = insuranceController.populateItemsMap(insured); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); // Execute the method. - const result = insuranceController.populateParentAttachmentsMap(insured, itemsMap); + const result = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Verify that the map is populated correctly. - expect(result.size).toBe(6); // There are 6 base-level items in this insurance package. + expect(result.size).toBe(9); // There are 9 base-level items in this insurance package. - const gun = result.get("911a0f04d5d9c7e239807ae0"); - expect(gun.length).toBe(7); // This AK has 7 attachments. + const gun = result.get("35111c9b72a87b6b7d95ad35"); + expect(gun.length).toBe(31); // This gun has 31 attachments. - // The attachments should be mapped to the AK properly... + // The attachments should be mapped to the gun properly... const validAttachmentTemplates = [ - "677c209ebb45445ebb42c405", - "4bd10f89836fd9f86aedcac1", - "8b1327270791b142ac341b03", - "da8cde1b3024c336f6e06152", - "bc041c0011d76f714b898400", - "9f8d7880a6e0a47a211ec5d3", - "db2ef9442178910eba985b51", + "7c42d3dce0ddbc4806bce48b", + "10b97872c5f4e0e1949a0369", + "a6cd9986dde4cabddcd2dce2", + "b65635b515712f990fdcc201", + "0e11045873efe3625695c1ae", + "94c4161abe8bf654fb986063", + "9b284ccfd0d535acec1ff58b", + "d730caa83a11fd01250a7261", + "24291c7bcf91e362adb6d68b", + "0d98fd0769cce8e473bbe540", + "11b174510f039e8217fbd202", + "c435230e530574b1d7c32300", + "15666fe6fd2d95206612e418", + "a54de8b9014eee71fdf1d01d", + "c34555bc95a9a7a23150a36f", + "91cae4ae30d1366b87158238", + "48f23df4509164cf397b9ab5", + "a55f05f689978ac65c7da654", + "8ae4ea81a2d6074162d87a9c", + "312cc0f6687963305457235e", + "e1e5aaf474b7282a52ac9a14", + "bb9a34648e08f005db5d7484", + "dd9ac99d3ea4c9656221bcc9", + "b22748de8da5f3c1362dd8e0", + "e3cc1be8954c4889f94b435a", + "e73f05be5a306168e847da82", + "847cf35ec92d8af8e4814ea8", + "bb4b7a4475fea0f0135305f6", + "d0ac8e688a0bb17668589909", + "5dbcf8cbbb3f8ef669836320", + "f996645c809968f8033593a6", ]; for (const value of validAttachmentTemplates) { @@ -594,64 +625,37 @@ describe("InsuranceController", () => } }); - it("should ignore gun accessories that cannot be modified in-raid", () => - { - const insured = insuranceFixture[0]; - - // Generate the items map. - const itemsMap = insuranceController.populateItemsMap(insured); - - // Execute the method. - const result = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - - // Verify that the map is populated correctly. - expect(result.size).toBe(6); // There are 6 base-level items in this insurance package. - - const gun = result.get("911a0f04d5d9c7e239807ae0"); - expect(gun.length).toBe(7); // This AK has 7 valid attachments. - - // These are attachments for the AK, but they are not raid moddable, so they should not be mapped. - const invalidAttachmentTemplates = [ - "1e0b177df108c0c117028812", - "c9278dd8251e99578bf7a274", - "402b4086535a50ef7d9cef88", - "566335b3df586f34b47f5e35", - ]; - for (const value of invalidAttachmentTemplates) - { - // Verify that each template is not present in the array of attachments. - expect(gun.every((item) => item._id !== value)).toBe(true); - } - }); - it("should correctly map helmet to all of its attachments", () => { const insured = insuranceFixture[0]; // Generate the items map. - const itemsMap = insuranceController.populateItemsMap(insured); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); // Execute the method. - const result = insuranceController.populateParentAttachmentsMap(insured, itemsMap); + const result = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Verify that the map is populated correctly. - expect(result.size).toBe(6); // There are 6 base-level items in this insurance package. + expect(result.size).toBe(9); // There are 9 base-level items in this insurance package. - const gun = result.get("3679078e05f5b14466d6a730"); - expect(gun.length).toBe(5); // This LShZ-2DTM has 5 valid attachments. + const helmet = result.get("b2405216e5730f3511884a10"); + expect(helmet.length).toBe(4); // This helmet has 2 valid attachments. - // The attachments should be mapped to the AK properly... + // The attachments should be mapped to the helmet properly... const validAttachmentTemplates = [ - "a2b0c716162c5e31ec28c55a", - "dc565f750342cb2d19eeda06", - "e9ff62601669d9e2ea9c2fbb", - "ac134d7cf6c9d8e25edd0015", - "22274b895ecc80d51c3cba1c", + "7a0675280dbbad69ce592d74", + "c0c182942f54d3c183f0e179", + "f7066fdfeefb29eca1d2dbeb", + "ee0ec86e9608abe773175e3a", ]; for (const value of validAttachmentTemplates) { // Verify that each template is present in the array of attachments. - expect(gun.some((item) => item._id === value)).toBe(true); + expect(helmet.some((item) => item._id === value)).toBe(true); } }); @@ -660,29 +664,41 @@ describe("InsuranceController", () => const insured = insuranceFixture[0]; // Generate the items map. - const itemsMap = insuranceController.populateItemsMap(insured); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); // Execute the method. - const result = insuranceController.populateParentAttachmentsMap(insured, itemsMap); + const result = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Verify that the map is populated correctly. - expect(result.size).toBe(6); // There are 6 base-level items in this insurance package. + expect(result.size).toBe(9); // There are 9 base-level items in this insurance package. - const gun = result.get("351180f3248d45c71cb2ebdc"); - expect(insured.items.find((item) => item._id === "351180f3248d45c71cb2ebdc").slotId).toBe("main"); - expect(gun.length).toBe(14); // This AS VAL has 14 valid attachments. + const gun = result.get("26598f88d49198c4a0a9391c"); + expect(insured.items.find((item) => item._id === "26598f88d49198c4a0a9391c").slotId).toBe("main"); + expect(gun.length).toBe(3); }); it("should not map items that do not have a main-parent", () => { + // Remove regular items from the fixture. insuranceFixture = new ProfileInsuranceFactory().adjustPackageDates().removeRegularItems().get(); const insured = insuranceFixture[0]; // Generate the items map. - const itemsMap = insuranceController.populateItemsMap(insured); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + + // Suppress warnings. + const mockLoggerWarning = vi.spyOn(insuranceController.logger, "warning").mockImplementation(vi.fn()); // Execute the method. - const result = insuranceController.populateParentAttachmentsMap(insured, itemsMap); + const result = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Verify that the map is populated correctly. expect(result.size).toBe(0); @@ -690,31 +706,92 @@ describe("InsuranceController", () => it("should log a warning when an item does not have a main-parent", () => { + // Remove regular items from the fixture. insuranceFixture = new ProfileInsuranceFactory().adjustPackageDates().removeRegularItems().get(); const insured = insuranceFixture[0]; // Generate the items map. - const itemsMap = insuranceController.populateItemsMap(insured); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); // Suppress warnings. const mockLoggerWarning = vi.spyOn(insuranceController.logger, "warning").mockImplementation(vi.fn()); // Execute the method. - insuranceController.populateParentAttachmentsMap(insured, itemsMap); + insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Verify that the warning was logged. expect(mockLoggerWarning).toHaveBeenCalled(); }); }); + describe("removeNonModdableAttachments", () => + { + it("should return a Map where each parent item ID is mapped to only moddable attachments", () => + { + const insured = insuranceFixture[0]; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + + // Execute the method. + const result = insuranceController.removeNonModdableAttachments(parentAttachmentsMap, itemsMap); + + // Verify that the map is populated correctly. + for (const [parentId, attachments] of result) + { + for (const attachment of attachments) + { + // Verify that each attachment is moddable. + const attachmentParentItem = itemsMap.get(parentId); + expect(insuranceController.itemHelper.isRaidModdable(attachment, attachmentParentItem)).toBe(true); + } + } + }); + + it("should remove parents that do not have any moddable attachments", () => + { + const insured = insuranceFixture[0]; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + + // Mock isRaidModdable to return false for all attachments. + vi.spyOn(insuranceController.itemHelper, "isRaidModdable").mockReturnValue(false); + + // Execute the method. + const result = insuranceController.removeNonModdableAttachments(parentAttachmentsMap, itemsMap); + + // Verify that the map is now empty. + expect(result.size).toBe(0); + }); + }); + describe("processRegularItems", () => { it("should process regular items and their non-attachment children", () => { + // Remove attachment items from the fixture. insuranceFixture = new ProfileInsuranceFactory().adjustPackageDates().removeAttachmentItems().get(); + const insured = insuranceFixture[0]; const numberOfItems = insured.items.length; const toDelete = new Set(); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Mock helper methods. const mockIsAttachmentAttached = vi.spyOn(insuranceController.itemHelper, "isAttachmentAttached"); @@ -727,11 +804,11 @@ describe("InsuranceController", () => const mockRollForDelete = vi.spyOn(insuranceController, "rollForDelete").mockReturnValue(true); // Execute the method. - insuranceController.processRegularItems(insured, toDelete); + insuranceController.processRegularItems(insured, toDelete, parentAttachmentsMap); // Verify that the correct methods were called. - expect(mockIsAttachmentAttached).toHaveBeenCalled(); - expect(mockFindAndReturnChildrenAsItems).toHaveBeenCalled(); + expect(mockIsAttachmentAttached).toHaveBeenCalledTimes(numberOfItems); + expect(mockFindAndReturnChildrenAsItems).not.toHaveBeenCalled(); expect(mockRollForDelete).toHaveBeenCalledTimes(numberOfItems); // Verify that all items were added to the toDelete set. @@ -742,6 +819,12 @@ describe("InsuranceController", () => { const insured = insuranceFixture[0]; const toDelete = new Set(); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Mock isAttachmentAttached to return true for all items. vi.spyOn(insuranceController.itemHelper, "isAttachmentAttached").mockReturnValue(true); @@ -750,7 +833,7 @@ describe("InsuranceController", () => const mockRollForDelete = vi.spyOn(insuranceController, "rollForDelete").mockReturnValue(true); // Execute the method. - insuranceController.processRegularItems(insured, toDelete); + insuranceController.processRegularItems(insured, toDelete, parentAttachmentsMap); // Verify that a roll was not made for any items. expect(mockRollForDelete).not.toHaveBeenCalled(); @@ -761,20 +844,24 @@ describe("InsuranceController", () => it("should mark attachments for deletion when parent is marked for deletion", () => { - const itemHelper = container.resolve("ItemHelper"); - const insured = insuranceFixture[0]; const toDelete = new Set(); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Mock rollForDelete to return true for all base-parent items. const mockRollForDelete = vi.fn((traderId, insuredItem) => { - return !itemHelper.isAttachmentAttached(insuredItem); + return !insuranceController.itemHelper.isAttachmentAttached(insuredItem); }); vi.spyOn(insuranceController, "rollForDelete").mockImplementation(mockRollForDelete); // Execute the method. - insuranceController.processRegularItems(insured, toDelete); + insuranceController.processRegularItems(insured, toDelete, parentAttachmentsMap); // Verify that all items were added to the toDelete set. expect(toDelete).toEqual(new Set(insured.items.map((item) => item._id))); @@ -786,44 +873,53 @@ describe("InsuranceController", () => it("should iterate over each parent item", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); const toDelete = new Set(); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Mock helper methods. const mockProcessAttachmentByParent = vi.spyOn(insuranceController, "processAttachmentByParent"); // Execute the method. - insuranceController.processAttachments(parentToAttachmentMap, itemsMap, insured.traderId, toDelete); + insuranceController.processAttachments(parentAttachmentsMap, itemsMap, insured.traderId, toDelete); // Verify - expect(mockProcessAttachmentByParent).toHaveBeenCalledTimes(parentToAttachmentMap.size); + expect(mockProcessAttachmentByParent).toHaveBeenCalledTimes(parentAttachmentsMap.size); }); it("should log the name of each parent item", () => { - const itemHelper = container.resolve("ItemHelper"); - const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); const toDelete = new Set(); + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); // Mock helper methods. - const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug"); + const mockLoggerDebug = vi.spyOn(insuranceController.logger, "debug").mockImplementation(vi.fn()); + + // Mock processAttachmentByParent to prevent it from being called. + vi.spyOn(insuranceController, "processAttachmentByParent").mockImplementation(vi.fn()); // Execute the method. - insuranceController.processAttachments(parentToAttachmentMap, itemsMap, insured.traderId, toDelete); + insuranceController.processAttachments(parentAttachmentsMap, itemsMap, insured.traderId, toDelete); // Verify that the name of each parent item is logged. - for (const [parentId] of parentToAttachmentMap) + for (const [parentId] of parentAttachmentsMap) { const parentItem = itemsMap.get(parentId); if (parentItem) { - const expectedMessage = `Processing attachments for parent item: ${ - itemHelper.getItemName(parentItem._tpl) - }`; + const expectedMessage = `Processing attachments of parent "${ + insuranceController.itemHelper.getItemName(parentItem._tpl) + }":`; expect(mockLoggerDebug).toHaveBeenCalledWith(expectedMessage); } } @@ -835,9 +931,13 @@ describe("InsuranceController", () => it("should handle sorting, rolling, and deleting attachments by calling helper methods", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.entries().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.entries().next().value; const toDelete = new Set(); // Mock helper methods. @@ -854,12 +954,16 @@ describe("InsuranceController", () => expect(mockAttachmentDeletionByValue).toHaveBeenCalled(); }); - it("should log attachment details and number of successful rolls", () => + it("should log attachment details and number of attachments to be deleted", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.entries().next().value; const toDelete = new Set(); const successfulRolls = 4; @@ -873,7 +977,7 @@ describe("InsuranceController", () => // Verify that the logs were called/written. expect(mockLogAttachmentsDetails).toBeCalled(); - expect(mockLoggerDebug).toHaveBeenCalledWith(`Number of successful rolls: ${successfulRolls}`); + expect(mockLoggerDebug).toHaveBeenCalledWith(`Number of attachments to be deleted: ${successfulRolls}`); }); }); @@ -882,15 +986,20 @@ describe("InsuranceController", () => it("should sort the attachments array by maxPrice in descending order", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.entries().next().value; + const attachmentCount = attachments.length; // Execute the method. const sortedAttachments = insuranceController.sortAttachmentsByPrice(attachments); - // Verify the length of the sorted attachments array - expect(sortedAttachments.length).toBe(5); + // Verify the length of the sorted attachments array is unchanged + expect(sortedAttachments.length).toBe(attachmentCount); // Verify that the attachments are sorted by maxPrice in descending order for (let i = 1; i < sortedAttachments.length; i++) @@ -902,20 +1011,22 @@ describe("InsuranceController", () => it("should place attachments with null maxPrice at the bottom of the sorted list", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; - - // Set the maxPrice of the first two attachments to null. - vi.spyOn(insuranceController.itemHelper, "getItemMaxPrice").mockReturnValueOnce(null).mockReturnValueOnce( - null, + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, ); + const attachments = parentAttachmentsMap.entries().next().value; + + // Set the maxPrice of the first attachment to null. + vi.spyOn(insuranceController.itemHelper, "getItemMaxPrice").mockReturnValue(666).mockReturnValueOnce(null); // Execute the method. const sortedAttachments = insuranceController.sortAttachmentsByPrice(attachments); // Verify that the attachments with null maxPrice are at the bottom of the list - const nullPriceAttachments = sortedAttachments.slice(-2); + const nullPriceAttachments = sortedAttachments.slice(-1); for (const attachment of nullPriceAttachments) { expect(attachment.maxPrice).toBeNull(); @@ -947,8 +1058,8 @@ describe("InsuranceController", () => // Verify that logger.debug was called correctly. expect(loggerDebugSpy).toHaveBeenCalledTimes(2); - expect(loggerDebugSpy).toHaveBeenNthCalledWith(1, "Child Item - Name: Item 1, Max Price: 100"); - expect(loggerDebugSpy).toHaveBeenNthCalledWith(2, "Child Item - Name: Item 2, Max Price: 200"); + expect(loggerDebugSpy).toHaveBeenNthCalledWith(1, "Attachment 1: \"Item 1\" - Price: 100"); + expect(loggerDebugSpy).toHaveBeenNthCalledWith(2, "Attachment 2: \"Item 2\" - Price: 200"); }); it("should not log anything when there are no attachments", () => @@ -968,12 +1079,16 @@ describe("InsuranceController", () => describe("countSuccessfulRolls", () => { - it("should count the number of successful rolls based on the rollForDelete method", () => + it("should count the number of successful rolls made in the rollForDelete method", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.values().next().value; // Mock rollForDelete to return true for the first two attachments. const mockRollForDelete = vi.spyOn(insuranceController, "rollForDelete").mockReturnValue(false) @@ -987,12 +1102,16 @@ describe("InsuranceController", () => expect(result).toBe(2); }); - it("should count the number of successful rolls based on the rollForDelete method", () => + it("should return zero if no successful rolls were made in the rollForDelete method", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.values().next().value; // Mock rollForDelete to return false. const mockRollForDelete = vi.spyOn(insuranceController, "rollForDelete").mockReturnValue(false); @@ -1027,9 +1146,13 @@ describe("InsuranceController", () => it("should add the correct number of attachments to the toDelete set", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.values().next().value; const successfulRolls = 2; const toDelete = new Set(); @@ -1044,9 +1167,13 @@ describe("InsuranceController", () => it("should not add any attachments to toDelete if successfulRolls is zero", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.values().next().value; const successfulRolls = 0; const toDelete = new Set(); @@ -1061,9 +1188,13 @@ describe("InsuranceController", () => it("should add all attachments to toDelete if successfulRolls is greater than the number of attachments", () => { const insured = insuranceFixture[0]; - const itemsMap = insuranceController.populateItemsMap(insured); - const parentToAttachmentMap = insuranceController.populateParentAttachmentsMap(insured, itemsMap); - const attachments = parentToAttachmentMap.values().next().value; + const itemsMap = insuranceController.itemHelper.generateItemsMap(insured.items); + const parentAttachmentsMap = insuranceController.populateParentAttachmentsMap( + insuranceController.hashUtil.generate(), + insured, + itemsMap, + ); + const attachments = parentAttachmentsMap.values().next().value; const successfulRolls = 999; const toDelete = new Set(); @@ -1134,125 +1265,10 @@ describe("InsuranceController", () => }); }); - describe("adoptOrphanedItems", () => - { - it("should adopt orphaned items by resetting them as base-level items", () => - { - // Get all of the items, so that we can dynamically find the hideout item. - const insured = insuranceFixture[0]; - const hideoutParentId = insuranceController.fetchHideoutItemParent(insured.items); - - // Manually set one of the items to be orphaned. - insured.items[0].parentId = "9999"; // Should not exist in the items array. - insured.items[0].slotId = "main"; // Should not be "hideout". - - // Iterate over the items and find an individual orphaned item. - const orphanedItem = insured.items.find((item) => - !insured.items.some((parent) => parent._id === item.parentId) - ); - - // Setup tests to verify that the orphaned item we added is in fact orphaned. - expect(orphanedItem.parentId).toBe(insured.items[0].parentId); - expect(orphanedItem.slotId).toBe(insured.items[0].slotId); - - // Execute the method. - insuranceController.adoptOrphanedItems(insured); - - // Verify that the orphaned items have been adopted. - expect(orphanedItem.parentId).toBe(hideoutParentId); - expect(orphanedItem.slotId).toBe("hideout"); - }); - - it("should not adopt items that are not orphaned", () => - { - const unmodified = insuranceFixture[0]; - - // Create a deep copy of the insured items array. - const insured = JSON.parse(JSON.stringify(insuranceFixture[0])); - - // Execute the method. - insuranceController.adoptOrphanedItems(insured); - - // Verify that the orphaned items have been adopted. - expect(insured).toStrictEqual(unmodified); - }); - - it("should remove location data from adopted items", () => - { - const insured = insuranceFixture[0]; - - // Manually set one of the items to be orphaned. - insured.items[0].parentId = "9999"; // Should not exist in the items array. - insured.items[0].slotId = "main"; // Should not be "hideout". - insured.items[0].location = { x: 1, y: 2, r: 3, isSearched: true }; // Should be removed. - - // Iterate over the items and find an individual orphaned item. - const orphanedItem = insured.items.find((item) => - !insured.items.some((parent) => parent._id === item.parentId) - ); - - // Setup tests to verify that the orphaned item we added is in fact orphaned. - expect(orphanedItem.parentId).toBe(insured.items[0].parentId); - expect(orphanedItem.slotId).toBe(insured.items[0].slotId); - - // Execute the method. - insuranceController.adoptOrphanedItems(insured); - - // Verify that the orphaned items have been adopted. - expect(orphanedItem).not.toHaveProperty("location"); - }); - }); - - describe("fetchHideoutItemParent", () => - { - it("should return the parentId value of an item that has a slotId of 'hideout'", () => - { - const insured = insuranceFixture[0]; - const hideoutParentId = insuranceController.fetchHideoutItemParent(insured.items); - - // Execute the method. - const result = insuranceController.fetchHideoutItemParent(insured.items); - - // Verify that the hideout item parentId is returned. - expect(result).toBe(hideoutParentId); - }); - - it("should return an empty string if no item with a slotId of 'hideout' could be found", () => - { - // Fetch a bunch of orphaned items that don't have a hideout parent. - const insuranceFixture = new ProfileInsuranceFactory().adjustPackageDates().removeRegularItems().get(); - const insured = insuranceFixture[0]; - - // Execute the method. - const result = insuranceController.fetchHideoutItemParent(insured.items); - - // Verify that the hideout item parentId is returned. - expect(result).toBe(""); - }); - - it("should log a warning if the base-level item does not exist", () => - { - // Fetch a bunch of orphaned items that don't have a hideout parent. - const insuranceFixture = new ProfileInsuranceFactory().adjustPackageDates().removeRegularItems().get(); - const insured = insuranceFixture[0]; - - // Spy on the logger. - const loggerWarningSpy = vi.spyOn(insuranceController.logger, "warning"); - - // Execute the method. - insuranceController.fetchHideoutItemParent(insured.items); - - // Verify that the hideout item parentId is returned. - expect(loggerWarningSpy).toHaveBeenCalled(); - }); - }); - describe("sendMail", () => { it("should send insurance failed message when no items are present", () => { - const traderHelper = container.resolve("TraderHelper"); - const insurance = insuranceFixture[0]; insurance.items = []; // Empty the items array const sessionID = "session-id"; @@ -1276,19 +1292,17 @@ describe("InsuranceController", () => // Verify that the insurance failed message was sent. expect(sendMessageSpy).toHaveBeenCalledWith( sessionID, - traderHelper.getTraderById(insurance.traderId), + insuranceController.traderHelper.getTraderById(insurance.traderId), MessageType.INSURANCE_RETURN, insuranceFailedTpl, insurance.items, - insurance.messageContent.maxStorageTime, - insurance.messageContent.systemData, + insurance.maxStorageTime, + insurance.systemData, ); }); it("should not send insurance failed message when items are present", () => { - const traderHelper = container.resolve("TraderHelper"); - const insurance = insuranceFixture[0]; const sessionID = "session-id"; const insuranceFailedTpl = "failed-message-template"; @@ -1311,12 +1325,12 @@ describe("InsuranceController", () => // Verify that the insurance failed message was not sent. expect(sendMessageSpy).toHaveBeenCalledWith( sessionID, - traderHelper.getTraderById(insurance.traderId), + insuranceController.traderHelper.getTraderById(insurance.traderId), MessageType.INSURANCE_RETURN, - insurance.messageContent.templateId, + insurance.messageTemplateId, insurance.items, - insurance.messageContent.maxStorageTime, - insurance.messageContent.systemData, + insurance.maxStorageTime, + insurance.systemData, ); }); }); @@ -1519,14 +1533,17 @@ describe("InsuranceController", () => expect(pmcData.InsuredItems.length).toBe(body.items.length); }); - it("should return the output with warnings if payment fails", () => + it("should update output with warnings if payment fails", () => { // Override the payMoney mock to simulate a payment failure with a warning. const expectedPayMoneyReturn = { - warnings: [{ index: 0, errmsg: "Not enough money to complete transaction", code: 500 }], + warnings: [{ index: 0, errmsg: "You broke.", code: 500 }], otherProperty: "property-value", }; - mockPayMoney.mockReturnValue(expectedPayMoneyReturn); + mockPayMoney.mockImplementation((pmcData, request, sessionID, output) => + { + output.warnings = expectedPayMoneyReturn.warnings; + }); // Execute the method. const response = insuranceController.insure(pmcData, body, sessionId); @@ -1542,10 +1559,13 @@ describe("InsuranceController", () => { // Override the payMoney mock to simulate a payment failure with a warning. const expectedPayMoneyReturn = { - warnings: [{ index: 0, errmsg: "Not enough money to complete transaction", code: 500 }], + warnings: [{ index: 0, errmsg: "You broke.", code: 500 }], otherProperty: "property-value", }; - mockPayMoney.mockReturnValue(expectedPayMoneyReturn); + mockPayMoney.mockImplementation((pmcData, request, sessionID, output) => + { + output.warnings = expectedPayMoneyReturn.warnings; + }); // Execute the method. insuranceController.insure(pmcData, body, sessionId);