コード例 #1
0
        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);
        }
コード例 #2
0
        private async Task <bool> Interacting()
        {
            //if (_interactionCoroutine.State == InteractionCoroutine.States.NotStarted)
            //{
            //    var portalGizmo = BountyHelpers.GetPortalNearMarkerPosition(_markerPosition);
            //    if (portalGizmo == null)
            //    {
            //        Logger.Debug("[Bounty] No portal nearby, keep exploring .");
            //        State = States.SearchingForDestinationWorld;
            //        return false;
            //    }
            //    _interactionCoroutine.DiaObject = portalGizmo;
            //}

            if (await _interactionCoroutine.GetCoroutine())
            {
                ActorFinder.InteractWhitelist.Remove(_actorId);
                if (_interactionCoroutine.State == InteractionCoroutine.States.TimedOut)
                {
                    Logger.Debug("[Bounty] Couldn't interact with the unit, failing.");
                    State = States.Failed;
                    return(false);
                }
                State = States.Completed;
                _interactionCoroutine = null;
                return(false);
            }
            return(false);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        private async Task <bool> InteractingWithGizmo()
        {
            SafeZerg.Instance.DisableZerg();
            EnablePulse();
            PulseChecks();
            //Refresh actor just in case
            if (_currentGizmo.Untargateble)
            {
                State = States.ClearingGizmoArea;
                return(false);
            }
            if (_currentGizmo.HasBeenOperated)
            {
                State = States.SearchingForGizmo;
                return(false);
            }

            if (!await _interactionCoroutine.GetCoroutine())
            {
                return(false);
            }
            _interactionCoroutine = null;
            State = States.SearchingForGizmo;
            ObjectSearchRadius = 300;

            return(false);
        }
コード例 #5
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);
 }
コード例 #6
0
        private async Task <bool> Interacting()
        {
            //if (_interactionCoroutine.State == InteractionCoroutine.States.NotStarted)
            //{
            //    var portalGizmo = BountyHelpers.GetPortalNearMarkerPosition(_markerPosition);
            //    if (portalGizmo == null)
            //    {
            //        Core.Logger.Debug("[Bounty] No portal nearby, keep exploring .");
            //        State = States.SearchingForDestinationWorld;
            //        return false;
            //    }
            //    _interactionCoroutine.DiaObject = portalGizmo;
            //}

            Core.Logger.Debug("[InteractWithGizmo] Starting interaction subroutine.");

            if (await _interactionCoroutine.GetCoroutine())
            {
                ActorFinder.InteractWhitelist.Remove(_actorId);
                if (_interactionCoroutine.State == InteractionCoroutine.States.TimedOut)
                {
                    Core.Logger.Error("[InteractWithGizmo] Interaction timed out.");
                    State = States.Failed;
                    return(false);
                }

                if (_useAll)
                {
                    var nextGizmo = ActorFinder.FindGizmo(_actorId, gizmo => gizmo.IsInteractableQuestObject());
                    if (nextGizmo != null)
                    {
                        Core.Logger.Warn("Found another actor that needs some interaction. Dist={0}", nextGizmo.Distance);
                        State = States.Searching;
                        return(false);
                    }
                }

                var actor = ActorFinder.FindGizmo(_actorId);
                if (actor == null)
                {
                    Core.Logger.Log($"No Gizmo Found.");
                    State = States.Failed;
                    return(false);
                }

                if (await(MoveToAndInteract.Execute(actor)))
                {
                    State = States.Completed;
                    _interactionCoroutine = null;
                    return(false);
                }
            }
            return(false);
        }
コード例 #7
0
 private async Task <bool> PreClearingGizmoArea()
 {
     SafeZerg.Instance.DisableZerg();
     EnablePulse();
     if (!await ClearAreaCoroutine.Clear(_currentGizmo.Position, 70))
     {
         return(false);
     }
     _interactionCoroutine = new InteractionCoroutine(GizmoSNO, new TimeSpan(0, 0, 7), new TimeSpan(0, 0, 1));
     State = States.InteractingWithGizmo;
     return(false);
 }
コード例 #8
0
 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;
 }
コード例 #9
0
        private async Task<bool> Interacting()
        {
            //if (_interactionCoroutine.State == InteractionCoroutine.States.NotStarted)
            //{
            //    var portalGizmo = BountyHelpers.GetPortalNearMarkerPosition(_markerPosition);
            //    if (portalGizmo == null)
            //    {
            //        Logger.Debug("[Bounty] No portal nearby, keep exploring .");
            //        State = States.SearchingForDestinationWorld;
            //        return false;
            //    }
            //    _interactionCoroutine.DiaObject = portalGizmo;
            //}

            if (await _interactionCoroutine.GetCoroutine())
            {
                ActorFinder.InteractWhitelist.Remove(_actorId);
                if (_interactionCoroutine.State == InteractionCoroutine.States.TimedOut)
                {
                    Logger.Debug("[Bounty] Couldn't interact with the unit, failing.");
                    State = States.Failed;
                    return false;
                }
                State = States.Completed;
                _interactionCoroutine = null;
                return false;
            }
            return false;
        }
