コード例 #1
0
        private async Task <bool> Interact(DiaObject actor)
        {
            //var world = ZetaDia.Globals.WorldId;
            //bool retVal = false;
            //switch (actor.ActorType)
            //{
            //    case ActorType.Gizmo:
            //        switch (actor.ActorInfo.GizmoType)
            //        {
            //            case GizmoType.BossPortal:
            //            case GizmoType.Portal:
            //            case GizmoType.ReturnPortal:
            //                retVal = ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position);
            //                break;
            //            default:
            //                retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position);
            //                break;
            //        }
            //        break;
            //    case ActorType.Monster:
            //        retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position);
            //        break;
            //}

            //if (!ZetaDia.Globals.IsLoadingWorld && world == ZetaDia.Globals.WorldId)
            //{
            //Core.Logger.Debug($"Fallback Interaction Used");
            //actor.Interact();
            //}


            var world = ZetaDia.Globals.WorldId;
            await Coroutine.Sleep(100);

            if (actor == null || !actor.IsFullyValid())
            {
                return(false);
            }

            var ret = actor.Interact();
            await Coroutine.Sleep(_sleepTime);

            if (_isPortal)
            {
                await Coroutine.Sleep(1000);
            }
            if (!ZetaDia.Globals.IsLoadingWorld && world == ZetaDia.Globals.WorldId)
            {
                await Coroutine.Sleep(400);

                if (actor.IsFullyValid())
                {
                    ret = actor.Interact();
                }
            }
            return(ret);
        }
コード例 #2
0
        private static async Task <bool> Interact(DiaObject actor)
        {
            bool retVal = false;

            switch (actor.ActorType)
            {
            case ActorType.Gizmo:
                switch (actor.ActorInfo.GizmoType)
                {
                case GizmoType.BossPortal:
                case GizmoType.Portal:
                case GizmoType.ReturnPortal:
                    retVal = ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position);
                    break;

                default:
                    retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position);
                    break;
                }
                break;

            case ActorType.Monster:
                retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position);
                break;
            }

            // Doubly-make sure we interact
            actor.Interact();
            await Coroutine.Sleep(100);

            return(retVal);
        }
コード例 #3
0
        public static async Task <bool> MoveToAndInteract(DiaObject obj, float range = -1f)
        {
            if (obj == null)
            {
                return(false);
            }
            if (!obj.IsFullyValid())
            {
                return(false);
            }
            if (range == -1f)
            {
                range = obj.CollisionSphere.Radius;
            }

            if (obj.Position.Distance2D(ZetaDia.Me.Position) > range)
            {
                await MoveTo(obj.Position, obj.Name);
            }

            if (obj.Position.Distance2D(ZetaDia.Me.Position) < range)
            {
                obj.Interact();
            }

            return(true);
        }
コード例 #4
0
        private async Task <bool> Interact(DiaObject actor)
        {
            Logger.Debug("[Interaction] Attempting to interact with {0} at distance {1}", ((SNOActor)actor.ActorSnoId).ToString(), actor.Distance);
            bool retVal = false;

            switch (actor.ActorType)
            {
            case ActorType.Gizmo:
                switch (actor.ActorInfo.GizmoType)
                {
                case GizmoType.BossPortal:
                case GizmoType.Portal:
                case GizmoType.ReturnPortal:
                    retVal = ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position);
                    break;

                default:
                    retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position);
                    break;
                }
                break;

            case ActorType.Monster:
                retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position);
                break;
            }

            // Doubly-make sure we interact
            actor.Interact();
            await Coroutine.Sleep(_sleepTime);

            return(retVal);
        }
コード例 #5
0
        /// <summary>
        /// Moves to something and interacts with it
        /// </summary>
        /// <param name="obj">object to interact with</param>
        /// <param name="range">how close to get</param>
        /// <param name="interactLimit">maximum number of times to interact</param>
        public static async Task<bool> Execute(DiaObject obj, float range = -1f, int interactLimit = 5)
        {
            if (obj == null)
                return false;

            if (!obj.IsFullyValid())
                return false;

            if (interactLimit < 1) interactLimit = 5;
            if (range < 0) range = obj.CollisionSphere.Radius;

            if (obj.Position.Distance(ZetaDia.Me.Position) > range)
            {
                if (!await MoveTo.Execute(obj.Position, obj.Name))
                {
                    Logger.Log("MoveTo Failed for {0} ({1}) Distance={2}", obj.Name, obj.ActorSNO, obj.Distance);
                    return false;
                }                    
            }

            var distance = obj.Position.Distance(ZetaDia.Me.Position);
            if (distance <= range || distance - obj.CollisionSphere.Radius <= range)
            {
                for (int i = 1; i <= interactLimit; i++)
                {
                    Logger.LogVerbose("Interacting with {0} ({1}) Attempt={2}", obj.Name, obj.ActorSNO, i);
                    if (obj.Interact() && i > 1)
                        break;

                    await Coroutine.Sleep(500);
                    await Coroutine.Yield();
                }
            }

            // Better to be redundant than failing to interact.

            Navigator.PlayerMover.MoveTowards(obj.Position);
            await Coroutine.Sleep(500);
            obj.Interact();

            Navigator.PlayerMover.MoveStop();
            await Coroutine.Sleep(1000);
            await Interact(obj);
            return true;
        }
コード例 #6
0
        private async Task <bool> Interact(DiaObject actor)
        {
            Core.PlayerMover.MoveTowards(actor.Position);

            Core.Logger.Debug($"[UsePortal] Attempting to use portal {((SNOActor)actor.ActorSnoId)} at distance {actor.Distance}");
            StatusText = $"[UsePortal] Attempting to use portal {((SNOActor)actor.ActorSnoId)} at distance {actor.Distance}";
            bool retVal = false;

            switch (actor.ActorType)
            {
            case ActorType.Gizmo:
                switch (actor.ActorInfo.GizmoType)
                {
                case GizmoType.BossPortal:
                case GizmoType.Portal:
                case GizmoType.ReturnPortal:
                    retVal = ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position);
                    break;

                default:
                    retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position);
                    break;
                }
                break;

            case ActorType.Monster:
                retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position);
                break;
            }

            // Doubly-make sure we interact
            actor.Interact();
            actor.Interact();

            _interactAttempts++;
            //GameEvents.FireWorldTransferStart();
            await Coroutine.Sleep(_sleepTime);

            return(retVal);
        }
コード例 #7
0
        private static async Task <bool> Interact(DiaObject actor)
        {
            if (!actor.IsFullyValid())
            {
                return(false);
            }

            // Doubly-make sure we interact
            var retVal = actor.Interact();
            await Coroutine.Yield();

            return(retVal);
        }
