Пример #1
0
 public static int LowerSearchRadius(int currentSearchRadius)
 {
     if (_radiusChangeCount >= 2)
     {
         Logger.Info(
             "[ActorFinder] It looks like we couldn't path to the destination, lowering the search radius.");
         _radiusChangeCount = 0;
         return(100);
     }
     _radiusChangeCount++;
     if (currentSearchRadius >= 1500)
     {
         return(currentSearchRadius / 2);
     }
     if (currentSearchRadius >= 500)
     {
         return(currentSearchRadius - 100);
     }
     if (currentSearchRadius >= 100)
     {
         return(currentSearchRadius - 50);
     }
     if (currentSearchRadius > 20)
     {
         return(currentSearchRadius - 10);
     }
     return(currentSearchRadius);
 }
Пример #2
0
        private void ScanForBoss()
        {
            var portalMarker = AdvDia.CurrentWorldMarkers.FirstOrDefault(m => m.Id >= 0 && m.Id <= 200);

            if (portalMarker != null)
            {
                _bossLocation = portalMarker.Position;
            }
            if (_bossLocation == Vector3.Zero)
            {
                var boss =
                    ZetaDia.Actors.GetActorsOfType <DiaUnit>()
                    .FirstOrDefault(a => a.IsFullyValid() && a.CommonData.IsUnique);
                if (boss != null)
                {
                    if (boss.IsAlive)
                    {
                        _bossLocation = boss.Position;
                    }
                }
            }
            if (_bossLocation != Vector3.Zero)
            {
                Logger.Info("[Rift] The Boss is near.");
                State = States.MovingToBoss;
                Logger.Debug("[Rift] Found the boss at distance {0}", AdvDia.MyPosition.Distance2D(_bossLocation));
            }
        }
Пример #3
0
 private void ScanForObjective()
 {
     if (PluginTime.ReadyToUse(_lastScanTime, 1000))
     {
         _lastScanTime = PluginTime.CurrentMillisecond;
         if (_actorId != 0)
         {
             _objectiveLocation = BountyHelpers.ScanForActorLocation(_actorId, _objectiveScanRange);
         }
         if (_objectiveLocation != Vector3.Zero)
         {
             using (new PerformanceLogger("[MoveToObject] Path to Objective Check", true))
             {
                 //if ((Navigator.GetNavigationProviderAs<DefaultNavigationProvider>().CanFullyClientPathTo(_objectiveLocation)))
                 //{
                 Logger.Info("[MoveToObject] Found the objective at distance {0}",
                             AdvDia.MyPosition.Distance2D(_objectiveLocation));
                 //}
                 //else
                 //{
                 //    Logger.Debug("[MoveToObject] Found the objective at distance {0}, but cannot get a path to it.",
                 //        AdvDia.MyPosition.Distance2D(_objectiveLocation));
                 //    _objectiveLocation = Vector3.Zero;
                 //}
             }
         }
     }
 }
