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);
        }
Ejemplo n.º 2
0
        public static void RegisterActorSystem(this ContainerBuilder builder, AkkaActorSystem akkaActorSystem)
        {
            var actorFinder = new ActorFinder(akkaActorSystem);
            var actorSystem = new ActorSystem(akkaActorSystem.Name, actorFinder);

            builder.RegisterInstance <ActorSystem>(actorSystem);
        }
Ejemplo n.º 3
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);
 }
 private async Task <bool> ScanForObjective()
 {
     if (PluginTime.ReadyToUse(_lastScanTime, 1000))
     {
         _lastScanTime = PluginTime.CurrentMillisecond;
         if (_actorId != 0)
         {
             //var objectiveActor = BountyHelpers.ScanForActor(_actorId, _objectiveScanRange, _actorSelector);
             var objectiveActor = ActorFinder.FindActor(_actorId, _markerId, 500, "", _actorSelector);
             if (objectiveActor != null)
             {
                 _objectiveLocation = objectiveActor.Position;
                 if (_stopDistance == -1)
                 {
                     _stopDistance = objectiveActor.Radius;
                 }
             }
             else
             {
                 _objectiveLocation = Vector3.Zero;
             }
         }
         if (_objectiveLocation != Vector3.Zero)
         {
             Core.Logger.Log($"[MoveToObject] Found the objective at distance {AdvDia.MyPosition.Distance(_objectiveLocation)}");
         }
     }
     return(true);
 }
Ejemplo n.º 5
0
        public void InitializeTest()
        {
            var _actorSystem = Akka.Actor.ActorSystem.Create(testSystemName);
            var testActor    = _actorSystem.ActorOf <EchoActor>(testActorName);

            _finder = new ActorFinder(_actorSystem);
        }
