Esempio n. 1
0
 internal static void TryUnstuck(bool smallUnstuck)
 {
     Ticker face;
     Logging.Write(LogType.Warning, "Stuck");
     MoveRandom();
     Thread.Sleep(2000);
     MoveHelper.ReleaseKeys();
     if (!smallUnstuck)
     {
         int temp = new Random().Next(1, 3);
         if (temp != 2)
         {
             MoveHelper.Jump(new Random().Next(2000, 4000));
         }
         else
         {
             MoveHelper.Down(new Random().Next(1000, 2000));
         }
         MoveRandom();
         Thread.Sleep(1500);
         MoveHelper.ReleaseKeys();
         face = new Ticker(Convert.ToInt32(new Random().Next(50, 200)*Math.PI));
         MoveHelper.RotateRight(true);
         while (!face.IsReady) Thread.Sleep(10);
         MoveHelper.RotateRight(false);
         MoveHelper.Forwards(true);
         Thread.Sleep(new Random().Next(2000, 4000));
         MoveHelper.Forwards(false);
     }
     MoveRandom();
     Thread.Sleep(2000);
     MoveHelper.ReleaseKeys();
     Logging.Write(LogType.Warning, "Done");
 }
Esempio n. 2
0
 private static void Descent()
 {
     var ticker = new Ticker(6000);
     MoveHelper.Down(true);
     if (ObjectManager.MyPlayer.InVashjir)
     {
         //ugly vashjir method
         var timerDiff = new Ticker(1000);
         float diffSelf = 3;
         Location oldPos = ObjectManager.MyPlayer.Location;
         while (!ticker.IsReady && diffSelf > 0.3)
         {
             if (timerDiff.IsReady)
             {
                 diffSelf = MoveHelper.NegativeValue(oldPos.Z - ObjectManager.MyPlayer.Location.Z);
                 timerDiff.Reset();
                 oldPos = ObjectManager.MyPlayer.Location;
             }
             Thread.Sleep(10);
         }
     }
     else
     {
         while (ObjectManager.MyPlayer.IsFlying && !ticker.IsReady)
         {
             Thread.Sleep(10);
         }
     }
     MoveHelper.Down(false);
 }
Esempio n. 3
0
 public static bool Approach(Location location, int distance)
 {
     var timeout = new Ticker(6000);
     double num2 = location.DistanceToSelf;
     MoveHelper.StopMove();
     location.Face();
     FlyingEngine.Navigator.Start();
     FlyingEngine.Navigator.SetDestination(location);
     while (location.DistanceToSelf2D > distance)
     {
         if (timeout.IsReady)
         {
             FlyingEngine.Navigator.Stop();
             return false;
         }
         if (location.DistanceToSelf < num2)
         {
             num2 = location.DistanceToSelf;
             timeout.Reset();
         }
         if (location.DistanceToSelf < distance)
         {
             FlyingEngine.Navigator.Stop();
         }
         Thread.Sleep(10);
     }
     FlyingEngine.Navigator.Stop();
     Descent();
     return true;
 }
Esempio n. 4
0
        internal static void Pulse()
        {
            if (CorpsePosition.X == 0 && CorpsePosition.Y == 0 && CorpsePosition.Z == 0)
            {
                GrindingEngine.Navigator.Stop();
                MoveHelper.ReleaseKeys();
                CorpsePosition = ObjectManager.MyPlayer.Location;
                GrindingEngine.UpdateStats(0, 0, 1);
            }
            while (!ObjectManager.MyPlayer.IsGhost)
            {
                Thread.Sleep(1000);
                Frame staticPopup1Button1 = InterfaceHelper.GetFrameByName("StaticPopup1Button1");
                if (staticPopup1Button1 != null && staticPopup1Button1.IsVisible)
                {
                    staticPopup1Button1.LeftClick();
                    Thread.Sleep(2000);
                }
                Thread.Sleep(100);
            }
            if (GrindingEngine.Navigation.SpotToHit != CorpsePosition)
            {
                GrindingEngine.Navigation.SetNewSpot(CorpsePosition);
            }
            GrindingEngine.Navigation.Pulse();
            if (GrindingEngine.Navigation.IsLastWaypoints || CorpsePosition.DistanceToSelf2D < 20)
            {
                Logging.Write("Move to our corpse");
                GrindingEngine.Navigator.Stop();
                MoveHelper.ReleaseKeys();

                MoveHelper.MoveToLoc(CorpsePosition, 3);

                Logging.Write("Lets ress");

                Frame staticPopup1Button1 = InterfaceHelper.GetFrameByName("StaticPopup1Button1");
                var clickTimeout = new Ticker(5*1000);
                bool firstClick = false;
                while (ObjectManager.MyPlayer.IsGhost)
                {
                    if (!firstClick || clickTimeout.IsReady)
                    {
                        if (staticPopup1Button1 != null && staticPopup1Button1.IsVisible)
                        {
                            staticPopup1Button1.LeftClick();
                            firstClick = true;
                            clickTimeout.Reset();
                        }
                    }
                    Thread.Sleep(1000);
                }
                Logging.Write("Ress worked");
                Reset();
                GrindingEngine.Navigator.Stop();
                GrindingEngine.Navigation = new GrindingNavigation(GrindingEngine.CurrentProfile);
                return;
            }
            Thread.Sleep(10);
        }
