示例#1
0
        private async Task <bool> Moving()
        {
            if (!await NavigationCoroutine.MoveTo(_position, _distance, _straightLinePathing))
            {
                return(false);
            }

            if (NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                Core.Logger.Debug("[MoveToPosition] CoroutineResult.Failure");

                var canFullyPath = await AdvDia.Navigator.CanFullyClientPathTo(_position);

                var closeRayCastFail = AdvDia.MyPosition.Distance(_position) < 15f && !Core.Grids.CanRayWalk(AdvDia.MyPosition, _position);//!NavigationGrid.Instance.CanRayWalk(AdvDia.MyPosition, _position);
                var failedMoveResult = NavigationCoroutine.LastMoveResult == MoveResult.Failed || NavigationCoroutine.LastMoveResult == MoveResult.PathGenerationFailed;
                if (!canFullyPath || closeRayCastFail || failedMoveResult)
                {
                    Core.Logger.Debug("[MoveToPosition] Failed to reach position");
                    State = States.Failed;
                    return(false);
                }
            }

            if (AdvDia.MyPosition.Distance(_position) > 20)
            {
                return(false);
            }

            State = States.Completed;
            return(false);
        }
        private async Task <bool> Moving()
        {
            if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 10))
            {
                return(false);
            }
            if (NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                _objectiveLocation  = Vector3.Zero;
                _objectiveScanRange = ActorFinder.LowerSearchRadius(_objectiveScanRange);
                if (_objectiveScanRange <= 0)
                {
                    _objectiveScanRange = 50;
                }
                State = States.Searching;
                return(false);
            }
            var actor = ActorFinder.FindGizmo(_actorId);

            if (actor == null)
            {
                State = States.Searching;
                return(false);
            }
            State = States.Interacting;
            _interactionCoroutine = new InteractionCoroutine(actor.ActorSNO, new TimeSpan(0, 0, _secondsToTimeout),
                                                             new TimeSpan(0, 0, _secondsToSleepAfterInteraction), _interactAttemps);
            if (!actor.IsInteractableQuestObject())
            {
                ActorFinder.InteractWhitelist.Add(actor.ActorSNO);
            }
            return(false);
        }
        private async Task <bool> Moving()
        {
            if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 7))
            {
                return(false);
            }
            if (NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                _objectiveLocation  = Vector3.Zero;
                _objectiveScanRange = ActorFinder.LowerSearchRadius(_objectiveScanRange);
                if (_objectiveScanRange <= 0)
                {
                    _objectiveScanRange = 50;
                }
                State = States.Searching;
                return(false);
            }
            var actor = ActorFinder.FindGizmo(_actorId);

            if (actor == null)
            {
                Core.Logger.Debug("No Gizmo Found.");
                State = States.Searching;
                return(false);
            }
            State = States.Interacting;
            _interactionCoroutine = new InteractionCoroutine(actor.ActorSnoId, new TimeSpan(0, 0, _secondsToTimeout),
                                                             new TimeSpan(0, 0, _secondsToSleepAfterInteraction), _interactAttemps);
            if (!actor.IsInteractableQuestObject())
            {
                Core.Logger.Error($"Unable to Interact with: {actor.Name} | Distance: {actor.Distance}.  Whitelisting.");
                ActorFinder.InteractWhitelist.Add(actor.ActorSnoId);
            }
            return(false);
        }
示例#4
0
        private async Task <bool> Moving()
        {
            if (AdvDia.CurrentWorldScene.Name.ToLower().Contains(SceneName.ToLower()))
            {
                State = States.Completed;
                return(false);
            }

            if (_zergEnabled)
            {
                SafeZerg.Instance.EnableZerg();
            }

            if (await NavigationCoroutine.MoveTo(_objectiveLocation, 10))
            {
                if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure && _failureCount < 10)
                {
                    _failureCount++;
                    _previouslyFoundLocation       = _objectiveLocation;
                    _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
                    _objectiveLocation             = Vector3.Zero;
                    _objectiveScanRange            = Math.Max(ActorFinder.LowerSearchRadius(_objectiveScanRange), 250);
                    Core.Logger.Log($"Search Radius changed to  {_objectiveScanRange}");
                    State = States.Searching;
                    return(false);
                }
                State = States.Completed;
                return(false);
            }
            return(false);
        }