Пример #4
0
        private async Task <bool> TalkToOrek()
        {
            DisablePulse();
            if (AdvDia.RiftQuest.State == QuestState.InProgress && AdvDia.RiftQuest.Step == RiftStep.Cleared)
            {
                if (!await _talkToOrekCoroutine.GetCoroutine())
                {
                    return(false);
                }
                _talkToOrekCoroutine.Reset();
                if (AdvDia.RiftQuest.Step == RiftStep.Cleared)
                {
                    State = States.MoveToOrek;
                    return(false);
                }
                await Coroutine.Sleep(1200);

                await Coroutine.Wait(TimeSpan.FromSeconds(5), () => !ZetaDia.Me.IsParticipatingInTieredLootRun);

                if (ZetaDia.Me.IsParticipatingInTieredLootRun)
                {
                    Logger.Info("[Rift] Oh well, I seem to think that the rift is still active, that means I'll not be able to clear out my packs properly, sorry in advance.");
                }
            }

            _experienceTracker.StopAndReport("Rift");
            _experienceTracker.Start();
            State = States.TownRun;
            return(false);
        }
        private void ScanForObjective()
        {
            if (_previouslyFoundLocation != Vector3.Zero && PluginTime.ReadyToUse(_returnTimeForPreviousLocation, 60000))
            {
                _objectiveLocation             = _previouslyFoundLocation;
                _previouslyFoundLocation       = Vector3.Zero;
                _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
                Logger.Debug("[EnterLevelArea] Returning previous objective location.");

                return;
            }
            if (PluginTime.ReadyToUse(_lastScanTime, 250))
            {
                _lastScanTime = PluginTime.CurrentMillisecond;
                if (_portalMarker != 0)
                {
                    _objectiveLocation = BountyHelpers.ScanForMarkerLocation(_portalMarker, _objectiveScanRange);
                }
                // Belial
                if (_objectiveLocation == Vector3.Zero && _portalActorId == 159574)
                {
                    _objectiveLocation = BountyHelpers.ScanForActorLocation(_portalActorId, _objectiveScanRange);
                }
                //if (_objectiveLocation == Vector3.Zero && _portalActorId != 0)
                //{
                //    _objectiveLocation = BountyHelpers.ScanForActorLocation(_portalActorId, _objectiveScanRange);
                //}
                if (_objectiveLocation != Vector3.Zero)
                {
                    Logger.Info("[EnterLevelArea] Found the objective at distance {0}", AdvDia.MyPosition.Distance2D(_objectiveLocation));
                }
            }
        }
Пример #6
0
        private bool OnNewRiftLevel()
        {
            EnablePulse();
            RiftData.AddEntryPortal();

            if (AdvDia.CurrentLevelAreaId == 276150 && !_holyCowEventCompleted)
            {
                _possiblyCowLevel = true;
            }
            if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore && AdvDia.RiftQuest.Step == RiftStep.Cleared)
            {
                State = States.SearchingForTownstoneOrExitPortal;
            }
            else
            {
                State = States.SearchingForExitPortal;
            }
            if (Randomizer.GetRandomNumber(1, 10) > 5)
            {
                Logger.Info("[Rift] Let the massacre continue!");
            }
            else
            {
                Logger.Info("[Rift] Crom, Count the Dead!");
            }
            return(false);
        }
Пример #7
0
        private async Task <bool> Moving()
        {
            EnablePulse();
            TargetingHelper.TurnCombatOn();

            if (!await NavigationCoroutine.MoveTo(_keywardenLocation, 15))
            {
                return(false);
            }

            if (_keywardenData.IsAlive)
            {
                _keywardenLocation = GetKeywardenLocation();
                if (_keywardenLocation == Vector3.Zero)
                {
                    State = States.Searching;
                }
            }
            else
            {
                Logger.Info("[Keywarden] Keywarden shish kebab!");
                State = States.Waiting;
            }
            return(false);
        }
Пример #8
0
 private async Task <bool> MovingToBoss()
 {
     if (AdvDia.RiftQuest.Step == RiftStep.Cleared)
     {
         if (_RiftType == RiftType.Nephalem && PluginSettings.Current.NephalemRiftFullExplore)
         {
             State = States.SearchingForTownstoneOrExitPortal;
         }
         else
         {
             State = States.Completed;
         }
     }
     EnablePulse();
     if (!await NavigationCoroutine.MoveTo(_bossLocation, 5))
     {
         return(false);
     }
     if (AdvDia.MyPosition.Distance(_bossLocation) > 50)
     {
         _bossLocation = Vector3.Zero;
         State         = States.SearchingForBoss;
         return(false);
     }
     _bossLocation = Vector3.Zero;
     if (AdvDia.RiftQuest.Step != RiftStep.Cleared)
     {
         Logger.Info("[Rift] You will suffer and die, ugly creature!");
         State = States.KillingBoss;
     }
     return(false);
 }
Пример #9
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);
        }