Esempio n. 5
0
 public BarSpell(int id, int bar, int key, string name)
 {
     SpellId = id;
     Bar = bar;
     _globalCooldown = new Ticker(1600);
     Key = key;
     Name = name;
     KeyHelper.AddKey(name, "", Bar.ToString(), Key.ToString());
 }
Esempio n. 6
0
 public static void BotStarted()
 {
     if (ReloggerSettings.PeriodicReloggingEnabled && ReloggerSettings.ReloggingEnabled)
     {
         _logOutAfter = new Ticker((Convert.ToDouble(ReloggerSettings.PeriodicLogOut)*60)*1000);
         _logOutAfter.Reset();
         Logging.Write(LogType.Info,
                       "Periodic relog enabled. Next logout in: " +
                       Convert.ToDouble(ReloggerSettings.PeriodicLogOut) + " minutes");
     }
 }
Esempio n. 7
0
 public static void BotStarted()
 {
     if (LazySettings.StopAfterBool)
     {
         _stopAfter = new Ticker((Convert.ToDouble(LazySettings.StopAfter)*60)*1000);
         _stopAfter.Reset();
         Logging.Write(LogType.Info,
                       "Stop after enabled, will stop in " + Convert.ToDouble(LazySettings.StopAfter) +
                       " minuttes");
     }
 }
Esempio n. 8
0
 public override void DoWork()
 {
     if (ObjectManager.MyPlayer.IsAlive)
         CombatHandler.RunningAction();
     if (GrindingSettings.Jump && _jumpRandomly.IsReady)
     {
         MoveHelper.Jump();
         _jumpRandomly = new Ticker(_random.Next(4, 8)*1000);
     }
     GrindingEngine.Navigation.Pulse();
     Thread.Sleep(10);
 }
Esempio n. 9
0
 public static void BotStopped()
 {
     _stopAfter = null;
 }
Esempio n. 10
0
 public static void BotStopped()
 {
     _logOutAfter = null;
 }
