Exemplo n.º 1
0
        protected override bool Execute()
        {
            if (!Screen.ReadWindow())
            {
                return(false);
            }
            Blob teaStall;

            if (!Vision.LocateObject(TeaStallRoof, out teaStall, minTeaStallSize))
            {
                MessageBox.Show("Unable to locate a tea stall");
                return(false);
            }
            Point click = (Point)teaStall.RandomBlobPixel();

            Mouse.Move(click.X, click.Y);
            SafeWait(2000);
            if (!Vision.WaitForMouseOverText(MouseOverText))
            {
                return(++FailedRuns < FAIL_LIMIT);
            }
            SafeWaitPlus(0, 150);
            LeftClick(click.X, click.Y);

            SafeWait(1000);
            Stopwatch watch = new Stopwatch();

            watch.Start();
            while (Inventory.SlotIsEmpty(TeaInventorySlot.X, TeaInventorySlot.Y, true, false))
            {
                SafeWait(200);
                if (watch.ElapsedMilliseconds > 5000)
                {
                    return(++FailedRuns < FAIL_LIMIT);
                }
            }
            Inventory.DropItem(TeaInventorySlot.X, TeaInventorySlot.Y, false, new int[1] {
                0
            });

            FailedRuns = 0;
            RunParams.Iterations--;
            return(true);
        }