예제 #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 void TellAbout(string text, PGameObject pGameObject)
 {
     if (!HasTold(pGameObject))
     {
         Logging.ExtendedDebug("Not picking up node {0} due to: {1}", pGameObject.Name, text);
     }
     HasToldAbout(pGameObject);
 }
예제 #3
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);
 }
예제 #4
0
 private static void RetryMailOpen(PGameObject node)
 {
     MoveHelper.StrafeLeft(true);
     Thread.Sleep(500);
     MoveHelper.StrafeLeft(false);
     node.Location.Face();
     Thread.Sleep(100);
     node.Interact(false);
     Thread.Sleep(1500);
 }
예제 #5
0
 internal static bool CheckFight(PGameObject gameObject)
 {
     if (CheckDruidFight(gameObject))
     {
         return(true);
     }
     if (ObjectManager.ShouldDefend && !ObjectManager.MyPlayer.IsInFlightForm)
     {
         return(true);
     }
     return(false);
 }
예제 #6
0
    public void init(PGraphics graphics)
    {
        g = graphics;
        g.beginKeep();
        obj = g.prefab("unitychanP5");
        //obj = g.box (1);
        //obj.addRigid();

        obj.transform.Rotate(0, 90, 0);
        obj.rigidBody.constraints |= RigidbodyConstraints.FreezePositionZ;
        g.endKeep();
    }
            protected void SetupInputController(KeyCode primaryKey, KeyCode secondaryKey)
            {
                InputController = PGameObject.GetComponent <TwoButtonInputController>();
                if (InputController == null)
                {
                    InputController = PGameObject.AddComponent <TwoButtonInputController>();
                }

                InputController.SetControls(primaryKey, secondaryKey);

                Keys = new KeyCode[] { primaryKey, secondaryKey };
            }
예제 #8
0
 internal static bool CheckDruidFight(PGameObject gameObject)
 {
     if (ObjectManager.ShouldDefend && ObjectManager.MyPlayer.IsInFlightForm)
     {
         if (FlyingSettings.DruidAvoidCombat)
         {
             Logging.Write("Druid - avoiding combat - blacklisting node");
             FlyingBlackList.Blacklist(gameObject, 300, false);
             return(true);
         }
         Mount.Dismount();
         return(false);
     }
     return(false);
 }
예제 #9
0
 internal static bool PlayerToClose(int distance, PGameObject gameObject)
 {
     if (!FlyingSettings.AvoidPlayers)
     {
         return(false);
     }
     if (
         ObjectManager.GetPlayers.Where(obj => !obj.Name.Equals(ObjectManager.MyPlayer.Name))
         .Any(obj => FindNode.GetLocation(gameObject).GetDistanceTo(obj.Location) < distance))
     {
         Logging.Write("Player to close to node");
         FlyingBlackList.Blacklist(gameObject, 300, false);
         return(true);
     }
     return(false);
 }
예제 #10
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);
 }
예제 #11
0
파일: FindNode.cs 프로젝트: semi420/lazybot
 public static PGameObject SearchForNode()
 {
     try
     {
         if (ReloadCache.IsReady)
         {
             _cached = from u in ObjectManager.GetGameObject
                       where
                       (((_herbs.Contains(u.Name) && FlyingSettings.Herb) ||
                         (_mines.Contains(u.Name) && FlyingSettings.Mine) ||
                         (FlyingSettings.Fish && u.GameObjectType == 25 &&
                          u.Location.DistanceToSelf2D < FlyingSettings.FishApproach)) &&
                        !FlyingBlackList.IsBlacklisted(u) && !SkillToLow.IsBlacklisted(u.Name) &&
                        !LootedBlacklist.IsLooted(u))
                       select u;
             ReloadCache.Reset();
         }
         if (FlyingSettings.Fish)
         {
             PGameObject school = (from h in _cached where h.GameObjectType == 25 select h).FirstOrDefault();
             if (school != null)
             {
                 return(school);
             }
         }
         IOrderedEnumerable <PGameObject> orderedObjects = from p in _cached
                                                           orderby p.Location.DistanceToSelf
                                                           select p;
         if (orderedObjects.Count() > 0)
         {
             PGameObject searchForNode = orderedObjects.ToList()[0];
             if (!MarkedNode.IsMarked(searchForNode))
             {
                 Logging.Write(LogType.Info, "Found possible node: {0} : {1}", searchForNode.Name,
                               searchForNode.GUID);
                 MarkedNode.MarkNode(searchForNode);
             }
             return(searchForNode);
         }
     }
     catch (Exception e)
     {
         //Logging.Write("SearchForNode: " + e);
     }
     return(null);
 }
