Пример #1
0
        public static bool DoHades()
        {
            if (BasicTasks.Search("//div[contains(@onmousemove,'Czas regeneracji')]") || !Properties.Settings.Default.hades)
            {
                return(false);
            }

            int  maximum_rubles = Properties.Settings.Default.maximum_rubles_hades;
            bool first_attack   = true;

            string[] items = new string[4];
            BasicTasks.Click("//div[@id='cooldown_bar_expedition']/a[@class='cooldown_bar_link']");
            bool first  = false;
            bool second = false;

            if (BasicTasks.Search("//a[contains(@title,'Czas podróży')]"))
            {
                first = true;
            }
            else if (BasicTasks.Search("//a[text() = 'Pustelnik']"))
            {
                second = true;
            }

            if (first || second)
            {
                //enter hades
                if (!first)
                {
                    General.HealMe(100);
                    BasicTasks.Click("//div[@id='cooldown_bar_expedition']/a[@class='cooldown_bar_link']");
                    BasicTasks.Click("//a[contains(text(),'Pustelnik')]");
                    BasicTasks.Click("//a[contains(text(), 'zaświaty')]");
                    BasicTasks.Click("//input[@value='normalne']");
                }

                BasicTasks.WaitForXPath("//div[contains(text(),'Na wyprawę')]");

                //first fight, take off gear
                BasicTasks.Click("//a[@title='Podgląd']");
                Navigation.FreeBackpack();

                //reading values
                items[0] = Hades_Get_Class("3");
                items[1] = Hades_Get_Class("4");
                items[2] = Hades_Get_Class("5");
                items[3] = Hades_Get_Class("10");


                foreach (string item in items)
                {
                    BasicTasks.MoveMoveElement("//div[contains(@class,'" + item + "')]", "//a[@class='awesome-tabs']");
                    BasicTasks.ReleaseElement("//div[@id='inv']//div[@class='ui-droppable grid-droparea image-grayed active']");
                }
            }
            else
            {
                first_attack = false;
            }

            int  wasted_rubles = 0;
            bool no_points     = false;
            int  last_stage    = -1;
            int  current_stage = 0;

            while (true)
            {
                Gold.Pack_Gold();
                if (!no_points)
                {
                    int points = Convert.ToInt32(BasicTasks.GetElement("//span[@id='expeditionpoints_value_point']").GetAttribute("textContent"));
                    if (points == 0)
                    {
                        no_points = true;
                    }
                }

                Hades_Heal_Guild();
                current_stage = Hades_Get_Stage();
                if (current_stage != last_stage)
                {
                    Hades_Take_Boosters(current_stage);
                    last_stage = Hades_Get_Stage();
                }

                if (no_points)
                {
                    wasted_rubles++;
                }

                if (maximum_rubles >= wasted_rubles)
                {
                    BasicTasks.WaitForXPath("//div[@id='cooldown_bar_expedition']/div[@class='cooldown_bar_text']");
                    IList <IWebElement> click_buttons = Form1.driver.FindElementsByXPath("//button[contains(@id,'expedition_button')]");
                    foreach (IWebElement button in click_buttons)
                    {
                        if (button.Displayed)
                        {
                            button.Click();
                            break;
                        }
                    }
                }
                else
                {
                    Hades_Exit();
                }
                if (BasicTasks.Search("//div[contains(text(),'Dokonało się!')]"))
                {
                    BasicTasks.Click("//input[@id='linkcancelnotification'][@value='Nie']");
                    return(true);
                }

                if (first_attack && !BasicTasks.Search("//div[@class='reportLose']"))
                {
                    Hades_Get_Gear(items);
                    first_attack = false;
                }
            }
        }