GetFreeSlot() public method

public GetFreeSlot ( ) : int
return int
Exemplo n.º 1
0
        public void PickUp(Player player)
        {
            var slot = player.GetFreeSlot();
            if (this is Gold)
            {
                Item temp;
                player.Gold += (uint)Quantity;
                World.SendToAll(new QueDele(m_Map, new DeleteObject(m_Serial).Compile()));
                World.NewItems.TryRemove(m_Serial, out temp);
                Loc = null;
                World.RemoveDynamicObj(m_Map, m_Serial);

                return;
            }
            if (slot != -1)
            {
                DropTime = 0;
                World.RemoveDynamicObj(m_Map, m_Serial);
                World.SendToAll(new QueDele(m_Map, new DeleteObject(m_Serial).Compile()));
                m_Map = "inventory";
                Parent = player;

                Loc = null;
                InvSlot = slot;
               // World.DBConnect.WriteQue.Enqueue(() => World.DBConnect.UpdateItem(this));
                Parent.client.SendPacket(new AddItemToInventory2(this).Compile());
            }
        }
Exemplo n.º 2
0
 public Item Inventory(Player play)
 {
     if (Stackable)
     {
         var ore = play.Inventory.Where(xe => xe.Name.Split(':')[0] == this.Name.Split(':')[0]).FirstOrDefault();
         if (ore != null)
         {
             ore.Quantity++;
             play.client.SendPacket(new LKCamelot.model.AddItemToInventory2(ore).Compile());
             return ore;
         }
         else if (ore == null)
         {
             Quantity++;
             this.InvSlot = play.GetFreeSlot();
             this.Loc = null;
             this.Parent = play;
         }
     }
     else
     {
         this.InvSlot = play.GetFreeSlot();
         this.Loc = null;
         this.Parent = play;
     }
     return this;
 }