Compare commits
No commits in common. "ee5bbbb098cc4fb50b5fba6161322b7990a17095" and "01d3da1e8cca949994a51e8897b33a546d3e8f5e" have entirely different histories.
ee5bbbb098
...
01d3da1e8c
|
@ -4,7 +4,7 @@ using System.Text;
|
||||||
using KeycardTemplate = GClass2623;
|
using KeycardTemplate = GClass2623;
|
||||||
using ArmorTemplate = GClass2550;
|
using ArmorTemplate = GClass2550;
|
||||||
using ArmoredRigTemplate = GClass2602;
|
using ArmoredRigTemplate = GClass2602;
|
||||||
using MagazineTemplate = GClass2586;
|
using SimpleMedClass = GClass2631;
|
||||||
|
|
||||||
namespace LootValueEX.Extensions
|
namespace LootValueEX.Extensions
|
||||||
{
|
{
|
||||||
|
@ -29,10 +29,10 @@ namespace LootValueEX.Extensions
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
StringBuilder prehashString = new StringBuilder();
|
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()));
|
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())));
|
|
||||||
}
|
}
|
||||||
string itemHashTemplate = string.Format("{0}|{1}|{2}|{3}", prehashString.ToString(), item.TemplateId, item.GetDurability(), item.GetUses());
|
string itemHashTemplate = string.Format("{0}|{1}|{2}|{3}", prehashString.ToString(), item.TemplateId, item.GetDurability(), item.GetUses());
|
||||||
return Utils.HashingUtils.ConvertToSha256(itemHashTemplate);
|
return Utils.HashingUtils.ConvertToSha256(itemHashTemplate);
|
||||||
|
@ -70,13 +70,12 @@ namespace LootValueEX.Extensions
|
||||||
return -1f;
|
return -1f;
|
||||||
switch (item.Template)
|
switch (item.Template)
|
||||||
{
|
{
|
||||||
case KeycardTemplate:
|
case KeycardTemplate key:
|
||||||
KeyComponent keyComponent = item.GetItemComponent<KeyComponent>();
|
KeyComponent keyComponent = item.GetItemComponent<KeyComponent>();
|
||||||
return keyComponent.Template.MaximumNumberOfUsage - keyComponent.NumberOfUsages;
|
return keyComponent.Template.MaximumNumberOfUsage - keyComponent.NumberOfUsages;
|
||||||
|
case SimpleMedClass:
|
||||||
case Meds2Class:
|
case Meds2Class:
|
||||||
if (item.TryGetItemComponent(out MedKitComponent medKitComponent))
|
return item.GetItemAttribute(EItemAttributeId.HpResource);
|
||||||
return medKitComponent.HpResource;
|
|
||||||
return -1f;
|
|
||||||
default:
|
default:
|
||||||
return -1f;
|
return -1f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user