예제 #1
0
        private async Task <bool> Searching()
        {
            if (_hostileLocation == Vector3.Zero)
            {
                _hostileLocation = FindNearestHostileUnitLocation();
                if (_hostileLocation != Vector3.Zero)
                {
                    State = States.KillingHostile;
                    return(false);
                }
            }

            var ids = BountyData?.LevelAreaIds ?? new HashSet <int> {
                ZetaDia.CurrentLevelAreaSnoId
            };

            if (!await ExplorationCoroutine.Explore(ids, useIgnoreRegions: false))
            {
                return(false);
            }

            if (_stopWhenExplored && ProfileConditions.PercentNodesVisited(90))
            {
                State = States.Completed;
                return(false);
            }

            ExplorationGrid.Instance.WalkableNodes.ForEach(n => { n.IsVisited = false; });
            return(false);
        }
        private async Task <bool> Searching()
        {
            if (_objectiveLocation == Vector3.Zero)
            {
                await ScanForObjective();
            }

            if (_objectiveLocation != Vector3.Zero)
            {
                State = States.Moving;
                return(false);
            }

            if (!_isExploreAllowed)
            {
                Core.Logger.Log("Unable to find actor and exploration is disabled");
                State = States.Failed;
                return(false);
            }

            var areaIds = BountyData != null ? BountyData.LevelAreaIds : new HashSet <int> {
                AdvDia.CurrentLevelAreaId
            };

            if (!await ExplorationCoroutine.Explore(areaIds, useIgnoreRegions: false))
            {
                return(false);
            }

            Core.Scenes.Reset();
            return(false);
        }
        private async Task <bool> Searching()
        {
            if (_objectiveLocation == Vector3.Zero)
            {
                ScanForObjective();
            }
            if (_objectiveLocation != Vector3.Zero)
            {
                State = States.Moving;
                return(false);
            }

            Core.Logger.Debug("Unable to find scene, exploring...");

            var bountyData = BountyData;

            var levelAreaIds = bountyData?.LevelAreaIds != null && bountyData.LevelAreaIds.Any()
                ? bountyData.LevelAreaIds : new HashSet <int> {
                ZetaDia.CurrentLevelAreaSnoId
            };

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

            Core.Scenes.Reset();
            return(false);
        }
예제 #4
0
        private async Task <bool> Searching()
        {
            if (_objectiveLocation == Vector3.Zero)
            {
                ScanForObjective();
            }
            if (_objectiveLocation != Vector3.Zero)
            {
                // Special case for cursed chest events.
                if (_objectiveLocation.Distance(AdvDia.MyPosition) < 16f && _actorId == 365097 && ActorFinder.FindGizmo(364559) != null)
                {
                    Core.Logger.Log("Target gizmo has transformed into invulnerable event gizmo. Ending.");
                    State = States.Failed;
                    return(false);
                }

                State = States.Moving;
                return(false);
            }
            if (!await ExplorationCoroutine.Explore(BountyData.LevelAreaIds))
            {
                return(false);
            }
            Core.Scenes.Reset();
            return(false);
        }
예제 #5
0
        private async Task <bool> SearchingForGizmo()
        {
            if (PluginSettings.Current.BountyZerg)
            {
                SafeZerg.Instance.EnableZerg();
            }
            EnablePulse();

            _currentGizmo =
                _guardedGizmos.Values.Where(g => !g.HasBeenOperated)
                .OrderBy(g => g.Position.DistanceSqr(AdvDia.MyPosition))
                .FirstOrDefault();

            if (_currentGizmo != null)
            {
                State = States.MovingToGizmo;
                return(false);
            }

            if (!await ExplorationCoroutine.Explore(BountyData.LevelAreaIds))
            {
                return(false);
            }
            ScenesStorage.Reset();
            return(false);
        }
        private async Task <bool> Searching()
        {
            if (_objectiveLocation == Vector3.Zero)
            {
                ScanForObjective();
            }
            if (_objectiveLocation != Vector3.Zero)
            {
                State = States.Moving;
                return(false);
            }
            //if (_prioritizeExitScene && !_exitSceneUnreachable && ScenesStorage.CurrentWorldSceneIds.Any(s => s.Contains("Exit")))
            //{
            //    var exitScene = ScenesStorage.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;
            //            Logger.Debug("[EnterLevelArea] Moving to exit scene");
            //            State=States.MovingToExitScene;
            //            return false;
            //        }
            //    }

            //}
            if (!await ExplorationCoroutine.Explore(BountyData.LevelAreaIds))
            {
                return(false);
            }
            ScenesStorage.Reset();
            return(false);
        }
