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

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

Tries to add item to one of the main inventories, using temp as fallback. Unlike "Add" the item will be filled into stacks first, if possible, before calling Add.
public Insert ( Item item, bool tempFallback, List &changed ) : bool
item Item
tempFallback bool Add to temp inv when all other pockets are full?
changed List List of stacks that items were inserted into.
Результат bool
		public bool Insert(Item item, bool tempFallback, out List<Item> changed)
		{
			changed = null;

			var originalAmount = item.Amount;

			// TODO: Maybe it would be cleaner to ask the pockets for a list
			//   of certain items, that we can fill into, instead of them
			//   returning lists of changed items via out.
			if (item.Data.StackType == StackType.Stackable)
			{
				// Try stacks/sacs first
				lock (_pockets)
				{
					// Main inv
					_pockets[Pocket.Inventory].FillStacks(item, out changed);
					this.UpdateChangedItems(changed);

					// VIP inv
					// TODO: Add and check inv locks
					if (item.Info.Amount != 0)
					{
						_pockets[Pocket.VIPInventory].FillStacks(item, out changed);
						this.UpdateChangedItems(changed);
					}

					// Bags
					if (_creature.Client.Account.PremiumServices.CanUseBags)
					{
						for (var i = Pocket.ItemBags; i <= Pocket.ItemBagsMax; ++i)
						{
							if (item.Info.Amount == 0)
								break;

							if (_pockets.ContainsKey(i))
							{
								_pockets[i].FillStacks(item, out changed);
								this.UpdateChangedItems(changed);
							}
						}
					}
				}

				// Notify everybody about receiving the item, amount being
				// the amount of items filled into stacks.
				var inserted = (originalAmount - item.Info.Amount);
				if (inserted > 0 && _creature.IsPlayer)
					ChannelServer.Instance.Events.OnPlayerReceivesItem(_creature, item.Info.Id, inserted);

				if (item.Info.Amount == 0)
					return true;
			}

			return this.Add(item, tempFallback);
		}

Same methods

CreatureInventory::Insert ( Item item, bool tempFallback ) : bool