Esempio n. 11
0
 public override void Execute(int globalCooldown)
 {
     if (_globalCooldown == null)
     {
         _globalCooldown = new Ticker(globalCooldown);
     }
     if (_times > 0)
     {
         int i = _times;
         while (i > 0)
         {
             GetKey.SendKey();
             _globalCooldown.Reset();
             while (ObjectManager.MyPlayer.IsCasting || !_globalCooldown.IsReady)
             {
                 Thread.Sleep(10);
             }
             i--;
         }
     }
     else
     {
         if (ObjectManager.MyPlayer.IsValid && !ObjectManager.MyPlayer.IsMe)
             ObjectManager.MyPlayer.Target.Face();
         GetKey.SendKey();
         while (ObjectManager.MyPlayer.IsCasting || !_globalCooldown.IsReady)
         {
             Thread.Sleep(10);
         }
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Returns True if targettind succeed, else False.
        /// </summary>
        private bool HostileTabTargetting()
        {
            var t = new Ticker(4 * 1000);
            while (!t.IsReady)
            {
                if (ObjectManager.MyPlayer.TargetGUID.Equals(GUID))
                {
                    return true;
                }
                if (!Location.IsFacing())
                {
                    Location.Face();
                }
                KeyHelper.SendKey("TargetEnemy");
                Thread.Sleep(700);

            }
            return false;
        }
Esempio n. 13
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;
 }
Esempio n. 14
0
 /// <summary>
 ///   Target a friend unit with TargetFriend
 /// </summary>
 /// <returns>true if sucess</returns>
 public bool TargetFriend()
 {
     if (ObjectManager.MyPlayer.TargetGUID.Equals(GUID))
         return true;
     Logging.Write("[Unit]TargetingF: " + Name);
     if (IsDead)
         return TargetDead();
     Face();
     var timer = new Ticker(600);
     Thread.Sleep(500);
     while (!ObjectManager.MyPlayer.TargetGUID.Equals(GUID) && !timer.IsReady)
     {
         KeyHelper.SendKey("TargetFriend");
         Thread.Sleep(1000);
     }
     if (ObjectManager.MyPlayer.TargetGUID.Equals(GUID))
     {
         Face();
         return true;
     }
     Logging.Write("[Unit]Could not targetF: " + Name);
     return false;
 }
Esempio n. 15
0
 private bool HostileBackgroundTargetting()
 {
     var t = new Ticker(4 * 1000);
     while (!t.IsReady)
     {
         if (ObjectManager.MyPlayer.TargetGUID.Equals(GUID))
         {
             return true;
         }
         if (!Location.IsFacing())
         {
             Location.Face();
         }
         Memory.Write(Memory.BaseAddress + (uint)Pointers.Globals.MouseOverGUID, GUID);
         Thread.Sleep(50);
         KeyHelper.SendKey("InteractWithMouseOver");
         Thread.Sleep(500);
     }
     return false;
 }
Esempio n. 16
0
        // 根据路点跑
        private static bool MeGoGo(Dictionary<int, Location> path)
        {
            Ticker StuckTimer = new Ticker(300000); //5 min
            Ticker _stuckTimer = new Ticker(3000);
            foreach (KeyValuePair<int, Location> dest in path)
            {
                Location _destination = dest.Value;
                double _stopDistance = 1;

                int stuck = 0;
                double destinationDistance = _destination.DistanceToSelf2D;
                while (destinationDistance > _stopDistance)
                {
                    destinationDistance = _destination.DistanceToSelf2D;
                    if (LazyEvo.LGrindEngine.Helpers.Stuck.IsStuck && _stuckTimer.IsReady)
                    {
                        LazyEvo.LGrindEngine.Helpers.Unstuck.TryUnstuck();
                        _stuckTimer.Reset();
                        stuck++;
                    }
                    if (StuckTimer.IsReady)
                    {
                        stuck = 0;
                    }
                    if (stuck > 6)
                    {
                        // Stuck more than 6 times in 5 min 卡壳在5分钟之内,超过6次
                        MoveHelper.ReleaseKeys();
                        return false;
                    }
                    if (destinationDistance > _stopDistance)
                    {
                        if (!_destination.IsFacing(0.2f))
                        {
                            _destination.Face();
                        }
                        KeyHelper.PressKey("Up");
                    }
                    else
                    {
                        MoveHelper.ReleaseKeys();
                    }
                    Thread.Sleep(10);
                }
            }
            return true;

        }
Esempio n. 17
0
 /// <summary>
 ///   Moves to the location
 /// </summary>
 /// <param name = "targetObject">The target object.</param>
 /// <param name = "distance">The distance.</param>
 /// <param name = "continueMove"></param>
 /// <param name = "breakOnCombat"></param>
 /// <returns></returns>
 public static bool MoveToLoc(Location targetObject, double distance, bool continueMove, bool breakOnCombat)
 {
     Location oldPos = ObjectManager.MyPlayer.Location;
     var timer = new Ticker(1000*1.1);
     var timerWaypoint = new Ticker(1000*30);
     int stuck = 0;
     while (targetObject.DistanceToSelf > distance && !timerWaypoint.IsReady)
     {
         targetObject.Face();
         Forwards(true);
         if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) > 1)
         {
             oldPos = ObjectManager.MyPlayer.Location;
             timer.Reset();
         }
         if (breakOnCombat && ObjectManager.GetAttackers.Count != 0 && ObjectManager.ShouldDefend)
         {
             Forwards(false);
             return false;
         }
         Forwards(true);
         if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) < 1 && timer.IsReady)
         {
             if (stuck > 3)
                 return false;
             Logging.Write("[Move]I am stuck " + stuck);
             switch (stuck)
             {
                 case 0:
                     Forwards(false);
                     Forwards(true);
                     Thread.Sleep(50);
                     Jump();
                     Thread.Sleep(800);
                     break;
                 case 1:
                     Forwards(false);
                     Forwards(true);
                     StrafeLeft(true);
                     Thread.Sleep(800);
                     break;
                 case 2:
                     Forwards(false);
                     Forwards(true);
                     StrafeLeft(true);
                     Thread.Sleep(800);
                     break;
                 case 3:
                     Forwards(false);
                     Forwards(true);
                     StrafeRight(true);
                     Thread.Sleep(800);
                     break;
             }
             Thread.Sleep(200);
             stuck++;
             ReleaseKeys();
             Thread.Sleep(500);
             timer.Reset();
         }
         Thread.Sleep(10);
     }
     if (timerWaypoint.IsReady && targetObject.DistanceToSelf > distance)
     {
         Logging.Write("Approach: " + targetObject + " failed");
         Forwards(false);
         return false;
     }
     if (!continueMove)
     {
         Forwards(false);
         ReleaseKeys();
     }
     targetObject.Face();
     return true;
 }
