feat: added custom item hashing
This commit is contained in:
@@ -24,17 +24,18 @@ namespace LootValueEX.Extensions
|
||||
return -1f;
|
||||
}
|
||||
}
|
||||
internal static string CustomHash(this Item? item)
|
||||
internal static string GetCustomHash(this Item? item)
|
||||
{
|
||||
if (item == null)
|
||||
return string.Empty;
|
||||
StringBuilder prehashString = new StringBuilder();
|
||||
if (item.IsContainer)
|
||||
{
|
||||
return "0";
|
||||
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}", item.TemplateId, item.GetDurability(), item.GetUses(), item.StackObjectsCount);
|
||||
return "0";
|
||||
string itemHashTemplate = string.Format("{0}|{1}|{2}|{3}", prehashString.ToString(), item.TemplateId, item.GetDurability(), item.GetUses());
|
||||
return Utils.HashingUtils.ConvertToSha256(itemHashTemplate);
|
||||
}
|
||||
#if DEBUG
|
||||
internal static string AttributesToString(this Item? item)
|
||||
|
||||
Reference in New Issue
Block a user