Пример #10
0
 private bool TownRun()
 {
     Logger.Debug("[TownRun] BrainBehavior.IsVendoring is {0}", BrainBehavior.IsVendoring);
     Logger.Debug("[TownRun] ZetaDia.Me.IsParticipatingInTieredLootRun is {0}", ZetaDia.Me.IsParticipatingInTieredLootRun);
     Logger.Debug("[TownRun] AdvDia.RiftQuest.State is {0}", AdvDia.RiftQuest.State);
     Logger.Debug("[TownRun] AdvDia.RiftQuest.Step is {0}", AdvDia.RiftQuest.Step);
     DisablePulse();
     if (BrainBehavior.IsVendoring)
     {
         return(false);
     }
     if (!_townRunInitiated)
     {
         _townRunInitiated = true;
         BrainBehavior.ForceTownrun(" We need it.", true);
         return(false);
     }
     _townRunInitiated = false;
     if (AdvDia.RiftQuest.Step == RiftStep.Completed)
     {
         State = States.WaitForRiftCountdown;
         Logger.Info("[Rift] Tick tock, tick tock...");
     }
     else
     {
         State = States.NotStarted;
         _moveToRiftStoneCoroutine.Reset();
     }
     return(false);
 }
Пример #11
0
        public static int LowerSearchRadius(int currentSearchRadius)
        {
            var radius = currentSearchRadius;

            if (currentSearchRadius >= 1500)
            {
                radius = currentSearchRadius / 2;
            }
            else if (currentSearchRadius >= 500)
            {
                radius = currentSearchRadius - 100;
            }
            else if (currentSearchRadius >= 100)
            {
                radius = currentSearchRadius - 50;
            }
            else if (currentSearchRadius > 20)
            {
                radius = currentSearchRadius - 10;
            }

            if (_radiusChangeCount >= 2)
            {
                Logger.Info("[ActorFinder] It looks like we couldn't path to the destination, lowering the search radius (New Radius = {0})", radius);
                _radiusChangeCount = 0;
            }
            _radiusChangeCount++;

            return(radius);
        }
Пример #12
0
        private async Task <bool> UpgradingGems()
        {
            if (RiftData.VendorDialog.IsVisible && RiftData.ContinueButton.IsVisible && RiftData.ContinueButton.IsEnabled)
            {
                Logger.Debug("[Rift] Clicking to Continue button.");
                RiftData.ContinueButton.Click();
                RiftData.VendorCloseButton.Click();
                await Coroutine.Sleep(2000);

                return(false);
            }

            var gemToUpgrade = GetUpgradeTarget(_enableGemUpgradeLogs);

            if (gemToUpgrade == null)
            {
                Logger.Info("[Rift] I couldn't find any gems to upgrade, failing.");
                State = States.Failed;
                return(false);
            }
            _enableGemUpgradeLogs = false;
            if (AdvDia.RiftQuest.Step == RiftStep.Cleared)
            {
                Logger.Debug("[Rift] Rift Quest is completed, returning to town");
                State = States.Completed;
                return(false);
            }

            Logger.Debug("[Rift] Gem upgrades left before the attempt: {0}", ZetaDia.Me.JewelUpgradesLeft);
            if (!await CommonCoroutines.AttemptUpgradeGem(gemToUpgrade))
            {
                Logger.Debug("[Rift] Gem upgrades left after the attempt: {0}", ZetaDia.Me.JewelUpgradesLeft);
                return(false);
            }
            var gemUpgradesLeft = ZetaDia.Me.JewelUpgradesLeft;

            if (_gemUpgradesLeft != gemUpgradesLeft)
            {
                _gemUpgradesLeft      = gemUpgradesLeft;
                _enableGemUpgradeLogs = true;
            }
            if (gemUpgradesLeft == 0)
            {
                //TODO add await here by andrew
                await Coroutine.Sleep(8000);

                Logger.Debug("[Rift] Finished all upgrades, returning to town.");
                State = States.Completed;
                return(false);
            }


            return(false);
        }
