示例#1
0
        /// <summary>
        /// Determines if house options is open
        /// </summary>
        /// <returns>true if the world switcher is open</returns>
        protected bool HouseOptionsIsOpen()
        {
            Inventory.OpenOptions(false);
            Screen.ReadWindow();
            int left   = Screen.Width - 169;
            int right  = left + 100;
            int top    = Screen.Height - 296;
            int bottom = top + 20;

            Color[,] houseOptionsTitle = Vision.ScreenPiece(left, right, top, bottom);
            double       houseOptionsMatch        = ImageProcessing.FractionalMatch(houseOptionsTitle, RGBHSBRangeFactory.BankTitle());
            const double houseOptionsMinimumMatch = 0.05;

            return(houseOptionsMatch > houseOptionsMinimumMatch);
        }
示例#2
0
        /// <summary>
        /// Get the demon butler to take oak logs to the sawmill
        /// </summary>
        /// <returns>true if successful</returns>
        protected override bool Construct()
        {
            Inventory.OpenOptions(false);
            Point houseOptions = Probability.GaussianCircle(HouseOptionsLocation(), 5, 0, 360, 12);

            Mouse.Move(houseOptions.X, houseOptions.Y);
            if (WaitForTeleport())
            {
                return(false);
            }
            if (!WaitFor(IsAtHouse) || !CallServant() || !InitiateDemonDialog())
            {
                return(false);
            }

            long      lastBody   = 0;
            long      dialogBody = 0;
            Stopwatch watch      = new Stopwatch();

            watch.Start();
            while (!StopFlag && (watch.ElapsedMilliseconds < 30000) && AnyDialog(true))
            {
                dialogBody = DialogHash(false);

                if (!Numerical.CloseEnough(dialogBody, lastBody, _hashPrecision))
                {
                    if (ContinueBar())
                    {
                        Keyboard.Space();
                    }
                    else
                    {
                        if (ProcessDialog(dialogBody))
                        {
                            lastBody = dialogBody;
                        }
                    }
                }
                SafeWait(200);
            }
            return(!AnyDialog(false));
        }