From df6a08367b3f989f44b0781b7ec69b2c2ecd77de Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 5 Nov 2023 13:19:10 +0000 Subject: [PATCH] Remove reduandant else from `getRepairableItemQualityValue()` --- project/src/helpers/ItemHelper.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index c91474dc..6fdb3db8 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -363,7 +363,7 @@ class ItemHelper // 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`); + 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; } @@ -372,24 +372,22 @@ class ItemHelper { return repairable.Durability / itemDetails._props.MaxDurability; } - else + + // Weapon + // Get max dura from props, if it isnt there use repairable max dura value + const maxDurability = (itemDetails._props.MaxDurability) + ? itemDetails._props.MaxDurability + : repairable.MaxDurability; + const durability = repairable.Durability / maxDurability; + + if (!durability) { - // Weapon - // Get max dura from props, if it isnt there use repairable max dura value - const maxDurability = (itemDetails._props.MaxDurability) - ? itemDetails._props.MaxDurability - : repairable.MaxDurability; - const durability = repairable.Durability / maxDurability; + this.logger.error(this.localisationService.getText("item-durability_value_invalid_use_default", item._tpl)); - if (!durability) - { - this.logger.error(this.localisationService.getText("item-durability_value_invalid_use_default", item._tpl)); - - return 1; - } - - return Math.sqrt(durability); + return 1; } + + return Math.sqrt(durability); } /**