示例#1
0
        /// <summary>
        /// Looks for, picks up, and alchs a drop that matches a ColorRange
        /// </summary>
        /// <param name="screenDropArea"></param>
        /// <param name="referenceColor"></param>
        /// <param name="minimumSize">minimum number of pixels needed to </param>
        /// <returns>True if an item is found, picked up, and alched. May be false if no item is found or if there isn't inventory space to pick it up.</returns>
        private bool FindAndAlch(Color[,] screenDropArea, Point offset, ColorFilter referenceColor, int minimumSize)
        {
            bool[,] matchedPixels = Vision.ColorFilter(screenDropArea, referenceColor);
            Blob biggestBlob = ImageProcessing.BiggestBlob(matchedPixels);

            if (biggestBlob.Size < minimumSize)
            {
                return(false);   //Nothing to grab.
            }

            Point blobCenter = biggestBlob.Center;

            if (AlchAlchables)
            {
                Inventory.GrabAndAlch(blobCenter.X + offset.X, blobCenter.Y + offset.Y);
                Inventory.OpenInventory();
            }
            else
            {
                Inventory.Telegrab(blobCenter.X + offset.X, blobCenter.Y + offset.Y);
                Inventory.OpenInventory();
            }

            return(true);
        }