コード例 #1
0
ファイル: Container.cs プロジェクト: uvbs/bot-2016
        /// <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());
        }
コード例 #2
0
ファイル: Inventory.cs プロジェクト: uvbs/bot-2016
 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);
 }
コード例 #3
0
ファイル: Container.cs プロジェクト: KyLuaa/bot
        /// <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();
        }
コード例 #4
0
ファイル: Container.cs プロジェクト: KyLuaa/bot
 public bool ContainsItemLocation(ItemLocation itemLoc)
 {
     return itemLoc.WorldLocation.X == 0xFFFF &&
         itemLoc.WorldLocation.Y == this.OrderNumber + Constants.Inventory.MinimumContainerNumber;
 }
コード例 #5
0
ファイル: Container.cs プロジェクト: uvbs/bot-2016
 public bool ContainsItemLocation(ItemLocation itemLoc)
 {
     return(itemLoc.WorldLocation.X == 0xFFFF &&
            itemLoc.WorldLocation.Y == this.OrderNumber + Constants.Inventory.MinimumContainerNumber);
 }