public static void Run() { BasicTasks.AlreadyRunning(); try { Thread.Sleep(5000); while (!Form1.startChrome) { Thread.Sleep(500); } var driverOptions = new ChromeOptions(); driverOptions.AddExtension(@"C:\Users\danie\Documents\Visual Studio 2017\Resources\Gladiatus_bots\GladiatusTools.crx"); if (Properties.Settings.Default.headless) { driverOptions.AddArgument("--headless"); driverOptions.AddArgument("--disable-gpu"); driverOptions.AddArgument("--window-size=1920,1080"); } if (Screen.AllScreens.Length > 1) { driverOptions.AddArgument("--window-position=1750,50"); } var driverService = ChromeDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; Form1.driver = new ChromeDriver(driverService, driverOptions); if (!Properties.Settings.Default.headless) { Form1.driver.Manage().Window.Maximize(); } using (Form1.driver) { bool logged_in = Login(); Form1.bot_running = true; Tests.RunTests(); bool non_stop = true; int expedition_points = 0; int dungeon_points = 0; bool dungeon_event = true; while (non_stop) { bool first_extract = true; while (Form1.botAction) { do { if (!Form1.botAction) { break; } if (first_extract) { General.ExtractItems(); General.Store_Components(); first_extract = false; } expedition_points = Farming.Expedition(false); dungeon_points = Farming.Dungeon(false); if (dungeon_event) { dungeon_event = Farming.DungeonEvent(); } Farming.Arena35(); Farming.Turma35(); General.Training(); Gold.Pack_Gold(); expedition_points = BasicTasks.ReturnInt("//span[@id='expeditionpoints_value_point']"); dungeon_points = BasicTasks.ReturnInt("//span[@id='dungeonpoints_value_point']"); if (expedition_points == 0 && !Properties.Settings.Default.dungeonsChecked && Form1.british_land && !Properties.Settings.Default.farm_arenas || expedition_points == 0 && Form1.british_land && !Properties.Settings.Default.farm_arenas || dungeon_points == 0 && !Properties.Settings.Default.expeditionsChecked && Form1.british_land && !Properties.Settings.Default.farm_arenas) { if (!Hades.Take_Pater_Costume() /*&& !Hades.DoHades()*/) { break; } } } while (dungeon_points > 0 || expedition_points > 0 || Properties.Settings.Default.farm_arenas); if (!Form1.botAction) { break; } Gold.Search_Pack(); General.ExtractItems(); General.SellItems(false); Gold.Pack_Gold(); General.BuyFood(false); General.Buy_Auction_House(); General.MovingFood(); BasicTasks.Wait_For_Exit(); } while (Form1.moveGoldAction) { Gold.Pack_Gold(); Form1.moveGoldAction = false; Form1.turn_off_func = true; Form1.notification_type = 1; } while (Form1.sellItemsAction) { General.SellItems(true); Form1.sellItemsAction = false; Form1.turn_off_func = true; Form1.notification_type = 2; } while (Form1.takeGoldAction) { Gold.TakeGold(); Form1.takeGoldAction = false; Form1.turn_off_func = true; Form1.notification_type = 3; } while (Form1.buyRingsAction) { General.Buy_Auction_House(); Form1.buyRingsAction = false; Form1.turn_off_func = true; Form1.notification_type = 4; } while (Form1.downloadPackages) { General.Download_Packages(); Form1.downloadPackages = false; Form1.turn_off_func = true; Form1.notification_type = 5; } while (!Form1.botAction && !Form1.moveGoldAction && !Form1.sellItemsAction && !Form1.takeGoldAction && !Form1.buyRingsAction && !Form1.downloadPackages) { Thread.Sleep(1500); Form1.currently_running = "Waiting for actions.."; } } } } catch (Exception _exception) { BasicTasks.Save_Exception(_exception, Helpers.Switch_World()); Run(); } }
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; } } }