Пример #13
0
        private async Task <bool> OpeningRift()
        {
            if (RiftData.RiftWorldIds.Contains(AdvDia.CurrentWorldId))
            {
                State = States.OnNewRiftLevel;
                return(false);
            }
            DisablePulse();
            if (!await _interactWithRiftStoneInteractionCoroutine.GetCoroutine())
            {
                return(false);
            }
            await Coroutine.Wait(2500, () => UIElements.RiftDialog.IsVisible);

            _interactWithRiftStoneInteractionCoroutine.Reset();
            if (!UIElements.RiftDialog.IsVisible)
            {
                return(false);
            }
            _riftStartTime = DateTime.UtcNow;

            long empoweredCost;

            if (_RiftType == RiftType.Greater && _options.IsEmpowered && RiftData.EmpoweredRiftCost.TryGetValue(_level, out empoweredCost) && ZetaDia.PlayerData.Coinage >= empoweredCost)
            {
                Logger.Info("Opening Empowered Greater Rift (Cost={0})", empoweredCost);
                ZetaDia.Me.OpenRift(_level, true);
            }
            else
            {
                Logger.Info("Opening {0} Rift", _RiftType);
                ZetaDia.Me.OpenRift(_level);
            }

            if (_level == -1)
            {
                await Coroutine.Sleep(5000);

                if (IsRiftPortalOpen)
                {
                    _prePortalWorldDynamicId = AdvDia.CurrentWorldDynamicId;
                    State = States.EnteringRift;
                }
            }
            else
            {
                await Coroutine.Wait(30000, () => ZetaDia.CurrentRift.IsStarted && RiftData.RiftWorldIds.Contains(AdvDia.CurrentWorldId) && !ZetaDia.IsLoadingWorld);

                DisablePulse();
                State = States.EnteringGreaterRift;
            }
            return(false);
        }
Пример #14
0
 private async Task <bool> InteractingWithHolyCow()
 {
     EnablePulse();
     if (!await _talkToHolyCowCoroutine.GetCoroutine())
     {
         return(false);
     }
     _talkToHolyCowCoroutine.Reset();
     Logger.Info("[Rift] Mooo moooo....");
     State = States.SearchingForExitPortal;
     return(false);
 }
Пример #15
0
 private async Task <bool> MovingToHolyCow()
 {
     EnablePulse();
     if (!await NavigationCoroutine.MoveTo(_holyCowLocation, 5))
     {
         return(false);
     }
     _holyCowLocation = Vector3.Zero;
     Logger.Info("[Rift] Mooooo?");
     State = States.InteractingWithHolyCow;
     return(false);
 }
Пример #16
0
 private void ScanForObjective()
 {
     if (_previouslyFoundLocation != Vector3.Zero && PluginTime.ReadyToUse(_returnTimeForPreviousLocation, 60000))
     {
         _objectiveLocation       = _previouslyFoundLocation;
         _previouslyFoundLocation = Vector3.Zero;
         Logger.Debug("[MoveToScenePosition] Returning previous objective location.");
         return;
     }
     if (PluginTime.ReadyToUse(_lastScanTime, 1000))
     {
         _lastScanTime = PluginTime.CurrentMillisecond;
         if (!string.IsNullOrEmpty(_sceneName))
         {
             var scene = ScenesStorage.CurrentWorldScenes.OrderBy(s => s.Center.DistanceSqr(AdvDia.MyPosition.ToVector2())).FirstOrDefault(s => s.Name.Contains(_sceneName));
             if (scene != null)
             {
                 _worldScene        = scene;
                 _objectiveLocation = _worldScene.GetWorldPosition(_position);
             }
         }
         else if (!string.IsNullOrEmpty(_tempSceneName))
         {
             var scene = ScenesStorage.CurrentWorldScenes.OrderBy(s => s.Center.DistanceSqr(AdvDia.MyPosition.ToVector2())).FirstOrDefault(s => s.Name == _tempSceneName);
             if (scene != null)
             {
                 _worldScene        = scene;
                 _objectiveLocation = _worldScene.GetWorldPosition(_position);
             }
         }
         //if (_objectiveLocation == Vector3.Zero && _actorId != 0)
         //{
         //    _objectiveLocation = BountyHelpers.ScanForActorLocation(_actorId, _objectiveScanRange);
         //}
         if (_objectiveLocation != Vector3.Zero)
         {
             using (new PerformanceLogger("[MoveToScenePosition] Path to Objective Check", true))
             {
                 //if ((Navigator.GetNavigationProviderAs<DefaultNavigationProvider>().CanFullyClientPathTo(_objectiveLocation)))
                 //{
                 Logger.Info("[MoveToScenePosition] Found the objective at distance {0}",
                             AdvDia.MyPosition.Distance2D(_objectiveLocation));
                 //}
                 //else
                 //{
                 //    Logger.Debug("[MoveToMapMarker] Found the objective at distance {0}, but cannot get a path to it.",
                 //        AdvDia.MyPosition.Distance2D(_objectiveLocation));
                 //    _objectiveLocation = Vector3.Zero;
                 //}
             }
         }
     }
 }
