Ejemplo n.º 1
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.ActorSnoId == 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.ActorSnoId == 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);
 }
Ejemplo n.º 2
0
 public RiftCoroutine(RiftType RiftType)
 {
     _RiftType = RiftType;
     if (RiftType == RiftType.Nephalem)
     {
         _level = -1;
     }
     else
     {
         _level = RiftData.GetGreaterRiftLevel();
     }
 }
Ejemplo n.º 3
0
        public override async Task <bool> StartTask()
        {
            if (Level == 0)
            {
                Level = SelectedRiftType == RiftType.Greater ?
                        RiftData.GetGreaterRiftLevel() :
                        -1;
            }

            _remainingRuns = Math.Max(RiftCount, PluginSettings.Current.RiftCount);
            _remainingRuns = _remainingRuns == 0 ? -1 : _remainingRuns;
            return(false);
        }
Ejemplo n.º 4
0
        public RiftCoroutine(RiftType RiftType, RiftOptions options = null)
        {
            _RiftType = RiftType;
            if (RiftType == RiftType.Nephalem)
            {
                _level = -1;
            }
            else
            {
                _level = RiftData.GetGreaterRiftLevel();
            }

            _id = Guid.NewGuid();

            _options = options ?? new RiftOptions();
        }
Ejemplo n.º 5
0
        private void ScanForExitPortal()
        {
            if (_nextLevelPortalLocation != Vector3.Zero)
            {
                return;
            }
            var portal =
                ZetaDia.Actors.GetActorsOfType <DiaGizmo>(true)
                .Where(
                    g =>
                    g.IsFullyValid() && g.IsPortal && !RiftData.DungeonStoneSNOs.Contains(g.ActorSNO) &&
                    g.Distance < _portalScanRange && g.CommonData.GizmoType != GizmoType.HearthPortal)
                .OrderBy(g => g.Position.Distance2DSqr(AdvDia.MyPosition))
                .FirstOrDefault();

            if (portal != null)
            {
                _nextLevelPortalLocation = portal.Position;
                var currentWorldExitPortalHash = RiftData.GetRiftExitPortalHash(AdvDia.CurrentWorldId);
                var marker = AdvDia.CurrentWorldMarkers.FirstOrDefault(m => m.Position.Distance2D(_nextLevelPortalLocation) < 10);
                if (marker == null)
                {
                    _nextLevelPortalLocation = Vector3.Zero;
                }
                else
                {
                    if (marker.NameHash != currentWorldExitPortalHash)
                    {
                        _nextLevelPortalLocation = Vector3.Zero;
                    }
                }
            }
            if (_nextLevelPortalLocation != Vector3.Zero)
            {
                Logger.Info("[Rift] Oh look! There is a portal over there, let's see what's on the other side.");
                Logger.Debug("[Rift] Found the objective at distance {0}",
                             AdvDia.MyPosition.Distance2D(_nextLevelPortalLocation));
            }
        }
Ejemplo n.º 6
0
        private void PulseChecks()
        {
            if (BrainBehavior.IsVendoring || !ZetaDia.IsInGame || ZetaDia.IsLoadingWorld || ZetaDia.IsPlayingCutscene)
            {
                DisablePulse();
                return;
            }

            //AdvDia.Update(true);

            if (AdvDia.CurrentWorldId == ExplorationData.ActHubWorldIds[Act.A1] && (AdvDia.RiftQuest.Step == RiftStep.KillingMobs || AdvDia.RiftQuest.Step == RiftStep.BossSpawned || AdvDia.RiftQuest.Step == RiftStep.UrshiSpawned))
            {
                if (!EnteringRiftStates.Contains(State))
                {
                    Logger.Info(
                        "[Rift] Oh darn, I managed to return to town, I better go back in the rift before anyone notices.");
                    State = States.MoveToRiftStone;
                    return;
                }
            }

            if (AdvDia.CurrentWorldId == ExplorationData.ActHubWorldIds[Act.A1] && State != States.EnteringRift)
            {
                DisablePulse();
                return;
            }


            if (_currentWorldDynamicId != AdvDia.CurrentWorldDynamicId && _previusWorldDynamicId != AdvDia.CurrentWorldDynamicId && AdvDia.CurrentWorldId != ExplorationData.ActHubWorldIds[Act.A1])
            {
                RiftData.AddEntryPortal();
                _previusWorldDynamicId = _currentWorldDynamicId;
                _currentWorldDynamicId = AdvDia.CurrentWorldDynamicId;
            }


            switch (AdvDia.RiftQuest.Step)
            {
            case RiftStep.BossSpawned:
                if (!BossSpawnedStates.Contains(State))
                {
                    Logger.Info("[Rift] Behold the Rift Boss!");
                    State = States.BossSpawned;
                }
                break;

            case RiftStep.UrshiSpawned:
                if (!UrshiSpawnedStates.Contains(State))
                {
                    _riftEndTime = DateTime.UtcNow;
                    var totalTime = _riftEndTime - _riftStartTime;
                    if (totalTime.TotalSeconds < 3600 && totalTime.TotalSeconds > 0)
                    {
                        Logger.Info("[Rift] All done. (Total Time: {0} mins {1} seconds)", totalTime.Minutes, totalTime.Seconds);
                        Logger.Info("[Rift] Level: {0}", ZetaDia.Me.InTieredLootRunLevel + 1);
                    }
                    else
                    {
                        Logger.Info("[Rift] All done. (Partial rift, no stats available)");
                    }
                    Logger.Info("[Rift] My dear Urshi, I have some gems for you.");
                    State = States.UrshiSpawned;
                }
                break;

            case RiftStep.Cleared:
                if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore && State != States.TownstoneFound)
                {
                    break;
                }
                if (!ClearedStates.Contains(State))
                {
                    _riftEndTime = DateTime.UtcNow;
                    var totalTime = _riftEndTime - _riftStartTime;
                    if (totalTime.TotalSeconds < 3600 && totalTime.TotalSeconds > 0)
                    {
                        Logger.Info("[Rift] All done. (Total Time: {0} mins {1} seconds)", totalTime.Minutes,
                                    totalTime.Seconds);
                    }
                    else
                    {
                        Logger.Info("[Rift] All done. (Partial rift, no stats available)");
                    }
                    State = States.ReturningToTown;
                }
                break;
            }
        }