Esempio n. 18
0
 private static void CombatThread()
 {
     try
     {
         Logging.Write("Started combat engine");
         if (ObjectManager.MyPlayer.IsMounted && !ObjectManager.MyPlayer.TravelForm)
             KeyHelper.SendKey("GMount");
         MoveHelper.ReleaseKeys();
         if (DefendAgainst() == null)
         {
             Logging.Write("Pulling: " + Unit.Name + " " + Unit.GUID);
             MoveHelper.MoveToUnit(Unit, 30);
             if (!Unit.TargetHostile())
             {
                 if (ObjectManager.GetAttackers.Count == 0)
                     PPullBlackList.Blacklist(Unit, 800, true);
             }
             Unit.Face();
             MoveHelper.ReleaseKeys();
             PullResult result = Pull();
             Logging.Write("Pull result: " + result);
             if (result.Equals(PullResult.CouldNotPull))
             {
                 PPullBlackList.Blacklist(Unit, 800, true);
                 return;
             }
             if (PPullBlackList.IsBlacklisted(Unit))
             {
                 return;
             }
         }
         else
         {
             Logging.Write("Got into combat with: " + Unit.Name);
             Unit.TargetHostile();
             Unit.Face();
         }
         Ticker combatTimeout;
         if (ObjectManager.MyPlayer.Level > 10)
         {
             combatTimeout = new Ticker(20*1000);
         }
         else
         {
             combatTimeout = new Ticker(40*1000);
         }
         while (!Unit.IsDead)
         {
             _combatLoopThread = new Thread(DoCombat) {IsBackground = true};
             _combatLoopThread.Name = "DoCombat";
             _combatLoopThread.SetApartmentState(ApartmentState.STA);
             _combatLoopThread.Start();
             while (_combatLoopThread.IsAlive)
             {
                 Thread.Sleep(50);
                 if (!Langs.TrainingDummy(Unit.Name) && combatTimeout.IsReady && Unit.Health > 85)
                 {
                     Logging.Write("Combat took to long, bugged - blacklisting");
                     _combatResult = CombatResult.Bugged;
                     if (!PBlackList.IsBlacklisted(Unit))
                         PBlackList.Blacklist(Unit, 1200, false);
                     return;
                 }
             }
         }
     }
     catch
     {
     }
 }
Esempio n. 19
0
        /// <summary>
        ///   Moves to the location
        /// </summary>
        /// <param name = "targetObject">The target object.</param>
        /// <param name = "distance">The distance.</param>
        /// <param name = "continueMove"></param>
        /// <param name = "breakOnCombat"></param>
        /// <returns></returns>
        public static bool MoveToLoc(Location targetObject, double distance, bool continueMove, bool breakOnCombat)
        {
            Location oldPos        = ObjectManager.MyPlayer.Location;
            var      timer         = new Ticker(1000 * 1.1);
            var      timerWaypoint = new Ticker(1000 * 30);
            int      stuck         = 0;

            while (targetObject.DistanceToSelf > distance && !timerWaypoint.IsReady)
            {
                targetObject.Face();
                Forwards(true);
                if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) > 1)
                {
                    oldPos = ObjectManager.MyPlayer.Location;
                    timer.Reset();
                }
                if (breakOnCombat && ObjectManager.GetAttackers.Count != 0 && ObjectManager.ShouldDefend)
                {
                    Forwards(false);
                    return(false);
                }
                Forwards(true);
                if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) < 1 && timer.IsReady)
                {
                    if (stuck > 3)
                    {
                        return(false);
                    }
                    Logging.Write("[Move]I am stuck " + stuck);
                    switch (stuck)
                    {
                    case 0:
                        Forwards(false);
                        Forwards(true);
                        Thread.Sleep(50);
                        Jump();
                        Thread.Sleep(800);
                        break;

                    case 1:
                        Forwards(false);
                        Forwards(true);
                        StrafeLeft(true);
                        Thread.Sleep(800);
                        break;

                    case 2:
                        Forwards(false);
                        Forwards(true);
                        StrafeLeft(true);
                        Thread.Sleep(800);
                        break;

                    case 3:
                        Forwards(false);
                        Forwards(true);
                        StrafeRight(true);
                        Thread.Sleep(800);
                        break;
                    }
                    Thread.Sleep(200);
                    stuck++;
                    ReleaseKeys();
                    Thread.Sleep(500);
                    timer.Reset();
                }
                Thread.Sleep(10);
            }
            if (timerWaypoint.IsReady && targetObject.DistanceToSelf > distance)
            {
                Logging.Write("Approach: " + targetObject + " failed");
                Forwards(false);
                return(false);
            }
            if (!continueMove)
            {
                Forwards(false);
                ReleaseKeys();
            }
            targetObject.Face();
            return(true);
        }
