예제 #1
0
파일: Bot.cs 프로젝트: zneel/TheNoobBot
 internal static void Dispose()
 {
     try
     {
         FishingTask.StopLoopFish();
         CombatClass.DisposeCombatClass();
         Fsm.StopEngine();
         Fight.StopFight();
         MovementManager.StopMove();
     }
     catch (Exception e)
     {
         Logging.WriteError("Grinder > Bot > Bot  > Dispose(): " + e);
     }
 }
예제 #2
0
        public void EatOrDrink(string itemName, bool isMana = false)
        {
            try
            {
                if (FishingTask.IsLaunched)
                {
                    FishingTask.StopLoopFish();
                }
                // isMana = false => Health
                if (ObjectManager.ObjectManager.Me.IsMounted)
                {
                    Usefuls.DisMount();
                }
                MovementManager.StopMove();
                Thread.Sleep(500);

                ObjectManager.ObjectManager.Me.ForceIsCasting = true; // Make the bot believe it's casting something. (we set it to false in Finally())
                ItemsManager.UseItem(itemName);
                for (int i = 0; i < 30; i++)
                {
                    if (ObjectManager.ObjectManager.Me.IsDeadMe || ObjectManager.ObjectManager.Me.InCombat)
                    {
                        return;
                    }
                    if (!isMana && ObjectManager.ObjectManager.Me.HealthPercent > 95 || isMana && ObjectManager.ObjectManager.Me.ManaPercentage > 95)
                    {
                        break;
                    }
                    Thread.Sleep(500);
                    // Eat/Drink for 15 seconds or until we get to high HP/Mana
                }
            }
            catch (Exception e)
            {
                Logging.WriteError("public void EatOrDrink(string itemName, bool isMana = false): " + e);
            }
            finally
            {
                ObjectManager.ObjectManager.Me.ForceIsCasting = false;
                // In case we set it to true and crash, prevent the bot from believing that its constantly casting.
            }
        }
예제 #3
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);
            }
        }