示例#5
0
        private async Task <bool> Moving()
        {
            EnablePulse();
            TargetingHelper.TurnCombatOn();

            if (!await NavigationCoroutine.MoveTo(_keywardenLocation, 15))
            {
                return(false);
            }

            if (_keywardenData.IsAlive)
            {
                _keywardenLocation = GetKeywardenLocation();
                if (_keywardenLocation == Vector3.Zero)
                {
                    State = States.Searching;
                }
            }
            else
            {
                Logger.Info("[Keywarden] Keywarden shish kebab!");
                State = States.Waiting;
            }
            return(false);
        }
示例#6
0
 private async Task <bool> MovingToBoss()
 {
     if (AdvDia.RiftQuest.Step == RiftStep.Cleared)
     {
         if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore)
         {
             State = States.SearchingForTownstoneOrExitPortal;
         }
         else
         {
             State = States.Completed;
         }
     }
     EnablePulse();
     if (!await NavigationCoroutine.MoveTo(_bossLocation, 5))
     {
         return(false);
     }
     if (AdvDia.MyPosition.Distance(_bossLocation) > 50)
     {
         _bossLocation = Vector3.Zero;
         State         = States.SearchingForBoss;
         return(false);
     }
     _bossLocation = Vector3.Zero;
     if (AdvDia.RiftQuest.Step != RiftStep.Cleared)
     {
         Logger.Info("[Rift] You will suffer and die, ugly creature!");
         State = States.KillingBoss;
     }
     return(false);
 }
示例#7
0
 private async Task <bool> Moving()
 {
     if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 10))
     {
         return(false);
     }
     if (AdvDia.MyPosition.Distance2D(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
     {
         _partialMovesCount++;
         if (_partialMovesCount < 2)
         {
             return(false);
         }
         _previouslyFoundLocation       = _objectiveLocation;
         _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
         _partialMovesCount             = 0;
         _objectiveLocation             = Vector3.Zero;
         _objectiveScanRange            = ActorFinder.LowerSearchRadius(_objectiveScanRange);
         if (_objectiveScanRange <= 0)
         {
             _objectiveScanRange = 50;
         }
         State = States.Searching;
         return(false);
     }
     SafeZerg.Instance.DisableZerg();
     State = States.Completed;
     return(false);
 }
示例#8
0
 public async Task <bool> Routine()
 {
     if (!await NavigationCoroutine.MoveTo(new Vector3(X, Y, Z), 5))
     {
         return(true);
     }
     _isDone = true;
     return(true);
 }
示例#9
0
 private async Task <bool> MovingBack()
 {
     if (!await NavigationCoroutine.MoveTo(_center, 10))
     {
         return(false);
     }
     State = States.Clearing;
     return(false);
 }
示例#10
0
 private async Task <bool> MovingToTyrael()
 {
     if (!await NavigationCoroutine.MoveTo(TyraelPositions[_act], 2))
     {
         return(false);
     }
     _interactionCoroutine = new InteractionCoroutine(TYRAEL, new TimeSpan(0, 0, 20), new TimeSpan(0, 0, 1));
     State = States.InteractingWithTyrael;
     return(false);
 }
示例#11
0
        private async Task <bool> MovingToExitPortal()
        {
            EnablePulse();
            if (!await NavigationCoroutine.MoveTo(_nextLevelPortalLocation, 15))
            {
                return(false);
            }
            _nextLevelPortalLocation = Vector3.Zero;
            if (NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                _portalScanRange = ActorFinder.LowerSearchRadius(_portalScanRange);
                if (_portalScanRange <= 100)
                {
                    _portalScanRange = 100;
                }
                if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore &&
                    AdvDia.RiftQuest.Step == RiftStep.Cleared)
                {
                    State = States.SearchingForTownstoneOrExitPortal;
                }
                else
                {
                    State = States.SearchingForExitPortal;
                }
                return(false);
            }
            var portal =
                ZetaDia.Actors.GetActorsOfType <DiaGizmo>(true)
                .Where(g => g.IsFullyValid() && g.IsPortal)
                .OrderBy(g => g.Distance)
                .FirstOrDefault();

            if (portal == null)
            {
                portal = BountyHelpers.GetPortalNearMarkerPosition(_nextLevelPortalLocation);
                if (portal == null)
                {
                    if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore &&
                        AdvDia.RiftQuest.Step == RiftStep.Cleared)
                    {
                        State = States.SearchingForTownstoneOrExitPortal;
                    }
                    else
                    {
                        State = States.SearchingForExitPortal;
                    }
                    return(false);
                }
            }
            State = States.EnteringExitPortal;
            _nextLevelPortalSNO      = portal.ActorSNO;
            _prePortalWorldDynamicId = AdvDia.CurrentWorldDynamicId;
            return(false);
        }