Пример #17
0
        private bool NotStarted()
        {
            DisablePulse();
            _keywardenLocation = Vector3.Zero;

            if (!_keywardenData.IsAlive)
            {
                State = States.Completed;
                return(false);
            }
            TargetingHelper.TurnCombatOn();
            Logger.Info("[Keywarden] Lets go find da guy with da machina, shall we?");
            State = AdvDia.CurrentLevelAreaId == _keywardenData.LevelAreaId ? States.Searching : States.TakingWaypoint;
            return(false);
        }
Пример #18
0
        private void ScanForObjective()
        {
            if (_previouslyFoundLocation != Vector3.Zero && PluginTime.ReadyToUse(_returnTimeForPreviousLocation, 60000))
            {
                _objectiveLocation             = _previouslyFoundLocation;
                _previouslyFoundLocation       = Vector3.Zero;
                _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond;
                Logger.Debug("[MoveToMapMarker] Returning previous objective location.");

                return;
            }
            if (PluginTime.ReadyToUse(_lastScanTime, 1000))
            {
                _lastScanTime = PluginTime.CurrentMillisecond;
                if (_marker != 0)
                {
                    if (_marker == -1)
                    {
                        _objectiveLocation = BountyHelpers.ScanForMarkerLocation(0, _objectiveScanRange);
                    }
                    else
                    {
                        _objectiveLocation = BountyHelpers.ScanForMarkerLocation(_marker, _objectiveScanRange);
                    }
                }
                //if (_objectiveLocation == Vector3.Zero && _actorId != 0)
                //{
                //    _objectiveLocation = BountyHelpers.ScanForActorLocation(_actorId, _objectiveScanRange);
                //}
                if (_objectiveLocation != Vector3.Zero)
                {
                    using (new PerformanceLogger("[MoveToMapMarker] Path to Objective Check", true))
                    {
                        //if ((Navigator.GetNavigationProviderAs<DefaultNavigationProvider>().CanFullyClientPathTo(_objectiveLocation)))
                        //{
                        Logger.Info("[MoveToMapMarker] Found the objective at distance {0}",
                                    AdvDia.MyPosition.Distance2D(_objectiveLocation));
                        //}
                        //else
                        //{
                        //    Logger.Debug("[MoveToMapMarker] Found the objective at distance {0}, but cannot get a path to it.",
                        //        AdvDia.MyPosition.Distance2D(_objectiveLocation));
                        //    _objectiveLocation = Vector3.Zero;
                        //}
                    }
                }
            }
        }