Ejemplo n.º 6
0
        private bool NotStarted()
        {
            State = States.Clearing;

            _currentDestination = ActorFinder.FindNearestHostileUnitInRadius(_center, _radius);
            if (_currentDestination == Vector3.Zero && !_forceMoveAround)
            {
                State = States.Completed;
                return(false);
            }

            if (_forceMoveAround)
            {
                // Desperate Measures
                _forceClearDestinations =
                    new ConcurrentBag <Vector3>(
                        ExplorationHelpers.GetFourPointsInEachDirection(_center, _radius).Where(d => d != Vector3.Zero));

                Core.Logger.Debug($"[ClearArea] No actors found in the area, using the desperate measures. Center={_center} Radius={_radius}");
                State = States.ForceClearing;
                if (_forceClearDestinations.TryTake(out _currentDestination))
                {
                    return(false);
                }
                Core.Logger.Error($"[ClearArea] Couldn't get force clear destinations, ending tag. Center={_center} Radius={_radius}");
                State = States.Completed;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 7
0
        private bool MatchesCondition(DiaObject actor)
        {
            if (actor.IsValid)
            {
                switch (Type)
                {
                case BountyScriptItemType.InteractWithGizmo:
                    if (actor is DiaGizmo)
                    {
                        var gizmo = actor as DiaGizmo;
                        return(gizmo.IsFullyValid() && ActorFinder.IsGizmoInteractable(gizmo));
                    }
                    return(false);

                case BountyScriptItemType.InteractWithMonster:
                    if (actor is DiaUnit)
                    {
                        var unit = actor as DiaUnit;
                        return(ActorFinder.IsUnitInteractable(unit));
                    }
                    return(false);

                default:
                    return(false);
                }
            }
            return(false);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        private async Task <bool> Checking()
        {
            var actor = ActorFinder.FindObject(_actorId);

            //if (actor != null && actor.Distance > actor.CollisionSphere.Radius + 2)
            //{
            //    await NavigationCoroutine.MoveTo(actor.Position, (int)actor.CollisionSphere.Radius + 1);
            //    return false;
            //}
            if (_sourceWorldDynamicId != AdvDia.CurrentWorldDynamicId)
            {
                Logger.Debug("[UsePortal] World has changed, assuming done.");
                State = States.Completed;
                return(false);
            }
            if (actor == null)
            {
                Logger.Debug("[UsePortal] Nothing to interact, failing. ");
                State = States.Failed;
                return(false);
            }
            if (_interactAttempts > 5)
            {
                await NavigationCoroutine.MoveTo(actor.Position, (int)actor.Distance - 1);

                _interactAttempts = 0;
            }
            State = States.Interacting;
            return(false);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        private async Task <bool> Interacting()
        {
            _interactAttempts++;
            if (ZetaDia.IsLoadingWorld)
            {
                Logger.Debug("[UsePortal] Waiting for the world to load");
                await Coroutine.Sleep(250);

                return(false);
            }

            var actor = ActorFinder.FindObject(_actorId);

            if (actor == null)
            {
                Logger.Debug("[UsePortal] Nothing to interact, failing. ");
                State = States.Failed;
                return(false);
            }


            if (await Interact(actor))
            {
                State = States.Checking;
            }
            return(false);
        }
Ejemplo n.º 12
0
 private DiaObject GetActor()
 {
     var trinActor = ActorFinder.FindActor(_actorId, _markerHash);
     var actor = trinActor != null
         ? ZetaDia.Actors.GetActorByACDId(trinActor.AcdId)
         : ActorFinder.FindObject(_actorId);
     return actor;
 }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
0
        private void ZergCheck()
        {
            if (!_zergEnabled)
            {
                return;
            }
            var corruptGrowthDetectionRadius = ZetaDia.Me.ActorClass == ActorClass.Barbarian ? 30 : 20;
            var combatState = false;

            if (!combatState && ZetaDia.Me.HitpointsCurrentPct <= 0.8f)
            {
                combatState = true;
            }

            if (!combatState &&

                ZetaDia.Actors.GetActorsOfType <DiaUnit>(true).Any(u => u.IsFullyValid() && u.IsAlive && (
//                u.CommonData.IsElite || u.CommonData.IsRare || u.CommonData.IsUnique ||
                                                                       KeywardenDataFactory.GoblinSNOs.Contains(u.ActorSnoId) || (KeywardenDataFactory.A4CorruptionSNOs.Contains(u.ActorSnoId) && u.IsAlive & u.Position.Distance(AdvDia.MyPosition) <= corruptGrowthDetectionRadius))
                                                                   ))

            {
                combatState = true;
            }

            var keywarden = KeywardenDataFactory.Items.FirstOrDefault(kw => kw.Value.WorldId == AdvDia.CurrentWorldId);

            if (!combatState && keywarden.Value != null && keywarden.Value.IsAlive)
            {
                var kwActor = ActorFinder.FindUnit(keywarden.Value.KeywardenSNO);
                if (kwActor != null && kwActor.Distance < 80f)
                {
                    Logger.Verbose("Turning off zerg because {0} is nearby. Distance={1}", kwActor.Name, kwActor.Distance);
                    combatState = true;
                }
            }

            var closeUnitsCount = ZetaDia.Actors.GetActorsOfType <DiaUnit>(true).Count(u => u.IsFullyValid() && u.IsHostile && u.IsAlive && u.Position.Distance(AdvDia.MyPosition) <= 15f);

            if (!combatState && (closeUnitsCount >= 8 || closeUnitsCount >= 3 && ZetaDia.Me.HitpointsCurrentPct <= 0.6))
            {
                combatState = true;
            }

            if (combatState)
            {
                TargetingHelper.TurnCombatOn();
            }
            else
            {
                TargetingHelper.TurnCombatOff();
            }
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
 private async Task <bool> Clearing()
 {
     if (!await NavigationCoroutine.MoveTo(_currentDestination, 10))
     {
         return(false);
     }
     _currentDestination = _currentDestination = ActorFinder.FindNearestHostileUnitInRadius(_center, _radius);
     if (_currentDestination == Vector3.Zero)
     {
         State = States.Cleared;
     }
     return(false);
 }
Ejemplo n.º 18
0
        private bool Checking()
        {
            var actor = ActorFinder.FindObject(_actorId);

            if (actor == null)
            {
                Logger.Debug("[Interaction] Nothing to interact, failing. ");
                State = States.Failed;
                return(false);
            }
            if (!actor.IsInteractableQuestObject())
            {
                Logger.Debug("[Interaction] The object is not valid or not interactable, failing.");
                State = States.Failed;
                return(false);
            }
            if (actor is DiaGizmo)
            {
                var gizmoActor = (DiaGizmo)actor;
                if (gizmoActor.IsDestructibleObject)
                {
                }
            }

            if (actor is DiaGizmo && (actor as DiaGizmo).IsPortal)
            {
                _isPortal = true;
            }
            if (actor.ActorSnoId == 364715)
            {
                _isNephalemStone = true;
            }
            if (actor.ActorSnoId == 363744)
            {
                _isOrek = true;
            }
            if (_isNephalemStone && UIElements.RiftDialog.IsVisible)
            {
                State = States.Completed;
                return(false);
            }
            if (_isOrek && AdvDia.RiftQuest.State == QuestState.Completed)
            {
                State = States.Completed;
                return(false);
            }
            State = States.Interacting;
            return(false);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 20
0
        private void PulseChecks()
        {
            var gizmos = ZetaDia.Actors.GetActorsOfType <DiaGizmo>(true).Where(g => g.IsFullyValid() && g.ActorSnoId == GizmoSNO && g.Distance < ObjectSearchRadius);

            foreach (var gizmo in gizmos.Where(gizmo => gizmo.IsFullyValid()))
            {
                Vector3 position;
                bool    hasBeenOperated;
                bool    untargetable;
                try
                {
                    position        = gizmo.Position;
                    hasBeenOperated = !ActorFinder.IsGizmoInteractable(gizmo);
                    untargetable    = gizmo.CommonData.GetAttribute <int>(ActorAttributeType.Untargetable) == 1;
                }
                catch (ACDAttributeLookupFailedException)
                {
                    continue;
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("ReadProcessMemory"))
                    {
                        continue;
                    }
                    throw;
                }

                GuardedGizmo guardedGizmo;
                if (!_guardedGizmos.ContainsKey(position))
                {
                    guardedGizmo                  = new GuardedGizmo();
                    guardedGizmo.Position         = position;
                    guardedGizmo.InteractDistance = (int)Math.Round(gizmo.CollisionSphere.Radius + 1, MidpointRounding.AwayFromZero);
                    _guardedGizmos.Add(position, guardedGizmo);
                }
                else
                {
                    guardedGizmo = _guardedGizmos[gizmo.Position];
                }
                guardedGizmo.HasBeenOperated = !ActorFinder.IsGizmoInteractable(gizmo);
                guardedGizmo.Untargateble    = untargetable;
            }
        }
 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);
 }
Ejemplo n.º 22
0
        public bool FindActor()
        {
            var actor = ActorFinder.FindActor(ActorId, MarkerHash, MaxRange, ActorInternalName, CheckActorAnimation);

            if (actor == null)
            {
                return(false);
            }

            Core.Logger.Debug($"[{TagClassName}] Actor Found: {actor}");
            ActorId = actor.ActorSnoId;

            if (IsDefault(nameof(StopDistance), StopDistance))
            {
                StopDistance = actor.Radius;
                Core.Logger.Debug($"[{TagClassName}] Using Actor Radius as StopDistance: {StopDistance}");
            }

            return(true);
        }
Ejemplo n.º 23
0
        public GameLogic()
        {
            Max_HP = 100;
            HP = Max_HP;
            tower = new Tower(Max_HP);

            gameTimePeriod = 10 * 60 * 1000;

            gameState = GameState.IDLE;
            finder = new ActorFinder();

            timer = new Timer(gameTickPeriod);

            timer.Elapsed += Timer_Elapsed;
            timer.Start();

            currentAttackersCount = 0;
            currentDefendersCount = 0;
            team = new Team(Team.TeamColor.RED);

        }
Ejemplo n.º 24
0
        private async Task <bool> Checking()
        {
            _actor       = ActorFinder.FindObject(_actorId);
            _attackSkill = SkillHelper.DefaultWeaponPower;
            _attackRange = SkillHelper.DefaultWeaponDistance;

            if (_actor == null)
            {
                Logger.Info("[AttackCoroutine] Actor not found with id: {0}", _actorId);
                State = States.Completed;
                return(false);
            }

            if (_actor.Distance > _attackRange)
            {
                State = States.Moving;
                return(false);
            }

            State = States.Attacking;
            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);
 }
Ejemplo n.º 26
0
 private void ScanForObjective()
 {
     if (PluginTime.ReadyToUse(_lastScanTime, 1000))
     {
         _lastScanTime = PluginTime.CurrentMillisecond;
         if (_marker != 0)
         {
             _objectiveLocation = BountyHelpers.ScanForMarkerLocation(_marker, _objectiveScanRange);
         }
         if (_objectiveLocation == Vector3.Zero && _actorId != 0)
         {
             var actor = ActorFinder.FindGizmo(_actorId);
             if (actor != null && !actor.HasBeenOperated)
             {
                 _objectiveLocation = BountyHelpers.ScanForActorLocation(_actorId, _objectiveScanRange);
             }
         }
         if (_objectiveLocation != Vector3.Zero)
         {
             Core.Logger.Log("[InteractWithGizmo] Found the objective at distance {0}", AdvDia.MyPosition.Distance(_objectiveLocation));
         }
     }
 }
 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);
 }
