private async Task <bool> MovingToScene()
        {
            if (CurrentGateScene == null)
            {
                Core.Logger.Debug("Can't move to unspecified scene");
                State = States.Failed;
                return(false);
            }

            Core.Logger.Debug($"Not in the nearest gate scene ({CurrentGateScene.Name}), moving...");
            if (_moveToSceneCoroutine == null || _moveToSceneCoroutine.SceneName != CurrentGateScene.Name)
            {
                _moveToSceneCoroutine = new MoveToSceneCoroutine(_questId, _worldId, CurrentGateScene.Name);
            }

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

            if (CurrentGateScene.SnoId != ZetaDia.Me.CurrentScene.SceneInfo.SNOId)
            {
                Core.Logger.Debug("Failed to move to gate scene, finished.");
                State = States.Failed;
                return(false);
            }

            Core.Logger.Debug($"Successfully moved to gate scene {CurrentGateScene.Name}.");
            State = States.Searching;
            return(false);
        }
 public void Reset()
 {
     _isDone = false;
     _state  = States.NotStarted;
     _usedGatePositions.Clear();
     _gatesUsed                = 0;
     _moveAttempts             = 0;
     TargetGatePosition        = Vector3.Zero;
     TargetGateScene           = null;
     CurrentGateScene          = null;
     _moveToSceneCoroutine     = null;
     _interactionCoroutine     = null;
     _sceneDataBufferStartTime = DateTime.MinValue;
 }
        private async Task <bool> MovingToNearestScene()
        {
            _moveToSceneCoroutine = new MoveToSceneCoroutine(_questId, _sourceWorldId, _nearestScene.Name);

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

            if (AdvDia.MyPosition.Distance(_nearestScene.Center.ToVector3()) > 75 || _moveToSceneCoroutine.State == MoveToSceneCoroutine.States.Failed)
            {
                Core.Logger.Debug("[EnterLevelArea] Nearest scene is unreachable, going back to the normal routine");
                _nearestSceneCooldown = DateTime.UtcNow + TimeSpan.FromSeconds(60);
                _moveToSceneCoroutine = null;
                _nearestScene         = null;
            }

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