コード例 #8
0
ファイル: SellRepair.cs プロジェクト: adverserandomx/dbsark
        public bool Interact(string name)
        {
            DiaObject unit = ZetaDia.Actors.GetActorsOfType <DiaObject>(true, false).FirstOrDefault(u => u.Name.Contains(name));

            if (unit.Name.Contains(name))
            {
                return(unit.Interact());
            }
            else
            {
                return(false);
            }
        }
コード例 #9
0
        /// <summary>
        /// Perform interaction on the given Actor
        /// </summary>
        /// <returns></returns>
        private double DoInteract()
        {
            actor.Interact();

            System.Threading.Thread.Sleep(1000);

            if (startInteractPosition == Vector3.Zero)
            {
                startInteractPosition = ZetaDia.Me.Position;
            }


            completedInteractions++;
            lastInteract = DateTime.Now;

            double lastInteractDuration = Math.Abs(DateTime.Now.Subtract(lastInteract).TotalSeconds);

            if (QuestTools.EnableDebugLogging)
            {
                Logging.WriteDiagnostic("[MoveToActor] Interacting with Object: {0} {1} attempt: {2}, lastInteractDuration: {3:0}",
                                        actor.ActorSNO, status(), completedInteractions, lastInteractDuration);
            }
            return(lastInteractDuration);
        }
コード例 #10
0
        public static async Task<bool> MoveToAndInteract(DiaObject obj, float range = -1f)
        {
            if (obj == null)
                return false;
            if (!obj.IsFullyValid())
                return false;
            if (range == -1f)
                range = obj.CollisionSphere.Radius;

            if (obj.Position.Distance2D(ZetaDia.Me.Position) > range)
                await MoveTo(obj.Position, obj.Name);

            if (obj.Position.Distance2D(ZetaDia.Me.Position) < range)
                obj.Interact();

            return true;
        }
コード例 #11
0
        public GreedState FoundPortal()
        {
            if (ProfileManager.CurrentProfile.Path != _GreedProfile && ProfileManager.CurrentProfile.Path != _GreedProfileBackUp)
            {
                Logger.Log("Loading Greed Profile - " + DateTime.Now.ToString());

                _currentProfile = ProfileManager.CurrentProfile;

                LoadProfile(_GreedProfile, true, 1);

                if (ProfileManager.CurrentProfile.Path != _GreedProfile)
                {
                    LoadProfile(_GreedProfileBackUp, true, 1);
                }
            }

            if (ZetaDia.CurrentWorldId != 379962 && ZetaDia.CurrentWorldId != 380753)
            {
                DiaObject portalObject = ZetaDia.Actors.RActorList.OfType <DiaObject>().FirstOrDefault(r => r.ActorSNO == _GreedPortalSNO);

                if (portalObject != null && !ZetaDia.Me.IsInCombat)
                {
                    Logger.Log("Moving to portal - Distance " + (int)ZetaDia.Me.Position.Distance2D(portalObject.Position) + " feet away");
                    Navigator.MoveTo(portalObject.Position);

                    PauseBot(0, 300);

                    portalObject.Interact();

                    PauseBot(0, 300);
                }
            }
            else
            {
                return(GreedState.InsidePortal);
            }

            return(ConfirmWorld());
        }
コード例 #12
0
ファイル: MoveToMapMarker.cs プロジェクト: shmilyzxt/MyBuddy
 private Decorator UseActorIfInRange()
 {
     return // use the actor if defined and within range
            (new Wait(2, ret => actor.Position.Distance(ZetaDia.Me.Position) <= InteractRange && InteractAttempts > -1 && (completedInteractAttempts < InteractAttempts || IsPortal),
                      new Sequence(
                          new Action(ret => lastPosition = ZetaDia.Me.Position),
                          new PrioritySelector(
                              new Decorator(ret => actor is DiaGizmo,
                                            new Action(ret => ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position, actor.WorldDynamicId, actor.ACDGuid))
                                            ),
                              new Decorator(ret => actor is DiaUnit,
                                            new Action(ret => ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position, actor.WorldDynamicId, actor.ACDGuid))
                                            ),
                              new Action(ret => actor.Interact())
                              ),
                          new Action(ret => completedInteractAttempts++),
                          new DecoratorContinue(ret => QuestTools.EnableDebugLogging,
                                                new Action(ret => Logging.WriteDiagnostic("Interacting with portal object {0}, result: {1}", actor.ActorSNO, status()))
                                                ),
                          new Sleep(500),
                          new Action(ret => GameEvents.FireWorldTransferStart())
                          )
                      ));
 }
コード例 #13
0
        private async Task <bool> InteractRoutine()
        {
            if (Player.IsValid && Actor != null && Actor.IsValid)
            {
                if (TargetIsDungeonStone && (GameUI.IsElementVisible(GameUI.GenericOK) || GameUI.IsElementVisible(UIElements.ConfirmationDialogOkButton)))
                {
                    GameUI.SafeClickElement(GameUI.GenericOK, "Generic OK");
                    await Coroutine.Yield();

                    GameUI.SafeClickElement(UIElements.ConfirmationDialogOkButton);
                    await Coroutine.Yield();

                    await Coroutine.Sleep(3000);

                    return(true);
                }


                if (_startingWorldId <= 0)
                {
                    _startingWorldId = ZetaDia.CurrentWorldId;
                }

                _interactWaitMilliSeconds = TargetIsDungeonStone ? 4000 : 250;
                LogInteraction();

                if (IsPortal)
                {
                    GameEvents.FireWorldTransferStart();
                }

                if (IsChanneling)
                {
                    await Coroutine.Wait(TimeSpan.FromSeconds(3), () => IsChanneling);
                }

                switch (Actor.ActorType)
                {
                case ActorType.Gizmo:
                    switch (Actor.ActorInfo.GizmoType)
                    {
                    case GizmoType.BossPortal:
                    case GizmoType.Portal:
                    case GizmoType.ReturnPortal:
                        ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, Actor.Position);
                        break;

                    default:
                        ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, Actor.Position);
                        break;
                    }
                    break;

                case ActorType.Monster:
                    ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, Actor.Position);
                    break;
                }

                // Doubly-make sure we interact
                Actor.Interact();

                GameUI.SafeClickElement(GameUI.GenericOK, "Generic OK");
                GameUI.SafeClickElement(UIElements.ConfirmationDialogOkButton, "Confirmation Dialog OK Button");

                if (_startInteractPosition == Vector3.Zero)
                {
                    _startInteractPosition = ZetaDia.Me.Position;
                }

                _lastPosition = ZetaDia.Me.Position;
                _completedInteractions++;
                _lastInteract = DateTime.UtcNow;
                if (TargetIsDungeonStone || IsPortal)
                {
                    await Coroutine.Sleep(250);
                }

                return(true);
            }
            return(false);
        }
