Beispiel #1
0
        /// <summary>
        /// Finds the fairy ring and teleports to Karamja
        /// </summary>
        /// <param name="expectedLocation">The point at the expected center of the fairy ring.</param>
        /// <param name="searchRadius">The maximum expected deviation of the fairy ring's center from the expected center.</param>
        /// <returns>true if successful</returns>
        protected bool EnterFairyRing(Point expectedLocation, int searchRadius)
        {
            Point?ringCenter = LocateFairyRing(expectedLocation, searchRadius);

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

            int x = ringCenter.Value.X;
            int y = ringCenter.Value.Y;

            RightClick(x, y, 6);
            RightClick fairyRingOptions = new RightClick(x, y, RSClient, 6);

            if (!fairyRingOptions.WaitForPopup(2000, Popups.RightClick.CheckHeight.Half))
            {
                return(false);
            }

            if (!FairyRingConfigured)
            {
                ConfigureFairyRing(fairyRingOptions);
            }
            else
            {
                fairyRingOptions.CustomOption(2);   //teleport to the last location
            }

            MoveMouse(Minimap.Center.X + 55, Minimap.Center.Y, 40);
            SafeWait(2500);
            WaitForFairyRingTeleport();
            return(true);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        /// <summary>
        /// Configures and teleports to a specified location.
        /// Assumes that a fairy ring was just right-clicked on.
        /// </summary>
        /// <param name="expectedLocation">Expected location of the center of the fairy ring.</param>
        /// <param name="searchRadius">The maximum expected deviation of the fairy ring's center from the expected center.</param>
        /// <returns></returns>
        protected void ConfigureFairyRing(RightClick fairyRingOptions)
        {
            fairyRingOptions.CustomOption(1);   //open the configuration popup
            SafeWaitPlus(2000, 400);
            FairyRingsConfigure menu = new FairyRingsConfigure(Screen, RSClient);

            menu.SetConfiguration('c', 'k', 'r');
            menu.Teleport(false);
            FairyRingConfigured = true;
        }