Example #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);
        }
Example #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);
        }
Example #3
0
        /// <summary>
        /// Carefully un-notes logs using the bank chest
        /// </summary>
        /// <returns>true if successful</returns>
        protected override bool Bank()
        {
            Inventory.OpenInventory();
            SafeWait(500);
            Screen.ReadWindow();
            if (InventoryIsReady())
            {
                return(true);
            }

            Inventory.ClickInventory(InventoryLogSlot, true);
            Mouse.Move(Screen.Center.X, Screen.Center.Y);
            if (WaitForTeleport())
            {
                return(false);
            }

            if (!ItemsAreReady())   //reset the inventory to its correct starting configuration
            {
                RefreshInventory();
                if (SafeWait(1000))
                {
                    return(false);
                }
                if (!ItemsAreReady())
                {
                    return(false);   //TODO restock at the GE
                }
            }

            const int maxUnNoteTries = 5;

            for (int i = 0; i < maxUnNoteTries; i++)
            {
                if (StopFlag)
                {
                    return(false);
                }
                if (UnNoteBankChest(InventoryLogSlot, i == 0))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #4
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);
        }
Example #5
0
        /// <summary>
        /// Teleports to Edgeville and moves to the Edgeville bank
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool MoveToEdgevilleBank()
        {
            //teleport to Edgeville bank
            Inventory.GloryTeleport(Inventory.GloryTeleports.Edgeville, false);
            Stopwatch watch = new Stopwatch();

            watch.Start();
            MoveMouse(Minimap.Center.X + 35, Minimap.Center.Y + 8, 35);
            SafeWait(Inventory.TELEPORT_DURATION);

            //Start moving to bank booth
            Point bankIconOffsetTarget = new Point(2 * MinimapGauge.GRID_SQUARE_SIZE, MinimapGauge.GRID_SQUARE_SIZE / 2);

            if (!Banking.MoveToBank(0, true, 4, 2, bankIconOffsetTarget))
            {
                return(false);
            }

            CheckItems();
            Inventory.OpenInventory();
            MoveMouse(Screen.Center.X, Screen.Center.Y + 30, 15);
            return(true);
        }
Example #6
0
        /// <summary>
        /// Selects a banking route to use based on the user's selection
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool Bank()
        {
            switch (UserSelections.BankChoice)
            {
            case NatureRingsSettingsData.BankOptions.Edgeville:
                if (!MoveToEdgevilleBank())
                {
                    return(false);
                }
                break;

            default:
                return(false);
            }

            Inventory.OpenInventory();  //Inventory should already be open, but just to make sure
            if (!Minimap.WaitDuringMovement(8000, 0))
            {
                return(false);
            }
            SafeWait(2 * BotRegistry.GAME_TICK);

            return(RefreshItems());
        }
Example #7
0
        protected override bool Run()
        {
            Inventory.OpenInventory(true);

            return(true);
        }