Пример #19
0
        private bool InTown()
        {
            DisablePulse();
            if (AdvDia.CurrentWorldId != ExplorationData.ActHubWorldIds[Act.A1])
            {
                State = States.GoingToAct1Hub;
                return(false);
            }
            if (AdvDia.RiftQuest.State == QuestState.Completed)
            {
                State = States.TownRun;
                return(false);
            }
            switch (AdvDia.RiftQuest.Step)
            {
            case RiftStep.Cleared:
                Logger.Info("[Rift] I think I should go and brag to Orek about my success.");
                State = States.MoveToOrek;
                return(false);

            case RiftStep.BossSpawned:
                Logger.Info("[Rift] I wonder why am I in town while the boss is spawned in the rift, I'm taking my chances with this portal.");
                State = States.MoveToRiftStone;
                return(false);

            case RiftStep.UrshiSpawned:
                Logger.Info("[Rift] I wonder why am I in town while Urshi spawned in the rift, I'm taking my chances with this portal.");
                State = States.MoveToRiftStone;
                return(false);

            case RiftStep.KillingMobs:
                Logger.Info("[Rift] I wonder why am I in town while there are many mobs to kill in the rift, I'm taking my chances with this portal.");
                State = States.MoveToRiftStone;
                return(false);

            case RiftStep.NotStarted:
                State = States.MoveToRiftStone;
                _moveToRiftStoneCoroutine.Reset();
                Logger.Info("[Rift] Time to kill some scary monsters. Chop chop!");
                return(false);

            default:
                Logger.Info("[Rift] I really don't know what to do now.");
                State = States.Failed;
                return(false);
            }
        }
Пример #20
0
        private void ScanForUrshi()
        {
            var urshi =
                ZetaDia.Actors.GetActorsOfType <DiaUnit>()
                .FirstOrDefault(a => a.IsFullyValid() && a.ActorSNO == RiftData.UrshiSNO);

            if (urshi != null)
            {
                _urshiLocation = urshi.Position;
            }
            if (_urshiLocation != Vector3.Zero)
            {
                Logger.Info("[Rift] Urshi is near.");
                State = States.MovingToUrshi;
                Logger.Debug("[Rift] Found Urshi at distance {0}", AdvDia.MyPosition.Distance2D(_urshiLocation));
            }
        }
Пример #21
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);
 }
Пример #22
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);
 }
Пример #23
0
        private async Task <bool> MoveToMarker()
        {
            if (_markerCooldownUntil > DateTime.UtcNow)
            {
                return(true);
            }

            var marker = GetKeywardenMarker();

            if (marker == null)
            {
                return(true);
            }

            if (marker.Position.Distance(AdvDia.MyPosition) < 20f)
            {
                Logger.Info("[Keywarden] Finished Following marker");
                return(true);
            }

            if (_markerCoroutine == null)
            {
                Logger.Info("[Keywarden] Following a keywarden marker, lets see where it goes");
                _markerCoroutine = new MoveToMapMarkerCoroutine(-1, AdvDia.CurrentWorldId, marker.NameHash, 0, false);
            }

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

            if (_markerCoroutine.State == MoveToMapMarkerCoroutine.States.Failed)
            {
                _markerCooldownUntil = DateTime.UtcNow.Add(TimeSpan.FromMinutes(1));
                Logger.Info("[Keywarden] Looks like we can't find a path to the keywarden marker :(");
                return(true);
            }

            Logger.Info("[Keywarden] Finished Following marker");
            return(true);
        }
 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)
         {
             _objectiveLocation = BountyHelpers.ScanForActorLocation(_actorId, _objectiveScanRange);
         }
         if (_objectiveLocation != Vector3.Zero)
         {
             Logger.Info("[InteractWithUnit] Found the objective at distance {0}", AdvDia.MyPosition.Distance2D(_objectiveLocation));
         }
     }
 }
Пример #25
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);
 }