Esempio n. 20
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);
 }
Esempio n. 21
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);
     }
 }
Esempio n. 22
0
        /*
        * ConsiderAvoidAdds - Avoid Adds
        */

        internal void ConsiderAvoidAdds(PUnit target)
        {
            bool petattacking = false;
            List<PUnit> closeUnits = ObjectManager.CheckForMobsAtLoc(target.Location,
                                                                     PveBehaviorSettings.SkipAddsDis + 5, false);
            if (closeUnits.Count == 0) return;
            PUnit closestAdd = GetClosestBesides(closeUnits, target);
            if (closestAdd == null) return;
            if (closestAdd.GUID == target.GUID) return;
            // Somebody is close enough to maybe jump in.  If the monster is in front of us and close
            // enough, might be time to back it up.
            if (closestAdd.DistanceToSelf < Avoidaddsdistance)
            {
                Logging.Write("Possible add: " + closestAdd.Name + ": " + closestAdd.DistanceToSelf);
                _addBackup.Reset();
                var futility = new Ticker(3000);
                closestAdd.Face();
                MoveHelper.Backwards(true);
                if (ObjectManager.MyPlayer.HasLivePet)
                {
                    petattacking = ObjectManager.MyPlayer.Pet.Target.IsValid;
                    PetFollow.SendKey();
                }

                while (!futility.IsReady)
                {
                    Thread.Sleep(10);
                    closestAdd.Face();
                    if (closestAdd.DistanceToSelf > Avoidaddsdistance + 6.0) // Slack space.
                        break;
                }
                MoveHelper.Backwards(false);
                if (ObjectManager.MyPlayer.HasLivePet && petattacking)
                    PetAttackKey.SendKey();
                _addBackup.Reset();
            }
        }
Esempio n. 23
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;
 }
Esempio n. 24
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);
     }
 }
Esempio n. 25
0
 /// <summary>
 /// Sets the cooldown.
 /// </summary>
 /// <param name="cooldown">The cooldown.</param>
 public void SetCooldown(int cooldown)
 {
     _globalCooldown = new Ticker(cooldown);
     Cooldown = cooldown;
 }
