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);
        }
 private async Task <bool> RunningBounties()
 {
     if (_currentBountyCoroutine == null)
     {
         if (_bountyCoroutines.Count != 0)
         {
             _currentBountyCoroutine = _bountyCoroutines[0];
         }
         else
         {
             if (BountyHelpers.IsActTurninInProgress(Act))
             {
                 State = States.TurningInTheActQuest;
                 return(false);
             }
             State = States.Failed;
             return(false);
         }
     }
     if (!await _currentBountyCoroutine.GetCoroutine())
     {
         return(false);
     }
     BountyStatistics.Report();
     ScenesStorage.Reset();
     if (_currentBountyCoroutine.State == BountyCoroutine.States.Failed)
     {
         //Logger.Info("[ActBounties] Looks like the bounty has failed, skipping the rest of the act.");
         State = States.Failed;
         return(false);
     }
     _bountyCoroutines.Remove(_currentBountyCoroutine);
     _currentBountyCoroutine = null;
     return(false);
 }
Esempio n. 3
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)
                {
                    Logger.Debug("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);
            }
            ScenesStorage.Reset();
            return(false);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
 private bool NotStarted()
 {
     if (!_experienceTracker.IsStarted)
     {
         _experienceTracker.Start();
     }
     SafeZerg.Instance.DisableZerg();
     if (_RiftType == RiftType.Greater)
     {
         _level = RiftData.GetGreaterRiftLevel();
     }
     if (_runningNephalemInsteadOfGreaterRift && AdvDia.StashAndBackpackItems.Any(i => i.IsValid && i.ActorSNO == RiftData.GreaterRiftKeySNO))
     {
         _level    = RiftData.GetGreaterRiftLevel();
         _RiftType = RiftType.Greater;
         _runningNephalemInsteadOfGreaterRift = false;
         return(false);
     }
     if (AdvDia.RiftQuest.State == QuestState.NotStarted && _RiftType == RiftType.Greater && !AdvDia.StashAndBackpackItems.Any(i => i.IsValid && i.ActorSNO == RiftData.GreaterRiftKeySNO))
     {
         if (PluginSettings.Current.GreaterRiftRunNephalem)
         {
             _level    = -1;
             _RiftType = RiftType.Nephalem;
             _runningNephalemInsteadOfGreaterRift = true;
             return(false);
         }
         else
         {
             Logger.Error("You have no Greater Rift Keys. Stopping the bot.");
             BotMain.Stop();
             return(true);
         }
     }
     _currentWorldDynamicId = AdvDia.CurrentWorldDynamicId;
     if (AdvDia.RiftQuest.State == QuestState.InProgress && RiftData.RiftWorldIds.Contains(AdvDia.CurrentWorldId))
     {
         State = States.SearchingForExitPortal;
         return(false);
     }
     State = AdvDia.CurrentWorldId == ExplorationData.ActHubWorldIds[Act.A1] ? States.InTown : States.GoingToAct1Hub;
     if (AdvDia.RiftQuest.State == QuestState.NotStarted)
     {
         ScenesStorage.Reset();
         RiftData.EntryPortals.Clear();
         _currentWorldDynamicId   = 0;
         _previusWorldDynamicId   = 0;
         _bossLocation            = Vector3.Zero;
         _nextLevelPortalLocation = Vector3.Zero;
         _holyCowLocation         = Vector3.Zero;
         _holyCowEventCompleted   = false;
         _possiblyCowLevel        = false;
     }
     return(false);
 }
Esempio n. 8
0
 public static void GameEvents_OnWorldChanged(object sender, EventArgs e)
 {
     if (!Adventurer.IsAdventurerTagRunning())
     {
         Logger.Debug("[BotEvents] Reseting the grids.");
         ScenesStorage.Reset();
     }
     WorldChangeTime = PluginTime.CurrentMillisecond;
     Logger.Debug("[BotEvents] World has changed to WorldId: {0} LevelAreaSnoIdId: {1}", AdvDia.CurrentWorldId, AdvDia.CurrentLevelAreaId);
     EntryPortals.AddEntryPortal();
 }
Esempio n. 9
0
        public static void PulseUpdates()
        {
            var curFrame = ZetaDia.Memory.Executor.FrameCount;

            if (curFrame == _lastUpdate)
            {
                return;
            }
            _lastUpdate = curFrame;
            ScenesStorage.Update();
            ExplorationGrid.PulseSetVisited();
            BountyStatistics.Pulse();
        }
Esempio n. 10
0
        private static void InternalTimerTick(object sender, EventArgs e)
        {
            try
            {
                if (_radarWindow == null)
                {
                    return;
                }

                if (!DataModel.Enabled && DataModel.IsLazyCacheVisible)
                {
                    return;
                }
                //Update();

                if (BotEvents.IsBotRunning)
                {
                    Update();
                }
                else
                {
                    //AdvDia.Update();
                    SafeFrameLock.ExecuteWithinFrameLock(() =>
                    {
                        ScenesStorage.Update();
                        Update();
                    }, true);
                }
                var userControl = _radarWindow.Content as UserControl;
                if (userControl == null)
                {
                    return;
                }

                var canvas = userControl.Content as RadarCanvas.RadarCanvas;
                if (canvas != null)
                {
                    canvas.UpdateData();
                }
            }
            catch (Exception ex)
            {
                if (!ex.Message.Contains("ReadProcessMemory"))
                {
                    Logger.Debug("Exception in CacheUI.InternalTimerTick(). {0} {1} {2}", ex.Message, ex.InnerException,
                                 ex);
                }
            }
        }
 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);
 }
Esempio n. 12
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);
 }
Esempio n. 13
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);
 }
Esempio n. 14
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);
        }
Esempio n. 15
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);
 }
Esempio n. 16
0
        private async Task <bool> GetCoroutine()
        {
            if (_isDone)
            {
                return(true);
            }

            if (PluginEvents.TimeSinceWorldChange < 1000)
            {
                Logger.Debug("[RunActBountiesTag] Sleeping 1 second due to world change");
                await Coroutine.Sleep(1000);
            }

            if (_bounties == null || _bounties.Count == 0)
            {
                if (BountyHelpers.AreAllActBountiesCompleted(Act))
                {
                    if (await _completeActBountiesCoroutine.GetCoroutine())
                    {
                        _isDone = true;
                        return(true);
                    }
                    return(true);
                }
                _isDone = true;
                return(true);
            }
            _currentBounty = _bounties.FirstOrDefault();
            if (_currentBounty != null)
            {
                if (_currentBounty.State != BountyCoroutine.States.Completed && _currentBounty.State != BountyCoroutine.States.Failed)
                {
                    return(await _currentBounty.GetCoroutine());
                }
                ScenesStorage.Reset();

                _bounties.Remove(_currentBounty);
                BountyStatistics.Report();
            }
            return(true);
        }
Esempio n. 17
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);
        }
Esempio n. 18
0
 public static void GameEvents_OnGameJoined(object sender, EventArgs e)
 {
     ScenesStorage.Reset();
     //AdvDia.Update();
 }