コード例 #14
0
        protected async Task <bool> MoveToObjectiveRoutine()
        {
            if (ZetaDia.Me.IsDead || ZetaDia.IsLoadingWorld)
            {
                Logger.Log("IsDead={0} IsLoadingWorld={1}", ZetaDia.Me.IsDead, ZetaDia.IsLoadingWorld);
                return(false);
            }

            SceneSegmentation.Update();

            if (_route.Any() || _currentRouteDestination != Vector3.Zero)
            {
                return(MoveAlongRoute(_route));
            }

            // If the bot has failed to run directly towards the objective marker too many times
            // We'll blacklist it for 30 seconds to allow adjacent scenes to be explored.
            if (FailedAttempts >= FailedAttemptMax)
            {
                Logger.Log("Blacklisting Objective Marker for 60 seconds");
                BlacklistMarkerExpires = DateTime.UtcNow.AddSeconds(60);
                FailedAttempts         = 0;
                _route = CreateRouteToUnexploredScene();
                return(false);
            }

            // While the bot is currently blacklisted from directly running at the objective
            // Generate a route to go through some nearby scenes
            if (DateTime.UtcNow < BlacklistMarkerExpires)
            {
                _route = CreateRouteToObjective();
                return(false);
            }

            // 'ReachedDestination' is returned when finding a path to destination has failed.
            if (_lastMoveResult == MoveResult.ReachedDestination && _objectiveObject == null)
            {
                if (_miniMapMarker != null && _miniMapMarker.IsValid && _miniMapMarker.IsPointOfInterest)
                {
                    var distance = ZetaDia.Me.Position.Distance(_miniMapMarker.Position);
                    if (distance > 100)
                    {
                        FailedAttempts++;
                        Logger.Log("Direct Pathfinding failed towards Objective Marker. Attempts={0}/{1}", FailedAttempts, FailedAttemptMax);
                    }
                    else if (distance < 30)
                    {
                        Logger.Log("ReachedDestination no Objective found - finished!");
                        _isDone = true;
                        return(true);
                    }
                }
            }

            // Find the objective minimap marker
            FindObjectiveMarker();

            // If the marker is found or was previously found, find a nearby actor
            if (_mapMarkerLastPosition != Vector3.Zero)
            {
                RefreshActorInfo();
            }

            if (_objectiveObject == null && _miniMapMarker == null && Position == Vector3.Zero)
            {
                Logger.Log("Error: Could not find Objective Marker! {0}", Status());
                _isDone = true;
                return(true);
            }

            // Finish if World Changed
            if (ZetaDia.CurrentWorldId != _startWorldId)
            {
                Logger.Log("World changed from {0} to {1}, finished {2}", _startWorldId, ZetaDia.CurrentWorldId, Status());
                _isDone = true;
                return(true);
            }

            // Finish because Objective Found
            if (IsValidObjective() && _objectiveObject is DiaUnit && _objectiveObject.Position.Distance(ZetaDia.Me.Position) <= PathPrecision)
            {
                Logger.Log("We found the objective and its a monster, ending tag so we can kill it. {0}", Status());
                _isDone = true;
                return(true);
            }

            // Objective Object is available
            if (_objectiveObject != null && _objectiveObject.IsFullyValid())
            {
                // Move Closer to Objective Object
                if (_lastMoveResult != MoveResult.ReachedDestination)
                {
                    Logger.Debug("Moving to actor {0} {1}", _objectiveObject.ActorSNO, Status());
                    _lastMoveResult = await CommonCoroutines.MoveTo(_objectiveObject.Position);

                    return(true);
                }

                if (_objectiveObject is GizmoPortal)
                {
                    if (_lastMoveResult == MoveResult.ReachedDestination && _objectiveObject.Distance > InteractRange)
                    {
                        Logger.Log("ReachedDestination but not within InteractRange, finished");
                        _isDone = true;
                        return(true);
                    }
                    if (GameUI.PartyLeaderBossAccept.IsVisible || GameUI.PartyFollowerBossAccept.IsVisible)
                    {
                        Logger.Debug("Party Boss Button visible");
                        return(true);
                    }
                    if (ZetaDia.Me.Movement.IsMoving)
                    {
                        await CommonBehaviors.MoveStop().ExecuteCoroutine();
                    }
                    _objectiveObject.Interact();
                    _completedInteractAttempts++;
                    Logger.Debug("Interacting with portal object {0}, result: {1}", _objectiveObject.ActorSNO, Status());
                    await Coroutine.Sleep(500);

                    GameEvents.FireWorldTransferStart();
                    return(true);
                }
            }

            if (_miniMapMarker != null && ObjectiveObjectIsNullOrInvalid())
            {
                if (_miniMapMarker != null && _miniMapMarker.Position.Distance(ZetaDia.Me.Position) > PathPrecision)
                {
                    Logger.Debug("Moving to Objective Marker {0}, {1}", _miniMapMarker.NameHash, Status());
                    _lastMoveResult = await CommonCoroutines.MoveTo(_miniMapMarker.Position);

                    return(true);
                }

                if (_miniMapMarker != null && _miniMapMarker.Position.Distance(ZetaDia.Me.Position) < PathPrecision)
                {
                    Logger.Debug("Successfully Moved to Objective Marker {0}, {1}", _miniMapMarker.NameHash, Status());
                    _isDone = true;
                    return(true);
                }
            }
            if (_miniMapMarker == null && Position != Vector3.Zero && Position.Distance(ZetaDia.Me.Position) > PathPrecision)
            {
                _lastMoveResult = CommonCoroutines.MoveTo(Position).Result;
                if (_lastMoveResult == MoveResult.ReachedDestination)
                {
                    Logger.Log("ReachedDestination of Position, minimap marker not found, finished.");
                    _isDone = true;
                    return(true);
                }
            }

            Logger.Error("MoveToObjective Error: marker={0} actorNull={1} actorValid={2} completedInteracts={3} isPortal={4} dist={5} interactRange={6}",
                         _miniMapMarker != null,
                         _objectiveObject != null,
                         (_objectiveObject != null && _objectiveObject.IsFullyValid()),
                         _completedInteractAttempts,
                         IsPortal,
                         (_objectiveObject != null && _objectiveObject.IsFullyValid() ? _objectiveObject.Position.Distance(ZetaDia.Me.Position) : 0f),
                         InteractRange);

            return(false);
        }
