Compare commits

..

No commits in common. "ee5bbbb098cc4fb50b5fba6161322b7990a17095" and "01d3da1e8cca949994a51e8897b33a546d3e8f5e" have entirely different histories.

View File

@ -4,7 +4,7 @@ using System.Text;
using KeycardTemplate = GClass2623;
using ArmorTemplate = GClass2550;
using ArmoredRigTemplate = GClass2602;
using MagazineTemplate = GClass2586;
using SimpleMedClass = GClass2631;
namespace LootValueEX.Extensions
{
@ -29,10 +29,10 @@ namespace LootValueEX.Extensions
if (item == null)
return string.Empty;
StringBuilder prehashString = new StringBuilder();
item.GetAllItems().Where(prop => !prop.Equals(item)).ExecuteForEach(prop => prehashString.Append(prop.GetCustomHash()));
if (item.Template.Equals(typeof(MagazineTemplate))){
MagazineTemplate magTemplate = (MagazineTemplate)item.Template;
magTemplate.Cartridges.ExecuteForEach(prop => prop.Items.ExecuteForEach(ammo => prehashString.Append(ammo.GetCustomHash())));
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,13 +70,12 @@ namespace LootValueEX.Extensions
return -1f;
switch (item.Template)
{
case KeycardTemplate:
case KeycardTemplate key:
KeyComponent keyComponent = item.GetItemComponent<KeyComponent>();
return keyComponent.Template.MaximumNumberOfUsage - keyComponent.NumberOfUsages;
case SimpleMedClass:
case Meds2Class:
if (item.TryGetItemComponent(out MedKitComponent medKitComponent))
return medKitComponent.HpResource;
return -1f;
return item.GetItemAttribute(EItemAttributeId.HpResource);
default:
return -1f;
}