Ejemplo n.º 7
0
        public void UpdateGemList()
        {
            var greaterRiftLevel = RiftData.GetGreaterRiftLevel();

            Gems.UpdateGems(greaterRiftLevel);
        }
Ejemplo n.º 8
0
        public static async Task <bool> OpenRift(RiftType riftType,
                                                 int maxLevel,
                                                 int maxEmpowerLevel,
                                                 bool shouldEmpower,
                                                 bool runNormalUntilXP)
        {
            if (IsRiftPortalOpen)
            {
                return(IsRiftPortalOpen);
            }

            var riftKeys = CurrentRiftKeyCount;

            if (riftType == RiftType.Greater &&
                riftKeys <= PluginSettings.Current.MinimumKeys &&
                !PluginSettings.Current.GreaterRiftRunNephalem)
            {
                s_logger.Error($"[{nameof(OpenRift)}] You have no Greater Rift Keys. Stopping the bot.");
                BotMain.Stop();
                return(false);
            }

            s_logger.Debug($"[{nameof(OpenRift)}] I have {riftKeys} rift keys.");

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

            if (riftKeys <= PluginSettings.Current.MinimumKeys)
            {
                riftType = RiftType.Nephalem;
            }

            // TODO: Figure out why there is that check against that magic.
            var maximizeXp = runNormalUntilXP &&
                             riftType == RiftType.Greater &&
                             ZetaDia.Me.RestExperience <5000000000 &&
                                                        ZetaDia.Me.RestExperience> -1;

            if (maximizeXp)
            {
                riftType = RiftType.Nephalem;
            }

            var level       = Math.Min(riftType == RiftType.Greater ? RiftData.GetGreaterRiftLevel() : -1, maxLevel);
            var isEmpowered = riftType == RiftType.Greater &&
                              shouldEmpower &&
                              level <= maxEmpowerLevel &&
                              RiftData.EmpoweredRiftCost.TryGetValue(level, out var empoweredCost) &&
                              ZetaDia.Storage.PlayerDataManager.ActivePlayerData.Coinage >=
                              (empoweredCost + PluginSettings.Current.MinimumGold);

            DiaGizmo lrs = LootRunSwitch;

            if (lrs == null)
            {
                await CommonCoroutines.MoveTo(ZetaDia.Actors.GetActorsOfType <DiaGizmo>()
                                              .Where(g => g.Distance > 10f)
                                              .OrderByDescending(g => g.Distance)
                                              .FirstOrDefault());

                return(false);
            }

            if (!s_experienceTracker.IsStarted)
            {
                s_experienceTracker.Start();
            }

            if (await CommonCoroutines.MoveAndInteract(
                    lrs,
                    () => UIElements.RiftDialog.IsVisible) == CoroutineResult.Running)
            {
                return(false);
            }

            ZetaDia.Me.OpenRift(level, isEmpowered);
            return(await Coroutine.Wait(TimeSpan.FromSeconds(2), () => IsRiftPortalOpen));
        }