fix: fixed item usages in medkits and simple meds
This commit is contained in:
parent
01d3da1e8c
commit
0741831f3d
|
@ -29,11 +29,7 @@ namespace LootValueEX.Extensions
|
|||
if (item == null)
|
||||
return string.Empty;
|
||||
StringBuilder prehashString = new StringBuilder();
|
||||
if (item.IsContainer)
|
||||
{
|
||||
Plugin.Log.LogDebug($"Loop called on {item.LocalizedName()}");
|
||||
item.GetAllItems().Where(prop => !prop.Equals(item)).ExecuteForEach(prop => prehashString.Append(prop.GetCustomHash()));
|
||||
}
|
||||
string itemHashTemplate = string.Format("{0}|{1}|{2}|{3}", prehashString.ToString(), item.TemplateId, item.GetDurability(), item.GetUses());
|
||||
return Utils.HashingUtils.ConvertToSha256(itemHashTemplate);
|
||||
}
|
||||
|
@ -70,12 +66,13 @@ namespace LootValueEX.Extensions
|
|||
return -1f;
|
||||
switch (item.Template)
|
||||
{
|
||||
case KeycardTemplate key:
|
||||
case KeycardTemplate:
|
||||
KeyComponent keyComponent = item.GetItemComponent<KeyComponent>();
|
||||
return keyComponent.Template.MaximumNumberOfUsage - keyComponent.NumberOfUsages;
|
||||
case SimpleMedClass:
|
||||
case Meds2Class:
|
||||
return item.GetItemAttribute(EItemAttributeId.HpResource);
|
||||
if (item.TryGetItemComponent(out MedKitComponent medKitComponent))
|
||||
return medKitComponent.HpResource;
|
||||
return -1f;
|
||||
default:
|
||||
return -1f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user