예제 #12
0
 internal static bool IsMarked(PGameObject target)
 {
     if (target != null)
     {
         try
         {
             if (HasTold(target.GUID + ""))
             {
                 return(true);
             }
         }
         catch (Exception e)
         {
             Logging.Write("Marked: " + e);
         }
     }
     return(false);
 }
예제 #13
0
 public static bool IsLooted(PGameObject target)
 {
     try
     {
         if (target != null && LootedDic.ContainsKey(target.GUID))
         {
             Check();
             if (LootedDic.ContainsKey(target.GUID))
             {
                 return(true);
             }
         }
     }
     catch (Exception e)
     {
         Logging.Write("IsLooted: " + e);
     }
     return(false);
 }
예제 #14
0
 public static void Looted(PGameObject target)
 {
     if (target == null)
     {
         return;
     }
     try
     {
         if (!LootedDic.ContainsKey(target.GUID))
         {
             lock (LootedDic)
             {
                 LootedDic[target.GUID] = DateTime.Now.AddSeconds(20);
             }
         }
     }
     catch
     {
     }
 }
예제 #15
0
 internal static void HitTheNode(PGameObject nodeToHarvest)
 {
     Face.Reset();
     ToLongRun.Reset();
     _oldDis = FindNode.GetLocation(nodeToHarvest).DistanceToSelf;
     while (!ToLongRun.IsReady)
     {
         MoveHelper.Forwards(true);
         _distanceX =
             Math.Round(Math.Abs(FindNode.GetLocation(nodeToHarvest).Y - ObjectManager.MyPlayer.Location.Y));
         _distanceY =
             Math.Round(Math.Abs(FindNode.GetLocation(nodeToHarvest).X - ObjectManager.MyPlayer.Location.X));
         if (_distanceX <= 3 && _distanceY <= 3)
         {
             break;
         }
         if (Face.IsReady)
         {
             FindNode.GetLocation(nodeToHarvest).Face();
             Face.Reset();
         }
         Thread.Sleep(2);
         if (_oldDis < FindNode.GetLocation(nodeToHarvest).DistanceToSelf)
         {
             break;
         }
     }
     if (nodeToHarvest.Location.DistanceToSelf2D > 2.9)
     {
         if (nodeToHarvest.Location.DistanceToSelf2D > 2)
         {
             Thread.Sleep(150);
         }
         else if (nodeToHarvest.Location.DistanceToSelf2D > 1)
         {
             Thread.Sleep(100);
         }
     }
     MoveHelper.ReleaseKeys();
 }
예제 #16
0
 public static bool IsBlacklisted(PGameObject target)
 {
     if (target != null)
     {
         try
         {
             if (IsBadNode(target))
             {
                 return(true);
             }
             if (IsBlacklisted(target.GUID))
             {
                 return(true);
             }
         }
         catch (Exception e)
         {
             Logging.Write("IsObjectBlacklisted: " + e);
         }
     }
     return(false);
 }
예제 #17
0
        /// <summary>
        ///   Descents to node.
        /// </summary>
        internal static void DescentToNode(PGameObject nodeToHarvest)
        {
            var ticker = new Ticker(6000);

            if (ObjectManager.MyPlayer.InVashjir)
            {
                MoveHelper.Down(true);
                DescentToNodeVashir(nodeToHarvest);
                MoveHelper.Down(false);
            }
            else
            {
                if (!ObjectManager.MyPlayer.IsFlying) //To avoid sitting on the ground
                {
                    return;
                }
                MoveHelper.Down(true);
                while (ObjectManager.MyPlayer.IsFlying && !ticker.IsReady)
                {
                    Thread.Sleep(10);
                }
                MoveHelper.Down(false);
            }
        }
