From c527824d60d19eb23c96c690e413dc1f636a4e73 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 5 Nov 2023 13:16:59 +0000 Subject: [PATCH] Change `getRepairableItemQualityValue()` to handle max durability being lower than durability --- project/src/helpers/ItemHelper.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index a77a268b..c91474dc 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -360,6 +360,13 @@ class ItemHelper */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number { + // Edge case, max durability is below durability + if (repairable.Durability < repairable.MaxDurability) + { + this.logger.warning(`Max durability ${repairable.MaxDurability} for item id: ${item._id} was below Durability ${repairable.Durability}, adjusting values to match`); + repairable.MaxDurability = repairable.Durability; + } + // Armor if (itemDetails._props.armorClass) {