Aura.Channel.Scripting.Scripts.NpcScript.EquipItem C# (CSharp) Метод

EquipItem() защищенный Метод

Adds item to NPC's inventory.
protected EquipItem ( Pocket pocket, int itemId, uint color1, uint color2, uint color3, ItemState state = ItemState.Up ) : void
pocket Pocket
itemId int
color1 uint
color2 uint
color3 uint
state ItemState For robes and helmets
Результат void
		protected void EquipItem(Pocket pocket, int itemId, uint color1 = 0, uint color2 = 0, uint color3 = 0, ItemState state = ItemState.Up)
		{
			if (this.NPC == null)
				throw new InvalidOperationException("NPC's race has to be set first.");

			if (!pocket.IsEquip())
			{
				Log.Error("Pocket '{0}' is not for equipment ({1})", pocket, this.GetType().Name);
				return;
			}

			if (!AuraData.ItemDb.Exists(itemId))
			{
				Log.Error("Unknown item '{0}' ({1})", itemId, this.GetType().Name);
				return;
			}

			var item = new Item(itemId);
			item.Info.Pocket = pocket;
			item.Info.Color1 = color1;
			item.Info.Color2 = color2;
			item.Info.Color3 = color3;
			item.Info.State = (byte)state;

			this.NPC.Inventory.InitAdd(item);
		}