예제 #18
0
        //Ugly ugly ugly but we have to support vashir
        internal static void DescentToSchool(PGameObject nodeToHarvest)
        {
            var      ticker    = new Ticker(20 * 1000);
            var      timerDiff = new Ticker(500);
            float    diffSelf  = 3;
            Location oldPos    = ObjectManager.MyPlayer.Location;
            float    diffZ     = MoveHelper.NegativeValue(nodeToHarvest.Location.Z - ObjectManager.MyPlayer.Location.Z);

            while (ObjectManager.MyPlayer.IsFlying && diffZ > 2 && !ticker.IsReady && diffSelf > 0.3)
            {
                if (FlyingBlackList.IsBlacklisted(nodeToHarvest))
                {
                    return;
                }
                diffZ = MoveHelper.NegativeValue(ObjectManager.MyPlayer.Location.Z - nodeToHarvest.Location.Z);
                if (timerDiff.IsReady)
                {
                    diffSelf = MoveHelper.NegativeValue(oldPos.Z - ObjectManager.MyPlayer.Location.Z);
                    timerDiff.Reset();
                    oldPos = ObjectManager.MyPlayer.Location;
                }
                Thread.Sleep(10);
            }
        }
예제 #19
0
 internal static void MarkNode(PGameObject pGameObject)
 {
     HasToldAbout(pGameObject);
 }
예제 #20
0
 public StateGather()
 {
     _node = new PGameObject(0);
 }
예제 #21
0
        public static bool FindBobberAndClick(bool waitForLoot)
        {
            PGameObject bobber = null;

            Thread.Sleep(1000);
            _triedWorldToScreen   = false;
            _saidSomethingManager = false;
            _tryingSearch         = false;
            while (ObjectManager.MyPlayer.IsCasting)
            {
                if (bobber != null)
                {
                    if (!_saidSomethingManager)
                    {
                        Logging.Write("Located bobber in objectmanager");
                        _saidSomethingManager = true;
                    }
                    if (LazySettings.BackgroundMode)
                    {
                        if (bobber.IsBobbing)
                        {
                            bobber.Interact(false);
                            Thread.Sleep(1500);
                            if (waitForLoot)
                            {
                                while (ObjectManager.MyPlayer.LootWinOpen && !TimeOut.IsReady)
                                {
                                    Thread.Sleep(100);
                                }
                                Thread.Sleep(1300);
                            }
                            return(true);
                        }
                    }
                    else
                    {
                        if (!Memory.ReadObject(Memory.BaseAddress + (uint)Pointers.Globals.MouseOverGUID, typeof(ulong)).Equals(bobber.GUID))
                        {
                            if (!_triedWorldToScreen)
                            {
                                Logging.Write("Trying world to screen");
                                FindTheBobber(bobber.Location, bobber.GUID);
                                _triedWorldToScreen = true;
                            }
                            else
                            {
                                if (!_tryingSearch)
                                {
                                    Logging.Write("Trying search");
                                    _tryingSearch = true;
                                }
                                FindBobberSearch();
                            }
                            Thread.Sleep(100);
                        }
                        else
                        {
                            if (bobber.IsBobbing)
                            {
                                KeyHelper.SendKey("InteractWithMouseOver");
                                Thread.Sleep(1500);
                                if (waitForLoot)
                                {
                                    while (ObjectManager.MyPlayer.LootWinOpen && !TimeOut.IsReady)
                                    {
                                        Thread.Sleep(100);
                                    }
                                    Thread.Sleep(1300);
                                }
                                return(true);
                            }
                        }
                    }
                    Thread.Sleep(1000);
                }
                else
                {
                    bobber = Bobber();
                }
                Thread.Sleep(100);
            }
            return(false);
        }
예제 #22
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);
        }
예제 #23
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);
        }
예제 #24
0