コード例 #15
0
 private Composite InteractSequence()
 {
     return
         (new Decorator(ret => Player.IsPlayerValid() && actor.IsValid,
                        new PrioritySelector(
                            new Decorator(ret => DungeonStonesPresent && (GameUI.IsElementVisible(GameUI.GenericOK) || GameUI.IsElementVisible(UIElements.ConfirmationDialogOkButton)),
                                          new Sequence(
                                              new Action(ret => GameUI.SafeClickElement(GameUI.GenericOK)),
                                              new Action(ret => GameUI.SafeClickElement(UIElements.ConfirmationDialogOkButton)),
                                              new Sleep(3000)
                                              )
                                          ),
                            new Sequence(
                                new DecoratorContinue(ret => startingWorldId <= 0,
                                                      new Action(ret => startingWorldId = ZetaDia.CurrentWorldId)
                                                      ),
                                new Action(ret => interactWaitSeconds = DungeonStonesPresent ? 4 : 1),
                                new Action(ret => LogInteraction()),
                                new DecoratorContinue(ret => IsPortal,
                                                      new Action(ret => GameEvents.FireWorldTransferStart())
                                                      ),
                                new Action(ret => WaitWhileChanneling()),
                                new DecoratorContinue(ret => actor.ActorType == ActorType.Gizmo,
                                                      new PrioritySelector(
                                                          new Decorator(ret => actor.ActorInfo.GizmoType == GizmoType.BossPortal,
                                                                        new Action(ret => ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position))
                                                                        ),
                                                          new Decorator(ret => actor.ActorInfo.GizmoType == GizmoType.Portal,
                                                                        new Action(ret => ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position))
                                                                        ),
                                                          new Decorator(ret => actor.ActorInfo.GizmoType == GizmoType.ReturnPortal,
                                                                        new Action(ret => ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position))
                                                                        ),
                                                          new Decorator(ret => actor.ActorInfo.GizmoType == GizmoType.Door,
                                                                        new Action(ret => ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position))
                                                                        ),
                                                          new Decorator(ret => actor.ActorInfo.GizmoType == GizmoType.Portal,
                                                                        new Action(ret => ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position))
                                                                        ),
                                                          new Action(ret => ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position))
                                                          )
                                                      ),
                                new DecoratorContinue(ret => actor.ActorType == ActorType.Monster,
                                                      new Action(ret => ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position))
                                                      ),
                                new Action(ret => actor.Interact()),
                                new Action(ret => GameUI.SafeClickElement(GameUI.GenericOK)),
                                new Action(ret => GameUI.SafeClickElement(UIElements.ConfirmationDialogOkButton)),
                                new DecoratorContinue(cnd => startInteractPosition == Vector3.Zero,
                                                      new Action(ret => startInteractPosition = ZetaDia.Me.Position)
                                                      ),
                                new Action(ret => lastPosition = ZetaDia.Me.Position),
                                new Action(ret => completedInteractions++),
                                new Action(ret => lastInteract = DateTime.UtcNow),
                                new DecoratorContinue(ret => DungeonStonesPresent || IsPortal,
                                                      new Sleep(500)
                                                      )
                                )
                            )
                        ));
 }
コード例 #16
0
        private async Task<bool> Interact(DiaObject actor)
        {
            Logger.Debug("[Interaction] Attempting to interact with {0} at distance {1}", ((SNOActor)actor.ActorSNO).ToString(), actor.Distance);
            bool retVal = false;
            switch (actor.ActorType)
            {
                case ActorType.Gizmo:
                    switch (actor.ActorInfo.GizmoType)
                    {
                        case GizmoType.BossPortal:
                        case GizmoType.Portal:
                        case GizmoType.ReturnPortal:
                            retVal = ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position);
                            break;
                        default:
                            retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position);
                            break;
                    }
                    break;
                case ActorType.Monster:
                    retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position);
                    break;
            }

            // Doubly-make sure we interact
            actor.Interact();
            await Coroutine.Sleep(_sleepTime);
            return retVal;
        }
コード例 #17
0
ファイル: Movement.cs プロジェクト: dachidahu/AutoFollow
        /// <summary>
        /// Moves to something and interacts with it. 
        /// (blocks execution, avoid using while in combat)
        /// </summary>
        /// <param name="obj">object to interact with</param>
        /// <param name="range">how close to get</param>
        /// <param name="interactLimit">maximum number of times to interact</param>
        public static async Task<bool> MoveToAndInteract(DiaObject obj, float range = -1f, int interactLimit = 5)
        {
            if (!Data.IsValid(obj))
                return false;

            var startWorldSnoId = ZetaDia.CurrentWorldSnoId;

            if (interactLimit < 1) interactLimit = 5;
            if (range < 0) range = obj.CollisionSphere.Radius - 2;
            
            if (obj.Position == default(Vector3))
            {
                Log.Verbose("Destination is invalid (Vector3.Zero)");
            }

            if (obj.Position.Distance(ZetaDia.Me.Position) > 600f)
            {
                Log.Verbose("Destination is too far away");
            }

            if (obj.Position.Distance(ZetaDia.Me.Position) > range)
            {
                if (!await MoveTo(obj.Position, obj.Name, range))
                    return false;
            }
            
            var distance = obj.Position.Distance(ZetaDia.Me.Position);
            if (distance <= range || distance - obj.CollisionSphere.Radius <= range)
            {
                for (int i = 1; i <= interactLimit; i++)
                {
                    Log.Verbose("Interacting with {0} ({1}) Attempt={2}", obj.Name, obj.ActorSnoId, i);
                    if (obj.Interact())
                        break;

                    await Coroutine.Sleep(1000);
                    await Coroutine.Yield();
                }
            }           

            Navigator.PlayerMover.MoveTowards(obj.Position);
            await Coroutine.Sleep(250);

            if(!ZetaDia.IsLoadingWorld && Data.IsValid(obj))
                obj.Interact();

            await Coroutine.Sleep(1000);

            if (obj is GizmoPortal && ZetaDia.IsLoadingWorld || ZetaDia.CurrentWorldSnoId != startWorldSnoId)
            {
                Log.Verbose("A portal was successfully interacted with");
                GameEvents.FireWorldTransferStart();
            }

            return true;
        }