コード例 #10
0
 private async Task<bool> Moving()
 {
     if (_timeout.IsFinished)
     {
         State = States.Failed;
         return false;
     }
     if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 1)) 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.FindUnit(_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;
 }
コード例 #11
0
        private async Task<bool> InteractingWithGizmo()
        {
            SafeZerg.Instance.DisableZerg();
            EnablePulse();
            PulseChecks();
            //Refresh actor just in case 
            if (_currentGizmo.Untargateble)
            {
                State = States.ClearingGizmoArea;
                return false;
            }
            if (_currentGizmo.HasBeenOperated)
            {
                State = States.SearchingForGizmo;
                return false;
            }

            if (!await _interactionCoroutine.GetCoroutine()) return false;
            _interactionCoroutine = null;
            State = States.SearchingForGizmo;
            ObjectSearchRadius = 300;

            return false;
        }
コード例 #12
0
 private async Task<bool> PreClearingGizmoArea()
 {
     SafeZerg.Instance.DisableZerg();
     EnablePulse();
     if (!await ClearAreaCoroutine.Clear(_currentGizmo.Position, 70)) return false;
     _interactionCoroutine = new InteractionCoroutine(GizmoSNO, new TimeSpan(0, 0, 7), new TimeSpan(0, 0, 1));
     State = States.InteractingWithGizmo;
     return false;
 }
コード例 #13
0
        private async Task <bool> Interacting()
        {
            var startSide = DeathGates.MySide;
            var startGate = ActorFinder.FindNearestDeathGate();

            if (startGate == null)
            {
                Core.Logger.Debug("Can't find a gate nearby");
                State = States.Failed;
                return(false);
            }
            if (startGate.Distance > startGate.CollisionSphere.Radius)
            {
                Core.Logger.Debug("Gate is too far away to interact");
                State = States.MovingToGate;
                return(false);
            }

            if (_interactionCoroutine == null || _interactionCoroutine.IsDone)
            {
                Core.Logger.Debug($"Interacting with {startGate.Name} at {startGate.Position} Distance={startGate.Distance} CurrentScene={CurrentGateScene}");
                _interactionCoroutine = new InteractionCoroutine(startGate.ActorSnoId, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(1), 5);
            }

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

            if (_interactionCoroutine.State == InteractionCoroutine.States.Failed)
            {
                Core.Logger.Debug("InteractionCoroutine reports interaction with gate failed");
                State = States.Failed;
                return(false);
            }

            if (TargetGatePosition.Distance(AdvDia.MyPosition) <= 10f)
            {
                Core.Logger.Debug("Interaction with gate failed, we didnt move anywhere.");
                State = States.Failed;
                return(false);
            }

            _gatesUsed++;

            //var endGateInteractPos = DeathGates.NearestGateToPosition(endGate.Position);
            var endGateInteractPos = CurrentGateScene.PortalPositions.FirstOrDefault(p => p != TargetGatePosition);

            Core.Logger.Debug($"Ignoring Gate at {endGateInteractPos} within {CurrentGateScene.Name} {DeathGates.MySide}");
            _usedGatePositions.Add(endGateInteractPos);

            Core.Logger.Debug($"Ignoring Gate at {TargetGatePosition} within {CurrentGateScene.Name} {startSide}");
            _usedGatePositions.Add(TargetGatePosition);

            Core.Logger.Debug($"Gate #{_gatesUsed} at {TargetGatePosition} within {CurrentGateScene.Name} ({startSide}=>{DeathGates.MySide}) was used successfully");
            if (_gatesToUse >= 0 && _gatesUsed >= _gatesToUse)
            {
                Core.Logger.Debug($"We've used all the gates we're supposed to ({_gatesUsed})");
                State = States.Completed;
                return(false);
            }
            State = States.Searching;
            return(false);
        }
コード例 #14
0
        private async Task<bool> Interacting()
        {
            //if (_interactionCoroutine.State == InteractionCoroutine.States.NotStarted)
            //{
            //    var portalGizmo = BountyHelpers.GetPortalNearMarkerPosition(_markerPosition);
            //    if (portalGizmo == null)
            //    {
            //        Logger.Debug("[Bounty] No portal nearby, keep exploring .");
            //        State = States.SearchingForDestinationWorld;
            //        return false;
            //    }
            //    _interactionCoroutine.DiaObject = portalGizmo;
            //}

            if (await _interactionCoroutine.GetCoroutine())
            {
                ActorFinder.InteractWhitelist.Remove(_actorId);
                if (_interactionCoroutine.State == InteractionCoroutine.States.TimedOut)
                {
                    Logger.Debug("[InteractWithGizmo] Interaction timed out.");
                    State = States.Failed;
                    return false;
                }

                if (_useAll)
                {
                    var nextGizmo = ActorFinder.FindGizmo(_actorId, gizmo => gizmo.IsInteractableQuestObject());
                    if (nextGizmo != null)
                    {
                        Logger.Warn("Found another actor that needs some interaction. Dist={0}", nextGizmo.Distance);
                        State = States.Searching;
                        return false;
                    }                        
                }

                State = States.Completed;
                _interactionCoroutine = null;
                return false;
            }
            return false;
        }
コード例 #15
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;
 }