Beispiel #1
0
        public void Execute()
        {
            if (Finished || WowInterface.Player.IsCasting)
            {
                return;
            }

            if (!WowInterface.Player.IsInCombat && DateTime.UtcNow.Subtract(LastUnitCheck).TotalMilliseconds >= 1250.0)
            {
                LastUnitCheck = DateTime.UtcNow;
                WowUnit       = WowInterface.ObjectManager.WowObjects
                                .OfType <WowUnit>()
                                .Where(e => !e.IsDead && NpcIds.Contains(WowGuid.ToNpcId(e.Guid)) && !e.IsNotAttackable &&
                                       WowInterface.HookManager.WowGetUnitReaction(WowInterface.Player, e) != WowUnitReaction.Friendly)
                                .OrderBy(e => e.Position.GetDistance(WowInterface.Player.Position))
                                .Take(3)
                                .OrderBy(e => WowInterface.PathfindingHandler.GetPathDistance((int)WowInterface.ObjectManager.MapId, WowInterface.Player.Position, e.Position))
                                .FirstOrDefault();

                // Kill enemies in the path
                if (WowUnit != null && !WowInterface.CombatClass.IsTargetAttackable(WowUnit))
                {
                    var path = WowInterface.PathfindingHandler.GetPath((int)WowInterface.ObjectManager.MapId,
                                                                       WowInterface.Player.Position, WowUnit.Position);
                    if (path != null)
                    {
                        var nearEnemies =
                            WowInterface.ObjectManager.GetEnemiesInPath <WowUnit>(path, 10.0f);
                        if (nearEnemies.Any())
                        {
                            WowUnit = nearEnemies.FirstOrDefault();
                        }
                    }
                }

                if (WowUnit != null)
                {
                    WowInterface.HookManager.WowTargetGuid(WowUnit.Guid);
                }
            }

            if (WowUnit != null)
            {
                SearchAreas.NotifyDetour();
                WowInterface.CombatClass.AttackTarget();
            }
            else if (WowInterface.Player.Position.GetDistance(CurrentSpot) < 3.0f || SearchAreas.HasAbortedPath() || WowInterface.MovementEngine.Status == MovementAction.None)
            {
                CurrentSpot = SearchAreas.GetNextPosition(WowInterface);
                WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, CurrentSpot);
            }
        }
Beispiel #2
0
        public void Execute()
        {
            if (Finished || Bot.Player.IsCasting)
            {
                return;
            }

            if (!SearchAreas.IsPlayerNearSearchArea(Bot) && Bot.Target == null) // if i have target, go nearby don't clear it
            {
                Bot.Wow.ClearTarget();
                IWowUnit = null;
            }

            if (!Bot.Player.IsInCombat &&
                Bot.Target == null)    // if pulling with ranged we have target and yet not in combat
            {
                IWowUnit = Bot.Objects.All
                           .OfType <IWowUnit>()
                           .Where(e => !e.IsDead && !e.IsNotAttackable &&
                                  Bot.Db.GetReaction(Bot.Player, e) != WowUnitReaction.Friendly &&
                                  e.Health > 10 &&   // workaround to filter some critters, would be nice e.CreatureType != WoWCreatureType.Critter
                                  BotMath.SlopeGradientAngle(Bot.Player.Position, e.Position) <= 39.0f)      // check if not too steep
                           .OrderBy(e => e.Position.GetDistance(Bot.Player.Position))
                           .FirstOrDefault();

                if (IWowUnit != null)
                {
                    Bot.Wow.ChangeTarget(IWowUnit.Guid);
                }
            }

            if (IWowUnit != null)
            {
                SearchAreas.NotifyDetour();
                Bot.CombatClass.AttackTarget();
            }
            else if (Bot.Player.Position.GetDistance(CurrentNode) < 3.5f || SearchAreas.HasAbortedPath())
            {
                CurrentNode = SearchAreas.GetNextPosition(Bot);
                Bot.Movement.SetMovementAction(MovementAction.Move, CurrentNode);
            }
        }
        public void Execute()
        {
            if (Finished || WowInterface.Player.IsCasting)
            {
                return;
            }

            if (!SearchAreas.IsPlayerNearSearchArea(WowInterface))
            {
                WowInterface.HookManager.WowClearTarget();
                WowUnit = null;
            }

            if (!WowInterface.Player.IsInCombat)
            {
                WowUnit = WowInterface.ObjectManager.WowObjects
                          .OfType <WowUnit>()
                          .Where(e => !e.IsDead && !e.IsNotAttackable &&
                                 WowInterface.HookManager.WowGetUnitReaction(WowInterface.Player, e) != WowUnitReaction.Friendly)
                          .OrderBy(e => e.Position.GetDistance(WowInterface.Player.Position))
                          .FirstOrDefault();

                if (WowUnit != null)
                {
                    WowInterface.HookManager.WowTargetGuid(WowUnit.Guid);
                }
            }

            if (WowUnit != null)
            {
                SearchAreas.NotifyDetour();
                WowInterface.CombatClass.AttackTarget();
            }
            else if (WowInterface.Player.Position.GetDistance(CurrentNode) < 3.5f || SearchAreas.HasAbortedPath())
            {
                CurrentNode = SearchAreas.GetNextPosition(WowInterface);
                WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, CurrentNode);
            }
        }