Пример #26
0
        private ACDItem GetUpgradeTarget(bool enableLog)
        {
            ZetaDia.Actors.Update();
            var gems = PluginSettings.Current.Gems;

            gems.UpdateGems(ZetaDia.Me.InTieredLootRunLevel + 1, PluginSettings.Current.GreaterRiftPrioritizeEquipedGems);

            var minChance       = PluginSettings.Current.GreaterRiftGemUpgradeChance;
            var upgradeableGems =
                gems.Gems.Where(g => g.UpgradeChance >= minChance && !g.MaxRank).ToList();

            if (upgradeableGems.Count == 0)
            {
                if (enableLog)
                {
                    Logger.Info("[Rift] Couldn't find any gems which is over the minimum upgrade change, upgrading the gem with highest upgrade chance");
                }
                upgradeableGems = gems.Gems.Where(g => !g.MaxRank).OrderByDescending(g => g.UpgradeChance).ToList();
            }
            if (upgradeableGems.Count == 0)
            {
                if (enableLog)
                {
                    Logger.Info("[Rift] Looks like you have no legendary gems, failing.");
                }
                State = States.Failed;
                return(null);
            }
            var gemToUpgrade = upgradeableGems.First();

            if (enableLog)
            {
                Logger.Info("[Rift] Attempting to upgrade {0}", gemToUpgrade.DisplayName);
            }
            var acdGem =
                ZetaDia.Actors.GetActorsOfType <ACDItem>()
                .FirstOrDefault(
                    i =>
                    i.ItemType == ItemType.LegendaryGem && i.ActorSNO == gemToUpgrade.SNO &&
                    i.JewelRank == gemToUpgrade.Rank);

            return(acdGem);
        }
Пример #27
0
 private void ScanForObjective()
 {
     if (_marker != 0)
     {
         _center = BountyHelpers.ScanForMarkerLocation(_marker, OBJECTIVE_SCAN_RANGE);
     }
     if (_center == Vector3.Zero && _actorId != 0)
     {
         _center = BountyHelpers.ScanForActorLocation(_actorId, OBJECTIVE_SCAN_RANGE);
     }
     if (_center == Vector3.Zero)
     {
         _center = AdvDia.MyPosition;
     }
     if (_center != Vector3.Zero)
     {
         Logger.Info("[ClearAreaForNSeconds] Found the objective at distance {0}", AdvDia.MyPosition.Distance2D(_center));
     }
 }
Пример #28
0
        private bool TownRun()
        {
            Logger.Debug("[TownRun] BrainBehavior.IsVendoring is {0}", BrainBehavior.IsVendoring);
            Logger.Debug("[TownRun] ZetaDia.Me.IsParticipatingInTieredLootRun is {0}", ZetaDia.Me.IsParticipatingInTieredLootRun);
            Logger.Debug("[TownRun] AdvDia.RiftQuest.State is {0}", AdvDia.RiftQuest.State);
            Logger.Debug("[TownRun] AdvDia.RiftQuest.Step is {0}", AdvDia.RiftQuest.Step);
            DisablePulse();
            if (BrainBehavior.IsVendoring)
            {
                return(false);
            }
            if (!_townRunInitiated)
            {
                _townRunInitiated = true;
                BrainBehavior.ForceTownrun(" We need it.", true);
                return(false);
            }

            _riftCounter++;
            Logger.Info("Rifts Completed = {0}", _riftCounter);

            if (_options.RiftCount > 0 && _riftCounter >= _options.RiftCount)
            {
                Logger.Info("[Rift] Rift limit set on profile tag reached. ({0})", _options.RiftCount);
                State = States.Completed;
                return(Finished());
            }

            _townRunInitiated = false;
            if (AdvDia.RiftQuest.Step == RiftStep.Completed)
            {
                State = States.WaitForRiftCountdown;
                Logger.Info("[Rift] Tick tock, tick tock...");
            }
            else
            {
                State = States.NotStarted;
                _moveToRiftStoneCoroutine.Reset();
            }
            return(false);
        }
Пример #29
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));
            }
        }
Пример #30
0
 private bool TownstoneFound()
 {
     Logger.Info("[Rift] That's it folks, returning to town.");
     State = States.ReturningToTown;
     return(false);
 }