Пример #1
0
        private static void Fly(IEnumerable <WoWGameObject> nodes, bool ignoreCanOpen = false)
        {
            try
            {
                nodes = nodes.OrderBy(x => x.GetDistance);
                foreach (WoWGameObject node in nodes.Where(node => node.IsValid))
                {
                    WoWGameObject inode = node;
                    if (_curNode != null && _curNode.IsValid && !nManagerSetting.IsBlackListed(_curNode.Guid))
                    {
                        inode = _curNode;
                    }
                    if (!inode.IsValid)
                    {
                        MovementManager.StopMove();
                        nManagerSetting.AddBlackList(inode.Guid, 2 * 60 * 1000);
                        Logging.Write("Current inode not valid, blacklist.");
                        continue;
                    }
                    _curNode = inode; // we save a inode we potentially bypassed to make sure we run the list.
                    if (!inode.CanOpen && !ignoreCanOpen)
                    {
                        nManagerSetting.AddBlackList(inode.Guid, 5000);
                        return;
                    }
                    float zT;
                    if (ObjectManager.ObjectManager.Me.Position.Z < inode.Position.Z)
                    {
                        zT = inode.Position.Z + 5.5f;
                    }
                    else
                    {
                        zT = inode.Position.Z + 2.5f;
                    }

                    Point aboveNode = new Point(inode.Position);
                    aboveNode.Z = aboveNode.Z + 2.5f;
                    Point farAboveNode = new Point(aboveNode);
                    farAboveNode.Z = farAboveNode.Z + 50;
                    if (TraceLine.TraceLineGo(farAboveNode, aboveNode, CGWorldFrameHitFlags.HitTestAllButLiquid))
                    {
                        MovementManager.StopMove();
                        if (TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position, aboveNode, CGWorldFrameHitFlags.HitTestAllButLiquid))
                        {
                            Logging.Write("Node stuck");
                            nManagerSetting.AddBlackList(inode.Guid, 1000 * 60 * 2);
                            return;
                        }
                    }
                    else
                    {
                        MovementManager.StopMove();
                    }
                    if (_lastnode != inode.Guid)
                    {
                        _lastnode = inode.Guid;
                        Logging.Write("Farm " + inode.Name + " (" + inode.Entry + ") > " + inode.Position);
                    }
                    MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT, true);

                    Helpful.Timer timer   = new Helpful.Timer((int)(ObjectManager.ObjectManager.Me.Position.DistanceTo(inode.Position) / 3 * 1000) + 5000);
                    bool          toMine  = false;
                    bool          landing = false;

                    while (inode.IsValid && !Usefuls.BadBottingConditions && !Usefuls.ShouldFight && !timer.IsReady)
                    {
                        if (!landing)
                        {
                            bool noDirectPath = TraceLine.TraceLineGo(aboveNode, ObjectManager.ObjectManager.Me.Position, CGWorldFrameHitFlags.HitTestAllButLiquid);
                            zT = noDirectPath ? ObjectManager.ObjectManager.Me.Position.Z : aboveNode.Z;

                            if (ObjectManager.ObjectManager.Me.Position.Z < aboveNode.Z)
                            {
                                // elevate in a 45° angle instead of 90°
                                Point direction = Math.GetPosition2DOfLineByDistance(ObjectManager.ObjectManager.Me.Position,
                                                                                     inode.Position,
                                                                                     (inode.Position.Z + 2.5f) - ObjectManager.ObjectManager.Me.Position.Z);
                                // if there is an obstacle, then go mostly vertical but not 90° to prevent spinning around
                                if (TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position,
                                                          direction,
                                                          CGWorldFrameHitFlags.HitTestAllButLiquid))
                                {
                                    direction = Math.GetPosition2DOfLineByDistance(ObjectManager.ObjectManager.Me.Position,
                                                                                   inode.Position, 1.0f);
                                }
                                MovementManager.MoveTo(direction.X, direction.Y, inode.Position.Z + 5.0f);
                            }
                            else
                            {
                                MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT);
                            }

                            if (!ObjectManager.ObjectManager.Me.IsMounted)
                            {
                                return;
                            }
                            if (!noDirectPath)
                            {
                                landing = true;
                            }
                        }

                        if (ObjectManager.ObjectManager.Me.Position.DistanceTo2D(inode.Position) < 4.0f &&
                            ObjectManager.ObjectManager.Me.Position.DistanceZ(inode.Position) >= 5.0f && !toMine)
                        {
                            toMine = true;

                            if (!ObjectManager.ObjectManager.Me.IsMounted)
                            {
                                return;
                            }
                            zT = inode.Position.Z + 1.5f;
                            MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT);
                            if (inode.GetDistance > 3.0f && TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position, inode.Position, CGWorldFrameHitFlags.HitTestAllButLiquid))
                            {
                                Logging.Write("Node outside view");
                                nManagerSetting.AddBlackList(inode.Guid, 1000 * 120);
                                break;
                            }
                        }
                        else if ((ObjectManager.ObjectManager.Me.Position.DistanceTo2D(inode.Position) < 1.1f ||
                                  (!Usefuls.IsFlying &&
                                   ObjectManager.ObjectManager.Me.Position.DistanceTo2D(inode.Position) < 3.0f)) &&
                                 ObjectManager.ObjectManager.Me.Position.DistanceZ(inode.Position) < 6)
                        {
                            Thread.Sleep(150);
                            MovementManager.StopMove();
                            if (Usefuls.IsFlying)
                            {
                                MountTask.Land();
                            }
                            if (ObjectManager.ObjectManager.Me.GetMove)
                            {
                                MovementManager.StopMove();
                            }
                            while (ObjectManager.ObjectManager.Me.GetMove)
                            {
                                Thread.Sleep(50);
                            }
                            if (!ObjectManager.ObjectManager.Me.HaveBuff(SpellManager.AllInteractMountId()) &&
                                (!inode.IsHerb || inode.IsHerb && !ObjectManager.ObjectManager.Me.HaveBuff(SpellManager.HerbsInteractMountId())))
                            {
                                if (!(SpellManager.HasSpell(169606) && Usefuls.ContinentId == 1116 || Usefuls.ContinentId == 1464)) // Passive Silver Dollar Club given by Stables.
                                {
                                    MountTask.DismountMount();
                                }
                            }
                            else if (inode.IsHerb && ObjectManager.ObjectManager.Me.HaveBuff(SpellManager.DruidMountId()))
                            {
                                Logging.WriteDebug("Druid IsFlying ? " + Usefuls.IsFlying);
                                if (Usefuls.IsFlying)
                                {
                                    MountTask.Land();
                                    MovementManager.StopMove();
                                    if (Usefuls.IsFlying)
                                    {
                                        Logging.Write("You are still flying after two attemps of Landing.");
                                        Logging.Write("Make sure you have binded the action \"SitOrStand\" on a keyboard key and not any mouse button or special button.");
                                        Logging.Write("If you still have this message, please try a \"Reset Keybindings\" before posting on the forum.");
                                        Logging.Write("A work arround have been used, it may let you actually farm or not. Because it's random, please fix your keybinding issue.");
                                        MountTask.Land(true);
                                    }
                                }
                            }

                            Thread.Sleep(Usefuls.Latency + 200);
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                MountTask.DismountMount();
                                return;
                            }
                            _wasLooted    = false;
                            CountThisLoot = true;
                            NodeOrUnit    = true;
                            Interact.InteractWith(inode.GetBaseAddress);
                            Thread.Sleep(Usefuls.Latency + 500);
                            if (!ObjectManager.ObjectManager.Me.IsCast)
                            {
                                Interact.InteractWith(inode.GetBaseAddress);
                                Thread.Sleep(Usefuls.Latency + 500);
                            }
                            while (ObjectManager.ObjectManager.Me.IsCast)
                            {
                                Thread.Sleep(100);
                            }
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                MountTask.DismountMount();
                                CountThisLoot = false;
                                return;
                            }
                            Thread.Sleep(Usefuls.Latency + 100);
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                MountTask.DismountMount();
                                CountThisLoot = false;
                                return;
                            }
                            nManagerSetting.AddBlackList(inode.Guid, 1000 * 20);
                            return;
                        }
                        else if (!ObjectManager.ObjectManager.Me.GetMove)
                        {
                            Thread.Sleep(50);
                            if (!ObjectManager.ObjectManager.Me.IsMounted)
                            {
                                return;
                            }
                            MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT);
                        }
                        if (States.Farming.PlayerNearest(inode))
                        {
                            Logging.Write("Player near the inode, farm canceled");
                            nManagerSetting.AddBlackList(inode.Guid, 15 * 1000);
                            return;
                        }
                    }
                    if (timer.IsReady)
                    {
                        nManagerSetting.AddBlackList(inode.Guid, 60 * 1000);
                    }
                    MovementManager.StopMove();
                    if (!_wasLooted)
                    {
                        Logging.Write("Farm failed #1");
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.WriteError("FarmingTask > Fly(IEnumerable<WoWGameObject> nodes): " + ex);
            }
        }
Пример #2
0
        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);
        }
Пример #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);
            }
        }