Aura.Channel.Skills.Base.CreationSkill.ReadMaterials C# (CSharp) Method

ReadMaterials() protected method

Reads materuals from packet, starting with the count. Returns false if a material item wasn't found, after logging it.
protected ReadMaterials ( Creature creature, Packet packet, List &materials ) : bool
creature Aura.Channel.World.Entities.Creature
packet Packet
materials List
return bool
		protected bool ReadMaterials(Creature creature, Packet packet, out List<ProductionMaterial> materials)
		{
			materials = new List<ProductionMaterial>();

			var count = packet.GetByte();
			for (int i = 0; i < count; ++i)
			{
				var itemEntityId = packet.GetLong();
				var amount = packet.GetShort();

				// Check item
				var item = creature.Inventory.GetItem(itemEntityId);
				if (item == null)
				{
					Log.Warning("CreationSkill.ReadMaterials: Creature '{0:X16}' tried to use non-existent material item.", creature.EntityId);
					return false;
				}

				materials.Add(new ProductionMaterial(item, amount));
			}

			return true;
		}
	}