diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 0e1f21fd4..d112a5434 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -1872,7 +1872,7 @@ namespace Server public static bool DisableDismountInWarmode { get; set; } - public static int BodyWeight { get; set; } = 14; + public static int BodyWeight { get; set; } = 11; // 11 + 3 for the backpack [CommandProperty(AccessLevel.GameMaster)] public IMount Mount @@ -4107,19 +4107,25 @@ namespace Server switch (type) { default: - m_TotalGold += delta; - Delta(MobileDelta.Gold); - break; + { + m_TotalGold += delta; + Delta(MobileDelta.Gold); + break; + } case TotalType.Items: - m_TotalItems += delta; - break; + { + m_TotalItems += delta; + break; + } case TotalType.Weight: - m_TotalWeight += delta; - Delta(MobileDelta.Weight); - OnWeightChange(m_TotalWeight - delta); - break; + { + m_TotalWeight += delta; + Delta(MobileDelta.Weight); + OnWeightChange(m_TotalWeight - delta); + break; + } } } diff --git a/Projects/UOContent/Commands/Dupe.cs b/Projects/UOContent/Commands/Dupe.cs index 3cbf9de10..3b90a0adf 100644 --- a/Projects/UOContent/Commands/Dupe.cs +++ b/Projects/UOContent/Commands/Dupe.cs @@ -47,11 +47,13 @@ namespace Server.Commands for (var i = 0; i < props.Length; i++) { + var p = props[i]; try { - if (props[i].CanRead && props[i].CanWrite) + // Do not set the parent since it screws up mobile/container totals and weights. + if (p.CanRead && p.CanWrite && p.Name != "Parent") { - props[i].SetValue(dest, props[i].GetValue(src, null), null); + p.SetValue(dest, p.GetValue(src, null), null); } } catch @@ -97,14 +99,12 @@ namespace Server.Commands if (m_InBag) { - if (copy.Parent is Container cont) + pack = copy.Parent switch { - pack = cont; - } - else if (copy.Parent is Mobile m) - { - pack = m.Backpack; - } + Container cont => cont, + Mobile m => m.Backpack, + _ => pack + }; } else { @@ -130,7 +130,6 @@ namespace Server.Commands { CopyProperties(newItem, copy); copy.OnAfterDuped(newItem); - newItem.Parent = null; if (pack != null) { @@ -141,7 +140,9 @@ namespace Server.Commands newItem.MoveToWorld(from.Location, from.Map); } + newItem.UpdateTotals(); newItem.InvalidateProperties(); + newItem.Delta(ItemDelta.Update); CommandLogging.WriteLine( from,