feat: added support for hashing of mags

This commit is contained in:
Yui 2024-10-23 22:14:33 -03:00
parent 0741831f3d
commit ee5bbbb098
Signed by: yui
GPG Key ID: F368D23A0ABA04B4

View File

@ -4,7 +4,7 @@ using System.Text;
using KeycardTemplate = GClass2623;
using ArmorTemplate = GClass2550;
using ArmoredRigTemplate = GClass2602;
using SimpleMedClass = GClass2631;
using MagazineTemplate = GClass2586;
namespace LootValueEX.Extensions
{
@ -30,6 +30,10 @@ namespace LootValueEX.Extensions
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())));
}
string itemHashTemplate = string.Format("{0}|{1}|{2}|{3}", prehashString.ToString(), item.TemplateId, item.GetDurability(), item.GetUses());
return Utils.HashingUtils.ConvertToSha256(itemHashTemplate);
}