Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// Determines which inventory slot the teas will be picked up into
        /// </summary>
        protected override bool Run()
        {
            //ReadWindow();
            //bool[,] mask = ColorFilter(TeaStallRoof);
            //DebugUtilities.TestMask(Bitmap, ColorArray, TeaStallRoof, mask, "C:\\Projects\\Roboport\\test_pictures\\mask_tests\\", "teaStall");

            //SafeWait(3000);
            //ReadWindow();
            //bool[,] mask = ColorFilter(MouseOverText);
            //DebugUtilities.TestMask(Bitmap, ColorArray, MouseOverText, mask, "C:\\Projects\\Roboport\\test_pictures\\mask_tests\\", "mouseoverText");


            minTeaStallSize = Screen.ArtifactArea(0.00283);
            Point?teaSlot = Inventory.FirstEmptySlot();

            if (teaSlot == null)
            {
                MessageBox.Show("Clear at least one inventory slot for the stolen tea");
                return(false);
            }
            TeaInventorySlot = (Point)teaSlot;
            FailedRuns       = 0;
            return(true);
        }