Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.8.0

This commit is contained in:
Dev 2023-11-05 20:24:28 +00:00
commit d3b7e5ef7a

View File

@ -360,29 +360,34 @@ 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)
{
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);
}
/**