From 74f67487c4d464600d917cee7fe34beccaa7557b Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:14:05 -0700 Subject: [PATCH] fix: Adds DupeExcludedProperty to Items (#1556) --- Projects/Server/Items/Item.cs | 10 ++++++++++ Projects/UOContent/Commands/Dupe.cs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index 767efa6df..4875452dc 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -3348,6 +3348,16 @@ public class Item : IHued, IComparable, ISpawnable, IObjectPropertyListEnt } } + private static readonly HashSet _excludedProperties = new() + { + "Parent", + "Next", + "Previous", + "OnLinkList" + }; + + public virtual bool DupeExcludedProperty(string propertyName) => _excludedProperties.Contains(propertyName); + public virtual void OnAfterDuped(Item newItem) { } diff --git a/Projects/UOContent/Commands/Dupe.cs b/Projects/UOContent/Commands/Dupe.cs index 0911a5389..56b0f46d1 100644 --- a/Projects/UOContent/Commands/Dupe.cs +++ b/Projects/UOContent/Commands/Dupe.cs @@ -51,7 +51,7 @@ namespace Server.Commands try { // Do not set the parent since it screws up mobile/container totals and weights. - if (p.CanRead && p.CanWrite && p.Name != "Parent") + if (p.CanRead && p.CanWrite && !src.DupeExcludedProperty(p.Name) && !dest.DupeExcludedProperty(p.Name)) { p.SetValue(dest, p.GetValue(src, null), null); }