Ejemplo n.º 28
0
        private async Task <bool> SetUsedGatesToIgnored()
        {
            // 'Reference' positions are hardcoded gate positions by SceneSnoId.
            // These allow gate nativation as soon as a scene is discovered.
            // And may be slightly off from actual gate actor positions.

            if (_deathGate != null)
            {
                Core.Logger.Debug($"Added origin gate to ignore list. (DiaGizmo) {_deathGate.Position}");
                _deathGateIgnoreList[_deathGate.Position] = DateTime.UtcNow;
            }

            if (_deathGate?.Position != _deathGatePosition)
            {
                Core.Logger.Debug($"Added origin gate position to ignore list. (Reference) {_deathGatePosition}");
                _deathGateIgnoreList[_deathGatePosition] = DateTime.UtcNow;
            }

            var destinationGate = ActorFinder.FindNearestDeathGate();

            if (destinationGate != null)
            {
                Core.Logger.Debug($"Added destination gate to ignore list (DiaGizmo) {destinationGate}");
                _deathGateIgnoreList[destinationGate.Position] = DateTime.UtcNow;
            }

            var destinationGateReferencePosition = DeathGates.NearestGateToPosition(AdvDia.MyPosition);

            if (destinationGateReferencePosition != Vector3.Zero)
            {
                Core.Logger.Debug($"Added destination gate to ignore list (Reference) {destinationGateReferencePosition}");
                _deathGateIgnoreList[destinationGateReferencePosition] = DateTime.UtcNow;
            }

            return(false);
        }
