mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 08:50:43 -05:00
Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.8.0
This commit is contained in:
commit
d3b7e5ef7a
@ -360,29 +360,34 @@ class ItemHelper
|
|||||||
*/
|
*/
|
||||||
protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number
|
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
|
// Armor
|
||||||
if (itemDetails._props.armorClass)
|
if (itemDetails._props.armorClass)
|
||||||
{
|
{
|
||||||
return repairable.Durability / itemDetails._props.MaxDurability;
|
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
|
this.logger.error(this.localisationService.getText("item-durability_value_invalid_use_default", item._tpl));
|
||||||
// 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)
|
return 1;
|
||||||
{
|
|
||||||
this.logger.error(this.localisationService.getText("item-durability_value_invalid_use_default", item._tpl));
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.sqrt(durability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Math.sqrt(durability);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user