コード例 #1
0
        private static bool CheckMobs(PGameObject harvest)
        {
            int mobs =
                ObjectManager.GetUnits.Where(
                    unit => unit.Location.DistanceFrom(harvest.Location) < 25 && unit.Reaction == Reaction.Hostile).
                Count();

            if ((mobs > 0) && HasRessSickness())
            {
                ToldAboutNode.TellAbout("there are mobs close to the node and we have ress sickness", harvest);
                FlyingBlackList.Blacklist(harvest, 120, true);
                return(false);
            }
            if (FlyingSettings.AvoidElites &&
                ObjectManager.GetUnits.Where(
                    unit =>
                    unit.Location.DistanceFrom(harvest.Location) < 30 && unit.IsElite &&
                    unit.Reaction == Reaction.Hostile).Count() != 0)
            {
                Logging.Write("周围有精英怪,就不落地了");
                FlyingBlackList.Blacklist(harvest, 120, true);
                return(false);
            }
            if (Convert.ToInt32(FlyingSettings.MaxUnits) < mobs)
            {
                Logging.Write("周围怪太多,这个点被加入黑名单");
                FlyingBlackList.Blacklist(harvest, 120, true);
                return(false);
            }
            return(true);
        }
コード例 #2
0
 internal static bool DismountAndHarvest(PGameObject harvest, Ticker timeOut)
 {
     if (!LazySettings.BackgroundMode && !harvest.Location.IsFacing())
     {
         harvest.Location.Face();
     }
     if (Mount.IsMounted() && !ObjectManager.MyPlayer.IsInFlightForm)
     {
         Mount.Dismount();
         timeOut.Reset();
         while (ObjectManager.MyPlayer.IsMoving && !timeOut.IsReady)
         {
             Thread.Sleep(100);
         }
         Thread.Sleep(500);
     }
     Logging.Debug("Going to do harvest now");
     harvest.Interact(true);
     Latency.Sleep(ObjectManager.MyPlayer.UnitRace != "Tauren" ? 750 : 500);
     if (!ObjectManager.MyPlayer.IsCasting && ObjectManager.MyPlayer.UnitRace != "Tauren")
     {
         harvest.Interact(true);
         Latency.Sleep(750);
     }
     if (CheckFight(harvest))
     {
         ToldAboutNode.TellAbout("正在战斗状态", harvest);
         return(false);
     }
     timeOut.Reset();
     while (ObjectManager.MyPlayer.IsCasting && !timeOut.IsReady)
     {
         if (CheckFight(harvest))
         {
             ToldAboutNode.TellAbout("正在战斗状态", harvest);
             return(false);
         }
         Thread.Sleep(100);
     }
     if (CheckFight(harvest))
     {
         ToldAboutNode.TellAbout("正在战斗状态", harvest);
         return(false);
     }
     if (Langs.SkillToLow(ObjectManager.MyPlayer.RedMessage))
     {
         Logging.Write("技能太低");
         HelperFunctions.ResetRedMessage();
         if (FindNode.IsMine(harvest) || FindNode.IsHerb(harvest))
         {
             SkillToLow.Blacklist(harvest.Name, 240);
         }
         return(false);
     }
     return(true);
 }
コード例 #3
0
 public static bool GatherNode(PGameObject harvest)
 {
     if (FindNode.IsSchool(harvest))
     {
         return(GatherFishNode(harvest));
     }
     if (ApprochNode(harvest))
     {
         Logging.Write("靠近[矿/草]点");
         HitTheNode(harvest);
         if (!CheckMobs(harvest))
         {
             return(false);
         }
         if (FlyingBlackList.IsBlacklisted(harvest))
         {
             ToldAboutNode.TellAbout("is blacklisted", harvest);
             return(false);
         }
         if (MoveHelper.NegativeValue(ObjectManager.MyPlayer.Location.Z - FindNode.GetLocation(harvest).Z) > 1)
         {
             Logging.Write("下降中......");
             DescentToNode(harvest);
         }
         if (FlyingBlackList.IsBlacklisted(harvest))
         {
             ToldAboutNode.TellAbout("is blacklisted", harvest);
             return(false);
         }
         if (FindNode.GetLocation(harvest).DistanceToSelf2D > 5)
         {
             ApproachPosFlying.Approach(harvest.Location, 4);
         }
         if (FindNode.GetLocation(harvest).DistanceToSelf > 10)
         {
             Logging.Write("距离矿/草太远,放弃");
             return(false);
         }
         if (!DismountAndHarvest(harvest, TimeOut))
         {
             return(false);
         }
         return(true);
     }
     ToldAboutNode.TellAbout("过不去啊!!!", harvest);
     return(false);
 }
