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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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> 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); }