Пример #1
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);
        }
Пример #2
0
        protected override bool Execute()
        {
            //Drop kebbit pickups to make room for more.
            if (!Inventory.SlotIsEmpty(18, true))
            {
                Inventory.DropInventory(false);
            }

            List <Kebbit> kebbits = LocateKebbits();

            kebbits = SortAndFilterKebbits(kebbits);
            kebbits = kebbits.GetRange(0, Math.Min(kebbits.Count, 2));   //Only try the first 2 kebbits.

            foreach (Kebbit kebbit in kebbits)
            {
                if (StopFlag)
                {
                    return(false);
                }

                if (HandEye.MouseOverNPC(new Blob(kebbit.Location.Center), true, 1, 500))
                {
                    if (RetrieveFalcon(kebbit.Location.Center))
                    {
                        FailedRuns = 0;
                        RunParams.Iterations--;
                        return(true);
                    }
                    break;  //Don't keep trying after a failed catch attempt.
                }
            }

            FailedRuns++;
            if (FailedRuns >= 5)
            {
                if (FailedRuns % 10 == 0)
                {
                    Minimap.MoveToPosition(225, 0.95, true, 3, 2500, null, 10000);
                    Vision.WaitDuringPlayerAnimation(6000);
                }
                else if (FailedRuns % 5 == 0)
                {
                    Minimap.MoveToPosition(315, 0.95, true, 3, 2500, null, 10000);
                    Vision.WaitDuringPlayerAnimation(6000);
                }
            }
            return(FailedRuns < 60 && !FalconRanAway);
        }
Пример #3
0
        protected override bool Execute()
        {
            Screen.ReadWindow();

            if (Minimap.Hitpoints() > 0.9)
            {
                Logout();
                return(false);   //Assume that we died in the Nightmare Zone if hitpoints suddenly become full
            }

            if (Overload() || Hitpoints() || Absorption())
            {
                if (StopFlag)
                {
                    return(false);
                }
                Point inventoryCorner      = new Point(Screen.Width - Inventory.INVENTORY_OFFSET_LEFT - Inventory.INVENTORY_GAP_X, Screen.Height - Inventory.INVENTORY_OFFSET_TOP - Inventory.INVENTORY_GAP_Y);
                int   acceptableAreaRadius = (int)Geometry.DistanceBetweenPoints(Screen.Center, inventoryCorner);
                HandEye.MouseOverNPC(new Blob(new Point(Screen.Center.X, Screen.Center.Y)), true, acceptableAreaRadius, 1000);
            }

            return(true);
        }