Aura.Channel.World.Inventory.CreatureInventory.Decrement C# (CSharp) Method

Decrement() public method

Reduces item's amount and sends the necessary update packets. Also removes the item, if it's not a sack and its amount reaches 0.
public Decrement ( Item item, ushort amount = 1 ) : bool
item Item
amount ushort
return bool
		public bool Decrement(Item item, ushort amount = 1)
		{
			if (!this.Has(item) || item.Info.Amount == 0 || item.Info.Amount < amount)
				return false;

			item.Info.Amount -= amount;

			if (item.Info.Amount > 0 || item.Data.StackType == StackType.Sac)
			{
				ChannelServer.Instance.Events.OnPlayerRemovesItem(_creature, item.Info.Id, amount);
				Send.ItemAmount(_creature, item);
			}
			else
			{
				this.Remove(item);
			}

			return true;
		}