コード例 #18
0
        /// <summary>
        /// Moves to something and interacts with it
        /// </summary>
        /// <param name="obj">object to interact with</param>
        /// <param name="range">how close to get</param>
        /// <param name="interactLimit">maximum number of times to interact</param>
        public static async Task <bool> Execute(DiaObject obj, float range = -1f, int interactLimit = 5)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!obj.IsFullyValid())
            {
                return(false);
            }

            if (interactLimit < 1)
            {
                interactLimit = 5;
            }
            if (range < 0)
            {
                range = obj.InteractDistance;
            }

            if (Core.Player.IsInTown)
            {
                GameUI.CloseVendorWindow();
            }

            if (obj.Position.Distance(ZetaDia.Me.Position) > range)
            {
                Navigator.PlayerMover.MoveTowards(obj.Position);

                if (!await MoveTo.Execute(obj.Position, obj.Name))
                {
                    Core.Logger.Log("MoveTo Failed for {0} ({1}) Distance={2}", obj.Name, obj.ActorSnoId, obj.Distance);
                    return(false);
                }
            }

            var distance = obj.Position.Distance(ZetaDia.Me.Position);

            if (distance <= range || distance - obj.InteractDistance <= range)
            {
                for (var i = 1; i <= interactLimit; i++)
                {
                    Core.Logger.Verbose("Interacting with {0} ({1}) Attempt={2}", obj.Name, obj.ActorSnoId, i);
                    if (obj.Interact() && i > 1)
                    {
                        break;
                    }

                    await Coroutine.Yield();
                }
            }

            // Better to be redundant than failing to interact.

            Navigator.PlayerMover.MoveTowards(obj.Position);
            await Coroutine.Yield();

            obj.Interact();

            Navigator.PlayerMover.MoveStop();
            await Coroutine.Yield();

            await Interact(obj);

            return(true);
        }
コード例 #19
0
 /// <summary>
 /// Main MoveToObjective Behavior
 /// </summary>
 /// <returns></returns>
 protected override Composite CreateBehavior()
 {
     return
         (new Sequence(
              new DecoratorContinue(ret => ZetaDia.Me.IsDead || ZetaDia.IsLoadingWorld,
                                    new Sequence(
                                        new Action(ret => Logger.Log("IsDead={0} IsLoadingWorld={1}", ZetaDia.Me.IsDead, ZetaDia.IsLoadingWorld)),
                                        new Action(ret => RunStatus.Failure)
                                        )
                                    ),
              new DecoratorContinue(ret => _lastMoveResult == MoveResult.ReachedDestination && _objectiveObject == null,
                                    new Sequence(
                                        new Action(ret => Logger.Log("ReachedDestination, no Objective found - finished!")),
                                        new Action(ret => _isDone = true),
                                        new Action(ret => RunStatus.Failure)
                                        )
                                    ),
              new Action(ret => FindObjectiveMarker()),
              new DecoratorContinue(ret => _mapMarkerLastPosition != Vector3.Zero,
                                    new Action(ret => RefreshActorInfo())
                                    ),
              new DecoratorContinue(ret => _objectiveObject == null && _miniMapMarker == null && Position == Vector3.Zero,
                                    new Sequence(
                                        new Action(ret => Logger.Log("Error: Could not find Objective Marker! {0}", Status())),
                                        new Action(ret => _isDone = true)
                                        )
                                    ),
              new Sequence(
                  new PrioritySelector(
                      new Decorator(ret => ZetaDia.CurrentWorldId != _startWorldId,
                                    new Sequence(
                                        new Action(ret => Logger.Log("World changed from {0} to {1}, finished {2}", _startWorldId, ZetaDia.CurrentWorldId, Status())),
                                        new Action(ret => _isDone = true)
                                        )
                                    ),
                      new Decorator(ret => IsValidObjective() && _objectiveObject is DiaUnit && _objectiveObject.Position.Distance(ZetaDia.Me.Position) <= PathPrecision,
                                    new Sequence(
                                        new Action(ret => Logger.Log("We found the objective and its a monster, ending tag so we can kill it. {0}", Status())),
                                        new Action(ret => _isDone = true)
                                        )
                                    ),
                      new Decorator(ret => _objectiveObject != null && _objectiveObject.IsValid,
                                    new PrioritySelector(
                                        new Decorator(ret => _lastMoveResult != MoveResult.ReachedDestination,
                                                      new Sequence(
                                                          new Action(ret => Logger.Debug("Moving to actor {0} {1}", _objectiveObject.ActorSNO, Status())),
                                                          new Action(ret => _lastMoveResult = Navigator.MoveTo(_objectiveObject.Position))
                                                          )
                                                      ),
                                        new Decorator(ret => _objectiveObject is GizmoPortal,
                                                      new PrioritySelector(
                                                          new Decorator(ret => _lastMoveResult == MoveResult.ReachedDestination && _objectiveObject.Distance > InteractRange,
                                                                        new Sequence(
                                                                            new Action(ret => Logger.Log("ReachedDestination but not within InteractRange, finished")),
                                                                            new Action(ret => _isDone = true)
                                                                            )
                                                                        ),
                                                          new Decorator(ret => ZetaDia.Me.Movement.IsMoving,
                                                                        new Action(ret => CommonBehaviors.MoveStop())),
                                                          new Sequence(
                                                              new Action(ret => _objectiveObject.Interact()),
                                                              new Action(ret => _completedInteractAttempts++),
                                                              new Action(ret => Logger.Debug("Interacting with portal object {0}, result: {1}", _objectiveObject.ActorSNO, Status())),
                                                              new Sleep(500),
                                                              new Action(ret => GameEvents.FireWorldTransferStart())
                                                              )
                                                          )
                                                      )
                                        )
                                    ),
                      new Decorator(ret => _miniMapMarker != null && _objectiveObject == null,
                                    new PrioritySelector(
                                        new Decorator(ret => _miniMapMarker != null && _miniMapMarker.Position.Distance(ZetaDia.Me.Position) > PathPrecision,
                                                      new Sequence(
                                                          new Action(ret => Logger.Debug("Moving to Objective Marker {0}, {1}", _miniMapMarker.NameHash, Status())),
                                                          new Action(ret => _lastMoveResult = Navigator.MoveTo(_miniMapMarker.Position))
                                                          )
                                                      ),
                                        new Decorator(ret => _miniMapMarker != null && _miniMapMarker.Position.Distance(ZetaDia.Me.Position) < PathPrecision,
                                                      new Sequence(
                                                          new Action(ret => Logger.Debug("Successfully Moved to Objective Marker {0}, {1}", _miniMapMarker.NameHash, Status())),
                                                          new Action(ret => _isDone = true)
                                                          )
                                                      )
                                        )
                                    ),
                      new Decorator(ret => _miniMapMarker == null && Position != Vector3.Zero && Position.Distance(ZetaDia.Me.Position) > PathPrecision,
                                    new Sequence(
                                        new Action(ret => _lastMoveResult = Navigator.MoveTo(Position)),
                                        new DecoratorContinue(ret => _lastMoveResult == MoveResult.ReachedDestination,
                                                              new Sequence(
                                                                  new Action(ret => Logger.Log("ReachedDestination of Position, finished.")),
                                                                  new Action(ret => _isDone = true)
                                                                  )
                                                              )
                                        )
                                    ),
                      new Action(ret =>
                                 Logger.LogError("MoveToObjective Error: marker={0} actor={1}/{2} completedInteracts={3} isPortal={4} dist={5} interactRange={6}",
                                                 _miniMapMarker != null,
                                                 _objectiveObject != null,
                                                 (_objectiveObject != null && _objectiveObject.IsValid),
                                                 _completedInteractAttempts,
                                                 IsPortal,
                                                 (_objectiveObject != null && _objectiveObject.IsValid ? _objectiveObject.Position.Distance(ZetaDia.Me.Position) : 0f),
                                                 InteractRange)
                                 )
                      )
                  )
              ));
 }