예제 #7
0
        private async Task <bool> Searching()
        {
            if (!_keywardenData.IsAlive)
            {
                State = States.Waiting;
                return(false);
            }
            EnablePulse();

            if (_keywardenLocation != Vector3.Zero && DateTime.UtcNow > MoveCooldownUntil)
            {
                State = States.Moving;
                Core.Logger.Log("[Keywarden] It's clobberin time!");
                return(false);
            }

            if (!await MoveToMarker())
            {
                return(false);
            }

            if (!await ExplorationCoroutine.Explore(_levelAreaIds, null, CanMoveToMarker))
            {
                return(false);
            }

            Core.Logger.Error("[Keywarden] Oh shit, that guy is nowhere to be found.");
            Core.Scenes.ResetVisited();
            State = States.Searching;
            return(false);
        }
예제 #8
0
        private async Task <bool> Searching()
        {
            if (!_keywardenData.IsAlive)
            {
                State = States.Waiting;
                return(false);
            }
            EnablePulse();

            if (_keywardenLocation != Vector3.Zero)
            {
                State = States.Moving;
                Logger.Info("[Keywarden] It's clobberin time!");
                return(false);
            }

            if (!await MoveToMarker())
            {
                return(false);
            }

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

            Logger.Error("[Keywarden] Oh shit, that guy is nowhere to be found.");
            ScenesStorage.ResetVisited();
            State = States.Searching;
            return(false);
        }
예제 #9
0
        private async Task <bool> Searching()
        {
            if (_objectiveLocation == Vector3.Zero)
            {
                ScanForObjective();
            }
            if (_objectiveLocation != Vector3.Zero)
            {
                State = States.Moving;
                _partialMovesCount = 0;
                return(false);
            }

            var levelAreas = BountyData != null && BountyData.LevelAreaIds != null && BountyData.LevelAreaIds.Any()
                ? BountyData.LevelAreaIds
                : new HashSet <int> {
                AdvDia.CurrentLevelAreaId
            };

            if (!await ExplorationCoroutine.Explore(levelAreas))
            {
                return(false);
            }
            ScenesStorage.Reset();
            return(false);
        }
예제 #10
0
        public static async Task <bool> ClearRift()
        {
            if (AdvDia.RiftQuest.Step >= RiftStep.UrshiSpawned)
            {
                return(true);
            }

            if (await EnsureInRift() == CoroutineResult.Running)
            {
                return(false);
            }

            // TODO: Handle Cow level
            if (ExitPortal == null)
            {
                await ExplorationCoroutine.Explore(new HashSet <SNOLevelArea> {
                    AdvDia.CurrentLevelAreaId
                });

                return(false);
            }

            var tmpWorld     = ZetaDia.Globals.WorldSnoId;
            var tmpLevelArea = ZetaDia.CurrentLevelAreaSnoId;


            // There is a rare but possible condition when the character enters the ExitPortal
            // but IsLoadingWorld and IsPlayingCutscene does not return 'true'.
            //
            // In this case the bot runs in an infinite loop of cycling between two portals.
            // The reason is because it was checked for CoroutineResult.Done before and since the implementation
            // of CommonCoroutines.MoveAndInteract only returns Done when the condition is met it was always 'Running' returned.
            //
            // Changing the MoveAndInteract breaks navigation due to the wait timout. Adding the change of the
            // level and world area ids in the condition leads to returning NoAction in second iteration.
            //
            // Due to these reasons we simply ignore the Coroutine.Result in that specific case and everything
            // is fixed and working.
            //
            // Don't change that. You have been warned. It works like it is now.
            await CommonCoroutines.MoveAndInteract(
                ExitPortal,
                () => ZetaDia.Globals.IsLoadingWorld ||
                ZetaDia.Globals.IsPlayingCutscene);

            if (tmpLevelArea != ZetaDia.CurrentLevelAreaSnoId ||
                tmpWorld != ZetaDia.Globals.WorldSnoId)
            {
                PreviousWorld = tmpWorld;
                PreviousLevel = tmpLevelArea;
            }

            return(false);
        }
예제 #11
0
 public async Task <bool> Coroutine()
 {
     if (await ExplorationCoroutine.Explore(new HashSet <int> {
         LevelAreaId
     }))
     {
         _isDone = true;
         return(true);
     }
     return(false);
 }
예제 #12
0
        private async Task<bool> Searching()
        {
            SafeZerg.Instance.DisableZerg();

            if (_objectiveLocation == Vector3.Zero)
                ScanForObjective();
            if (_objectiveLocation != Vector3.Zero)
            {
                State = States.Moving;
                return false;
            }
            var levelArea = BountyData != null ? BountyData.LevelAreaIds : new HashSet<int> {ZetaDia.CurrentLevelAreaSnoId};
            if (!await ExplorationCoroutine.Explore(levelArea)) return false;
            Core.Scenes.Reset();
            return false;
        }
예제 #13
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);
        }
예제 #14
0
 private async Task <bool> SearchingForUrshi()
 {
     EnablePulse();
     if (_urshiLocation != Vector3.Zero)
     {
         State = States.MovingToUrshi;
         return(false);
     }
     if (!await ExplorationCoroutine.Explore(new HashSet <int> {
         AdvDia.CurrentLevelAreaId
     }))
     {
         return(false);
     }
     Logger.Info("[Rift] Where are you, my dear Urshi!");
     ScenesStorage.Reset();
     return(false);
 }