Esempio n. 26
0
        public static bool Relog()
        {
            try
            {
                PeriodicLogoutActive = false;
                Thread.Sleep(2500);
                while (!CheckConnection())
                {
                    Thread.Sleep(5000);
                }

                if (InterfaceHelper.GetFrameByName(Gluedialogbackground).IsVisible)
                {
                    KeyHelper.SendEnter();
                }
                Thread.Sleep(500);
                if (InterfaceHelper.GetFrameByName(Accountloginloginbutton).IsVisible)
                {
                    InterfaceHelper.GetFrameByName(Accountloginaccountedit).SetEditBoxText(ReloggerSettings.AccountName);
                    Thread.Sleep(3000);
                    InterfaceHelper.GetFrameByName(Accountloginpasswordedit).LeftClick();
                    Thread.Sleep(1500);
                    InterfaceHelper.GetFrameByName(Accountloginpasswordedit).SetEditBoxText(ReloggerSettings.AccountPw);
                    Thread.Sleep(1000);
                    InterfaceHelper.GetFrameByName(Accountloginloginbutton).LeftClick();
                }
                Thread.Sleep(5000);
                try
                {
                    if (InterfaceHelper.GetFrameByName(Wowaccountselectdialogbackground).IsVisible)
                    {
                        InterfaceHelper.GetFrameByName(string.Format(WoWAccountSelectDialogBackgroundContainerButton,
                                                                     ReloggerSettings.AccountAccount)).LeftClick();
                        Thread.Sleep(2000);
                        InterfaceHelper.GetFrameByName(Wowaccountselectdialogbackgroundacceptbutton).LeftClick();
                    }
                }
                catch
                {
                }
                if (InterfaceHelper.GetFrameByName(Tokenenterdialog).IsVisible)
                {
                    Logging.Write("Can't log in with authenticator attached");
                    return false;
                }
                while (!InterfaceHelper.GetFrameByName(Charselectenterworldbutton).IsVisible)
                    Thread.Sleep(3000);

                InterfaceHelper.GetFrameByName(Charselectenterworldbutton).LeftClick();
                Thread.Sleep(7000);
                while (!ObjectManager.InGame)
                {
                    Thread.Sleep(1000);
                }
                Logging.Write(LogType.Good, "Relogging worked :)");

                Latency.Sleep(5000);

                LazyForms.MainForm.StartBotting();

                Thread.Sleep(5000);
                var timeOut = new Ticker(8000);
                while (!timeOut.IsReady)
                {
                    if (ObjectManager.MyPlayer.IsMoving)
                        break;
                }
                if (timeOut.IsReady)
                {
                    Logging.Write(LogType.Warning, "We did not start moving, restarting");
                    LazyForms.MainForm.StopBotting(true);
                    Thread.Sleep(2000);
                    LazyForms.MainForm.StartBotting();
                }
                return true;
            }
            catch (Exception e)
            {
                Logging.Write("Error when relogging: " + e);
            }
            return false;
        }
Esempio n. 27
0
        /// <summary>
        ///   Moves to the unit.
        /// </summary>
        /// <param name = "targetObject">The unit to approach.</param>
        /// <param name = "distance">The distance.</param>
        /// <returns>Returns true on sucess</returns>
        public static bool MoveToUnit(PUnit targetObject, double distance)
        {
            //Start by facing
            Location oldPos = ObjectManager.MyPlayer.Location;

            Forwards(false);
            var timer         = new Ticker(1000 * 1.1);
            var timerWaypoint = new Ticker(1000 * 16);
            int stuck         = 0;

            while (targetObject.DistanceToSelf > distance && !timerWaypoint.IsReady)
            {
                targetObject.Face();
                Forwards(true);
                if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) > 1)
                {
                    oldPos = ObjectManager.MyPlayer.Location;
                    timer.Reset();
                }
                Forwards(true);
                if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) < 1 && timer.IsReady)
                {
                    if (stuck > 3)
                    {
                        return(false);
                    }
                    Logging.Write("[Move]I am stuck " + stuck);
                    switch (stuck)
                    {
                    case 0:
                        Forwards(false);
                        Forwards(true);
                        Thread.Sleep(50);
                        Jump();
                        Thread.Sleep(800);
                        break;

                    case 1:
                        Forwards(false);
                        Forwards(true);
                        StrafeLeft(true);
                        Thread.Sleep(800);
                        break;

                    case 2:
                        Forwards(false);
                        Forwards(true);
                        StrafeLeft(true);
                        Thread.Sleep(800);
                        break;

                    case 3:
                        Forwards(false);
                        Forwards(true);
                        StrafeRight(true);
                        Thread.Sleep(800);
                        break;
                    }
                    Thread.Sleep(200);
                    stuck++;
                    ReleaseKeys();
                    Thread.Sleep(500);
                    timer.Reset();
                }
                Thread.Sleep(10);
            }
            if (timerWaypoint.IsReady && targetObject.DistanceToSelf > distance)
            {
                Logging.Write("Approach: " + targetObject.Name + " failed");
                Forwards(false);
                return(false);
            }
            Forwards(false);
            ReleaseKeys();
            targetObject.Face();
            return(true);
        }
Esempio n. 28
0
        public static bool LogOutFor(int mins)
        {
            if (ObjectManager.InGame)
            {
                PeriodicLogoutActive = true;
                KeyHelper.ChatboxSendText(Logout);
            }

            var t = new Ticker(mins*60000);
            while (!t.IsReady) Thread.Sleep(10000);

            return Relog();
        }
