Example #1
0
        public static void FindTarget()
        {
            List <WowUnit> hostileUnits = ObjectManager.Units.FindAll(unit => unit.isHostile && !unit.Dead && !blackList.Contains(unit.GUID) && !blackNameList.Contains(unit.Name) && unit.Health > 1 && unit.Level <= ObjectManager.Me.Level + 1).OrderBy(unit => unit.Distance).ToList();

            if (hostileUnits.Count > 0)
            {
                WowUnit target = hostileUnits[0];

                int trys = 0;
                while (!ObjectManager.Me.Combat || BotUtils.getMobsWithBeef().Count == 0)
                {
                    trys++;
                    Console.WriteLine("Trys: " + trys + " -> " + target.Name + " " + target.Health + " " + target.IsUnit);
                    BotUtils.AttackUnit(target);
                    Thread.Sleep(100);

                    if (trys > 100)
                    {
                        blackList.Add(target.GUID);
                        break;
                    }
                }

                Console.WriteLine("Attacking: " + target.Name + " isHostile: " + target.isHostile + " " + BotUtils.getMobsWithBeef().Count);
            }
        }