Example #1
0
        private static void btnClick_ScanUIElement(object sender, RoutedEventArgs routedEventArgs)
        {
            try
            {
                //[1E8E8E20] Last clicked: 0x80E63C97B008F590, Name: Root.NormalLayer.vendor_dialog_mainPage.training_dialog
                //[1E94FCC0] Mouseover: 0x244BD04C84DF92F1, Name: Root.NormalLayer.vendor_dialog_mainPage

                using (new MemoryHelper())
                {
                    UIElement.FromHash(0x244BD04C84DF92F1).FindDecedentsWithText("jeweler");
                }
            }
            catch (Exception ex)
            {
                Logger.LogError("Error btnClick_ScanUIElement:" + ex);
            }
        }
        private async Task <bool> MainCoroutine()
        {
            if (ZetaDia.IsLoadingWorld || !ZetaDia.IsInTown)
            {
                Logger.Verbose("We're not in town!");
                _isDone = true;
                return(false);
            }

            if (ZetaDia.Me.IsParticipatingInTieredLootRun)
            {
                Logger.Debug("Already in Greater Rift!");
                _isDone = true;
                return(false);
            }

            CheckForRiftPortal();

            //[22559C94] GizmoType: LootRunSwitch Name: x1_OpenWorld_LootRunObelisk_B-91 ActorSNO: 364715 Distance: 4.497307 Position: <359.9, 262.766, -0.0996094> Barracade: False Radius: 9.874258

            var       destination = Vector3.Zero;
            DiaObject actor;

            switch (ZetaDia.CurrentAct)
            {
            case Act.A3:
            case Act.A4:
                destination = new Vector3(463.4105f, 387.2089f, 0.4986931f);
                break;

            case Act.A5:
                destination = new Vector3(602.5745f, 751.5975f, 2.620764f);
                break;

            case Act.A1:
                destination = new Vector3(372.5257f, 591.0864f, 24.04533f);
                break;

            case Act.A2:
                destination = new Vector3(353.7471f, 262.6955f, -0.3242264f);
                break;

            default:

                actor = GetObeliskActor();
                if (actor != null)
                {
                    destination = actor.Position;
                }
                else
                {
                    Logger.Error("Unable to find Rift Obelisk");
                    return(false);
                }
                break;
            }

            if (ZetaDia.Me.Position.Distance(destination) > 15f)
            {
                Logger.Verbose("Starting movement to Rift Obelisk");

                while (ZetaDia.Me.Position.Distance(destination) > 15f)
                {
                    await CommonCoroutines.MoveAndStop(destination, 15f);

                    await Coroutine.Yield();
                }

                Logger.Verbose("Finished movement to Rift Obelisk");
            }

            actor = GetObeliskActor();

            if (actor == null || !actor.IsValid)
            {
                Logger.Error("Unable to find Rift Obelisk");
                return(false);
            }

            bool readyToStart = false;

            for (int j = 0; j < 10; j++)
            {
                if (UIElement.FromHash(0x3182F223039F15F0).IsVisible)
                {
                    readyToStart = true;
                    break;
                }
                Logger.Verbose("Interacting with rift obelisk");
                actor.Interact();
                await Coroutine.Sleep(500);
            }

            if (readyToStart)
            {
                ZetaDia.Me.OpenRift(_level);
                await Coroutine.Sleep(1000);
            }


            return(false);
        }