Esempio n. 29
0
        private static void gogo()
        {
            Dictionary<int, Location> nowpath = new Dictionary<int, Location>();
            Ticker isJump = new Ticker(500000);
            int level = ObjectManager.MyPlayer.Level;
            int nowlevel = ObjectManager.MyPlayer.Level;
            int exp = ObjectManager.MyPlayer.ExperiencePercentage;
            int nowexp = ObjectManager.MyPlayer.ExperiencePercentage;
            int last_run_exp = ObjectManager.MyPlayer.ExperiencePercentage;
            DateTime intime = DateTime.Now;
            DateTime last_run_time = DateTime.Now;
            while (true)
            {
                switch (FBStatus)
                {
                    case DBStatus.In_EntryChecking:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        while (!SetLeader()) ;
                        if (CanStart())
                        {
                            LastLeaderStep = 0;
                            FBStatus = DBStatus.In_LeaderInScopeCheck;
                            Logging.Write("检查大号是不是在范围内");
                            last_run_exp = ObjectManager.MyPlayer.ExperiencePercentage;
                            exp = ObjectManager.MyPlayer.ExperiencePercentage;
                            level = ObjectManager.MyPlayer.Level;
                        }
                        break;

                    case DBStatus.In_LeaderInScopeCheck:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        if (IsLeaderInScope())
                        {
                            nowpath = GetMemPath();
                            FBStatus = DBStatus.In_Running;
                            int this_turn_exp = ObjectManager.MyPlayer.ExperiencePercentage - last_run_exp;
                            this_turn_exp = this_turn_exp >= 0 ? this_turn_exp : 100 + this_turn_exp;
                            Logging.Write(string.Format("第{0}次跑路。这次共获得经验[{1}],耗时[{2}]。",
                                LastLeaderStep + 1,
                                this_turn_exp,
                                DateTime.Now - last_run_time));
                            last_run_exp = ObjectManager.MyPlayer.ExperiencePercentage;
                            last_run_time = DateTime.Now;
                        }
                        break;

                    case DBStatus.In_Running:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        if (MeGoGo(nowpath))
                        {
                            if (LastLeaderStep == LeaderInFB.Keys.Max())
                            {
                                FBStatus = DBStatus.In_CheckIsOut;
                                Logging.Write(string.Format("等待大号暗语,准备出本"));
                            }
                            else
                            {
                                FBStatus = DBStatus.In_LeaderInScopeCheck;
                            }
                            LastLeaderStep++;
                        }
                        break;
                    case DBStatus.In_CheckIsOut:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        if (_Action == ActionStatus.OutFB || _Action == ActionStatus.DirectOut)
                        {
                            Logging.Write(string.Format("收到暗语,出本!!!"));
                            nowlevel = ObjectManager.MyPlayer.Level;
                            nowexp = ObjectManager.MyPlayer.ExperiencePercentage;
                            if (_Action == ActionStatus.OutFB) MeGoGo(GetMemOutPath());

                            //出副本
                            Thread.Sleep(200);
                            FBExit.Face();
                            KeyHelper.PressKey("Up");
                            while (ObjectManager.InGame) Thread.Sleep(100);
                            KeyHelper.ReleaseKey("Up");
                            Thread.Sleep(2000);
                            while (!ObjectManager.InGame) Thread.Sleep(100);
                            _Action = ActionStatus.Nothing;
                            Logging.Write(string.Format("出来了,等待暗语,准备进本。上次刷本经验获得了{0}%,耗时{1},升了{2}级",
                                nowexp - exp >= 0 ? nowexp - exp : 100 + nowexp - exp,
                                DateTime.Now - intime,
                                nowlevel - level));
                            FBStatus = DBStatus.Out_ExitDone;
                        }
                        break;
                    case DBStatus.Out_ExitDone:
                        if (_Action == ActionStatus.InFB)
                        {
                            FBStatus = DBStatus.Out_following;
                            _Action = ActionStatus.Nothing;
                        }
                        break;
                    case DBStatus.Out_following:
                        if (isJump.IsReady)
                        {
                            isJump.Reset();
                            KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space);
                            KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space);
                            Thread.Sleep(4000);
                        }
                        Logging.Write(string.Format("进本!!!"));
                        FBEntry.Face();
                        KeyHelper.PressKey("Up");
                        while (ObjectManager.InGame) Thread.Sleep(100);
                        KeyHelper.ReleaseKey("Up");
                        Thread.Sleep(2000);
                        while (!ObjectManager.InGame) Thread.Sleep(100);
                        Logging.Write(string.Format("进副本了,现在是{0}级,经验{1}%", ObjectManager.MyPlayer.Level, ObjectManager.MyPlayer.ExperiencePercentage));
                        level = ObjectManager.MyPlayer.Level;
                        exp = ObjectManager.MyPlayer.ExperiencePercentage;
                        last_run_exp = exp;
                        intime = DateTime.Now;
                        last_run_time = intime;
                        FBStatus = DBStatus.In_EntryChecking;
                        break;

                }
                Thread.Sleep(100);
            }
        }