示例#12
0
 private async Task <bool> MovingToUrshi()
 {
     EnablePulse();
     if (!await NavigationCoroutine.MoveTo(_urshiLocation, 5))
     {
         return(false);
     }
     _urshiLocation = Vector3.Zero;
     State          = States.InteractingWithUrshi;
     return(false);
 }
        private async Task <bool> Moving()
        {
            if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 12))
            {
                return(false);
            }

            if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                _previouslyFoundLocation       = _objectiveLocation;
                _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
                _objectiveLocation             = Vector3.Zero;
                _objectiveScanRange            = ActorFinder.LowerSearchRadius(_objectiveScanRange);
                if (_objectiveScanRange <= 0)
                {
                    _objectiveScanRange = 50;
                }
                State = States.Searching;
                return(false);
            }

            var portal = ActorFinder.FindGizmo(_portalActorId);

            if (portal == null)
            {
                portal = BountyHelpers.GetPortalNearMarkerPosition(_objectiveLocation);
                if (_portalActorId == 0)
                {
                    _discoveredPortalActorId = portal.ActorSNO;
                }
                //if (_portalActorId != portal.ActorSNO && BountyData.Act == Act.A5)
                //{
                //    Logger.Info("[EnterLevelArea] Was expecting to use portal SNO {0}, using {1} instead.", _portalActorId, portal.ActorSNO);
                //    _portalActorId = portal.ActorSNO;
                //}
            }
            else
            {
                if (portal.Position.Distance(_objectiveLocation) > 15)
                {
                    portal = null;
                }
            }
            if (portal == null)
            {
                State = States.Searching;
                return(false);
            }
            _objectiveLocation = portal.Position;
            State = States.Entering;
            _prePortalWorldDynamicId = AdvDia.CurrentWorldDynamicId;
            return(false);
        }
示例#14
0
 private async Task <bool> MovingToHolyCow()
 {
     EnablePulse();
     if (!await NavigationCoroutine.MoveTo(_holyCowLocation, 5))
     {
         return(false);
     }
     _holyCowLocation = Vector3.Zero;
     Logger.Info("[Rift] Mooooo?");
     State = States.InteractingWithHolyCow;
     return(false);
 }
 private async Task <bool> Moving()
 {
     if (!await NavigationCoroutine.MoveTo(_position, 1))
     {
         return(false);
     }
     if (AdvDia.MyPosition.Distance(_position) > 20)
     {
         return(false);
     }
     State = States.Completed;
     return(false);
 }
