Beispiel #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);
        }
Beispiel #2
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 and telegrabbed. May be false if no item is found or if there isn't inventory space to pick it up.</returns>
        private bool FindAndGrab(Color[,] screenDropArea, Point offset, ColorFilter referenceColor, int minimumSize = 50)
        {
            bool[,] matchedPixels = Vision.ColorFilter(screenDropArea, referenceColor);
            Blob biggestBlob = ImageProcessing.BiggestBlob(matchedPixels);

            if (biggestBlob.Size > minimumSize)
            {
                Point blobCenter = biggestBlob.Center;
                Inventory.Telegrab(blobCenter.X + offset.X, blobCenter.Y + offset.Y);
                Inventory.OpenInventory();
                return(true);
            }
            return(false);
        }
Beispiel #3
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 and telegrabbed. May be false if no item is found or if there isn't inventory space to pick it up.</returns>
        private bool FindAndGrabChaosRune(Color[,] screenDropArea, Point offset, ColorFilter referenceColor, int minimumSize = 50)
        {
            bool[,] matchedPixels = Vision.ColorFilter(screenDropArea, referenceColor);
            List <Blob> chaosRunes = ImageProcessing.FindBlobs(matchedPixels, true);

            for (int i = 0; i < Math.Min(10, chaosRunes.Count); i++)
            {
                if ((chaosRunes[i].Size > minimumSize) && chaosRunes[i].IsCircle(0.4))
                {
                    Point blobCenter = chaosRunes[i].Center;
                    Inventory.Telegrab(blobCenter.X + offset.X, blobCenter.Y + offset.Y);
                    Inventory.OpenInventory();
                    return(true);
                }
            }

            return(false);
        }