Esempio n. 30
0
// ReSharper restore FunctionNeverReturns

        public static bool StillMoving()
        {
            var maxwait = new Ticker(850);
            Location orig = ObjectManager.MyPlayer.Location;
            Location next = orig;
            while (orig.DistanceFrom(next) < 0.15 && !maxwait.IsReady)
            {
                Thread.Sleep(10);
                next = ObjectManager.MyPlayer.Location;
            }
            if (orig.DistanceFrom(next) > 0.15)
                return true;
            //Changed to 0.1, if it where flying directly into a wall i would never figure out that it where stuck
            return false;
        }
Esempio n. 31
0
        public static void lua_GetAllMail()
        {
            Ticker ServerMail = new Ticker(65000);
            // 确保邮箱开着
            if (MailFrame.CurrentTabIsSendMail) MailFrame.ClickInboxTab();
            ServerMail.Reset();
            // 发送取结果的命令
            KeyHelper.SendLuaOverChat("/script GetAllMailDoor()");
            while (GetInfoFromFrame() == LUA_RUNNING_STRING)
            {
                // 看看是否所有邮件都取完
                string info = frmMailData.GetInfoText;
                if (string.IsNullOrWhiteSpace(info))
                {
                    Logging.Write("读取frmMailData.GetInfoText信息返回空字符");
                    continue;
                }
                if (Convert.ToInt32(info) == 0) MailFrame.Close();
                if (ServerMail.IsReady)
                {
                    MailManager.TargetMailBox();
                    ServerMail.Reset();
                    Thread.Sleep(1000);
                }
                Thread.Sleep(100);
            }

            // 取得返回值(注意排错)
            string resultString = GetInfoFromFrame();
            if (resultString.Contains("错误"))
            {
                Logging.Write("获取信息错误: " + resultString);
                return;
            }

        }
Esempio n. 32
0
 /// <summary>
 ///   Moves to the unit.
 /// </summary>
 /// <param name = "targetObject">The unit to approach.</param>
 /// <param name = "distance">The distance.</param>
 /// <returns>Returns true on sucess</returns>
 public static bool MoveToUnit(PUnit targetObject, double distance)
 {
     //Start by facing
     Location oldPos = ObjectManager.MyPlayer.Location;
     Forwards(false);
     var timer = new Ticker(1000*1.1);
     var timerWaypoint = new Ticker(1000*16);
     int stuck = 0;
     while (targetObject.DistanceToSelf > distance && !timerWaypoint.IsReady)
     {
         targetObject.Face();
         Forwards(true);
         if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) > 1)
         {
             oldPos = ObjectManager.MyPlayer.Location;
             timer.Reset();
         }
         Forwards(true);
         if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) < 1 && timer.IsReady)
         {
             if (stuck > 3)
                 return false;
             Logging.Write("[Move]I am stuck " + stuck);
             switch (stuck)
             {
                 case 0:
                     Forwards(false);
                     Forwards(true);
                     Thread.Sleep(50);
                     Jump();
                     Thread.Sleep(800);
                     break;
                 case 1:
                     Forwards(false);
                     Forwards(true);
                     StrafeLeft(true);
                     Thread.Sleep(800);
                     break;
                 case 2:
                     Forwards(false);
                     Forwards(true);
                     StrafeLeft(true);
                     Thread.Sleep(800);
                     break;
                 case 3:
                     Forwards(false);
                     Forwards(true);
                     StrafeRight(true);
                     Thread.Sleep(800);
                     break;
             }
             Thread.Sleep(200);
             stuck++;
             ReleaseKeys();
             Thread.Sleep(500);
             timer.Reset();
         }
         Thread.Sleep(10);
     }
     if (timerWaypoint.IsReady && targetObject.DistanceToSelf > distance)
     {
         Logging.Write("Approach: " + targetObject.Name + " failed");
         Forwards(false);
         return false;
     }
     Forwards(false);
     ReleaseKeys();
     targetObject.Face();
     return true;
 }