fix: Adds DupeExcludedProperty to Items (#1556)

This commit is contained in:
Kamron Batman 2023-10-17 20:14:05 -07:00 committed by GitHub
parent 85e23d8d83
commit 74f67487c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -3348,6 +3348,16 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
}
}
private static readonly HashSet<string> _excludedProperties = new()
{
"Parent",
"Next",
"Previous",
"OnLinkList"
};
public virtual bool DupeExcludedProperty(string propertyName) => _excludedProperties.Contains(propertyName);
public virtual void OnAfterDuped(Item newItem)
{
}

View file

@ -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);
}