コード例 #1
0
        public Inventory AddToInventoryWithSlotAndType(ItemInstance iteminstance, InventoryType type, short slot)
        {
            Logger.Debug($"Slot: {slot} Type: {type} VNUM: {iteminstance.ItemVNum}", Owner.Session.SessionId);
            Inventory inv = new Inventory()
            {
                Type = type, Slot = slot, ItemInstance = iteminstance, CharacterId = Owner.CharacterId
            };
            string inventoryPacket = Owner.Session.Character.GenerateInventoryAdd(iteminstance.ItemVNum, inv.ItemInstance.Amount, type, slot, iteminstance.Rare, iteminstance.Design, 0, 0);

            if (!String.IsNullOrEmpty(inventoryPacket))
            {
                Owner.Session.SendPacket(inventoryPacket);
            }

            if (Inventory.Any(s => s.Slot == slot && s.Type == type))
            {
                return(null);
            }

            inv.ItemInstance.Id = inv.Id; // set id because its a one to one
            Inventory.Add(inv);
            return(inv);
        }
コード例 #2
0
 /// <summary>
 /// Puts a Single Invenory including ItemInstance to the List
 /// </summary>
 /// <param name="inventory"></param>
 public void PutInventory(Inventory inventory)
 {
     Inventory.Add(inventory);
 }