Aura.Channel.World.Inventory.CreatureInventory.PickUp C# (CSharp) Метод

PickUp() публичный Метод

Tries to put item into the inventory, by filling stacks and adding it. If it was completely added to the inventory, it's removed from the region the inventory's creature is in.
public PickUp ( Item item ) : bool
item Item
Результат bool
		public bool PickUp(Item item)
		{
			var originalAmount = item.Info.Amount;

			// Making a copy of the item and generating a new temp id
			// ensures that we can still remove the item from the ground
			// after moving it (region, x, y) to the pocket.
			// (Remove takes an id parameter, maybe this can be solved
			//   properly, see pet invs.)
			// We also need the new id to prevent conflicts in the db
			// (SVN r67).
			// If this is changed, the item's owner and protection limit
			// should be reset on pick up.

			var newItem = new Item(item);
			newItem.IsNew = true;

			var success = this.Insert(newItem, false);

			// Remove item from floor if it was completely added to
			// the inventory, into existing or new stacks.
			if (success)
			{
				_creature.Region.RemoveItem(item);
			}
			// Update original item's amount if it wasn't added completely.
			else if (newItem.Info.Amount != originalAmount)
			{
				item.Info.Amount = newItem.Info.Amount;
				// TODO: We need an update packet for items on the floor.
			}

			return success;
		}