コード例 #1
0
ファイル: Fight.cs プロジェクト: zneel/TheNoobBot
        public static UInt128 StartFight(UInt128 guid = default(UInt128))
        {
            MovementManager.StopMove();
            WoWUnit targetNpc = null;

            try
            {
                if (guid == 0)
                {
                    targetNpc =
                        new WoWUnit(
                            ObjectManager.ObjectManager.GetNearestWoWUnit(
                                ObjectManager.ObjectManager.GetHostileUnitAttackingPlayer()).GetBaseAddress);
                }
                else
                {
                    targetNpc =
                        new WoWUnit(ObjectManager.ObjectManager.GetObjectByGuid(guid).GetBaseAddress);
                }

                if (!targetNpc.Attackable)
                {
                    nManagerSetting.AddBlackList(targetNpc.Guid, 20000); // blacklist 20 sec
                }

                if (ObjectManager.ObjectManager.Me.IsMounted &&
                    (CombatClass.InAggroRange(targetNpc) || CombatClass.InRange(targetNpc)))
                {
                    MountTask.DismountMount();
                }

                InFight = true;

                if (!ObjectManager.ObjectManager.Me.IsCast)
                {
                    Interact.InteractWith(targetNpc.GetBaseAddress);
                }
                Thread.Sleep(100);
                if (ObjectManager.ObjectManager.Me.GetMove && !ObjectManager.ObjectManager.Me.IsCast)
                {
                    MovementManager.StopMoveTo();
                }

                Point positionStartTarget = targetNpc.Position;

                int timer = 0;
figthStart:
                // If pos start is very different
                if (targetNpc.Position.DistanceTo(positionStartTarget) > 50)
                {
                    return(0);
                }
                if (!targetNpc.Attackable)
                {
                    nManagerSetting.AddBlackList(targetNpc.Guid, 20000); // blacklist 20 sec
                    // Some become unattackable instead of being dead.
                    // Some will evade.
                }
                if (Usefuls.IsInBattleground && !Battleground.IsFinishBattleground())
                {
                    List <WoWUnit> tLUnit = ObjectManager.ObjectManager.GetHostileUnitAttackingPlayer();
                    if (tLUnit.Count > 0)
                    {
                        if (ObjectManager.ObjectManager.GetNearestWoWUnit(tLUnit).GetDistance < targetNpc.GetDistance &&
                            ObjectManager.ObjectManager.GetNearestWoWUnit(tLUnit).SummonedBy == 0)
                        {
                            return(0);
                        }
                    }
                }
                if ((ObjectManager.ObjectManager.Me.InCombat && !CombatClass.InRange(targetNpc)) || TraceLine.TraceLineGo(targetNpc.Position)) // If obstacle or not in range
                {
                    bool         resultSucces;
                    List <Point> points = PathFinder.FindPath(targetNpc.Position, out resultSucces);
                    if (!resultSucces && !Usefuls.IsFlying && MountTask.GetMountCapacity() >= MountCapacity.Fly)
                    {
                        MountTask.Mount(true, true);
                    }

                    // TODO: Code a FindTarget that includes CombatClass.GetRange here or we will often do wierd thing with casters.
                    MovementManager.Go(points);
                    timer = Others.Times + (int)(Math.DistanceListPoint(points) / 3 * 1000) + 15000;

                    while (!ObjectManager.ObjectManager.Me.IsDeadMe && !targetNpc.IsDead && targetNpc.Attackable && !targetNpc.IsLootable &&
                           targetNpc.Health > 0 && targetNpc.IsValid &&
                           MovementManager.InMovement && InFight && Usefuls.InGame &&
                           (TraceLine.TraceLineGo(targetNpc.Position) || !CombatClass.InAggroRange(targetNpc))
                           )
                    {
                        // Mob already in fight
                        if (targetNpc.Type != Enums.WoWObjectType.Player && !(targetNpc.IsTargetingMe || targetNpc.Target == 0 || ((WoWUnit)ObjectManager.ObjectManager.GetObjectByGuid(targetNpc.Target)).
                                                                              SummonedBy == ObjectManager.ObjectManager.Me.Guid || targetNpc.Target == ObjectManager.ObjectManager.Pet.Guid))
                        {
                            return(targetNpc.Guid);
                        }

                        // Timer
                        if (Others.Times > timer && TraceLine.TraceLineGo(targetNpc.Position))
                        {
                            return(targetNpc.Guid);
                        }

                        // Target Pos Verif
                        if (!targetNpc.Position.IsValid)
                        {
                            return(targetNpc.Guid);
                        }

                        // If pos start is very different
                        if (targetNpc.Position.DistanceTo(positionStartTarget) > 50)
                        {
                            return(0);
                        }

                        // Return if player/pet is attacked by another unit
                        if (ObjectManager.ObjectManager.GetNumberAttackPlayer() > 0 && !targetNpc.IsTargetingMe && !(targetNpc.Target == ObjectManager.ObjectManager.Pet.Guid && targetNpc.Target > 0))
                        {
                            return(0);
                        }
                        Thread.Sleep(50);
                    }
                }
                timer = Others.Times + (int)(ObjectManager.ObjectManager.Me.Position.DistanceTo(targetNpc.Position) / 3 * 1000) + 5000;
                if (MovementManager.InMovement)
                {
                    MovementManager.StopMove();
                }

                if (!ObjectManager.ObjectManager.Me.IsCast && ObjectManager.ObjectManager.Me.Target != targetNpc.Guid)
                {
                    Interact.InteractWith(targetNpc.GetBaseAddress);
                }

                InFight = true;
                Thread.Sleep(200);
                if (CombatClass.InAggroRange(targetNpc))
                {
                    if (ObjectManager.ObjectManager.Me.GetMove && !ObjectManager.ObjectManager.Me.IsCast)
                    {
                        MovementManager.StopMoveTo();
                    }
                    if (!ObjectManager.ObjectManager.Me.GetMove && ObjectManager.ObjectManager.Me.IsMounted)
                    {
                        MountTask.DismountMount();
                    }
                }

                // If target died after only 0.2sec of fight, let's find a new target.
                if (targetNpc.IsDead || !targetNpc.IsValid || targetNpc.Attackable)
                {
                    WoWUnit newTargetNpc = new WoWUnit(ObjectManager.ObjectManager.GetNearestWoWUnit(ObjectManager.ObjectManager.GetHostileUnitAttackingPlayer()).GetBaseAddress);
                    if (newTargetNpc.IsValid && !ObjectManager.ObjectManager.Me.IsCast && ObjectManager.ObjectManager.Me.Target != newTargetNpc.Guid)
                    {
                        targetNpc = newTargetNpc;
                        Interact.InteractWith(targetNpc.GetBaseAddress);
                        // Face the new target
                        MovementManager.Face(targetNpc);
                    }
                }

                while (!ObjectManager.ObjectManager.Me.IsDeadMe && !targetNpc.IsDead && targetNpc.Attackable && targetNpc.IsValid && InFight &&
                       targetNpc.IsValid && !ObjectManager.ObjectManager.Me.InTransport)
                {
                    // Return if player attacked and this target not attack player
                    if (targetNpc.Type != Enums.WoWObjectType.Player && !targetNpc.IsTargetingMe && !(targetNpc.Target == ObjectManager.ObjectManager.Pet.Guid && targetNpc.Target > 0) &&
                        ObjectManager.ObjectManager.GetNumberAttackPlayer() > 0)
                    {
                        return(0);
                    }

                    // Cancel fight if the mob was tapped by another player
                    if (targetNpc.IsTapped)
                    {
                        return(0);
                    }

                    // Target Pos Verif
                    if (!targetNpc.Position.IsValid)
                    {
                        InFight = false;
                        return(targetNpc.Guid);
                    }

                    // Target mob if not target
                    if (ObjectManager.ObjectManager.Me.Target != targetNpc.Guid && !targetNpc.IsDead && !ObjectManager.ObjectManager.Me.IsCast)
                    {
                        Interact.InteractWith(targetNpc.GetBaseAddress);
                    }

                    // Move to target if out of range
                    if (!ObjectManager.ObjectManager.Me.IsCast &&
                        ((!ObjectManager.ObjectManager.Me.InCombat && !CombatClass.InAggroRange(targetNpc)) ||
                         ((ObjectManager.ObjectManager.Me.InCombat && !CombatClass.InRange(targetNpc)))))
                    {
                        int rJump = Others.Random(1, 20);
                        MovementManager.MoveTo(targetNpc);
                        if (rJump == 5)
                        {
                            MovementsAction.Jump();
                        }
                    }
                    // Create path if the mob is out of sight or out of range
                    if ((!CombatClass.InRange(targetNpc) && !ObjectManager.ObjectManager.Me.IsCast) ||
                        TraceLine.TraceLineGo(targetNpc.Position))
                    {
                        goto figthStart;
                    }
                    // Stop move if in range
                    if (CombatClass.InRange(targetNpc) && ObjectManager.ObjectManager.Me.GetMove &&
                        !ObjectManager.ObjectManager.Me.IsCast)
                    {
                        MovementManager.StopMoveTo();
                    }
                    if (ObjectManager.ObjectManager.Me.IsMounted)
                    {
                        MountTask.DismountMount();
                        Interact.InteractWith(targetNpc.GetBaseAddress);
                    }

                    // Face player to mob
                    MovementManager.Face(targetNpc);

                    // If obstacle between us and the target after this timer expires then stop the fight and blacklist
                    if (Others.Times > timer && TraceLine.TraceLineGo(targetNpc.Position) &&
                        targetNpc.HealthPercent > 90)
                    {
                        InFight = false;
                        return(targetNpc.Guid);
                    }

                    Thread.Sleep(75 + Usefuls.Latency);

                    // If timer expires and still not in fight, then stop the fight and blacklist
                    if (Others.Times > timer && !ObjectManager.ObjectManager.Me.InCombat && !targetNpc.IsDead)
                    {
                        InFight = false;
                        return(targetNpc.Guid);
                    }
                }

                MovementManager.StopMoveTo();
                InFight = false;
            }
            catch (Exception exception)
            {
                Logging.WriteError("StartFight(UInt128 guid = 0, bool inBg = false): " + exception);
                InFight = false;
            }
            try
            {
                if (targetNpc != null)
                {
                    return(targetNpc.Guid);
                }
            }
            catch
            {
                return(0);
            }
            return(0);
        }
