Example #1
0
        /// <summary>
        /// Attempts to get the best slot for an item location to move into this container. Returns null if unsuccessful.
        /// </summary>
        /// <param name="itemToMove">The item location to move into this container.</param>
        /// <returns></returns>
        public ItemLocation GetBestSlot(ItemLocation itemToMove)
        {
            if (!this.IsOpen)
            {
                return(null);
            }

            // check if item is non-stackable
            if (itemToMove.ItemCount == 0)
            {
                return(this.GetFirstEmptySlot());
            }

            foreach (Item item in this.GetItems())
            {
                if (item.ID != itemToMove.ItemID)
                {
                    continue;
                }
                if (item.Count + itemToMove.ItemCount <= 100)
                {
                    return(item.ToItemLocation());
                }
            }
            return(this.GetFirstEmptySlot());
        }
Example #2
0
 public ItemLocation GetBestSlot(ItemLocation itemLoc, bool mustBeOtherContainer = true)
 {
     foreach (Container c in this.GetContainers())
     {
         if (mustBeOtherContainer && c.ContainsItemLocation(itemLoc))
         {
             continue;
         }
         var best = c.GetBestSlot(itemLoc);
         if (best != null)
         {
             return(best);
         }
     }
     return(null);
 }
Example #3
0
        /// <summary>
        /// Attempts to get the best slot for an item location to move into this container. Returns null if unsuccessful.
        /// </summary>
        /// <param name="itemToMove">The item location to move into this container.</param>
        /// <returns></returns>
        public ItemLocation GetBestSlot(ItemLocation itemToMove)
        {
            if (!this.IsOpen) return null;

            // check if item is non-stackable
            if (itemToMove.ItemCount == 0) return this.GetFirstEmptySlot();

            foreach (Item item in this.GetItems())
            {
                if (item.ID != itemToMove.ItemID) continue;
                if (item.Count + itemToMove.ItemCount <= 100) return item.ToItemLocation();
            }
            return this.GetFirstEmptySlot();
        }
Example #4
0
 public bool ContainsItemLocation(ItemLocation itemLoc)
 {
     return itemLoc.WorldLocation.X == 0xFFFF &&
         itemLoc.WorldLocation.Y == this.OrderNumber + Constants.Inventory.MinimumContainerNumber;
 }
Example #5
0
 public bool ContainsItemLocation(ItemLocation itemLoc)
 {
     return(itemLoc.WorldLocation.X == 0xFFFF &&
            itemLoc.WorldLocation.Y == this.OrderNumber + Constants.Inventory.MinimumContainerNumber);
 }