예제 #4
0
파일: ToTown.cs 프로젝트: zneel/TheNoobBot
        public override void Run()
        {
            List <Npc> listNPCs = new List <Npc>();
            Npc        mailBox  = null;

            // Stop fisher if needed
            if (Products.Products.ProductName == "Fisherbot" && FishingTask.IsLaunched)
            {
                FishingTask.StopLoopFish();
                // Then break the cast
                MovementsAction.MoveBackward(true);
                Thread.Sleep(50);
                MovementsAction.MoveBackward(false);
            }
            // If we need to send items.
            if (nManagerSetting.CurrentSetting.ActivateAutoMaillingFeature && !_suspendMailing &&
                nManagerSetting.CurrentSetting.MaillingFeatureRecipient != string.Empty &&
                Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SendMailWhenLessThanXSlotLeft)
            {
                if (_useMollE)
                {
                    MountTask.DismountMount();
                    ItemsManager.UseItem(ItemsManager.GetItemNameById(40768));
                    Thread.Sleep(2000);
                    WoWGameObject portableMailbox = ObjectManager.ObjectManager.GetNearestWoWGameObject(
                        ObjectManager.ObjectManager.GetWoWGameObjectById(191605));
                    if (portableMailbox.IsValid &&
                        portableMailbox.CreatedBy == ObjectManager.ObjectManager.Me.Guid)
                    {
                        mailBox = new Npc
                        {
                            Entry          = portableMailbox.Entry,
                            Position       = portableMailbox.Position,
                            Name           = portableMailbox.Name,
                            ContinentIdInt = Usefuls.ContinentId,
                            Faction        = ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde"
                                ? Npc.FactionType.Horde
                                : Npc.FactionType.Alliance,
                            SelectGossipOption = 0,
                            Type = Npc.NpcType.Mailbox
                        };
                    }
                }
                if (mailBox == null && NpcDB.GetNpcNearby(Npc.NpcType.Mailbox).Entry > 0)
                {
                    mailBox = NpcDB.GetNpcNearby(Npc.NpcType.Mailbox);
                }
                listNPCs.Add(mailBox);
            }
            // If we need to repair.
            if (ObjectManager.ObjectManager.Me.GetDurability <=
                nManagerSetting.CurrentSetting.RepairWhenDurabilityIsUnderPercent &&
                nManagerSetting.CurrentSetting.ActivateAutoRepairFeature)
            {
                if (_magicMountMammoth && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0)
                {
                    if (_travelersTundraMammoth.HaveBuff || _travelersTundraMammoth.IsSpellUsable)
                    {
                        if (!_travelersTundraMammoth.HaveBuff)
                        {
                            MountTask.DismountMount();
                            _travelersTundraMammoth.Launch(true, true, true);
                            Thread.Sleep(2000);
                        }
                        if (ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde")
                        {
                            WoWUnit drixBlackwrench =
                                ObjectManager.ObjectManager.GetNearestWoWUnit(
                                    ObjectManager.ObjectManager.GetWoWUnitByEntry(32641));
                            if (drixBlackwrench.IsValid && drixBlackwrench.IsAlive)
                            {
                                Npc drixBlackwrenchNpc = new Npc
                                {
                                    Entry              = drixBlackwrench.Entry,
                                    Position           = drixBlackwrench.Position,
                                    Name               = drixBlackwrench.Name,
                                    ContinentIdInt     = Usefuls.ContinentId,
                                    Faction            = Npc.FactionType.Horde,
                                    SelectGossipOption = 0,
                                    Type               = Npc.NpcType.Repair
                                };
                                listNPCs.Add(drixBlackwrenchNpc);
                            }
                        }
                        else
                        {
                            WoWUnit gnimo =
                                ObjectManager.ObjectManager.GetNearestWoWUnit(
                                    ObjectManager.ObjectManager.GetWoWUnitByEntry(32639));
                            if (gnimo.IsValid && gnimo.IsAlive)
                            {
                                Npc gnimoNpc = new Npc
                                {
                                    Entry              = gnimo.Entry,
                                    Position           = gnimo.Position,
                                    Name               = gnimo.Name,
                                    ContinentIdInt     = Usefuls.ContinentId,
                                    Faction            = Npc.FactionType.Alliance,
                                    SelectGossipOption = 0,
                                    Type               = Npc.NpcType.Repair
                                };
                                listNPCs.Add(gnimoNpc);
                            }
                        }
                    }
                }
                else if (_magicMountYak && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0)
                {
                    if (_grandExpeditionYak.HaveBuff || _grandExpeditionYak.IsSpellUsable)
                    {
                        if (!_grandExpeditionYak.HaveBuff)
                        {
                            MountTask.DismountMount();
                            _grandExpeditionYak.Launch(true, true, true);
                            Thread.Sleep(2000);
                        }
                        WoWUnit cousinSlowhands =
                            ObjectManager.ObjectManager.GetNearestWoWUnit(
                                ObjectManager.ObjectManager.GetWoWUnitByEntry(62822));
                        if (cousinSlowhands.IsValid && cousinSlowhands.IsAlive)
                        {
                            Npc cousinSlowhandsNpc = new Npc
                            {
                                Entry          = cousinSlowhands.Entry,
                                Position       = cousinSlowhands.Position,
                                Name           = cousinSlowhands.Name,
                                ContinentIdInt = Usefuls.ContinentId,
                                Faction        = ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde"
                                    ? Npc.FactionType.Horde
                                    : Npc.FactionType.Alliance,
                                SelectGossipOption = 0,
                                Type = Npc.NpcType.Repair
                            };
                            listNPCs.Add(cousinSlowhandsNpc);
                        }
                    }
                }
                else if (_use74A)
                {
                    Npc npcA = DoSpawnRobot("74A", Npc.NpcType.Repair);
                    if (npcA != null)
                    {
                        listNPCs.Add(npcA);
                    }
                }
                else if (_use110G)
                {
                    Npc npcG = DoSpawnRobot("110G", Npc.NpcType.Repair);
                    if (npcG != null)
                    {
                        listNPCs.Add(npcG);
                    }
                }
                else if (_useJeeves)
                {
                    Npc npcJeeves = DoSpawnRobot("Jeeves", Npc.NpcType.Repair);
                    if (npcJeeves != null)
                    {
                        listNPCs.Add(npcJeeves);
                    }
                }
                else
                {
                    if (NpcDB.GetNpcNearby(Npc.NpcType.Repair).Entry > 0)
                    {
                        listNPCs.Add(NpcDB.GetNpcNearby(Npc.NpcType.Repair));
                    }
                }
            }

            // If we need to sell.
            if (NeedFoodSupplies() || NeedDrinkSupplies() ||
                Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SellItemsWhenLessThanXSlotLeft &&
                nManagerSetting.CurrentSetting.ActivateAutoSellingFeature && !_suspendSelling)
            {
                if (_magicMountMammoth && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0)
                {
                    if (_travelersTundraMammoth.HaveBuff || _travelersTundraMammoth.IsSpellUsable)
                    {
                        if (!_travelersTundraMammoth.HaveBuff)
                        {
                            MountTask.DismountMount();
                            _travelersTundraMammoth.Launch(true, true, true);
                            Thread.Sleep(2000);
                        }
                        if (ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde")
                        {
                            WoWUnit mojodishu =
                                ObjectManager.ObjectManager.GetNearestWoWUnit(
                                    ObjectManager.ObjectManager.GetWoWUnitByEntry(32642));
                            if (mojodishu.IsValid && mojodishu.IsAlive)
                            {
                                Npc mojodishuNpc = new Npc
                                {
                                    Entry              = mojodishu.Entry,
                                    Position           = mojodishu.Position,
                                    Name               = mojodishu.Name,
                                    ContinentIdInt     = Usefuls.ContinentId,
                                    Faction            = Npc.FactionType.Horde,
                                    SelectGossipOption = 0,
                                    Type               = Npc.NpcType.Vendor
                                };
                                listNPCs.Add(mojodishuNpc);
                            }
                        }
                        else
                        {
                            WoWUnit hakmuddArgus =
                                ObjectManager.ObjectManager.GetNearestWoWUnit(
                                    ObjectManager.ObjectManager.GetWoWUnitByEntry(32638));
                            if (hakmuddArgus.IsValid && hakmuddArgus.IsAlive)
                            {
                                Npc hakmuddArgusNpc = new Npc
                                {
                                    Entry              = hakmuddArgus.Entry,
                                    Position           = hakmuddArgus.Position,
                                    Name               = hakmuddArgus.Name,
                                    ContinentIdInt     = Usefuls.ContinentId,
                                    Faction            = Npc.FactionType.Alliance,
                                    SelectGossipOption = 0,
                                    Type               = Npc.NpcType.Vendor
                                };
                                listNPCs.Add(hakmuddArgusNpc);
                            }
                        }
                    }
                }
                else if (_magicMountYak && MountTask.GetMountCapacity() >= MountCapacity.Ground && Skill.GetValue(SkillLine.Riding) > 0)
                {
                    if (_grandExpeditionYak.HaveBuff || _grandExpeditionYak.IsSpellUsable)
                    {
                        if (!_grandExpeditionYak.HaveBuff)
                        {
                            MountTask.DismountMount();
                            _grandExpeditionYak.Launch(true, true, true);
                            Thread.Sleep(2000);
                        }
                        WoWUnit cousinSlowhands =
                            ObjectManager.ObjectManager.GetNearestWoWUnit(
                                ObjectManager.ObjectManager.GetWoWUnitByEntry(62822));
                        if (cousinSlowhands.IsValid && cousinSlowhands.IsAlive)
                        {
                            Npc cousinSlowhandsNpc = new Npc
                            {
                                Entry              = cousinSlowhands.Entry,
                                Position           = cousinSlowhands.Position,
                                Name               = cousinSlowhands.Name,
                                ContinentIdInt     = Usefuls.ContinentId,
                                Faction            = Npc.FactionType.Neutral,
                                SelectGossipOption = 0,
                                Type               = Npc.NpcType.Vendor
                            };
                            listNPCs.Add(cousinSlowhandsNpc);
                        }
                    }
                }
                else if (_use74A)
                {
                    Npc npcA = DoSpawnRobot("74A", Npc.NpcType.Vendor);
                    if (npcA != null)
                    {
                        listNPCs.Add(npcA);
                    }
                }
                else if (_use110G)
                {
                    Npc npcG = DoSpawnRobot("110G", Npc.NpcType.Vendor);
                    if (npcG != null)
                    {
                        listNPCs.Add(npcG);
                    }
                }
                else if (_useJeeves)
                {
                    Npc npcJeeves = DoSpawnRobot("Jeeves", Npc.NpcType.Vendor);
                    if (npcJeeves != null)
                    {
                        listNPCs.Add(npcJeeves);
                    }
                }
                else
                {
                    if (NpcDB.GetNpcNearby(Npc.NpcType.Vendor).Entry > 0)
                    {
                        listNPCs.Add(NpcDB.GetNpcNearby(Npc.NpcType.Vendor));
                    }
                }
            }

            #region Repairer, Seller/Buyer, MailBox

            if (listNPCs.Count > 0)
            {
                listNPCs.Sort(OnComparison);
                foreach (Npc npc in listNPCs)
                {
                    Npc  target   = npc;
                    bool doTravel = target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 400 || target.ContinentIdInt != Usefuls.ContinentId;
                    if (!doTravel && target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) <= 400)
                    {
                        // Close NPC but no path ?
                        bool success;
                        PathFinder.FindPath(ObjectManager.ObjectManager.Me.Position, target.Position, Usefuls.ContinentNameMpq, out success);
                        if (!success)
                        {
                            doTravel = true;
                        }
                    }
                    //Start travel

                    if (_travelLocation != null && _travelLocation.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 0.1f)
                    {
                        if (Products.Products.TravelRegenerated && Products.Products.TravelFrom.IsValid)
                        {
                            _travelLocation = Products.Products.TravelFrom;
                            Products.Products.TravelRegenerated = false;
                        }
                    }
                    if (doTravel && (_travelLocation == null || _travelLocation.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 0.1f) && !_travelDisabled && !Usefuls.IsFlying)
                    {
                        MovementManager.StopMove();
                        switch (npc.Type)
                        {
                        case Npc.NpcType.Repair:
                            Logging.Write("Calling travel system to NpcRepair " + npc.Name + " (" + npc.Entry + ")...");
                            break;

                        case Npc.NpcType.Vendor:
                            Logging.Write("Calling travel system to NpcVendor " + npc.Name + " (" + npc.Entry + ")...");
                            break;

                        case Npc.NpcType.Mailbox:
                            Logging.Write("Calling travel system to Mailbox " + npc.Name + " (" + npc.Entry + ")...");
                            break;

                        default:
                            Logging.Write("Calling travel system for ToTown to " + npc.Name + " (" + npc.Entry + ")...");
                            break;
                        }
                        Products.Products.TravelToContinentId   = target.ContinentIdInt;
                        Products.Products.TravelTo              = target.Position;
                        Products.Products.TravelFromContinentId = Usefuls.ContinentId;
                        Products.Products.TravelFrom            = ObjectManager.ObjectManager.Me.Position;
                        // Pass the check for valid destination as a lambda
                        Products.Products.TargetValidationFct = Quest.IsNearQuestGiver; // compare me.Pos to dest.Pos
                        _travelLocation = Products.Products.TravelFrom;
                        return;
                    }
                    if (_travelLocation != null && _travelLocation.DistanceTo(ObjectManager.ObjectManager.Me.Position) <= 0.1f)
                    {
                        _travelDisabled = true; // don't forget to release travel once arrived.
                    }
                    //Start target finding based on Seller.
                    uint baseAddress = MovementManager.FindTarget(ref target, 0, !ObjectManager.ObjectManager.Me.IsMounted);
                    if (!target.ValidPath)
                    {
                        Logging.WriteDebug("No valid path/travel to Npc " + target.Name + ", removing him from NpcDB.");
                        NpcDB.DelNpc(target);
                    }
                    if (MovementManager.InMovement)
                    {
                        return;
                    }
                    if (target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) >= 5f)
                    {
                        return;
                    }
                    _travelDisabled = false;
                    if (baseAddress == 0 && target.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 5f)
                    {
                        NpcDB.DelNpc(target);
                    }
                    else if (baseAddress > 0)
                    {
                        if (!_travelersTundraMammoth.HaveBuff)
                        {
                            DoProspectingInTown(target);
                            DoMillingInTown(target);
                        }
                        Interact.InteractWith(baseAddress);
                        Thread.Sleep(500);
                        MovementManager.StopMove();
                        if (target.SelectGossipOption != 0)
                        {
                            Lua.LuaDoString("SelectGossipOption(" + target.SelectGossipOption + ")");
                            Thread.Sleep(500);
                        }
                        else if (target.Type == Npc.NpcType.Repair || target.Type == Npc.NpcType.Vendor)
                        {
                            if (!Gossip.SelectGossip(Gossip.GossipOption.Vendor))
                            {
                                Logging.WriteError("Problem with NPC " + npc.Name + " Removing it for NpcDB");
                                NpcDB.DelNpc(npc);
                                return;
                            }
                        }
                        // NPC Repairer
                        if (target.Type == Npc.NpcType.Repair)
                        {
                            Logging.Write("Repair items from " + target.Name + " (" + target.Entry + ").");
                            Vendor.RepairAllItems();
                            Thread.Sleep(1000);
                        }
                        // End NPC Repairer

                        if (target.Type == Npc.NpcType.Vendor)
                        {
                            // NPC Buyer
                            Logging.Write("Selling items to " + target.Name + " (" + target.Entry + ").");
                            List <WoWItemQuality> vQuality = new List <WoWItemQuality>();
                            if (nManagerSetting.CurrentSetting.SellGray)
                            {
                                vQuality.Add(WoWItemQuality.Poor);
                            }
                            if (nManagerSetting.CurrentSetting.SellWhite)
                            {
                                vQuality.Add(WoWItemQuality.Common);
                            }
                            if (nManagerSetting.CurrentSetting.SellGreen)
                            {
                                vQuality.Add(WoWItemQuality.Uncommon);
                            }
                            if (nManagerSetting.CurrentSetting.SellBlue)
                            {
                                vQuality.Add(WoWItemQuality.Rare);
                            }
                            if (nManagerSetting.CurrentSetting.SellPurple)
                            {
                                vQuality.Add(WoWItemQuality.Epic);
                            }
                            Vendor.SellItems(nManagerSetting.CurrentSetting.ForceToSellTheseItems, nManagerSetting.CurrentSetting.DontSellTheseItems, vQuality);
                            Thread.Sleep(3000);
                            if (Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SellItemsWhenLessThanXSlotLeft)
                            {
                                _suspendSelling = true;
                            }
                            // End NPC Buyer

                            // NPC Seller
                            if (NeedFoodSupplies() || NeedDrinkSupplies())
                            {
                                Logging.Write("Buying beverages and food from " + target.Name + " (" + target.Entry + ").");
                            }
                            for (int i = 0; i < 10 && NeedFoodSupplies(); i++)
                            {
                                Vendor.BuyItem(nManagerSetting.CurrentSetting.FoodName, 1);
                            }
                            for (int i = 0; i < 10 && NeedDrinkSupplies(); i++)
                            {
                                Vendor.BuyItem(nManagerSetting.CurrentSetting.BeverageName, 1);
                            }
                            // End NPC Seller
                        }
                        if (target.Type == Npc.NpcType.Repair || target.Type == Npc.NpcType.Vendor)
                        {
                            Gossip.CloseGossip();
                        }

                        // MailBox
                        if (target.Type == Npc.NpcType.Mailbox)
                        {
                            List <WoWItemQuality> mQuality = new List <WoWItemQuality>();
                            if (nManagerSetting.CurrentSetting.MailGray)
                            {
                                mQuality.Add(WoWItemQuality.Poor);
                            }
                            if (nManagerSetting.CurrentSetting.MailWhite)
                            {
                                mQuality.Add(WoWItemQuality.Common);
                            }
                            if (nManagerSetting.CurrentSetting.MailGreen)
                            {
                                mQuality.Add(WoWItemQuality.Uncommon);
                            }
                            if (nManagerSetting.CurrentSetting.MailBlue)
                            {
                                mQuality.Add(WoWItemQuality.Rare);
                            }
                            if (nManagerSetting.CurrentSetting.MailPurple)
                            {
                                mQuality.Add(WoWItemQuality.Epic);
                            }

                            bool mailSendingCompleted = false;
                            for (int i = 7; i > 0 && !mailSendingCompleted; i--)
                            {
                                Interact.InteractWith(baseAddress);
                                Thread.Sleep(1000);
                                Mail.SendMessage(nManagerSetting.CurrentSetting.MaillingFeatureRecipient,
                                                 nManagerSetting.CurrentSetting.MaillingFeatureSubject, "",
                                                 nManagerSetting.CurrentSetting.ForceToMailTheseItems,
                                                 nManagerSetting.CurrentSetting.DontMailTheseItems, mQuality,
                                                 out mailSendingCompleted);
                                Thread.Sleep(500);
                            }
                            if (mailSendingCompleted)
                            {
                                Logging.Write("Sending items to the player " + nManagerSetting.CurrentSetting.MaillingFeatureRecipient + " using " + target.Name + " (" +
                                              target.Entry + ").");
                            }
                            if (Usefuls.GetContainerNumFreeSlots <= nManagerSetting.CurrentSetting.SendMailWhenLessThanXSlotLeft)
                            {
                                _suspendMailing = true;
                            }
                            Lua.LuaDoString("CloseMail()");
                        }
                        // End MailBox
                    }
                    // still on the road, but not in movement for some reasons
                }
            }

            #endregion Repairer, Seller/Buyer, MailBox
        }