コード例 #2
0
        public override void Run()
        {
            if (!Products.IsStarted || ObjectManager.Me.IsDeadMe || ObjectManager.Me.InCombatBlizzard)
            {
                return;
            }
            if (!FisherbotSetting.CurrentSetting.FishSchool)
            {
                if (_firstRun && FishingTask.IsLaunched)
                {
                    _firstRun = false;
                }
                // If we have a saved position and we don't fish, then go to position
                if (FisherbotSetting.CurrentSetting.FisherbotPosition.IsValid && (!FishingTask.IsLaunched || _beenFighting) && !_firstRun)
                {
                    _beenFighting = false;
                    if (ObjectManager.Me.Position.DistanceTo(FisherbotSetting.CurrentSetting.FisherbotPosition) > 5)
                    {
                        LongMove.LongMoveGo(FisherbotSetting.CurrentSetting.FisherbotPosition);
                    }
                    else if (ObjectManager.Me.Position.DistanceTo(FisherbotSetting.CurrentSetting.FisherbotPosition) > 1.5f)
                    {
                        MovementManager.MoveTo(FisherbotSetting.CurrentSetting.FisherbotPosition);
                    }
                    MovementManager.Face(FisherbotSetting.CurrentSetting.FisherbotRotation);
                }
                // If we don't fish or the timer is null, then start a new timer, save position and fish
                if (timer == null || !FishingTask.IsLaunched)
                {
                    timer = new nManager.Helpful.Timer(10 * 60 * 1000 + 10 * 1000);
                    FisherbotSetting.CurrentSetting.FisherbotPosition = ObjectManager.Me.Position;
                    FisherbotSetting.CurrentSetting.FisherbotRotation = ObjectManager.Me.Rotation;
                    Fishing.EquipFishingPoles(FisherbotSetting.CurrentSetting.FishingPoleName);
                    FishingTask.LoopFish(0, FisherbotSetting.CurrentSetting.UseLure, FisherbotSetting.CurrentSetting.LureName, FisherbotSetting.CurrentSetting.FishingPoleName, false,
                                         FisherbotSetting.AutomaticallyUseDraenorSecondaryBait);
                }
                // If the timer ended, stop fishing, equip weapon, null the timer
                else if (timer.IsReady)
                {
                    FishingTask.StopLoopFish();
                    ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.WeaponName);
                    if (!string.IsNullOrEmpty(FisherbotSetting.CurrentSetting.ShieldName))
                    {
                        ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.ShieldName);
                    }

                    timer = null;
                }
                // We are in timer, we fish, then save the position
                else
                {
                    if (FishingTask._lastSuccessfullFishing > Environment.TickCount - 5000)
                    {
                        FisherbotSetting.CurrentSetting.FisherbotPosition = ObjectManager.Me.Position;
                        FisherbotSetting.CurrentSetting.FisherbotRotation = ObjectManager.Me.Rotation;
                        // We successfully fished in the last 5 seconds, let's record our position again.
                    }
                    if (FishingTask._lastSuccessfullFishing != 0 && FishingTask._lastSuccessfullFishing < Environment.TickCount - 25000)
                    {
                        // We did not catch a single thing in the last 25 seconds...
                        FishingTask.StopLoopFish();
                        return;
                    }
                    // _lastSuccessfullFishing is fine or we never fished yet, let it load :)
                    Thread.Sleep(500);
                }
                // No more while, we test what we need and return
                return;
            }

            // Nodes fishing code
            if (_node.IsValid)
            {
                FisherbotSetting.CurrentSetting.FisherbotPosition =
                    Bot.Profile.Points[Math.NearestPointOfListPoints(Bot.Profile.Points, _node.Position)];
                Logging.Write("Fish " + _node.Name + " > " + _node.Position);
            }

            if (FisherbotSetting.CurrentSetting.FishSchool)
            {
                Point whereToGo = Fishing.FindTheUltimatePoint(_node.Position);
                if (whereToGo.Type == "invalid")
                {
                    Logging.Write("No valid point found");
                    nManagerSetting.AddBlackList(_node.Guid);
                    return;
                }
                bool         r;
                List <Point> points = PathFinder.FindPath(whereToGo, out r);
                if (points.Count <= 1 || points.Count >= 20)
                {
                    points.Clear();
                    points.Add(ObjectManager.Me.Position);
                    points.Add(whereToGo);
                }
                else
                {
                    for (int i = 0; i < points.Count; i++)
                    {
                        if (points[i].Z < whereToGo.Z)
                        {
                            points[i].Z = whereToGo.Z;
                        }
                    }
                }
                Logging.Write("Going to point > " + whereToGo.X + " ; " + whereToGo.Y + " ; " + whereToGo.Z + " ; " +
                              points[0].Type);
                MovementManager.Go(points);

                timer = new nManager.Helpful.Timer(((int)Math.DistanceListPoint(points) / 3 * 1000) + 4000);
                while ((_node.IsValid || !FisherbotSetting.CurrentSetting.FishSchool) && Products.IsStarted &&
                       !ObjectManager.Me.IsDeadMe &&
                       !ObjectManager.Me.InInevitableCombat &&
                       !timer.IsReady && MovementManager.InMovement)
                {
                    if (ObjectManager.Me.Position.DistanceTo2D(whereToGo) <= 0.2f)
                    {
                        MovementManager.StopMove();
                        break;
                    }
                    Thread.Sleep(50);
                }

                if (timer.IsReady && _node.GetDistance2D > DistanceMax)
                {
                    Logging.Write("Fishing failed - No nearby point found (distance near position = " +
                                  ObjectManager.Me.Position.DistanceTo2D(
                                      FisherbotSetting.CurrentSetting.FisherbotPosition).ToString(CultureInfo.InvariantCulture) + ")");
                    MovementManager.StopMove();
                    nManagerSetting.AddBlackList(_node.Guid);
                    return;
                }
            }

            // Stop move
            MovementManager.StopMove();
            MountTask.DismountMount();

            // Face
            if (_node.IsValid)
            {
                MovementManager.Face(_node);
            }
            else
            {
                MovementManager.Face(FisherbotSetting.CurrentSetting.FisherbotRotation);
            }

            // Ce met a la bonne distance du banc de poisson
            if (_node.IsValid)
            {
                int nbIsSwimming = 0;
                timer = new nManager.Helpful.Timer(1000 * 8);
                while ((Usefuls.IsSwimming || _node.GetDistance > DistanceMax || _node.GetDistance < DistanceMin) &&
                       Products.IsStarted && !ObjectManager.Me.IsDeadMe && !ObjectManager.Me.InCombat && !timer.IsReady)
                {
                    if (nbIsSwimming * 100 > TimeTryFindGoodPos)
                    {
                        FishingTask.StopLoopFish();
                        MovementsAction.MoveBackward(false);
                        MovementsAction.MoveForward(false);
                        Logging.Write("BlackList " + _node.Name);
                        nManagerSetting.AddBlackList(_node.Guid);
                        return;
                    }
                    FishingTask.StopLoopFish();
                    MovementManager.Face(_node);

                    if (Usefuls.IsSwimming || _node.GetDistance < DistanceMin)
                    {
                        MovementsAction.MoveForward(false);
                        MovementsAction.MoveBackward(true);
                    }
                    if (_node.GetDistance > DistanceMax)
                    {
                        MovementsAction.MoveBackward(false);
                        MovementsAction.MoveForward(true);
                    }

                    nbIsSwimming++;
                    Thread.Sleep(100);
                }
                MovementsAction.MoveBackward(false);
                MovementsAction.MoveForward(false);
                if (timer.IsReady)
                {
                    Logging.Write("Fishing failed - Out of range" + timer.IsReady.ToString());
                    MovementManager.StopMove();
                    nManagerSetting.AddBlackList(_node.Guid);
                    return;
                }
            }

            // Fish
            Fishing.EquipFishingPoles(FisherbotSetting.CurrentSetting.FishingPoleName);
            FishingTask.LoopFish(_node.Guid, FisherbotSetting.CurrentSetting.UseLure, FisherbotSetting.CurrentSetting.LureName, FisherbotSetting.CurrentSetting.FishingPoleName,
                                 FisherbotSetting.CurrentSetting.PrecisionMode, FisherbotSetting.AutomaticallyUseDraenorSecondaryBait);

            timer = new nManager.Helpful.Timer(2 * 60 * 1000);
            while ((_node.IsValid || !FisherbotSetting.CurrentSetting.FishSchool) && Products.IsStarted &&
                   !ObjectManager.Me.IsDeadMe &&
                   !ObjectManager.Me.InCombat && !timer.IsReady &&
                   FishingTask.IsLaunched)
            {
                if (ObjectManager.Me.Position.DistanceTo2D(FisherbotSetting.CurrentSetting.FisherbotPosition) > 3.5f &&
                    !FisherbotSetting.CurrentSetting.FishSchool)
                {
                    break;
                }
                Thread.Sleep(300);
            }
            FishingTask.StopLoopFish();
            ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.WeaponName);
            if (!string.IsNullOrEmpty(FisherbotSetting.CurrentSetting.ShieldName))
            {
                ItemsManager.EquipItemByName(FisherbotSetting.CurrentSetting.ShieldName);
            }
        }
