Beispiel #1
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();
            }
        }
        private async Task <bool> Moving()
        {
            if (_timeout.IsFinished)
            {
                State = States.Failed;
                return(false);
            }
            if (!await NavigationCoroutine.MoveTo(_objectiveLocation, 1))
            {
                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.FindUnit(_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);
        }
Beispiel #3
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);
 }
Beispiel #4
0
        private void ZergCheck()
        {
            if (!_zergEnabled || ZetaDia.Me == null || !ZetaDia.Me.IsValid)
            {
                return;
            }

            var  corruptGrowthDetectionRadius = ZetaDia.Service.Hero.Class == ActorClass.Barbarian ? 30 : 20;
            bool combatState  = ZetaDia.Me.HitpointsCurrentPct <= 0.8f;
            bool eliteInRange = TargetUtil.IsEliteTargetInRange(TrinityCombat.Routines.Current.EliteRange) && Legendary.Ingeom.IsEquipped;

            if (eliteInRange)
            {
                Core.Logger.Verbose($"Turning off zerg because Elite is in Range and we have InGeom Equipped.");
                combatState = true;
            }

            if (!combatState)
            {
                var thing =
                    ZetaDia.Actors.GetActorsOfType <DiaUnit>(true).FirstOrDefault(u =>
                                                                                  u.IsFullyValid() && u.IsAlive && (KeywardenDataFactory.GoblinSNOs.Contains(u.ActorSnoId) ||
                                                                                                                    (KeywardenDataFactory.A4CorruptionSNOs.Contains(u.ActorSnoId) && u.IsAlive &
                                                                                                                     u.Position.Distance(AdvDia.MyPosition) <= corruptGrowthDetectionRadius)));

                if (thing != null)
                {
                    Core.Logger.Verbose($"Turning off zerg because either corrupt growth or goblin nearby. {thing.Name} ({thing.ActorSnoId}) Dist:{thing.Distance}");
                    combatState = true;
                }
            }

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

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

            var units = ZetaDia.Actors.GetActorsOfType <DiaUnit>(true).ToList();

            if (units.Any(u => CorruptGrowthIds.Contains(u.ActorSnoId) && u.Distance < 30f))
            {
                Core.Logger.Verbose($"Turning off zerg because corrupt growth is nearby");
                combatState = true;
            }

            var health          = ZetaDia.Me.HitpointsCurrentPct;
            var closeUnitsCount = units.Count(u => u.IsFullyValid() && u.IsHostile && u.IsAlive && u.Position.Distance(AdvDia.MyPosition) <= 15f);

            if (closeUnitsCount >= 8 || (closeUnitsCount >= 3 && health <= 0.6))
            {
                Core.Logger.Verbose($"Turning off zerg because {closeUnitsCount} units nearby and health is {health}. Distance={1}");
                combatState = true;
            }

            if (combatState)
            {
                SetPreviousCombatMode();
            }
            else
            {
                SetSafeZergCombatMode();
            }
        }