Ejemplo n.º 1
0
        /// <summary>
        /// Starts the Alter of Madness Quest logic
        /// </summary>
        public void Start()
        {
            UpdateScreen();                                   //updates Screen object in parent class with latest window size and x,y location.

            User32.SetForegroundWindow(App.MainWindowHandle); //brings window to front

            if (_finished == true && _riftMenuOpen == false)
            {
                if (Bot.IsCombatScreenUp(App))
                {
                    OpenRiftMenu();
                }
            }

            if (_finished == true && _riftMenuOpen == true)
            {
                EnterDungeon();
            }

            if (Bot.IsCombatScreenUp(App) && _startQuest == false && _finished == false) //look for combat screen, starts Quest once it is detected.
            {
                Thread.Sleep(TimeSpan.FromSeconds(1));
                if (IsRechargeUp())                       //added it here because of timing issues
                {
                    Click(_closeRechargeWindow[0].Point); //closes recharge window if its present.
                    Thread.Sleep(TimeSpan.FromSeconds(.1));
                }
                _startQuest = true;
                Click(new Point(128, 370)); // clicks the quest go button
                _mapPoint.UpdateColor(Screen);
            }

            if (Bot.IsCombatScreenUp(App) && _startQuest == true && _finished == false)
            {
                if (TimeSpan.FromMilliseconds(Timer.ElapsedMilliseconds) > TimeSpan.FromSeconds(15))
                {
                    //checks if there has been any map movement in the last 15 seconds
                    if (_mapPoint.IsPresent(Screen, 0))
                    {
                        //resets quest status by clicking on the auto combat button 3 times
                        //then changes _startQuest to false so i will start the quest again.
                        Click(new Point(876, 684));
                        Thread.Sleep(TimeSpan.FromSeconds(.1));
                        Click(new Point(876, 684));
                        Thread.Sleep(TimeSpan.FromSeconds(.1));
                        Click(new Point(876, 684));
                        Thread.Sleep(TimeSpan.FromSeconds(.1));
                        _startQuest = false;
                    }
                    _mapPoint.UpdateColor(Screen);
                }
            }
            if (NeedRevived())
            {
                Click(SpotRevive[0].Point);
                _startQuest = false;
            }
            if (IsGadgetUp())
            {
                Click(_closeGadgetWindow[0].Point);
                Thread.Sleep(TimeSpan.FromSeconds(.1));
            }
            if (IsRechargeUp())
            {
                Click(_closeRechargeWindow[0].Point);//closes recharge window if its present
                Thread.Sleep(TimeSpan.FromSeconds(.1));
            }
            if (_partyAccept[0].IsPresent(Screen, 2) && _partyAccept[1].IsPresent(Screen, 2))
            {
                Click(PartyAccept[0].Point);
                Thread.Sleep(TimeSpan.FromSeconds(.1));
            }
            if (IsFinished())
            {
                DoAgain();
            }
            Helper.Start();
        }