示例#16
0
 private async Task <bool> MovingToObjective()
 {
     if (_objectiveLocation == Vector3.Zero)
     {
         State = States.Searching;
         return(false);
     }
     if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 7))
     {
         return(false);
     }
     State = States.Completed;
     return(false);
 }
        private async Task <bool> MovingToExitScene()
        {
            if (!await NavigationCoroutine.MoveTo(_exitSceneLocation, 12))
            {
                return(false);
            }

            if (AdvDia.MyPosition.Distance2D(_exitSceneLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                Logger.Debug("[EnterLevelArea] Exit scene is unreachable, going back to the normal routine");
                _exitSceneLocation    = Vector3.Zero;
                _exitSceneUnreachable = true;
            }
            State = States.Searching;
            return(false);
        }
示例#18
0
        private async Task <bool> Searching()
        {
            if (_objectiveLocation == Vector3.Zero)
            {
                ScanForObjective();
            }

            if (_objectiveLocation != Vector3.Zero)
            {
                _nearestScene = Core.Scenes.CurrentWorldScenes.OrderBy(s => s.Center.Distance(_objectiveLocation.ToVector2())).FirstOrDefault();
                if (_nearestScene != null && DateTime.UtcNow > _nearestSceneCooldown && ExplorationData.FortressWorldIds.Contains(AdvDia.CurrentWorldId))
                {
                    State = States.MovingToNearestScene;
                }

                NavigationCoroutine.Reset();
                State = States.Moving;
                return(false);
            }

            //if (_prioritizeExitScene && !_exitSceneUnreachable && Core.Scenes.CurrentWorldSceneIds.Any(s => s.Contains("Exit")))
            //{
            //    var exitScene = Core.Scenes.CurrentWorldScenes.FirstOrDefault(s => s.Name.Contains("Exit"));
            //    if (exitScene != null)
            //    {
            //        var centerNode =
            //            exitScene.Nodes.Where(n=>n.HasEnoughNavigableCells).OrderBy(n => n.Center.DistanceSqr(exitScene.Center)).FirstOrDefault();
            //        if (centerNode != null)
            //        {
            //            _exitSceneLocation = centerNode.NavigableCenter;
            //            Core.Logger.Debug("[EnterLevelArea] Moving to exit scene");
            //            State=States.MovingToExitScene;
            //            return false;
            //        }
            //    }
            //}

            if (!await ExplorationCoroutine.Explore(BountyData.LevelAreaIds))
            {
                return(false);
            }

            Core.Logger.Debug("[EnterLevelAreaCoroutine] Finished Searching.");

            Core.Scenes.Reset();
            return(false);
        }
示例#19
0
        private async Task <bool> Moving()
        {
            if (_isPartialMove)
            {
                if (!await NavigationCoroutine.MoveTo(_partialMoveLocation, 10))
                {
                    return(false);
                }

                Core.Logger.Debug("Reverting after partial move");
                _isPartialMove = false;
            }
            else
            {
                if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 10))
                {
                    return(false);
                }
            }

            if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                _partialMovesCount++;
                if (_partialMovesCount < 4)
                {
                    Core.Logger.Debug("Creating partial move segment");
                    _partialMoveLocation = MathEx.CalculatePointFrom(AdvDia.MyPosition, _objectiveLocation, 125f);
                    _isPartialMove       = true;
                    return(false);
                }
                _previouslyFoundLocation       = _objectiveLocation;
                _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
                _partialMovesCount             = 0;
                _isPartialMove      = false;
                _objectiveLocation  = Vector3.Zero;
                _objectiveScanRange = ActorFinder.LowerSearchRadius(_objectiveScanRange);
                if (_objectiveScanRange <= 0)
                {
                    _objectiveScanRange = 50;
                }
                State = States.Searching;
                return(false);
            }
            SafeZerg.Instance.DisableZerg();
            State = States.Completed;
            return(false);
        }