コード例 #3
0
        public static void Pulse(IEnumerable <WoWUnit> woWUnits)
        {
            try
            {
                woWUnits = woWUnits.OrderBy(x => x.GetDistance);
                foreach (WoWUnit wowUnit in woWUnits)
                {
                    try
                    {
                        if (Products.Products.IsStarted)
                        {
                            if (nManagerSetting.IsBlackListed(wowUnit.Guid))
                            {
                                continue;
                            }

                            MovementManager.StopMove();
                            MovementManager.StopMove();
                            Thread.Sleep(250 + Usefuls.Latency);
                            while (ObjectManager.ObjectManager.Me.IsCast)
                            {
                                Thread.Sleep(200);
                            }

                            if (!wowUnit.IsValid)
                            {
                                continue;
                            }

                            bool looted = false;
                            if (wowUnit.IsLootable)
                            {
                                Logging.Write("Loot " + wowUnit.Name);
                            }
                            else if (wowUnit.IsSkinnable && nManagerSetting.CurrentSetting.ActivateBeastSkinning)
                            {
                                Logging.Write("Skin " + wowUnit.Name);
                            }
                            else
                            {
                                continue;
                            }
                            FarmingTask.CurUnit = wowUnit;

                            // We have no item to loot at range, then go to mob
                            if (!CombatClass.InMeleeRange(wowUnit) && (!nManagerSetting.CurrentSetting.UseLootARange || LootARangeId == 0 ||
                                                                       ObjectManager.ObjectManager.Me.Position.DistanceTo(wowUnit.Position) > 40f || !ItemsManager.IsItemUsable(LootARangeId)))
                            {
                                bool         success;
                                List <Point> points = PathFinder.FindPath(wowUnit.Position, out success);
                                if (points.Count <= 0)
                                {
                                    points.Add(ObjectManager.ObjectManager.Me.Position);
                                    points.Add(wowUnit.Position);
                                }
                                if (!success)
                                {
                                    if ((points.Count == 2 && wowUnit.GetDistance > 6) || points.Count != 2)
                                    {
                                        // we didn't find a valid path and the target is not that close, blacklisting.
                                        // Straightline wont help anyway.
                                        Logging.Write("No path to " + wowUnit.Name + ", blacklisting.");
                                        nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                    }
                                }
                                MovementManager.Go(points);
                                Timer timer = new Timer((int)(Math.DistanceListPoint(points) / 3 * 1000) + 3000);
                                while (!ObjectManager.ObjectManager.Me.IsDeadMe && wowUnit.IsValid &&
                                       Products.Products.IsStarted &&
                                       ObjectManager.ObjectManager.GetNumberAttackPlayer() == 0 &&
                                       !(ObjectManager.ObjectManager.Me.InCombat &&
                                         !(ObjectManager.ObjectManager.Me.IsMounted &&
                                           (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))) &&
                                       !timer.IsReady)
                                {
                                    if (ObjectManager.ObjectManager.Me.Position.DistanceTo(wowUnit.Position) <= 4.0f)
                                    {
                                        MovementManager.StopMove();
                                        MovementManager.StopMove();
                                        MountTask.DismountMount();
                                        Thread.Sleep(250);
                                        while (ObjectManager.ObjectManager.Me.GetMove)
                                        {
                                            Thread.Sleep(50);
                                        }
                                        break;
                                    }
                                }
                            }
                            // Now loot
                            if (wowUnit.IsLootable)
                            {
                                // Code for 109167 Findle's Loot-A-Range and 60854 Loot-A-Rang
                                if (nManagerSetting.CurrentSetting.UseLootARange && !CombatClass.InMeleeRange(wowUnit) &&
                                    ObjectManager.ObjectManager.Me.Position.DistanceTo(wowUnit.Position) <= 40f && LootARangeId != 0 &&
                                    ItemsManager.IsItemUsable(LootARangeId))
                                {
                                    // Since these items have a CD of only 3 sec, it's worth waiting for the CD to recover
                                    while (ItemsManager.IsItemOnCooldown(LootARangeId))
                                    {
                                        Thread.Sleep(250);
                                    }
                                    FarmingTask.CountThisLoot = true;
                                    FarmingTask.NodeOrUnit    = false;
                                    ItemsManager.UseToy(LootARangeId);
                                    Thread.Sleep(1000 + Usefuls.Latency);
                                    while (ObjectManager.ObjectManager.Me.IsCast)
                                    {
                                        if (ObjectManager.ObjectManager.Me.InCombat && !(ObjectManager.ObjectManager.Me.IsMounted && (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying)))
                                        {
                                            return;
                                        }
                                        Thread.Sleep(150);
                                    }
                                }
                                else
                                {
                                    FarmingTask.CountThisLoot = true;
                                    FarmingTask.NodeOrUnit    = false;
                                    Interact.InteractWith(wowUnit.GetBaseAddress);
                                    if ((ObjectManager.ObjectManager.Me.InCombat && !(ObjectManager.ObjectManager.Me.IsMounted && (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))))
                                    {
                                        return;
                                    }
                                    Thread.Sleep(500 + Usefuls.Latency);
                                }
                                if (nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                                    ObjectManager.ObjectManager.GetNumberAttackPlayer() > 0)
                                {
                                    return;
                                }
                                Statistics.Loots++;

                                if (nManagerSetting.CurrentSetting.ActivateBeastSkinning)
                                {
                                    Thread.Sleep(475 + Usefuls.Latency); // let the client react to unit flag change
                                    looted = true;
                                }
                                else
                                {
                                    WoWUnit unit = wowUnit;
                                    // we blacklist all unit around for a short time to be sure we loot then
                                    foreach (WoWUnit u in woWUnits.Where(u => u != unit).Where(u => u.Position.DistanceTo2D(unit.Position) <= 25f))
                                    {
                                        nManagerSetting.AddBlackList(u.Guid, 475 + Usefuls.Latency);
                                    }
                                    nManagerSetting.AddBlackList(wowUnit.Guid, 475 + Usefuls.Latency);
                                    return;
                                }
                            }
                            if ((looted || !wowUnit.IsLootable) && !wowUnit.IsSkinnable)
                            {
                                continue;
                            }
                            // From here we are sure the unit is skinnable
                            // if this is the unit we just looted, we need to redo check for extra loot
                            // if this is NOT the unit we just looted, then the check is already done at list building time
                            if (nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                                ObjectManager.ObjectManager.GetNumberAttackPlayer() == 0)
                            {
                                if ((looted || !wowUnit.IsLootable))
                                {
                                    if (wowUnit.ExtraLootType.HasFlag(TypeFlag.HERB_LOOT) || wowUnit.Entry == 112052 || wowUnit.Entry == 113646)
                                    {
                                        int myHerbalismLevel = Skill.GetValue(SkillLine.Herbalism);
                                        if (myHerbalismLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                    else if (wowUnit.ExtraLootType.HasFlag(TypeFlag.MINING_LOOT) || wowUnit.Entry == 104895 || wowUnit.Entry == 104877)
                                    {
                                        int myMiningLevel = Skill.GetValue(SkillLine.Mining);
                                        if (myMiningLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                    else if (wowUnit.ExtraLootType.HasFlag(TypeFlag.ENGENEERING_LOOT))
                                    {
                                        int myEngineeringLevel = Skill.GetValue(SkillLine.Engineering);
                                        if (myEngineeringLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        int mySkinningLevel = Skill.GetValue(SkillLine.Skinning);
                                        if (mySkinningLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                }
                                // If we looted at range, we must go to creature to skin it
                                if (!CombatClass.InMeleeRange(wowUnit))
                                {
                                    List <Point> points = PathFinder.FindPath(wowUnit.Position);
                                    if (points.Count <= 0)
                                    {
                                        points.Add(ObjectManager.ObjectManager.Me.Position);
                                        points.Add(wowUnit.Position);
                                    }
                                    MovementManager.Go(points);
                                    Timer timer = new Timer((int)(Math.DistanceListPoint(points) / 3 * 1000) + 3000);
                                    while (!ObjectManager.ObjectManager.Me.IsDeadMe && wowUnit.IsValid &&
                                           Products.Products.IsStarted &&
                                           ObjectManager.ObjectManager.GetNumberAttackPlayer() == 0 &&
                                           !(ObjectManager.ObjectManager.Me.InCombat &&
                                             !(ObjectManager.ObjectManager.Me.IsMounted &&
                                               (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))) &&
                                           !timer.IsReady)
                                    {
                                        if (CombatClass.InMeleeRange(wowUnit))
                                        {
                                            MovementManager.StopMove();
                                            MovementManager.StopMove();
                                            MountTask.DismountMount();
                                            Thread.Sleep(250);
                                            while (ObjectManager.ObjectManager.Me.GetMove)
                                            {
                                                Thread.Sleep(50);
                                            }
                                            break;
                                        }
                                    }
                                }
                                Logging.Write("Skin " + wowUnit.Name);
                                Interact.InteractWith(wowUnit.GetBaseAddress);
                                Thread.Sleep(200 + Usefuls.Latency);
                                while (ObjectManager.ObjectManager.Me.IsCast)
                                {
                                    Thread.Sleep(100);
                                }
                                if ((ObjectManager.ObjectManager.Me.InCombat &&
                                     !(ObjectManager.ObjectManager.Me.IsMounted &&
                                       (nManagerSetting.CurrentSetting.IgnoreFightIfMounted ||
                                        Usefuls.IsFlying))))
                                {
                                    return;
                                }
                                Thread.Sleep(400 + Usefuls.Latency);
                                if (nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                                    ObjectManager.ObjectManager.GetNumberAttackPlayer() > 0)
                                {
                                    return;
                                }
                                Statistics.Farms++;
                                nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                            }
                        }
                        MovementManager.StopMove();
                        MovementManager.StopMove();
                    }
                    catch
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.WriteError("LootingTask > Pulse(IEnumerable<WoWUnit> woWUnits): " + ex);
            }
        }