コード例 #4
0
        private static bool ApprochNode(PGameObject harvest)
        {
            var harvestModified = new PGameObject(harvest.BaseAddress);
            int num             = Convert.ToInt32(FlyingSettings.ApproachModifier);
            var modifiedPos     = new Location(harvestModified.X, harvestModified.Y, (harvestModified.Z + num));

            if (!ObjectManager.MyPlayer.IsFlying)
            {
                modifiedPos = new Location(harvestModified.X, harvestModified.Y, harvestModified.Z);
            }
            var    timeout = new Ticker(8000);
            double num2    = modifiedPos.DistanceToSelf;
            bool   jumped  = false;

            StopASec.Reset();
            while (modifiedPos.DistanceToSelf2D > 10.0)
            {
                FlyingEngine.Navigator.SetDestination(modifiedPos);
                if (PlayerToClose(20, harvest))
                {
                    ToldAboutNode.TellAbout("Player to close", harvest);
                    return(false);
                }
                if (timeout.IsReady)
                {
                    if (FlyingSettings.AutoBlacklist)
                    {
                        Logging.Write("Blacklisting node for-ever");
                        FlyingBlackList.AddBadNode(harvest.Location);
                    }
                    FlyingEngine.Navigator.Stop();
                    ToldAboutNode.TellAbout("node blacklisted", harvest);
                    return(false);
                }
                if (StopASec.IsReady)
                {
                    Logging.Write("Check spin");
                    FlyingEngine.Navigator.Stop();
                    MoveHelper.ReleaseKeys();
                    harvest.Location.Face();
                    StopASec.Reset();
                    FlyingEngine.Navigator.Start();
                }
                if (FlyingBlackList.IsBlacklisted(harvest))
                {
                    ToldAboutNode.TellAbout("node blacklisted", harvest);
                    return(false);
                }
                if (modifiedPos.DistanceToSelf < num2)
                {
                    num2 = modifiedPos.DistanceToSelf;
                    timeout.Reset();
                }
                if (modifiedPos.DistanceToSelf > 2.0)
                {
                    FlyingEngine.Navigator.Start();
                }
                else
                {
                    FlyingEngine.Navigator.Stop();
                }
                if (Stuck.IsStuck)
                {
                    Unstuck.TryUnstuck(false);
                }
                if (!Mount.IsMounted())
                {
                    Logging.Write("We got dismounted, abort");
                    return(false);
                }
                if (!jumped && modifiedPos.DistanceToSelf2D > 20 && !ObjectManager.MyPlayer.IsFlying &&
                    ObjectManager.MyPlayer.IsMounted && !ObjectManager.MyPlayer.InVashjir)
                {
                    Logging.Write("正在地面上跑,飞起来");
                    FlyingEngine.Navigator.Stop();
                    MoveHelper.Jump(1000);
                    FlyingEngine.Navigator.Start();
                    jumped = true;
                }
                Thread.Sleep(100);
            }
            FlyingEngine.Navigator.Stop();
            return(harvestModified.Location.DistanceToSelf2D < 10.0);
        }
コード例 #5
0
        internal static bool GatherFishNode(PGameObject node)
        {
            if (_reLure == null)
            {
                _reLure = new Ticker(600000);
                _reLure.ForceReady();
            }
            FlyingEngine.Navigator.Stop();
            var combat = new StateCombat();
            int nearestIndexInPositionList =
                Location.GetClosestPositionInList(FlyingEngine.CurrentProfile.WaypointsNormal, node.Location);
            Location position = FlyingEngine.CurrentProfile.WaypointsNormal[nearestIndexInPositionList];

            if (!ApproachPosFlying.Approach(position, 5))
            {
                return(false);
            }
            node.Location.Face();
            if (Bobber() != null)
            {
                Logging.Write("Someone is fishing, break");
                return(false);
            }
            if (!CheckMobs(node))
            {
                return(false);
            }
            if (FlyingBlackList.IsBlacklisted(node))
            {
                ToldAboutNode.TellAbout("is blacklisted", node);
                return(false);
            }
            DescentToSchool(node);
            Mount.Dismount();
            var timeout      = new Ticker((FlyingSettings.MaxTimeAtSchool * 60) * 1000);
            var checkIfValid = new Ticker(8000);

            while (node.IsValid)
            {
                while (combat.NeedToRun)
                {
                    combat.DoWork();
                    timeout.Reset();
                }
                if (checkIfValid.IsReady)
                {
                    if (ObjectManager.GetObjects.FirstOrDefault(u => u.BaseAddress == node.BaseAddress) == null)
                    {
                        break;
                    }
                    checkIfValid.Reset();
                }
                if (FlyingSettings.Lure && _reLure.IsReady)
                {
                    KeyHelper.SendKey("Lure");
                    Thread.Sleep(3500);
                    _reLure.Reset();
                }
                if (timeout.IsReady)
                {
                    return(false);
                }
                if (ObjectManager.MyPlayer.IsSwimming)
                {
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1000);
                    KeyHelper.SendKey("Waterwalk");
                    Thread.Sleep(2000);
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1500);
                    if (ObjectManager.MyPlayer.IsSwimming)
                    {
                        return(false);
                    }
                }
                node.Location.Face();
                var timeout3 = new Ticker(4000);
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D < 14))
                {
                    MoveHelper.Backwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                timeout3.Reset();
                node.Location.Face();
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D > 16))
                {
                    MoveHelper.Forwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                KeyHelper.SendKey("Fishing");
                Thread.Sleep(1500);
                Fishing.FindBobberAndClick(FlyingSettings.WaitForLoot);
                Thread.Sleep(100);
            }
            return(true);
        }