示例#20
0
 public static DiaGizmo FindNearestDeathGateToPosition(Vector3 position, Dictionary <Vector3, DateTime> ignoreList)
 {
     if (ignoreList == null)
     {
         ignoreList = new Dictionary <Vector3, DateTime>();
     }
     //328830
     if (ExplorationData.FortressLevelAreaIds.Contains(AdvDia.CurrentLevelAreaId) || ExplorationData.FortressWorldIds.Contains(AdvDia.CurrentWorldId))
     {
         var gizmo =
             ZetaDia.Actors.GetActorsOfType <DiaObject>(true)
             .Where(u => u.IsValid && u.ActorSnoId == 328830 && !NavigationCoroutine.IsDeathGateIgnored(u.Position, ignoreList))
             .OrderBy(u => u.Position.Distance(position))
             .FirstOrDefault();
         return(gizmo as DiaGizmo);
     }
     return(null);
 }
示例#21
0
 private async Task <bool> KillingHostile()
 {
     if (_hostileLocation == Vector3.Zero)
     {
         State = States.Searching;
         return(false);
     }
     if (!await NavigationCoroutine.MoveTo(_hostileLocation, 10))
     {
         return(false);
     }
     _hostileLocation = FindNearestHostileUnitLocation();
     if (_hostileLocation != Vector3.Zero)
     {
         return(false);
     }
     State = States.Searching;
     return(false);
 }
 private async Task <bool> Moving()
 {
     if (await NavigationCoroutine.MoveTo(_objectiveLocation, Math.Max(5, (int)_stopDistance)))
     {
         if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
         {
             _objectiveLocation  = Vector3.Zero;
             _objectiveScanRange = ActorFinder.LowerSearchRadius(_objectiveScanRange);
             if (_objectiveScanRange <= 0)
             {
                 _objectiveScanRange = 50;
             }
             State = States.Searching;
             return(false);
         }
         State = States.Completed;
         return(false);
     }
     return(false);
 }
示例#23
0
        private async Task <bool> MovingToGizmo()
        {
            if (PluginSettings.Current.BountyZerg)
            {
                SafeZerg.Instance.EnableZerg();
            }
            EnablePulse();
            if (_currentGizmo == null)
            {
                State = States.SearchingForGizmo;
                return(false);
            }

            if (!await NavigationCoroutine.MoveTo(_currentGizmo.Position, _currentGizmo.InteractDistance))
            {
                return(false);
            }

            if (NavigationCoroutine.LastResult == CoroutineResult.Failure && AdvDia.MyPosition.Distance(_currentGizmo.Position) > _currentGizmo.InteractDistance + 20)
            {
                Core.PlayerMover.MoveTowards(_currentGizmo.Position);
                ObjectSearchRadius = 150;
                _guardedGizmos.Remove(_currentGizmo.Position);
                Core.Logger.Log("[Bounty] Gizmo is out of reach, lowering the search radius to {0}", ObjectSearchRadius);
                State = States.SearchingForGizmo;
                return(false);
            }
            var gizmo =
                ZetaDia.Actors.GetActorsOfType <DiaGizmo>(true)
                .FirstOrDefault(g => g.ActorSnoId == GizmoSNO && g.Position.Distance(_currentGizmo.Position) < 5);

            if (gizmo == null)
            {
                _currentGizmo.HasBeenOperated = true;
                State = States.SearchingForGizmo;
                return(false);
            }
            State = States.PreClearingGizmoArea;
            return(false);
        }
 private async Task <bool> Moving()
 {
     if (await NavigationCoroutine.MoveTo(_objectiveLocation, 10, _straightLinePath))
     {
         if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
         {
             _previouslyFoundLocation       = _objectiveLocation;
             _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
             _objectiveLocation             = Vector3.Zero;
             _objectiveScanRange            = ActorFinder.LowerSearchRadius(_objectiveScanRange);
             if (_objectiveScanRange <= 0)
             {
                 _objectiveScanRange = 50;
             }
             State = States.Searching;
             return(false);
         }
         State = States.Completed;
         return(false);
     }
     return(false);
 }
