예제 #1
0
        private static bool Login()
        {
            Form1.currently_running = "Logging-in..";
            Form1.driver.Navigate().GoToUrl("https://pl.gladiatus.gameforge.com/game/");

            BasicTasks.CheckEvenets();

            IWebElement loginElement = BasicTasks.GetElement("//input[@id='login_username']");

            loginElement.SendKeys(Properties.Settings.Default.nickname);

            IWebElement passwordElement = BasicTasks.GetElement("//input[@id='login_password']");

            passwordElement.SendKeys(Properties.Settings.Default.password);

            BasicTasks.SelectElement("//select[@id='login_server']", Helpers.Switch_World());

            BasicTasks.Click("//input[@id='loginsubmit']");

            if (BasicTasks.Search("//div[@class='contentItem_content'][contains(text(),'błędne')]"))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #2
0
 public static void Arena35()
 {
     Form1.currently_running = "Arena between servers..";
     if (Properties.Settings.Default.arena35Checked)
     {
         General.HealMe(Properties.Settings.Default.healthLevel);
         BasicTasks.WaitForXPath("//div[@id='cooldown_bar_arena']/div[@class='cooldown_bar_text']");
         BasicTasks.Click("//div[@id='cooldown_bar_arena']");
         if (!BasicTasks.Search("//a[contains(@href,'serverArena&aType=2')][@class='awesome-tabs current']"))
         {
             BasicTasks.Click("//a[contains(@href,'serverArena&aType=2')]");
         }
         BasicTasks.Click("//div[@class='attack']");
         if (BasicTasks.Search("//div[@id='header_bod']"))
         {
             if (Form1.driver.FindElementByXPath("//div[@id='header_bod']").Displayed&&
                 Form1.driver.FindElementByXPath("//div[@id='header_bod']").Enabled)
             {
                 BasicTasks.Click("//input[@value='Jazda!']");
             }
         }
         while (!BasicTasks.Search("//body[@id='reportsPage']"))
         {
             if (BasicTasks.Search("//div[@id='errorText']"))
             {
                 return;
             }
             Thread.Sleep(500);
         }
     }
 }
예제 #3
0
        private static void Hades_Exit()
        {
            Navigation.Packages();
            Navigation.FreeBackpack();
            string exit_item = "//div[@id='inv']//div[contains(concat(' ', normalize-space(@class), ' '), ' " + "item-23-1" + " ')]";

            while (true)
            {
                if (BasicTasks.Search(exit_item))
                {
                    BasicTasks.MoveMoveElement(exit_item, "//a[@class='awesome-tabs']");
                    BasicTasks.ReleaseElement("//div[@class='ui-droppable grid-droparea image-grayed active']");
                    break;
                }
                else
                {
                    BasicTasks.Click("//a[@class='paging_button paging_right_step']");
                }
            }

            exit_item = "//div[@id='inv']//div[contains(concat(' ', normalize-space(@class), ' '), ' " + "item-23-1" + " ')]";
            BasicTasks.Click("//a[@class='cooldown_bar_link']");
            BasicTasks.Click("//a[contains(text(),'Opuść Hades')]");
            BasicTasks.MoveMoveElement(exit_item, "//a[@class='awesome-tabs']");
            BasicTasks.ReleaseElement("//div[@id='underworld_targetbox']/div[@class='ui-droppable active']");
            BasicTasks.Click("//input[@id='linkunderworldLeaveConfirm'][@value='Opuść Hades']");
        }
예제 #4
0
        void Life_Tray_Info()
        {
            while (!bot_running)
            {
                Thread.Sleep(500);
            }
            bool non_stop = true;

            while (non_stop)
            {
                string expedition_points     = BasicTasks.Return_String("//span[@id='expeditionpoints_value_point']");
                string dungeon_points        = BasicTasks.Return_String("//span[@id='dungeonpoints_value_point']");
                string expedition_points_max = BasicTasks.Return_String("//span[@id='expeditionpoints_value_pointmax']");
                string dungeon_points_max    = BasicTasks.Return_String("//span[@id='dungeonpoints_value_pointmax']");
                string gold_level            = BasicTasks.Return_String("//div[@id='sstat_gold_val']");
                string rubles_level          = BasicTasks.Return_String("//div[@id='sstat_ruby_val']");

                string final_string = "NoLife (" + Helpers.Switch_World() + ")" +
                                      Environment.NewLine + "Expedition: " + expedition_points + "/" + expedition_points_max +
                                      Environment.NewLine + "Dungeon: " + dungeon_points + "/" + dungeon_points_max +
                                      Environment.NewLine + "Gold: " + gold_level + Environment.NewLine + "Rubles: " + rubles_level +
                                      Environment.NewLine + "Current: " + currently_running;
                SetNotifyIconText(notifyIcon1, final_string);
                Thread.Sleep(500);
            }
        }
예제 #5
0
 public static void Guild_Medic()
 {
     while (!BasicTasks.Search("//a[contains(@href,'guild_medic')][@id='doctor_div']"))
     {
         BasicTasks.Click("//a[text() = 'Gildia']");
     }
     BasicTasks.Click("//a[contains(@href,'guild_medic')][@id='doctor_div']");
 }
예제 #6
0
        public static bool DungeonEvent()
        {
            Form1.currently_running = "Event war..";
            if (!Properties.Settings.Default.eventWar)
            {
                return(false);
            }

            bool first, second = false;

            first = BasicTasks.Search("//a[contains(@class,'menuitem glow eyecatcher')]");
            if (!first)
            {
                second = BasicTasks.Search("//a[contains(@class,'menuitem active glow eyecatcher')]");
            }

            if (!first && !second)
            {
                return(false);
            }

            int eventPoints = 0;

            BasicTasks.Click("//div[@id='cooldown_bar_expedition']/a[@class='cooldown_bar_link']");
            if (first)
            {
                BasicTasks.Click("//div[@id='submenu2']/a[contains(@class,'menuitem glow eyecatcher')]");
            }
            else
            {
                BasicTasks.Click("//a[contains(@class,'menuitem active glow eyecatcher')]");
            }

            if (!BasicTasks.Search("//div[@class='section-header']/p[2]"))
            {
                return(false);
            }
            string element = Form1.driver.FindElementByXPath("//div[@class='section-header']/p[2]").GetAttribute("textContent");

            string[] separated = element.Split(' ');

            for (int i = 0; i <= separated.Length; i++)
            {
                try { eventPoints = Convert.ToInt32(separated[i]); break; }
                catch { }
            }

            if (eventPoints == 0)
            {
                return(false);
            }

            if (eventPoints > 0 && BasicTasks.Search("//button[@class='expedition_button awesome-button ']"))
            {
                BasicTasks.Click("//button[@class='expedition_button awesome-button ']");
            }
            return(true);
        }
예제 #7
0
 public static void Guild_Market()
 {
     while (!BasicTasks.Search("//a[contains(@href,'guildMarket')][@class='map_label']"))
     {
         BasicTasks.Click("//a[text() = 'Gildia']");
     }
     BasicTasks.Click("//a[contains(@href,'guildMarket')][@class='map_label']");
     Guild_Market_Show();
 }
예제 #8
0
        public static int Gold_Level()
        {
            string goldBeforeString = BasicTasks.GetElement("//div[@id='sstat_gold_val']").GetAttribute("textContent");

            goldBeforeString = goldBeforeString.Replace(".", "");
            int gold = Convert.ToInt32(goldBeforeString);

            return(gold);
        }
예제 #9
0
        public static int Dungeon(bool error_packing)
        {
            Form1.currently_running = "Dungeon..";
            int dungeon_points = BasicTasks.ReturnInt("//span[@id='dungeonpoints_value_point']");

            if (dungeon_points > 0 && Properties.Settings.Default.dungeonsChecked || error_packing && !Form1.british_land)
            {
                if (BasicTasks.Search("//div[@id='cooldown_bar_dungeon']/a[@class='cooldown_bar_link']"))
                {
                    IWebElement element = Form1.driver.FindElementByXPath("//div[@id='cooldown_bar_dungeon']/a[@class='cooldown_bar_link']");
                    if (!element.Displayed)
                    {
                        Form1.british_land = true;
                        return(dungeon_points);
                    }
                }

                #region WaitForAvalibe
                BasicTasks.WaitForXPath("//div[@id='cooldown_bar_text_dungeon'][text() = 'Do lochów']");
                BasicTasks.Click("//div[@id='cooldown_bar_dungeon']/a[@class='cooldown_bar_link']");
                #endregion
                #region CheckNew
                if (BasicTasks.Search("//input[@value='normalne']") || BasicTasks.Search("//input[@value='zaawansowane']"))
                {
                    switch (Properties.Settings.Default.dungeonsOption)
                    {
                    case 0:
                        BasicTasks.Click("//input[@value='normalne']");
                        break;

                    case 1:
                        if (!BasicTasks.Search("//input[@value='zaawansowane'][@disabled='disabled']"))
                        {
                            BasicTasks.Click("//input[@value='zaawansowane']");
                        }
                        else
                        {
                            BasicTasks.Click("//input[@value='normalne']");
                        }
                        break;
                    }
                }
                #endregion
                #region Attack
                BasicTasks.WaitForXPath("//img[contains(@src,'combatloc.gif')]");
                BasicTasks.Click("//img[contains(@src,'combatloc.gif')]");
                #endregion
                error_packing = false;
                Thread.Sleep(2000);
                return(dungeon_points);
            }
            Thread.Sleep(2000);
            return(dungeon_points - 1);
        }
예제 #10
0
 private static void Hades_Heal_Guild()
 {
     if (Properties.Settings.Default.healthLevel > General.Health_Level())
     {
         Navigation.Guild_Medic();
         if (BasicTasks.Search("//a[contains(text(),'Lecz teraz!')]"))
         {
             BasicTasks.Click("//a[contains(text(),'Lecz teraz!')]");
         }
     }
 }
예제 #11
0
 public static bool FoodBackpack()
 {
     if (!BasicTasks.Search(Helpers.Switch_Backpack_Food() + "[@data-available='false']"))
     {
         BasicTasks.Click(Helpers.Switch_Backpack_Food());
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #12
0
 private static void Guild_Market_Show()
 {
     while (!BasicTasks.Search("//a[contains(text(),'Cena na rynku')]"))
     {
         BasicTasks.WaitForXPath("//section[@id='market_table']");
         string helper = Form1.driver.FindElementByXPath("//section[@id='market_table']").GetAttribute("style");
         if (helper == "display: none;")
         {
             BasicTasks.Click("//h2[contains(text(),'Przedmiot')]");
         }
     }
 }
예제 #13
0
        public static int ReturnInt(string ścieżka)
        {
            int value = 0;

            for (int i = 0; i < 2; i++)
            {
                IWebElement element = BasicTasks.GetElement(ścieżka);
                try { value = Convert.ToInt32(element.GetAttribute("textContent")); return(value); }
                catch { BasicTasks.Refresh(); }
            }
            return(value);
        }
예제 #14
0
        public static int Expedition(bool error_packing)
        {
            Form1.currently_running = "Expedition..";
            int expedition_points = BasicTasks.ReturnInt("//span[@id='expeditionpoints_value_point']");

            if (expedition_points > 0 && Properties.Settings.Default.expeditionsChecked || error_packing)
            {
                if (BasicTasks.Search("//a[contains(@class,'menuitem')][text() = 'Opuść Hades']"))
                {
                    Form1.hades = true;
                    return(expedition_points);
                }
                #region CheckForHealth
                General.HealMe(Properties.Settings.Default.healthLevel);
                #endregion
                #region WaitForAvalibe
                BasicTasks.WaitForXPath("//div[@id='cooldown_bar_expedition']/div[@class='cooldown_bar_text']");
                BasicTasks.Click("//div[@id='cooldown_bar_expedition']/a[@class='cooldown_bar_link']");
                #endregion
                #region ChooseEnemy
                IReadOnlyCollection <IWebElement> list_buttons = Form1.driver.FindElementsByXPath("//button[contains(@class,'expedition_button')]");
                int choose_properties = Properties.Settings.Default.expeditionOption;
                while (choose_properties >= list_buttons.Count)
                {
                    choose_properties--;
                }

                switch (choose_properties)
                {
                case 0:
                    list_buttons.ElementAt(0).Click();
                    break;

                case 1:
                    list_buttons.ElementAt(1).Click();
                    break;

                case 2:
                    list_buttons.ElementAt(2).Click();
                    break;

                case 3:
                    list_buttons.ElementAt(3).Click();
                    break;
                }
                Thread.Sleep(2000);
                return(expedition_points - 1);

                #endregion
            }
            Thread.Sleep(2000);
            return(expedition_points);
        }
예제 #15
0
        public static string Return_String(string path)
        {
            bool non_stop = true;

            while (non_stop)
            {
                try
                {
                    return(BasicTasks.GetElement(path).GetAttribute("textContent"));
                }
                catch { }
            }
            return(BasicTasks.GetElement(path).GetAttribute("textContent"));
        }
예제 #16
0
        public static void Arena()
        {
            bool non_stop = true;

            while (non_stop)
            {
                BasicTasks.Click("//div[@id='cooldown_bar_arena']/a");
                IWebElement element      = Form1.driver.FindElementByXPath("//*[@id='mainnav']/li/table/tbody/tr/td[1]/a");
                string      element_name = element.GetAttribute("textContent");
                if (element_name == "Arena")
                {
                    BasicTasks.Click("//*[@id='mainnav']/li/table/tbody/tr/td[1]/a"); return;
                }
            }
        }
예제 #17
0
        public static void Third_Tab_Sellers()
        {
            int iterator = 0;

            while (!BasicTasks.Search("//div[@class='shopTab dynamic']"))
            {
                Thread.Sleep(1000);
                if (iterator == 5)
                {
                    return;
                }
                iterator++;
            }
            BasicTasks.Click("//div[@class='shopTab dynamic']");
        }
예제 #18
0
        public static bool Check_sold(IWebElement element)
        {
            Actions move = new Actions(Form1.driver);

            move.MoveToElement(element);
            move.Build().Perform();
            if (BasicTasks.Search("//p[contains(text(),'Wskazówka')]"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #19
0
        private static bool Take_From_Packages(string path1, string path2, string sold)
        {
            bool sold_bool = false;
            bool found     = false;

            if (sold == "1")
            {
                sold_bool = true;
            }
            if (!BasicTasks.Search(path1) && BasicTasks.Search(path2))
            {
                return(true);
            }
            else if (BasicTasks.Search(path1))
            {
                found = true;
            }
            else if (!BasicTasks.Search(path1) && !BasicTasks.Search(path2))
            {
                while (BasicTasks.Search("//a[@class = 'paging_button paging_right_step']"))
                {
                    if (BasicTasks.Search(path1) && BasicTasks.Check_sold(path2) == sold_bool)
                    {
                        found = true;
                        break;
                    }
                }
            }

            if (found)
            {
                BasicTasks.MoveMoveElement(path1, "//div[@id='inv']");
                if (BasicTasks.Search("//div[@class = 'ui-droppable grid-droparea image-grayed active']"))
                {
                    BasicTasks.ReleaseElement("//div[@class = 'ui-droppable grid-droparea image-grayed active']");
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #20
0
        private static void Hades_Get_Gear(string[] items)
        {
            BasicTasks.Click("//a[@title='Podgląd']");
            Navigation.FreeBackpack();
            int[] numbers = new int[4];
            numbers[0] = 3;
            numbers[1] = 4;
            numbers[2] = 5;
            numbers[3] = 10;

            int iterator = 0;

            foreach (string item in items)
            {
                BasicTasks.MoveMoveElement("//div[contains(@class,'" + item + "')]", "//a[@class='awesome-tabs']");
                BasicTasks.ReleaseElement("//div[@class='ui-droppable active'][@data-container-number='" + Convert.ToString(numbers[iterator]) + "']");
                iterator++;
            }
        }
예제 #21
0
        private static bool Sell_On_Market(string path, string price)
        {
            BasicTasks.MoveReleaseElement(path, "//div[@id='market_sell']/div[@class='ui-droppable']");
            BasicTasks.SelectElement("//select[@id='dauer']", "24 h");
            IWebElement cena = BasicTasks.GetElement("//input[@name='preis']");

            cena.SendKeys(OpenQA.Selenium.Keys.Control + "a");
            cena.SendKeys(OpenQA.Selenium.Keys.Control + "a");
            cena.SendKeys(OpenQA.Selenium.Keys.Delete);
            cena.SendKeys(Convert.ToString(price));
            BasicTasks.Click("//input[@value='Oferta']");
            if (BasicTasks.Search("//div[@class='message fail']"))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #22
0
        private static int Hades_Get_Stage()
        {
            BasicTasks.Click("//div[@id='cooldown_bar_expedition']/a[@class='cooldown_bar_link']");

            string[] locations = new string[4];
            locations[0] = "Erebus";
            locations[1] = "Tartarus";
            locations[2] = "Sąd";
            locations[3] = "Wejście";

            for (int i = 0; i < 4; i++)
            {
                if (BasicTasks.Search("//a[contains(text(),'" + locations[i] + "')]"))
                {
                    BasicTasks.Click("//a[contains(text(),'" + locations[i] + "')]");
                    return(i);
                }
            }
            return(-1);
        }
예제 #23
0
 public static bool Take_Pater_Costume()
 {
     if (Convert.ToInt32(Form1.driver.FindElementByXPath("//div[@id='header_values_level']").GetAttribute("textContent")) < 100)
     {
         return(false);
     }
     if (BasicTasks.Search("//div[contains(@onmousemove,'Zbroja Disa Patera')]"))
     {
         return(false);
     }
     BasicTasks.Click("//a[@title='Podgląd']");
     BasicTasks.Click("//input[@value='zmień']");
     if (BasicTasks.Search("//input[contains(@onclick,'Zbroja Disa Patera')]"))
     {
         BasicTasks.Click("//input[contains(@onclick,'Zbroja Disa Patera')]");
         BasicTasks.Click("//td[@id='buttonleftchangeCostume']/input[@value='Tak']");
         return(true);
     }
     return(false);
 }
예제 #24
0
        public static void Wait_For_Exit()
        {
            if (Form1.turn_off && Properties.Settings.Default.main_bot)
            {
                Form1.currently_running = "Waiting for exit..";
                string[] processes = new string[7];
                processes[0] = "Gladiatus_1";
                processes[1] = "Gladiatus_25";
                processes[2] = "Gladiatus_34";
                processes[3] = "Gladiatus_36";
                processes[4] = "Gladiatus_37";
                processes[5] = "Gladiatus_38";
                processes[6] = "Gladiatus_39";

                bool found_process = false;
                do
                {
                    Thread.Sleep(60000);
                    found_process = false;
                    Process[] proceses = Process.GetProcesses();
                    foreach (Process proces in proceses)
                    {
                        for (int i = 0; i < processes.Length; i++)
                        {
                            if (proces.ProcessName == processes[i] && proces.ProcessName != Process.GetCurrentProcess().ProcessName)
                            {
                                found_process = true;
                                break;
                            }
                        }

                        if (found_process)
                        {
                            break;
                        }
                    }
                } while (found_process && Form1.turn_off);
            }
            BasicTasks.Exit(Form1.turn_off);
        }
예제 #25
0
 public static void Turma35()
 {
     Form1.currently_running = "Turma between servers..";
     if (Properties.Settings.Default.circusTurma35Checked)
     {
         BasicTasks.WaitForXPath("//div[@id='cooldown_bar_ct']/div[@class='cooldown_bar_text']");
         BasicTasks.Click("//div[@id='cooldown_bar_ct']");
         if (!BasicTasks.Search("//a[contains(@href,'serverArena&aType=3')][@class='awesome-tabs current']"))
         {
             BasicTasks.Click("//a[contains(@href,'serverArena&aType=3')]");
         }
         BasicTasks.Click("//div[@class='attack']");
         if (BasicTasks.Search("//div[@id='header_bod']"))
         {
             if (Form1.driver.FindElementByXPath("//div[@id='header_bod']").Displayed&&
                 Form1.driver.FindElementByXPath("//div[@id='header_bod']").Enabled)
             {
                 BasicTasks.Click("//input[@value='Jazda!']");
             }
         }
         for (int i = 0; i < 5; i++)
         {
             if (BasicTasks.Search("//div[@id='errorText']"))
             {
                 return;
             }
             if (!BasicTasks.Search("//body[@id='reportsPage']"))
             {
                 Thread.Sleep(1000);
             }
             else
             {
                 return;
             }
             Thread.Sleep(500);
         }
     }
 }
예제 #26
0
        public static void Search_Pack()
        {
            string file_path =
                @"C:\Users\danie\Documents\Visual Studio 2017\Resources\Gladiatus_bots\Items .txt files for Gladiatus_bot" + @"\items(" + Helpers.Switch_World() + ").txt";

            if (!Properties.Settings.Default.pakujChecked ||
                !File.Exists(file_path))
            {
                return;
            }

            IReadOnlyCollection <IWebElement> items;
            int lineCount = File.ReadLines(file_path).Count();

            if (lineCount == 0)
            {
                return;
            }
            string[] lines      = File.ReadAllLines(file_path);
            string[] names      = new string[lines.Length];
            string[] soulbounds = new string[lines.Length];
            string[] prices     = new string[lines.Length];
            string[] levels     = new string[lines.Length];
            string[] categories = new string[lines.Length];
            string[] qualities  = new string[lines.Length];
            string[] amounts    = new string[lines.Length];
            string[] solds      = new string[lines.Length];

            int    iterator = 0;
            string regex    = "\'(.*?)\'";

            for (int i = 0; i < lines.Length; i++)
            {
                string[] separated_line = lines[i].Split(' ');
                names[iterator]      = Regex.Match(separated_line[0], regex).Value;
                soulbounds[iterator] = Regex.Match(separated_line[1], regex).Value;
                prices[iterator]     = Regex.Match(separated_line[2], regex).Value;
                categories[iterator] = Regex.Match(separated_line[3], regex).Value;
                qualities[iterator]  = Regex.Match(separated_line[4], regex).Value;
                levels[iterator]     = Regex.Match(separated_line[5], regex).Value;
                amounts[iterator]    = Regex.Match(separated_line[6], regex).Value;
                solds[iterator]      = Regex.Match(separated_line[7], regex).Value;

                names[iterator]      = names[iterator].Replace("'", "");
                soulbounds[iterator] = soulbounds[iterator].Replace("'", "");
                prices[iterator]     = prices[iterator].Replace("'", "");
                categories[iterator] = categories[iterator].Replace("'", "");
                qualities[iterator]  = qualities[iterator].Replace("'", "");
                levels[iterator]     = levels[iterator].Replace("'", "");
                amounts[iterator]    = amounts[iterator].Replace("'", "");
                solds[iterator]      = solds[iterator].Replace("'", "");
                iterator++;
            }

            Navigation.Packages();
            Navigation.FreeBackpack();
            string path1          = "";
            string path2          = "";
            string found_sold     = "";
            bool   found          = false;
            bool   both_locations = false;
            bool   found_packages = false;
            string found_price    = "";
            string last_category  = "";
            string last_quality   = "";

            for (int i = 0; i < lines.Length; i++)
            {
                if (last_category != categories[i] || last_quality != qualities[i])
                {
                    BasicTasks.SelectElement("//select[@name='f']", Helpers.Type_Pack(categories[i]));
                    BasicTasks.SelectElement("//select[@name='fq']", Helpers.Quality_Pack(qualities[i]));
                    BasicTasks.Click("//input[@value='Filtr']");
                    last_category = categories[i];
                    last_quality  = qualities[i];
                }

                bool first_time = true;
                both_locations = false;
                while (!both_locations && !found)
                {
                    if (!first_time)
                    {
                        items          = Form1.driver.FindElementsByXPath("//div[@id='inv']//div[contains(@class,'ui-draggable')]");
                        both_locations = true;
                    }
                    else
                    {
                        items = Form1.driver.FindElementsByXPath("//div[@id='packages']//div[contains(@class,'ui-draggable')]");
                    }

                    bool packages = true;
                    while (packages)
                    {
                        packages = false;
                        if (first_time)
                        {
                            items = Form1.driver.FindElementsByXPath("//div[@id='packages']//div[contains(@class,'ui-draggable')]");
                        }

                        foreach (IWebElement item in items)
                        {
                            string name      = item.GetAttribute("class");
                            string level     = item.GetAttribute("data-level");
                            string soulbound = item.GetAttribute("data-soulbound-to");
                            string quality   = item.GetAttribute("data-quality");
                            string amount    = item.GetAttribute("data-amount");

                            bool   by_name      = false;
                            bool   by_level     = false;
                            bool   by_soulbound = false;
                            bool   by_quality   = false;
                            bool   by_amount    = false;
                            string result       = @"\s*\b" + names[i] + @"\s*\b";
                            if (Regex.Match(name, result).Success)
                            {
                                by_name = true;
                            }
                            if (levels[i] == level || levels[i] == "null")
                            {
                                by_level = true;
                            }
                            if (soulbounds[i] == soulbound || soulbounds[i] == "null")
                            {
                                by_soulbound = true;
                            }
                            if (qualities[i] == quality || qualities[i] == "null")
                            {
                                by_quality = true;
                            }
                            if (amounts[i] == amount || amounts[i] == "null")
                            {
                                by_amount = true;
                            }

                            bool sold = false;
                            if (solds[i] == "1")
                            {
                                sold = true;
                            }

                            if (by_name && by_level && by_soulbound && by_quality && by_quality && by_amount)
                            {
                                if (sold != BasicTasks.Check_sold(item))
                                {
                                    continue;
                                }
                                path1       = Prepare_XPath(true, names[i], soulbounds[i], levels[i], qualities[i], amounts[i]);
                                path2       = Prepare_XPath(false, names[i], soulbounds[i], levels[i], qualities[i], amounts[i]);
                                found       = true;
                                found_sold  = solds[i];
                                found_price = prices[i];
                                if (!both_locations)
                                {
                                    found_packages = true;
                                }
                                break;
                            }
                        }

                        if (first_time && BasicTasks.Search("//a[@class = 'paging_button paging_right_step']"))
                        {
                            BasicTasks.Click("//a[@class = 'paging_button paging_right_step']");
                            packages = true;
                            continue;
                        }
                        first_time = false;
                    }
                }

                if (found_packages)
                {
                    Take_From_Packages(path1, path2, found_sold);
                }

                bool success_market = false;
                while (!success_market && found)
                {
                    Navigation.Guild_Market();
                    Navigation.FreeBackpack();
                    if (!Sell_On_Market(path2, found_price))
                    {
                        Farming.Expedition(true);
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
예제 #27
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     BasicTasks.Exit(false);
 }
예제 #28
0
        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();
            }
        }
예제 #29
0
 public static void TakeGold()
 {
     Form1.currently_running = "Taking out gold..";
     Navigation.Packages();
     BasicTasks.SelectElement("//select[@name='f']", "Złoto");
     BasicTasks.Click("//input[@value='Filtr']");
     if (BasicTasks.Search("//a[@class='paging_button paging_right_full']"))
     {
         BasicTasks.Click("//a[@class='paging_button paging_right_full']");
     }
     if (!Properties.Settings.Default.gold_limit)
     {
         while (BasicTasks.Search("//div[@class='packageItem']//div[contains(@class,'ui-draggable')]") && Form1.takeGoldAction)
         {
             BasicTasks.MoveMoveElement("//div[@class='packageItem']//div[contains(@class,'ui-draggable')]", "//div[@id='inv']");
             if (BasicTasks.Search("//div[contains(@class,'ui-droppable')]"))
             {
                 BasicTasks.ReleaseElement("//div[contains(@class,'ui-droppable')]");
             }
             else
             {
                 return;
             }
         }
     }
     else
     {
         int needed_gold = Convert.ToInt32(Properties.Settings.Default.gold_level);
         while (Gold_Level() < needed_gold)
         {
             int         gold_before            = Gold_Level();
             IWebElement element                = Form1.driver.FindElementByXPath("//div[@class='packageItem']//div[contains(@class,'ui-draggable')]");
             string      current_element_string = element.GetAttribute("data-price-gold");
             int         current_element        = Convert.ToInt32(current_element_string);
             if (Gold_Level() + current_element < needed_gold)
             {
                 BasicTasks.MoveMoveElement("//div[@class='packageItem']//div[@data-price-gold='" + current_element_string + "']", "//div[@id='inv']");
                 if (BasicTasks.Search("//div[contains(@class,'ui-droppable')]"))
                 {
                     BasicTasks.ReleaseElement("//div[contains(@class,'ui-droppable')]");
                 }
                 else
                 {
                     continue;
                 }
             }
             else
             {
                 IReadOnlyCollection <IWebElement> list = Form1.driver.FindElementsByXPath("//div[@class='packageItem']//div[contains(@class,'ui-draggable')]");
                 string best_choose_string = list.ElementAt(0).GetAttribute("data-price-gold");
                 int    best_choose        = (Gold_Level() + Convert.ToInt32(list.ElementAt(0).GetAttribute("data-price-gold"))) - needed_gold;
                 int    position           = 0;
                 for (int i = 0; i < list.Count; i++)
                 {
                     int temporary = (Gold_Level() + Convert.ToInt32(list.ElementAt(i).GetAttribute("data-price-gold"))) - needed_gold;
                     if (temporary < best_choose)
                     {
                         best_choose        = temporary;
                         position           = i;
                         best_choose_string = list.ElementAt(i).GetAttribute("data-price-gold");
                     }
                 }
                 BasicTasks.MoveMoveElement("//div[@class='packageItem']//div[@data-price-gold='" + best_choose_string + "']", "//div[@id='inv']");
                 if (BasicTasks.Search("//div[contains(@class,'ui-droppable')]"))
                 {
                     BasicTasks.ReleaseElement("//div[contains(@class,'ui-droppable')]");
                 }
                 else
                 {
                     continue;
                 }
             }
             bool changed = false;
             for (int i = 0; i < 5; i++)
             {
                 if (Gold_Level() != gold_before)
                 {
                     Thread.Sleep(1000);
                     changed = true;
                 }
             }
             if (!changed)
             {
                 Form1.driver.Navigate().Refresh();
             }
         }
     }
 }
예제 #30
0
        public static int Get_Maximum_Gold_Avalibe()
        {
            if (!Properties.Settings.Default.pakujChecked)
            {
                return(100000000);
            }

            string file_path =
                @"C:\Users\danie\Documents\Visual Studio 2017\Resources\Gladiatus_bots\Items .txt files for Gladiatus_bot" + @"\items(" + Helpers.Switch_World() + ").txt";

            if (!File.Exists(file_path))
            {
                return(0);
            }
            int lineCount = File.ReadLines(file_path).Count();

            if (lineCount == 0)
            {
                return(0);
            }

            string[] lines      = File.ReadAllLines(file_path);
            string[] names      = new string[lines.Length];
            string[] soulbounds = new string[lines.Length];
            string[] prices     = new string[lines.Length];
            string[] levels     = new string[lines.Length];
            string[] categories = new string[lines.Length];
            string[] qualities  = new string[lines.Length];
            string[] amounts    = new string[lines.Length];
            string[] solds      = new string[lines.Length];

            int    iterator = 0;
            string regex    = "\'(.*?)\'";

            for (int i = 0; i < lines.Length; i++)
            {
                string[] separated_line = lines[i].Split(' ');
                names[iterator]      = Regex.Match(separated_line[0], regex).Value;
                soulbounds[iterator] = Regex.Match(separated_line[1], regex).Value;
                prices[iterator]     = Regex.Match(separated_line[2], regex).Value;
                categories[iterator] = Regex.Match(separated_line[3], regex).Value;
                qualities[iterator]  = Regex.Match(separated_line[4], regex).Value;
                levels[iterator]     = Regex.Match(separated_line[5], regex).Value;
                amounts[iterator]    = Regex.Match(separated_line[6], regex).Value;
                solds[iterator]      = Regex.Match(separated_line[7], regex).Value;

                names[iterator]      = names[iterator].Replace("'", "");
                soulbounds[iterator] = soulbounds[iterator].Replace("'", "");
                prices[iterator]     = prices[iterator].Replace("'", "");
                categories[iterator] = categories[iterator].Replace("'", "");
                qualities[iterator]  = qualities[iterator].Replace("'", "");
                levels[iterator]     = levels[iterator].Replace("'", "");
                amounts[iterator]    = amounts[iterator].Replace("'", "");
                solds[iterator]      = solds[iterator].Replace("'", "");
                iterator++;
            }

            int total_price = 0;

            Navigation.Guild_Market();
            if (!BasicTasks.Search("//input[@value='Kup']"))
            {
                return(0);
            }
            int first_iterator  = Form1.driver.FindElementsByXPath("//input[@value='Kup']").Count();
            int second_iterator = Form1.driver.FindElementsByXPath("//input[@value='Anuluj']").Count();

            iterator = first_iterator + second_iterator;

            for (int j = 0; j < lines.Length; j++)
            {
                bool   by_name         = false;
                bool   by_amount       = false;
                bool   by_soulbound    = false;
                bool   by_level        = false;
                bool   by_quality      = false;
                int    price_item_work = Convert.ToInt32(prices[j]);
                string name_item_work  = names[j];
                string soulbound_work  = soulbounds[j];
                string level_work      = levels[j];
                string item_quality    = qualities[j];
                string amount_work     = amounts[j];
                if (amount_work != "null")
                {
                    by_amount = true;
                }
                if (name_item_work != "null")
                {
                    by_name = true;
                }
                if (soulbound_work != "null")
                {
                    by_soulbound = true;
                }
                if (level_work != "null")
                {
                    by_level = true;
                }
                if (item_quality != "null")
                {
                    by_quality = true;
                }
                for (int i = 2; i <= iterator + 1; i++)
                {
                    if (BasicTasks.Search("//section[@id='market_table']//tr[position()='" + i + "']/td[@align='center']/input[@value='Kup']"))
                    {
                        IWebElement element           = Form1.driver.FindElementByXPath("//section[@id='market_table']//tr[position()='" + i + "']/td[@style]/div[@style]");
                        string      soulbound         = element.GetAttribute("data-soulbound-to");
                        string      name_item         = element.GetAttribute("class");
                        string      price_item_string = Form1.driver.FindElementByXPath
                                                            ("//section[@id='market_table']//tr[position()='" + i + "']/td[position()='3']").GetAttribute("textContent");
                        string level         = element.GetAttribute("data-level");
                        string quality_level = element.GetAttribute("data-quality");
                        string amount_loop   = element.GetAttribute("data-amount");

                        int price_item = Convert.ToInt32(new String(price_item_string.Where(Char.IsDigit).ToArray()));

                        if (price_item_work == price_item)
                        {
                            if (by_name && name_item != name_item_work ||
                                by_soulbound && soulbound != soulbound_work ||
                                by_level && level != level_work || by_quality && quality_level != item_quality || by_amount && amount_loop != amount_work)
                            {
                                continue;
                            }

                            total_price = total_price + price_item_work;
                            break;
                        }
                    }
                }
            }
            return(total_price);
        }