예제 #15
0
        private async Task <bool> SearchingForTownstoneOrExitPortal()
        {
            EnablePulse();
            if (_nextLevelPortalLocation != Vector3.Zero)
            {
                State = States.MovingToExitPortal;
                return(false);
            }

            if (!await ExplorationCoroutine.Explore(new HashSet <int> {
                AdvDia.CurrentLevelAreaId
            }))
            {
                return(false);
            }
            ScenesStorage.Reset();
            return(false);
        }
예제 #16
0
 private async Task <bool> SearchingForBoss()
 {
     EnablePulse();
     if (_bossLocation != Vector3.Zero)
     {
         State = States.MovingToBoss;
         return(false);
     }
     if (!await ExplorationCoroutine.Explore(new HashSet <int> {
         AdvDia.CurrentLevelAreaId
     }))
     {
         return(false);
     }
     Logger.Info("[Rift] The Boss must be scared, but we will find him!");
     ScenesStorage.Reset();
     return(false);
 }
 private async Task <bool> Searching()
 {
     if (_objectiveLocation == Vector3.Zero)
     {
         ScanForObjective();
     }
     if (_objectiveLocation != Vector3.Zero)
     {
         State = States.Moving;
         return(false);
     }
     if (!await ExplorationCoroutine.Explore(BountyData.LevelAreaIds))
     {
         return(false);
     }
     ScenesStorage.Reset();
     return(false);
 }
예제 #18
0
 private async Task <bool> SearchingForHolyCow()
 {
     EnablePulse();
     if (_holyCowLocation != Vector3.Zero)
     {
         Logger.Info("[Rift] Mooooo!");
         State = States.MovingToHolyCow;
         return(false);
     }
     if (!await ExplorationCoroutine.Explore(new HashSet <int> {
         AdvDia.CurrentLevelAreaId
     }))
     {
         return(false);
     }
     Logger.Info("[Rift] I am no butcher, where is this cow?");
     ScenesStorage.Reset();
     return(false);
 }
예제 #19
0
        private async Task <bool> Searching()
        {
            if (_hostileLocation == Vector3.Zero)
            {
                _hostileLocation = FindNearestHostileUnitLocation();
                if (_hostileLocation != Vector3.Zero)
                {
                    State = States.KillingHostile;
                    return(false);
                }
            }

            if (!await ExplorationCoroutine.Explore(BountyData.LevelAreaIds))
            {
                return(false);
            }
            ExplorationGrid.Instance.WalkableNodes.ForEach(n => { n.IsVisited = false; });
            return(false);
        }
예제 #20
0
        private async Task <bool> SearchingForUrshi()
        {
            EnablePulse();
            if (_urshiLocation != Vector3.Zero)
            {
                State = States.MovingToUrshi;
                return(false);
            }
            if (!await ExplorationCoroutine.Explore(new HashSet <int> {
                AdvDia.CurrentLevelAreaId
            }))
            {
                Core.Logger.Log("[UpgradeGems] Exploration for urshi has failed, the sadness!");
                State = States.Failed;
                return(false);
            }

            Core.Logger.Log("[UpgradeGems] Where are you, my dear Urshi!");
            Core.Scenes.Reset();
            return(false);
        }
예제 #21
0
        private async Task <bool> SearchingForExitPortal()
        {
            if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore && AdvDia.RiftQuest.Step == RiftStep.Cleared)
            {
                State = States.SearchingForTownstoneOrExitPortal;
                return(false);
            }
            EnablePulse();
            if (_nextLevelPortalLocation != Vector3.Zero)
            {
                State = States.MovingToExitPortal;
                return(false);
            }

            if (!await ExplorationCoroutine.Explore(new HashSet <int> {
                AdvDia.CurrentLevelAreaId
            }))
            {
                return(false);
            }
            ScenesStorage.Reset();
            return(false);
        }
예제 #22
0
        public static async Task <bool> ClearRift()
        {
            if (AdvDia.RiftQuest.Step >= RiftStep.UrshiSpawned)
            {
                return(true);
            }

            if (await EnsureInRift() == CoroutineResult.Running)
            {
                return(false);
            }

            // TODO: Handle Cow level
            if (ExitPortal == null)
            {
                await ExplorationCoroutine.Explore(new HashSet <SNOLevelArea> {
                    AdvDia.CurrentLevelAreaId
                });

                return(false);
            }

            var tmpWorld     = ZetaDia.Globals.WorldSnoId;
            var tmpLevelArea = ZetaDia.CurrentLevelAreaSnoId;

            if (await CommonCoroutines.MoveAndInteract(
                    ExitPortal,
                    () => ZetaDia.Globals.IsLoadingWorld ||
                    ZetaDia.Globals.IsPlayingCutscene) ==
                CoroutineResult.Done)
            {
                PreviousWorld = tmpWorld;
                PreviousLevel = tmpLevelArea;
            }

            return(false);
        }