diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index c010316e4..dfdc5e8f4 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -2269,39 +2269,44 @@ public class Item : IHued, IComparable, ISpawnable, IObjectPropertyListEnt } public virtual bool CanStackWith(Item dropped) => - dropped.Stackable && Stackable && dropped.GetType() == GetType() && dropped.ItemID == ItemID && - dropped.Hue == Hue && dropped.Name == Name && dropped.Amount + Amount <= 60000 && dropped != this; + dropped.Stackable && Stackable && + dropped.GetType() == GetType() && + dropped.ItemID == ItemID && + dropped.Hue == Hue && + dropped.Name == Name && + dropped.Amount + Amount <= 60000 && + dropped != this; public bool StackWith(Mobile from, Item dropped) => StackWith(from, dropped, true); public virtual bool StackWith(Mobile from, Item dropped, bool playSound) { - if (CanStackWith(dropped)) + if (!CanStackWith(dropped)) { - if (m_LootType != dropped.m_LootType) - { - m_LootType = LootType.Regular; - } - - Amount += dropped.Amount; - dropped.Delete(); - - if (playSound && from != null) - { - var soundID = GetDropSound(); - - if (soundID == -1) - { - soundID = 0x42; - } - - from.SendSound(soundID, GetWorldLocation()); - } - - return true; + return false; } - return false; + if (m_LootType != dropped.m_LootType) + { + m_LootType = LootType.Regular; + } + + Amount += dropped.Amount; + dropped.Delete(); + + if (playSound && from != null) + { + var soundID = GetDropSound(); + + if (soundID == -1) + { + soundID = 0x42; + } + + from.SendSound(soundID, GetWorldLocation()); + } + + return true; } public virtual bool OnDragDrop(Mobile from, Item dropped) diff --git a/Projects/UOContent/Items/Food/Food.cs b/Projects/UOContent/Items/Food/Food.cs index abfd05b3c..9ef6beb8d 100644 --- a/Projects/UOContent/Items/Food/Food.cs +++ b/Projects/UOContent/Items/Food/Food.cs @@ -49,17 +49,9 @@ public abstract partial class Food : Item } } - public override bool CanStackWith(Item dropped) - { - if (dropped is Food food) - { - if (Poison != food.Poison || Poisoner != food.Poisoner) - { - return false; - } - } - return base.CanStackWith(dropped); - } + public override bool CanStackWith(Item dropped) => + (dropped is not Food food || Poison == food.Poison && Poisoner == food.Poisoner) && + base.CanStackWith(dropped); public virtual bool Eat(Mobile from) diff --git a/Projects/UOContent/Items/Resources/Blacksmithing/Ore.cs b/Projects/UOContent/Items/Resources/Blacksmithing/Ore.cs index f9896bab2..809d76474 100644 --- a/Projects/UOContent/Items/Resources/Blacksmithing/Ore.cs +++ b/Projects/UOContent/Items/Resources/Blacksmithing/Ore.cs @@ -54,10 +54,8 @@ public abstract partial class BaseOre : Item }; public override bool CanStackWith(Item dropped) => - dropped.Stackable && Stackable && dropped.Hue == Hue && - dropped.GetType() == GetType() && dropped.ItemID == ItemID && - (dropped as BaseOre)?._resource == _resource && dropped.Name == Name && - dropped.Amount + Amount <= 60000 && dropped != this; + base.CanStackWith(dropped) && + (dropped as BaseOre)?._resource == _resource; public override void AddNameProperty(IPropertyList list) { @@ -444,4 +442,4 @@ public partial class ValoriteOre : BaseOre } public override BaseIngot GetIngot() => new ValoriteIngot(); -} \ No newline at end of file +}