introduce itemsDb variable inside repairItemByKit()

This commit is contained in:
Dev 2023-08-04 15:59:34 +01:00
parent ce65ec1260
commit 08c81aff26

View File

@ -196,7 +196,8 @@ export class RepairService
throw new Error(`Item ${itemToRepairId} not found, unable to repair`);
}
const itemToRepairDetails = this.databaseServer.getTables().templates.items[itemToRepair._tpl];
const itemsDb = this.databaseServer.getTables().templates.items;
const itemToRepairDetails = itemsDb[itemToRepair._tpl];
const repairItemIsArmor = (!!itemToRepairDetails._props.ArmorMaterial);
this.repairHelper.updateItemDurability(
@ -211,7 +212,7 @@ export class RepairService
for (const repairKit of repairKits)
{
const repairKitInInventory = pmcData.Inventory.items.find(x => x._id === repairKit._id);
const repairKitDetails = this.databaseServer.getTables().templates.items[repairKitInInventory._tpl];
const repairKitDetails = itemsDb[repairKitInInventory._tpl];
const repairKitReductionAmount = repairKit.count;
this.addMaxResourceToKitIfMissing(repairKitDetails, repairKitInInventory);