示例#25
0
        private async Task <bool> Moving()
        {
            EnablePulse();
            TargetingHelper.TurnCombatOn();

            if (!await NavigationCoroutine.MoveTo(_keywardenLocation, 15))
            {
                return(false);
            }

            if (NavigationCoroutine.LastResult == CoroutineResult.Failure && (NavigationCoroutine.LastMoveResult == MoveResult.Failed || NavigationCoroutine.LastMoveResult == MoveResult.PathGenerationFailed))
            {
                var canClientPathTo = await AdvDia.Navigator.CanFullyClientPathTo(_keywardenLocation);

                if (!canClientPathTo)
                {
                    State             = States.Searching;
                    MoveCooldownUntil = DateTime.UtcNow.AddSeconds(10);
                    Core.Logger.Debug("[Keywarden] Can't seem to get to the keywarden!");
                }
                return(false);
            }

            if (_keywardenData.IsAlive)
            {
                _keywardenLocation = GetKeywardenLocation();
                if (_keywardenLocation == Vector3.Zero)
                {
                    State = States.Searching;
                }
            }
            else
            {
                Core.Logger.Log("[Keywarden] Keywarden shish kebab!");
                State = States.Waiting;
            }
            return(false);
        }
 private async Task <bool> Moving()
 {
     if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 1))
     {
         return(false);
     }
     if (NavigationCoroutine.LastResult == CoroutineResult.Failure)
     {
         _previouslyFoundLocation       = _objectiveLocation;
         _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
         _objectiveLocation             = Vector3.Zero;
         _objectiveScanRange            = ActorFinder.LowerSearchRadius(_objectiveScanRange);
         if (_objectiveScanRange <= 0)
         {
             _objectiveScanRange = 50;
         }
         State = States.Searching;
         return(false);
     }
     State = States.Found;
     _clearAreaForNSecondsCoroutine = new ClearAreaForNSecondsCoroutine(_questId, 10, _actorId, _marker);
     return(false);
 }
        private async Task <bool> MovingToGate()
        {
            if (TargetGatePosition == Vector3.Zero)
            {
                Core.Logger.Debug("Can't move to unspecified TargetGatePosition");
                State = States.Failed;
                return(false);
            }

            var distance = TargetGatePosition.Distance(AdvDia.MyPosition);

            if (distance > 5f)
            {
                Core.Logger.Debug($"Moving to TargetGatePosition: {TargetGatePosition} in {TargetGateScene.Name} Distance={distance}");

                if (_navigationCoroutine == null || _navigationCoroutine.Destination != TargetGatePosition)
                {
                    _navigationCoroutine = new NavigationCoroutine(TargetGatePosition, 4);
                }

                if (!await _navigationCoroutine.GetCoroutine())
                {
                    return(false);
                }

                distance = TargetGatePosition.Distance(AdvDia.MyPosition);
                if (distance > 8f)
                {
                    //if (NavigationCoroutine.LastResult == CoroutineResult.Failure)
                    //{
                    _moveAttempts++;
                    if (_moveAttempts < _maxFailedMoveToGateAttempts)
                    {
                        Core.Logger.Debug($"Failed attempt #{_moveAttempts} moving to {TargetGatePosition} Distance={distance}.");
                        _navigationCoroutine = null;
                        return(false);
                    }
                    Core.Logger.Debug($"Failed to move to TargetGatePosition, Max Attempts Reached ({_maxFailedMoveToGateAttempts}), finished.");
                    State = States.Failed;
                    //}
                    //Core.Logger.Debug($"Failed to move to TargetGatePosition, too far away from gate ({distance}). finished.");
                    //State = States.Failed;
                    return(false);
                }
            }

            Core.Logger.Debug($"Successfully moved to gate {TargetGatePosition} within {TargetGateScene.Name}.");

            CurrentGateScene = DeathGates.CurrentGateScene;

            if (CurrentGateScene == null)
            {
                Core.Logger.Debug("Unable to find a gate scene");
                State = States.Failed;
                return(false);
            }

            Core.Logger.Debug($"Updated current scene to {CurrentGateScene.Name}");
            State         = States.Interacting;
            _moveAttempts = 0;
            return(false);
        }