コード例 #20
0
        internal static RunStatus UnidStashBehavior(object ret)
        {
            if (ZetaDia.Actors.Me == null)
            {
                Logger.DBLog.DebugFormat("GSError: Diablo 3 memory read error, or item became invalid [CoreStash-1]");
                return(RunStatus.Failure);
            }
            Vector3   vectorPlayerPosition = ZetaDia.Me.Position;
            Vector3   vectorStashLocation  = new Vector3(0f, 0f, 0f);
            DiaObject objPlayStash         = ZetaDia.Actors.GetActorsOfType <GizmoPlayerSharedStash>(true).FirstOrDefault <GizmoPlayerSharedStash>();

            if (objPlayStash != null)
            {
                vectorStashLocation = objPlayStash.Position;
            }
            else if (!ZetaDia.IsInTown)
            {
                return(RunStatus.Failure);
            }
            else
            {
                //Setup vector for movement
                switch (ZetaDia.CurrentAct)
                {
                case Act.A1:
                    vectorStashLocation = new Vector3(2971.285f, 2798.801f, 24.04533f); break;

                case Act.A2:
                    vectorStashLocation = new Vector3(323.4543f, 228.5806f, 0.1f); break;

                case Act.A3:
                case Act.A4:
                    vectorStashLocation = new Vector3(389.3798f, 390.7143f, 0.3321428f); break;
                }
            }

            float iDistanceFromStash = Vector3.Distance(vectorPlayerPosition, vectorStashLocation);

            if (iDistanceFromStash > 120f)
            {
                return(RunStatus.Failure);
            }

            //Out-Of-Range...
            if (objPlayStash == null)
            {
                Navigator.PlayerMover.MoveTowards(vectorStashLocation);
                return(RunStatus.Running);
            }
            if (iDistanceFromStash > 40f)
            {
                ZetaDia.Me.UsePower(SNOPower.Walk, vectorStashLocation, ZetaDia.Me.WorldDynamicId);
                return(RunStatus.Running);
            }
            if (iDistanceFromStash > 7.5f && !UIElements.StashWindow.IsVisible)
            {
                //Use our click movement
                Bot.NavigationCache.RefreshMovementCache();

                //Wait until we are not moving to send click again..
                if (Bot.NavigationCache.IsMoving)
                {
                    return(RunStatus.Running);
                }

                ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, vectorStashLocation, ZetaDia.Me.WorldDynamicId, objPlayStash.ACDGuid);
                return(RunStatus.Running);
            }

            if (!UIElements.StashWindow.IsVisible)
            {
                objPlayStash.Interact();
                return(RunStatus.Running);
            }

            if (!bUpdatedStashMap)
            {
                // Array for what blocks are or are not blocked
                for (int iRow = 0; iRow <= 29; iRow++)
                {
                    for (int iColumn = 0; iColumn <= 6; iColumn++)
                    {
                        GilesStashSlotBlocked[iColumn, iRow] = false;
                    }
                }
                // Block off the entire of any "protected stash pages"
                foreach (int iProtPage in CharacterSettings.Instance.ProtectedStashPages)
                {
                    for (int iProtRow = 0; iProtRow <= 9; iProtRow++)
                    {
                        for (int iProtColumn = 0; iProtColumn <= 6; iProtColumn++)
                        {
                            GilesStashSlotBlocked[iProtColumn, iProtRow + (iProtPage * 10)] = true;
                        }
                    }
                }
                // Remove rows we don't have
                for (int iRow = (ZetaDia.Me.NumSharedStashSlots / 7); iRow <= 29; iRow++)
                {
                    for (int iColumn = 0; iColumn <= 6; iColumn++)
                    {
                        GilesStashSlotBlocked[iColumn, iRow] = true;
                    }
                }
                // Map out all the items already in the stash
                foreach (ACDItem tempitem in ZetaDia.Me.Inventory.StashItems)
                {
                    if (tempitem.BaseAddress != IntPtr.Zero)
                    {
                        int inventoryRow    = tempitem.InventoryRow;
                        int inventoryColumn = tempitem.InventoryColumn;
                        // Mark this slot as not-free
                        GilesStashSlotBlocked[inventoryColumn, inventoryRow] = true;
                        // Try and reliably find out if this is a two slot item or not
                        GilesItemType tempItemType = Backpack.DetermineItemType(tempitem.InternalName, tempitem.ItemType, tempitem.FollowerSpecialType);
                        if (Backpack.DetermineIsTwoSlot(tempItemType) && inventoryRow != 19 && inventoryRow != 9 && inventoryRow != 29)
                        {
                            GilesStashSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                        }
                        else if (Backpack.DetermineIsTwoSlot(tempItemType) && (inventoryRow == 19 || inventoryRow == 9 || inventoryRow == 29))
                        {
                            Logger.DBLog.DebugFormat("GSError: DemonBuddy thinks this item is 2 slot even though it's at bottom row of a stash page: " + tempitem.Name + " [" + tempitem.InternalName +
                                                     "] type=" + tempItemType.ToString() + " @ slot " + (inventoryRow + 1).ToString(CultureInfo.InvariantCulture) + "/" +
                                                     (inventoryColumn + 1).ToString(CultureInfo.InvariantCulture));
                        }
                    }
                }         // Loop through all stash items
                bUpdatedStashMap = true;
            }             // Need to update the stash map?


            if (Bot.Character.Data.BackPack.townRunCache.hashGilesCachedUnidStashItems.Count > 0)
            {
                iCurrentItemLoops++;
                if (iCurrentItemLoops < iItemDelayLoopLimit)
                {
                    return(RunStatus.Running);
                }
                iCurrentItemLoops = 0;
                RandomizeTheTimer();
                CacheACDItem thisitem = Bot.Character.Data.BackPack.townRunCache.hashGilesCachedUnidStashItems.FirstOrDefault();
                if (LastStashPoint[0] < 0 && LastStashPoint[1] < 0 && LastStashPage < 0)
                {
                    bool bDidStashSucceed = GilesStashAttempt(thisitem, out LastStashPoint, out LastStashPage);
                    if (!bDidStashSucceed)
                    {
                        Logger.DBLog.DebugFormat("There was an unknown error stashing an item.");
                        if (OutOfGame.MuleBehavior)
                        {
                            return(RunStatus.Success);
                        }
                    }
                    else
                    {
                        return(RunStatus.Running);
                    }
                }
                else
                {
                    //We have a valid place to stash.. so lets check if stash page is currently open
                    if (ZetaDia.Me.Inventory.CurrentStashPage == LastStashPage)
                    {
                        //Herbfunk: Current Game Stats
                        Bot.Game.CurrentGameStats.CurrentProfile.LootTracker.StashedItemLog(thisitem);

                        ZetaDia.Me.Inventory.MoveItem(thisitem.ThisDynamicID, ZetaDia.Me.CommonData.DynamicId, InventorySlot.SharedStash, LastStashPoint[0], LastStashPoint[1]);
                        LastStashPoint = new[] { -1, -1 };
                        LastStashPage  = -1;

                        if (thisitem != null)
                        {
                            Bot.Character.Data.BackPack.townRunCache.hashGilesCachedUnidStashItems.Remove(thisitem);
                        }
                        if (Bot.Character.Data.BackPack.townRunCache.hashGilesCachedUnidStashItems.Count > 0)
                        {
                            return(RunStatus.Running);
                        }
                    }
                    else
                    {
                        //Lets switch the current page..
                        ZetaDia.Me.Inventory.SwitchStashPage(LastStashPage);
                        return(RunStatus.Running);
                    }
                }
            }
            return(RunStatus.Success);
        }
コード例 #21
0
ファイル: Movement.cs プロジェクト: dachidahu/AutoFollow
        /// <summary>
        /// Moves to something and interacts with it.
        /// (blocks execution, avoid using while in combat)
        /// </summary>
        /// <param name="obj">object to interact with</param>
        /// <param name="range">how close to get</param>
        /// <param name="interactLimit">maximum number of times to interact</param>
        public static async Task <bool> MoveToAndInteract(DiaObject obj, float range = -1f, int interactLimit = 5)
        {
            if (!Data.IsValid(obj))
            {
                return(false);
            }

            var startWorldSnoId = ZetaDia.CurrentWorldSnoId;

            if (interactLimit < 1)
            {
                interactLimit = 5;
            }
            if (range < 0)
            {
                range = obj.CollisionSphere.Radius - 2;
            }

            if (obj.Position == default(Vector3))
            {
                Log.Verbose("Destination is invalid (Vector3.Zero)");
            }

            if (obj.Position.Distance(ZetaDia.Me.Position) > 600f)
            {
                Log.Verbose("Destination is too far away");
            }

            if (obj.Position.Distance(ZetaDia.Me.Position) > range)
            {
                if (!await MoveTo(obj.Position, obj.Name, range))
                {
                    return(false);
                }
            }

            var distance = obj.Position.Distance(ZetaDia.Me.Position);

            if (distance <= range || distance - obj.CollisionSphere.Radius <= range)
            {
                for (int i = 1; i <= interactLimit; i++)
                {
                    Log.Verbose("Interacting with {0} ({1}) Attempt={2}", obj.Name, obj.ActorSnoId, i);
                    if (obj.Interact())
                    {
                        break;
                    }

                    await Coroutine.Sleep(1000);

                    await Coroutine.Yield();
                }
            }

            Navigator.PlayerMover.MoveTowards(obj.Position);
            await Coroutine.Sleep(250);

            if (!ZetaDia.IsLoadingWorld && Data.IsValid(obj))
            {
                obj.Interact();
            }

            await Coroutine.Sleep(1000);

            if (obj is GizmoPortal && ZetaDia.IsLoadingWorld || ZetaDia.CurrentWorldSnoId != startWorldSnoId)
            {
                Log.Verbose("A portal was successfully interacted with");
                GameEvents.FireWorldTransferStart();
            }

            return(true);
        }
コード例 #22
0
        internal static RunStatus StashMovement(object ret)
        {
            if (FunkyGame.GameIsInvalid)
            {
                ActionsChecked = false;
                FunkyTownRunPlugin.DBLog.InfoFormat("[Funky] Town Run Behavior Failed! (Not In Game/Invalid Actor/misc)");
                return(RunStatus.Failure);
            }


            Vector3   vectorPlayerPosition = ZetaDia.Me.Position;
            Vector3   vectorStashLocation  = Vector3.Zero;
            DiaObject objPlayStash         = ZetaDia.Actors.GetActorsOfType <GizmoPlayerSharedStash>(true).FirstOrDefault <GizmoPlayerSharedStash>();

            if (objPlayStash != null)
            {
                vectorStashLocation = objPlayStash.Position;
            }
            else if (!ZetaDia.IsInTown)
            {
                return(RunStatus.Failure);
            }
            else
            {
                vectorStashLocation = SafetyStashLocation;
            }

            float iDistanceFromStash = Vector3.Distance(vectorPlayerPosition, vectorStashLocation);

            if (iDistanceFromStash > 120f)
            {
                return(RunStatus.Failure);
            }

            //Out-Of-Range...
            if (objPlayStash == null)
            {
                Navigator.PlayerMover.MoveTowards(vectorStashLocation);
                return(RunStatus.Running);
            }
            if (iDistanceFromStash > 40f)
            {
                ZetaDia.Me.UsePower(SNOPower.Walk, vectorStashLocation, ZetaDia.Me.WorldDynamicId);
                return(RunStatus.Running);
            }
            if (iDistanceFromStash > 7.5f && !UIElements.StashWindow.IsVisible)
            {
                //Wait until we are not moving to send click again..
                if (FunkyGame.Hero.IsMoving)
                {
                    return(RunStatus.Running);
                }

                ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, vectorStashLocation, ZetaDia.Me.WorldDynamicId, objPlayStash.ACDGuid);
                return(RunStatus.Running);
            }

            if (!UIElements.StashWindow.IsVisible)
            {
                objPlayStash.Interact();
                return(RunStatus.Running);
            }

            return(RunStatus.Success);
        }
コード例 #23
0
        private static async Task<bool> Interact(DiaObject actor)
        {
            bool retVal = false;
            switch (actor.ActorType)
            {
                case ActorType.Gizmo:
                    switch (actor.ActorInfo.GizmoType)
                    {
                        case GizmoType.BossPortal:
                        case GizmoType.Portal:
                        case GizmoType.ReturnPortal:
                            retVal = ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, actor.Position);
                            break;
                        default:
                            retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, actor.Position);
                            break;
                    }
                    break;
                case ActorType.Monster:
                    retVal = ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, actor.Position);
                    break;
            }

            // Doubly-make sure we interact
            actor.Interact();
            await Coroutine.Sleep(100);
            return retVal;
        }
コード例 #24
0
 /// <summary>
 /// Main MoveToMapMarker Behavior
 /// </summary>
 /// <returns></returns>
 protected override Composite CreateBehavior()
 {
     return
         (new Sequence(
              new DecoratorContinue(ret => ZetaDia.Me.IsDead || ZetaDia.IsLoadingWorld,
                                    new Sequence(
                                        new Action(ret => Logger.Log("IsDead={0} IsLoadingWorld={1}", ZetaDia.Me.IsDead, ZetaDia.IsLoadingWorld)),
                                        new Action(ret => RunStatus.Failure)
                                        )
                                    ),
              CheckTimeout(),
              new Action(ret => FindMiniMapMarker()),
              new DecoratorContinue(ret => _miniMapMarker != null,
                                    new Action(ret => RefreshActorInfo())
                                    ),
              //new DecoratorContinue(ret => _interactObject == null && _miniMapMarker == null && Position == Vector3.Zero,
              //    new Sequence(
              //        new Action(ret => _miniMapMarker = GetRiftExitMarker())
              //    )
              //),
              new DecoratorContinue(ret => _interactObject == null && _miniMapMarker == null && Position == Vector3.Zero,
                                    new Sequence(
                                        new Action(ret => Logger.Debug("Error: Could not find MiniMapMarker nor PortalObject nor Position {0}", Status())),
                                        new Action(ret => _isDone = true)
                                        )
                                    ),
              new DecoratorContinue(ret => _lastMoveResult == MoveResult.ReachedDestination && _interactObject == null,
                                    new Sequence(
                                        new Action(ret => Logger.Log("ReachedDestination, no object found - finished!")),
                                        new Action(ret => _isDone = true),
                                        new Action(ret => RunStatus.Failure)
                                        )
                                    ),
              new Sequence(
                  new Action(ret => GameUI.SafeClickUIButtons()),
                  new PrioritySelector(
                      new Decorator(ret => GameUI.IsPartyDialogVisible,
                                    new Action(ret => Logger.Log("Party Dialog is visible"))
                                    ),
                      new Decorator(ret => GameUI.IsElementVisible(GameUI.GenericOK),
                                    new Action(ret => Logger.Log("Generic OK is visible"))
                                    ),
                      new Decorator(ret => DestinationWorldId == -1 && ZetaDia.CurrentWorldId != _startWorldId,
                                    new Sequence(
                                        new Action(ret => Logger.Log("World changed ({0} to {1}), destinationWorlId={2}, finished {3}",
                                                                     _startWorldId, ZetaDia.CurrentWorldId, DestinationWorldId, Status())),
                                        new Action(ret => _isDone = true)
                                        )
                                    ),
                      new Decorator(ret => DestinationWorldId != 0 && ZetaDia.CurrentWorldId == DestinationWorldId,
                                    new Sequence(
                                        new Action(ret => Logger.Log("DestinationWorlId matched, finished {0}", Status())),
                                        new Action(ret => _isDone = true)
                                        )
                                    ),
                      new Decorator(ret => _completedInteractAttempts > 1 && _lastPosition.Distance(ZetaDia.Me.Position) > 4f && DestinationWorldId != _startWorldId,
                                    new Sequence(
                                        new Action(ret => _isDone = true),
                                        new Action(ret => Logger.Log("Moved {0:0} yards after interaction, finished {1}", _lastPosition.Distance(ZetaDia.Me.Position), Status()))
                                        )
                                    ),
                      new Decorator(ret => _interactObject != null && _interactObject.IsValid,
                                    new PrioritySelector(
                                        new Decorator(ret => _lastMoveResult != MoveResult.ReachedDestination,
                                                      new Sequence(
                                                          new Action(ret => Logger.Debug("Moving to actor {0} {1}",
                                                                                         _interactObject.ActorSNO, Status())),
                                                          new Action(ret => _lastMoveResult = Navigator.MoveTo(_interactObject.Position))
                                                          )
                                                      ),
                                        new Decorator(ret => _lastMoveResult == MoveResult.ReachedDestination && _interactObject.Distance > InteractRange,
                                                      new Sequence(
                                                          new Action(ret => Logger.Log("ReachedDestination but not within InteractRange, finished")),
                                                          new Action(ret => _isDone = true)
                                                          )
                                                      ),
                                        new Decorator(ret => ZetaDia.Me.Movement.IsMoving,
                                                      new Action(ret => CommonBehaviors.MoveStop())),
                                        new Sequence(
                                            new Action(ret => _lastPosition = ZetaDia.Me.Position),
                                            new Action(ret => _interactObject.Interact()),
                                            new Action(ret => _completedInteractAttempts++),
                                            new Action(ret => Logger.Debug("Interacting with portal object {0}, result: {1}", _interactObject.ActorSNO, Status())),
                                            new Sleep(500),
                                            new Action(ret => GameEvents.FireWorldTransferStart())
                                            )
                                        )
                                    ),
                      new Decorator(ret => _miniMapMarker != null && _interactObject == null,
                                    new PrioritySelector(
                                        new Decorator(ret => _miniMapMarker != null && _miniMapMarker.Position.Distance(ZetaDia.Me.Position) > PathPrecision,
                                                      new Sequence(
                                                          new Action(ret => Logger.Debug("Moving to Map Marker {0}, {1}", _miniMapMarker.NameHash, Status())),
                                                          new Action(ret => _lastMoveResult = Navigator.MoveTo(_miniMapMarker.Position))
                                                          )
                                                      ),
                                        new Decorator(ret => _miniMapMarker != null && _miniMapMarker.Position.Distance(ZetaDia.Me.Position) < PathPrecision,
                                                      new Sequence(
                                                          new Action(ret => Logger.Debug("Successfully Moved to Map Marker {0}, {1}", _miniMapMarker.NameHash, Status())),
                                                          new Action(ret => _isDone = true)
                                                          )
                                                      )
                                        )
                                    ),
                      new Decorator(ret => _miniMapMarker == null && Position != Vector3.Zero,
                                    new Sequence(
                                        new Action(ret => _lastMoveResult = Navigator.MoveTo(Position)),
                                        new DecoratorContinue(ret => _lastMoveResult == MoveResult.ReachedDestination,
                                                              new Sequence(
                                                                  new Action(ret => Logger.Log("ReachedDestination of Position, finished.")),
                                                                  new Action(ret => _isDone = true)
                                                                  )
                                                              )
                                        )
                                    ),
                      new Action(ret =>
                                 Logger.LogError("MoveToMapMarker Error: marker={0} actor={1}/{2} completedInteracts={3} isPortal={4} dist={5} interactRange={6}",
                                                 _miniMapMarker != null,
                                                 _interactObject != null,
                                                 (_interactObject != null && _interactObject.IsValid),
                                                 _completedInteractAttempts,
                                                 IsPortal,
                                                 (_interactObject != null ? _interactObject.Position.Distance(ZetaDia.Me.Position) : 0f),
                                                 InteractRange))
                      )
                  )
              ));
 }