Ejemplo n.º 29
0
 private async Task <bool> InteractingWithTyrael()
 {
     if (await _interactionCoroutine.GetCoroutine())
     {
         if (!ZetaDia.Storage.Quests.AllQuests.Any(q => q.Quest == BountyHelpers.ActBountyFinishingQuests[_act] && q.State == QuestState.InProgress))
         {
             State = States.Completed;
             return(false);
         }
         var tyrael = ActorFinder.FindUnit(TYRAEL);
         if (tyrael == null)
         {
             Core.Logger.Error("[CompleteActBounties] Couldn't detect Tyrael. Failing");
             State = States.Failed;
             return(false);
         }
         if (tyrael.IsFullyValid() && tyrael.CommonData.MarkerType == MarkerType.Exclamation)
         {
             return(false);
         }
         State = States.Completed;
     }
     return(false);
 }
Ejemplo n.º 30
0
        private async Task <bool> Interacting()
        {
            if (ZetaDia.Me.IsFullyValid() && (ZetaDia.Me.CommonData.AnimationState == AnimationState.Casting || ZetaDia.Me.CommonData.AnimationState == AnimationState.Channeling))
            {
                Logger.Debug("[Interaction] Waiting for the cast to end");
                await Coroutine.Sleep(500);

                return(false);
            }

            var actor = ActorFinder.FindObject(_actorId);

            if (actor == null)
            {
                Logger.Debug("[Interaction] Nothing to interact, failing. ");
                State = States.Failed;
                return(false);
            }
            // Assume done
            if (!actor.IsInteractableQuestObject())
            {
                State = States.Completed;
                return(false);
            }
            if (_currentInteractAttempt > _interactAttempts)
            {
                State = States.Completed;
                return(true);
            }

            if (_timeoutCheckEnabled)
            {
                if (_interactionStartedAt == default(DateTime))
                {
                    _interactionStartedAt = DateTime.UtcNow;
                }
                else
                {
                    if (DateTime.UtcNow - _interactionStartedAt > _timeOut)
                    {
                        Logger.Debug("[Interaction] Interaction timed out after {0} seconds", (DateTime.UtcNow - _interactionStartedAt).TotalSeconds);
                        State = States.TimedOut;
                        return(false);
                    }
                }
            }

            if (await Interact(actor))
            {
                if (_currentInteractAttempt < _interactAttempts)
                {
                    _currentInteractAttempt++;
                    return(false);
                }
                if (!_isPortal && !_isNephalemStone && !_isOrek && actor.IsInteractableQuestObject())
                {
                    return(false);
                }
                if (_isNephalemStone && !UIElements.RiftDialog.IsVisible)
                {
                    return(false);
                }
                if (_isOrek && AdvDia.RiftQuest.State != QuestState.Completed)
                {
                    return(false);
                }
                State = States.Completed;
            }
            return(false);
        }