示例#28
0
        private async Task <bool> Moving()
        {
            if (_deathGateLocation != Vector3.Zero)
            {
                if (!await NavigationCoroutine.MoveTo(_deathGateLocation, 5))
                {
                    return(false);
                }

                _deathGateLocation = Vector3.Zero;
            }

            if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 5))
            {
                return(false);
            }

            if (NavigationCoroutine.LastMoveResult == MoveResult.UnstuckAttempt)
            {
                Core.Logger.Debug("Navigation ended with unstuck attempts last result.");
                Navigator.Clear();
            }

            if (AdvDia.MyPosition.Distance(_objectiveLocation) > 50 && NavigationCoroutine.LastResult == CoroutineResult.Failure)
            {
                Core.Logger.Debug("[EnterLevelAreaCoroutine] Navigation ended, extending scan radius to continue searching.");
                NavigationCoroutine.Reset();
                _previouslyFoundLocation       = _objectiveLocation;
                _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
                _objectiveLocation             = Vector3.Zero;
                _objectiveScanRange            = ActorFinder.LowerSearchRadius(_objectiveScanRange);
                if (_objectiveScanRange <= 0)
                {
                    _objectiveScanRange = 50;
                }
                State = States.Searching;
                return(false);
            }

            DiaGizmo portal = null;

            if (_portalActorIds != null)
            {
                foreach (var portalid in _portalActorIds)
                {
                    portal = ActorFinder.FindGizmo(portalid);
                    if (portal != null)
                    {
                        _portalActorId = portal.ActorSnoId;
                        break;
                    }
                }
            }
            else
            {
                portal = ActorFinder.FindGizmo(_portalActorId);
            }

            if (portal == null)
            {
                portal = BountyHelpers.GetPortalNearPosition(_objectiveLocation);
                if (portal != null)
                {
                    _discoveredPortalActorId = portal.ActorSnoId;
                }
                else if (_portalActorId == 0)
                {
                    portal = ZetaDia.Actors.GetActorsOfType <GizmoPortal>().OrderBy(d => d.Distance).FirstOrDefault();
                    if (portal != null)
                    {
                        _discoveredPortalActorId = portal.ActorSnoId;
                        Core.Logger.Log($"[EnterLevelArea] Unable to find the portal we needed, using this one instead {portal.Name} ({portal.ActorSnoId})");
                    }
                }
            }

            if (portal == null)
            {
                State = States.Searching;
                return(false);
            }

            _interactRange = portal.CollisionSphere.Radius;
            // Add some tolerance, sometimes the radius is pretty low and it will keep stuck trying to move to it even when it's right besides it.
            _interactRange += ZetaDia.Me.CollisionSphere.Radius;

            Core.Logger.Debug($"[EnterLevelArea] Using interact range from portal: {_interactRange}");

            if (portal.Position.Distance(_objectiveLocation) > _interactRange)
            {
                Core.Logger.Debug($"[EnterLevelArea] Portal is still too far away, something went wrong with NavigationCoroutine");
                await CommonCoroutines.MoveTo(portal.Position);

                State = States.Searching;
                return(false);
            }

            _objectiveLocation = portal.Position;
            State = States.Entering;
            _prePortalWorldDynamicId = AdvDia.CurrentWorldDynamicId;

            Core.PlayerMover.MoveTowards(portal.Position);
            await Coroutine.Sleep(1000);

            return(false);
        }
示例#29
0
 private bool NotStarted()
 {
     NavigationCoroutine.Reset();
     State = States.Moving;
     return(false);
 }