Пример #1
0
        /// <summary>
        /// Fills the small, medium, and large pouches.
        /// Refreshes stamina if it is almost out.
        /// Replaces any depleted jewelry.
        /// </summary>
        /// <param name="refreshStamina">set to true to drink a dose of stamina potion</param>
        /// <returns>true if successful</returns>
        protected bool FillSmallMediumLargePouches()
        {
            Point cursorLocation = new Point(Mouse.X, Mouse.Y);
            Bank  bank;

            if (HandEye.MouseOverStationaryObject(new Blob(cursorLocation), true, 0, 0))    //try mousing over the default guess location first
            {
                bank = new Bank(RSClient, Inventory, Keyboard);
                if (!bank.WaitForPopup(6000))
                {
                    return(false);
                }
            }
            else if (!Banking.OpenBank(out bank, 3))    //Look for the bank if guessing fails
            {
                return(false);
            }

            bank.DepositAll(InventorySlotCraftedRunes);
            BankWithdrawForServicing(bank);
            bank.WithdrawAll(BankSlotPureEssence.X, BankSlotPureEssence.Y);
            bank.Close();

            return(Servicing());
        }
Пример #2
0
        /// <summary>
        /// Crosses the tightrope
        /// </summary>
        /// <returns>true if successful</returns>
        private bool CrossTightrope()
        {
            Blob tightrope;

            ScanForMarkOfGrace(false);

            for (int i = 0; i < 3; i++)                                                                                      //finding the tightrope and failing the mouseover probably means that another player was blocking view of the tightrope during the screen capture
            {
                if (Vision.LocateObject(Tightrope, out tightrope, Screen.ArtifactArea(0.00009), Screen.ArtifactArea(0.714))) //ex 0.000357
                {
                    Point tightropeStart = tightrope.GetTop();
                    Point hitboxCenter   = new Point(tightropeStart.X, tightropeStart.Y - Screen.ArtifactLength(0.0269));
                    if (HandEye.MouseOverStationaryObject(new Blob(hitboxCenter), true, 10, 3000))
                    {
                        SafeWait(8000);
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Пример #3
0
        /// <summary>
        /// Attempts to retrieve a falcon after launching it at a kebbit.
        /// </summary>
        /// <param name="target">The expected location of the falcon catching the kebbit.</param>
        /// <returns>True if the falcon catches the kebbit and is successfully retrieved.</returns>
        protected bool RetrieveFalcon(Point target)
        {
            //Find the second inventory slot that should fill when we retrieve the falcon so as not to confuse with accidentally picking up an item from the ground.
            Point?nextEmptyInventorySlot = Inventory.FirstEmptySlot(false, 2);

            if (nextEmptyInventorySlot == null)
            {
                return(false);
            }

            if (!WaitForCatch(ref target) || !WaitForFalconToStop(ref target, (Point)nextEmptyInventorySlot))
            {
                return(false);
            }

            Stopwatch retrieveWatch = new Stopwatch();

            retrieveWatch.Start();
            while (retrieveWatch.ElapsedMilliseconds < 60000 && !StopFlag)
            {
                if (HandEye.MouseOverNPC(new Blob(target), true, 0))
                {
                    SafeWait((int)(RunTime(target) / 2));
                    if (Inventory.WaitForSlotToFill((Point)nextEmptyInventorySlot, 5000))
                    {
                        return(true);
                    }
                }
                else if (HandEye.MouseOverStationaryObject(new Blob(target), false, 0, 0))
                {
                    //LeftClick(target.X, target.Y, 12);
                    //WaitDuringPlayerAnimation((int) (RunTime(target) * 1.5));

                    RightClick(target.X, target.Y, 0);
                    RightClick falconMenu = new RightClick(target.X, target.Y, RSClient, Keyboard);
                    falconMenu.WaitForPopup();
                    falconMenu.CustomOption(1);
                    if (SafeWait(1000))
                    {
                        return(false);
                    }
                    //TODO Search for the first row in the popup with NPC yellow text instead of picking the second row.
                }

                //We accidentally collected the falcon at some point.
                if (!Inventory.SlotIsEmpty(nextEmptyInventorySlot.Value, true))
                {
                    return(true);
                }
                //The falcon ran away.
                else if (!LocateFlashingArrow(ref target))
                {
                    FalconRanAway = true;
                    return(false);
                }
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Jumps from the ladder roof to the church roof
        /// </summary>
        /// <returns>true if successful</returns>
        private bool JumpToChurchRoof()
        {
            Point hitboxCenter = new Point(Screen.Center.X - Screen.ArtifactLength(0.498), Screen.Center.Y + Screen.ArtifactLength(0.200));
            Blob  hitboxBlob   = new Blob(hitboxCenter);

            if (HandEye.MouseOverStationaryObject(hitboxBlob, false, 10, 2500))
            {
                ScanForMarkOfGrace();
                if (HandEye.MouseOverStationaryObject(new Blob(hitboxCenter), true, 10, 3000))
                {
                    SafeWait(5000);
                    return(true);
                }
            }
            return(false);
        }
Пример #5
0
        /// <summary>
        /// Jumps off of the church roof
        /// </summary>
        /// <returns>true if successful</returns>
        private bool JumpOffTreeRoof()
        {
            Point hitboxCenter = new Point(Screen.Center.X + Screen.ArtifactLength(0.069), Screen.Center.Y + Screen.ArtifactLength(0.069));
            Blob  hitboxBlob   = new Blob(hitboxCenter);

            if (HandEye.MouseOverStationaryObject(hitboxBlob, false, 10, 3500))
            {
                ScanForMarkOfGrace();
                if (HandEye.MouseOverStationaryObject(new Blob(hitboxCenter), true, 10, 3000))
                {
                    SafeWait(3000);
                    Inventory.HoverStandardTeleport(Inventory.StandardTeleports.Camelot, false, false);
                    Vision.WaitDuringPlayerAnimation(3000);
                    return(true);
                }
            }
            return(false);
        }
Пример #6
0
        /// <summary>
        /// Jumps from the bank roof to the roof at the start of the tightrope and waits for the player to come to a stop.
        /// </summary>
        /// <returns>true if successful</returns>
        private bool JumpToTightrope()
        {
            Blob whiteFlag;

            if (Vision.LocateStationaryObject(WhiteFlag, out whiteFlag, 20, 7000, Screen.ArtifactArea(0.000065), Screen.ArtifactArea(0.000260))) //ex 0.000130
            {
                ScanForMarkOfGrace();
                Point expectedLocation = new Point(whiteFlag.Center.X - Screen.ArtifactLength(0.337), whiteFlag.Center.Y + Screen.ArtifactLength(0.0688));
                if (HandEye.MouseOverStationaryObject(new Blob(expectedLocation), true, 25, 3000))
                {
                    SafeWait(5500);
                    MoveMouse(Screen.Center.X - Screen.ArtifactLength(0.207), Screen.Center.Y + Screen.ArtifactLength(0.34));
                    Vision.WaitDuringPlayerAnimation(4000);
                    return(true);
                }
            }
            return(false);
        }
Пример #7
0
        /// <summary>
        /// Clicks the interior nature altar
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool CraftInventory(Point altarLocation, Point?restMouse)
        {
            //click on the interior nature altar to craft inventory by guessing the location
            altarLocation = Probability.GaussianCircle(altarLocation, 5, 0, 360, 15);
            Blob interiorAltar = new Blob(altarLocation);

            //guess the location before searching
            if (!HandEye.MouseOverStationaryObject(interiorAltar, true, 20, 5000))
            {
                if (!LocateAltar(out interiorAltar) || !HandEye.MouseOverStationaryObject(interiorAltar, true, 20, 3000))
                {
                    return(false);
                }
            }
            if (restMouse != null)
            {
                MoveMouse(restMouse.Value.X, restMouse.Value.Y);    //leave the mouse close to where it will be needed next
            }

            return(true);
        }
Пример #8
0
        /// <summary>
        /// Clicks the exterior nature altar to enter it and clicks the nature altar to craft the first inventory of essence
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool EnterAltar()
        {
            int   minimumSize = Screen.ArtifactArea(0.01); //ex 0.0236
            Blob  exteriorAltar;
            Point searchCenter = new Point(Screen.Center.X + Screen.ArtifactLength(0.25), Screen.Center.Y - Screen.ArtifactLength(0.24));

            if (!HandEye.MouseOverStationaryObject(new Blob(searchCenter), true, 10, 1000))  //click on the exterior nature altar to enter
            {
                if (!LocateAltar(out exteriorAltar, searchCenter, Screen.ArtifactLength(0.3)))
                {
                    return(false);
                }
                Vision.WaitDuringPlayerAnimation(3000);
                if (!HandEye.MouseOverStationaryObject(exteriorAltar, true, 10, 2000))
                {
                    return(false);
                }
            }
            SafeWaitPlus((int)(2.5 * BotRegistry.GAME_TICK), 150);

            //click on the interior nature altar to craft inventory by guessing the location
            Point altarLocation = new Point(Screen.Center.X, Screen.Center.Y - Screen.ArtifactLength(0.311));
            int   x = InventorySlotSmallPouch.X, y = InventorySlotSmallPouch.Y;

            Inventory.InventoryToScreen(ref x, ref y);

            for (int i = 0; i < 5; i++)
            {
                CraftInventory(altarLocation, new Point(x, y));
                if (WaitForRunesToCraft(false, 3 * BotRegistry.GAME_TICK))
                {
                    break;
                }
                SafeWait(BotRegistry.GAME_TICK);
            }

            return(true);
        }
Пример #9
0
        /// <summary>
        /// Locates and opens a nown bank type
        /// </summary>
        /// <param name="bankPopup"></param>
        /// <returns></returns>
        internal bool OpenKnownBank(out Bank bankPopup, int allowedAttempts = 1)
        {
            bankPopup = null;
            if (BankBoothLocator == null)
            {
                return(false);
            }

            Blob bankBooth;

            for (int i = 0; i < allowedAttempts; i++)
            {
                if (BankBoothLocator(out bankBooth) && HandEye.MouseOverStationaryObject(bankBooth, true, 10))
                {
                    bankPopup = new Bank(RSClient, Inventory, Keyboard);
                    if (bankPopup.WaitForPopup(WAIT_FOR_BANK_WINDOW_TIMEOUT))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }