IsKanaisCube_MainPage_Visible() публичный статический Метод

public static IsKanaisCube_MainPage_Visible ( ) : bool
Результат bool
Пример #1
0
        public static bool ClickOnCube(ActorCommonData inputCubeStand)
        {
            bool FoundCube   = false;
            int  LoopCounter = 0;

            // Attempt to click on Cube, wait 2 sec (10x200ms)
            while (!FoundCube && LoopCounter <= 10)
            {
                float RX_Cube, RY_Cube;

                LoopCounter += 1;

                // Try to find where the cube is?
                A_Tools.T_World.ToScreenCoordinate(inputCubeStand.x0D0_WorldPosX, inputCubeStand.x0D4_WorldPosY, inputCubeStand.x0D8_WorldPosZ, out RX_Cube, out RY_Cube);

                // If vendor page or kanai page is not already visible, click it
                bool IsVendorPageVisible        = Tools.IsVendorPage_Visible();
                bool IsKanaiCubeMainPageVisible = Tools.IsKanaisCube_MainPage_Visible();

                if (!IsVendorPageVisible)
                {
                    // Move mouse cursor to the cube location coord and click it
                    A_Tools.InputSimulator.IS_Mouse.MoveCursor((uint)RX_Cube, (uint)RY_Cube);
                    A_Tools.InputSimulator.IS_Mouse.LeftClick();

                    Thread.Sleep(200);
                }

                if (IsVendorPageVisible && IsKanaiCubeMainPageVisible)
                {
                    FoundCube = true;
                }
            }
            return(FoundCube);
        }
Пример #2
0
        public static void DoUpgrade()
        {
            try
            {
                IsUpgrading_Rare = true;
                ActorCommonData CubeStand;

                bool CubeNearby      = Tools.IsCubeNearby(out CubeStand);
                var  UpgradableItems = Tools.Get_Items("rare");

                int Count_AvailableEnchants = (int)Tools.Get_AvailableEnchants_UpgradeRare();

                if (CubeNearby & UpgradableItems.Count > 0 & Count_AvailableEnchants > 0)
                {
                    if (Tools.ClickOnCube(CubeStand))
                    {
                        Stopwatch s1 = new Stopwatch(); /////////
                        s1.Start();                     ///////////
                        int Count_Enchants = 0;

                        //receipe button
                        A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Recipe_Button);
                        Thread.Sleep(5);
                        //press next button 2x for upgrade rare menu
                        A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Next);
                        Thread.Sleep(5);
                        A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Next);
                        Thread.Sleep(5);
                        int numberOfItemsBeforeTrying = UpgradableItems.Count;
                        //var a = UpgradableItems.Where(a => a.);

                        foreach (var item in UpgradableItems)
                        {
                            if (StopConversion)
                            {
                                break;
                            }
                            if (Count_Enchants == Count_AvailableEnchants)
                            {
                                break;
                            }
                            Count_Enchants++;
                            if (Tools.ClickOnCube(CubeStand))
                            {
                                //put item in cube
                                UIRect UIRect_item =
                                    A_Collection.D3UI.InventoryItemUIRectMesh.FirstOrDefault(
                                        x => x.Key.ItemSlotX == item.x118_ItemSlotX && x.Key.ItemSlotY == item.x11C_ItemSlotY).Value;

                                A_Tools.T_D3UI.UIElement.rightClick(UIRect_item);
                                //fill
                                A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Fill_Button);
                                //transmute
                                A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Transmute_Button);
                                Thread.Sleep(Properties.Settings.Default.SleepTransmute);
                                //click next and back to reset
                                A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Next);
                                A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Previous);
                            }
                        }
                        //close all windows
                        int close_timeout = 5;
                        while (Tools.IsKanaisCube_MainPage_Visible())
                        {
                            //A_Tools.InputSimulator.IS_Keyboard.Close_AllWindows(); //doesnt work if not assigned :D
                            //Press "X" - Button in Kanais Cube
                            A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Exit_Button);

                            close_timeout--;
                            if (close_timeout == 0)
                            {
                                break;
                            }
                            Thread.Sleep(200);
                        }
                        s1.Stop();                          /////////
                        TimeSpan t1 = s1.Elapsed;           //////
                        Console.WriteLine(t1.TotalSeconds); ////////
                    }
                }
                if (Properties.Settings.Default.RosBotUpgradeKadalaBool)
                {
                    WindowsInput.InputSimulator.SimulateKeyPress(WindowsInput.VirtualKeyCode.F6);
                }
                IsUpgrading_Rare = false;
            }
            catch (Exception)
            {
                IsUpgrading_Rare = false;
            }
        }
