From ee5bbbb098cc4fb50b5fba6161322b7990a17095 Mon Sep 17 00:00:00 2001 From: Yui Date: Wed, 23 Oct 2024 22:14:33 -0300 Subject: [PATCH] feat: added support for hashing of mags --- Plugin/Extensions/ItemExtensions.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugin/Extensions/ItemExtensions.cs b/Plugin/Extensions/ItemExtensions.cs index 937425c..f7266e1 100644 --- a/Plugin/Extensions/ItemExtensions.cs +++ b/Plugin/Extensions/ItemExtensions.cs @@ -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); }