Пример #3
0
        public static void DoUpgrade()
        {
            try
            {
                IsUpgrading_Rare = true;

                ActorCommonData CubeStand;

                bool CubeNearby = Tools.IsCubeNearby(out CubeStand);

                if (CubeNearby)
                {
                    while (true)
                    {
                        float RX_Cube, RY_Cube;

                        A_Tools.T_World.ToScreenCoordinate(CubeStand.x0D0_WorldPosX, CubeStand.x0D4_WorldPosY, CubeStand.x0D8_WorldPosZ, out RX_Cube, out RY_Cube);


                        if (Tools.IsVendorPage_Visible() && Tools.IsKanaisCube_MainPage_Visible())
                        {
                            break;
                        }

                        A_Tools.InputSimulator.IS_Mouse.MoveCursor((uint)RX_Cube, (uint)RY_Cube);
                        A_Tools.InputSimulator.IS_Mouse.LeftClick();

                        Thread.Sleep(100);
                    }

                    Stopwatch s1 = new Stopwatch(); /////////
                    s1.Start();                     ///////////

                    var UpgradableItems = Tools.Get_RareUpgradableItems();
                    List <ActorCommonData> Materials;
                    var Count_AvailableEnchants = Tools.Get_AvailableEnchants_UpgradeRare(out Materials);

                    var Count_Enchants = 0;

                    foreach (var item in UpgradableItems)
                    {
                        if (Count_Enchants == Count_AvailableEnchants)
                        {
                            break;
                        }

                        while (true)
                        {
                            float RX_Cube, RY_Cube;

                            A_Tools.T_World.ToScreenCoordinate(CubeStand.x0D0_WorldPosX, CubeStand.x0D4_WorldPosY, CubeStand.x0D8_WorldPosZ, out RX_Cube, out RY_Cube);


                            if (Tools.IsVendorPage_Visible() && Tools.IsKanaisCube_MainPage_Visible())
                            {
                                break;
                            }

                            A_Tools.InputSimulator.IS_Mouse.MoveCursor((uint)RX_Cube, (uint)RY_Cube);
                            A_Tools.InputSimulator.IS_Mouse.LeftClick();

                            Thread.Sleep(100);
                        }

                        UIRect UIRect_item =
                            A_Collection.D3UI.InventoryItemUIRectMesh.FirstOrDefault(
                                x => x.Key.ItemSlotX == item.x118_ItemSlotX && x.Key.ItemSlotY == item.x11C_ItemSlotY)
                            .Value;

                        A_Tools.InputSimulator.IS_Mouse.RightCLick((int)UIRect_item.Left, (int)UIRect_item.Top, (int)UIRect_item.Right, (int)UIRect_item.Bottom);
                        Thread.Sleep(100);

                        foreach (var material in Materials)
                        {
                            UIRect UIRect_material =
                                A_Collection.D3UI.InventoryItemUIRectMesh.FirstOrDefault(
                                    x => x.Key.ItemSlotX == material.x118_ItemSlotX && x.Key.ItemSlotY == material.x11C_ItemSlotY)
                                .Value;

                            A_Tools.InputSimulator.IS_Mouse.RightCLick((int)UIRect_material.Left, (int)UIRect_material.Top, (int)UIRect_material.Right, (int)UIRect_material.Bottom);
                            Thread.Sleep(100);
                        }

                        UIRect Transmute = A_Tools.T_D3UI.UIElement.getRect(BTN_Transmute);

                        A_Tools.InputSimulator.IS_Mouse.LeftClick((int)Transmute.Left, (int)Transmute.Top, (int)Transmute.Right, (int)Transmute.Bottom);
                        Thread.Sleep(100);

                        while (Tools.IsVendorPage_Visible())
                        {
                            A_Tools.InputSimulator.IS_Keyboard.Close_AllWindows();
                        }

                        Count_Enchants++;
                    }

                    s1.Stop();                          /////////
                    TimeSpan t1 = s1.Elapsed;           //////
                    Console.WriteLine(t1.TotalSeconds); ////////
                }

                IsUpgrading_Rare = false;
            }
            catch (Exception)
            {
                IsUpgrading_Rare = false;
            }
        }
        public static void DoConvert(string FromMaterialQuality, string ToMaterialQuality)
        {
            // check input
            if ((FromMaterialQuality == "normal" || FromMaterialQuality == "magic" || FromMaterialQuality == "rare") &&
                (ToMaterialQuality == "normal" || ToMaterialQuality == "magic" || ToMaterialQuality == "rare"))
            {
                try
                {
                    IsConvertingMaterial = true;
                    ActorCommonData CubeStand;
                    bool            CubeNearby = Tools.IsCubeNearby(out CubeStand);
                    // Get list of equipment of the specified quality
                    var ToItemList = Tools.Get_Items(ToMaterialQuality);

                    int Count_AvailableConversions = (int)Tools.Get_AvailableMaterial_Convert(FromMaterialQuality);

                    if (CubeNearby & ToItemList.Count > 0 & Count_AvailableConversions > 0)
                    {
                        if (Tools.ClickOnCube(CubeStand))
                        {
                            Stopwatch s1 = new Stopwatch(); /////////
                            s1.Start();                     ///////////
                            int Count_Conversions = 0;

                            // Get list of Materials to convert from
                            //receipe button
                            A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Recipe_Button);

                            //press next button 2x for upgrade rare menu - white (6) -blue (7) - yellow (8) [from]
                            var nextClicks = 0;
                            switch (FromMaterialQuality)
                            {
                            case "normal":
                                nextClicks = 6;
                                break;

                            case "magic":
                                nextClicks = 7;
                                break;

                            case "rare":
                                nextClicks = 8;
                                break;
                            }
                            while (nextClicks > 0)
                            {
                                A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Next);
                                Thread.Sleep(120);
                                nextClicks--;
                            }

                            int numberOfItemsBeforeTrying = ToItemList.Count;
                            foreach (var item in ToItemList)
                            {
                                if (StopConversion)
                                {
                                    break;
                                }
                                if (Count_Conversions == Count_AvailableConversions)
                                {
                                    break;
                                }
                                Count_Conversions++;
                                if (Tools.ClickOnCube(CubeStand))
                                {
                                    // Find the item position and rightclick on the item
                                    UIRect UIRect_item = A_Collection.D3UI.InventoryItemUIRectMesh.FirstOrDefault(x => x.Key.ItemSlotX == item.x118_ItemSlotX && x.Key.ItemSlotY == item.x11C_ItemSlotY).Value;
                                    A_Tools.InputSimulator.IS_Mouse.RightCLick((int)UIRect_item.Left, (int)UIRect_item.Top, (int)UIRect_item.Right, (int)UIRect_item.Bottom);
                                    //fill
                                    A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Fill_Button);
                                    //transmute
                                    A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Transmute_Button);
                                    Thread.Sleep(Properties.Settings.Default.SleepTransmute);
                                    //click next and back to reset
                                    A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Next);
                                    A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Page_Previous);
                                }
                            }
                            // Close Cube window after transmute
                            int close_timeout = 5;
                            while (Tools.IsKanaisCube_MainPage_Visible())
                            {
                                //A_Tools.InputSimulator.IS_Keyboard.Close_AllWindows(); //doesnt work if not assigned :D
                                //Press "X" - Button in Kanais Cube
                                A_Tools.T_D3UI.UIElement.leftClick(UIElements.Kanai_Cube_Exit_Button);

                                close_timeout--;
                                if (close_timeout == 0)
                                {
                                    break;
                                }
                                Thread.Sleep(200);
                            }
                            s1.Stop();                          /////////
                            TimeSpan t1 = s1.Elapsed;           //////
                            Console.WriteLine(t1.TotalSeconds); ////////
                        }
                    }

                    IsConvertingMaterial = false;
                }
                catch (Exception)
                {
                    IsConvertingMaterial = false;
                }
            }
        } //end method doconvert