Exemple #1
0
        public static void MoveToDurance3()
        {
            PC me = new PC();

            AreaMap map = new AreaMap(me.Area);

            map.Initialize();

            Pather p = me.GetSkillLevel(SkillType.Teleport) > 0 ? new Pather(map, new TeleportReducer(25)) : p = new Pather(map, new WalkingReducer(7, 13));

            p.FindPathToWarp(me.Position, new int[] { 67, 68 }, me.Area);

            Pathing.Mover m = new Pathing.Mover(p);
            m.OnMoverCallBack += new botNET.Pathing.Mover.MoverCallBackHandler(m_OnMoverCallBack);
            m.Move(me.GetSkillLevel(SkillType.Teleport) > 0 ? Reduction.TeleportReduction : Reduction.WalkingReduction);

            Warp warp = new Warp(p.LastPresetUsed);

            Thread.Sleep(200);

            me.Interact(warp);

            Thread.Sleep(200);

            while (me.Area != (AreaLevel)102)
            {
                me.ClickMap(ClickType.LeftDown, false, warp);
                Thread.Sleep(100);
                me.ClickMap(ClickType.LeftUp, false, warp);
                Thread.Sleep(500);
            }

            return;
        }
Exemple #2
0
        public static void Interact(UnitBase u)
        {
            PC me = new PC();

            me.ClickMap(ClickType.LeftDown, false, u);
            Thread.Sleep(100);
            me.ClickMap(ClickType.LeftUp, false, u);
        }
Exemple #3
0
        public static void CastAtXY(SkillType Skill, SkillHand Hand, int TargetX, int TargetY)
        {
            PC Me = new PC();

            if (Me.GetSkillOnHand(Hand) != Skill)
            {
                Me.SetSkill(Skill, Hand);
                int count = 0;
                while (true)
                {
                    if (Me.GetSkillOnHand(Hand) == Skill)
                    {
                        break;
                    }
                    Thread.Sleep(20);
                    count++;
                    if (count > 50)
                    {
                        throw new ApplicationException("Could not set skill on the given hand");
                    }
                }
            }

            int click = 3;

            if (Hand == SkillHand.Left)
            {
                click = 0;
            }
            Me.ClickMap((ClickType)click, false, TargetX, TargetY);
            Thread.Sleep(100);
            Me.ClickMap((ClickType)(click + 2), false, TargetX, TargetY);
            //return;

            if (Me.Mode == PlayerMode.Cast)
            {
                if (!ModeWait(PlayerMode.Cast, false))
                {
                    throw new ApplicationException("Could not start casting");
                }
            }

            if (!ModeWait(PlayerMode.Neutral, false))
            {
                throw new ApplicationException("Could not detect end of casting");
            }
        }
Exemple #4
0
        public static void Move(int x, int y)
        {
            PC me = new PC();

            while ((Math.Abs(me.X - x) > 4 || Math.Abs(me.Y - y) > 4))
            {
                while (me.RightSkill != SkillType.Teleport && me.GetSkillLevel(SkillType.Teleport) > 0)
                {
                    me.RightSkill = SkillType.Teleport;
                    Thread.Sleep(500);
                }

                int click = 3;
                if (me.IsInTown || me.GetSkillLevel(SkillType.Teleport) == 0)
                {
                    click = 0;
                }
                me.ClickMap((ClickType)click, false, x, y);
                Thread.Sleep(100);
                me.ClickMap((ClickType)(click + 2), false, x, y);
                Thread.Sleep(100);
            }
        }
Exemple #5
0
        /// <summary>
        /// </summary>
        private int WalkTo(Point c)
        {
            PC Me = new PC();

            int TargetX = c.X;
            int TargetY = c.Y;

            int startX    = Me.X;
            int startY    = Me.Y;
            int currDestX = TargetX;
            int currDestY = TargetY;

            if (Math.Abs(Me.X - TargetX) <= 2 &&
                Math.Abs(Me.Y - TargetY) <= 2)
            {
                return(1);
            }

            int    trys    = 0;
            int    ntrys   = 12;
            int    thrash  = 0;
            int    nthrash = 3;
            int    door;
            int    directionalmove = 0;
            double direction       = 0;

            while ((Math.Abs(Me.X - TargetX) > 3 || Math.Abs(Me.Y - TargetY) > 3) && trys <= ntrys)
            {
                Me.ClickMap(ClickType.LeftDown, false, currDestX, currDestY);
                Thread.Sleep(100);
                Me.ClickMap(ClickType.LeftUp, false, currDestX, currDestY);

                while (Me.Mode != PlayerMode.Neutral && Me.Mode != PlayerMode.TownNeutral)
                {
                    Thread.Sleep(20);
                }
                trys++;
                if ((Math.Abs(Me.X - TargetX) > 1 && Math.Abs(Me.Y - TargetX) > 1))
                {
                    if (thrash >= nthrash)
                    {
                        direction = Math.Abs(Math.Floor((Math.Atan2(TargetX - Me.X, TargetY - Me.Y)) * 180 / 3.1415) - 180);
                        if (direction > 0 && direction < 45)
                        {
                            currDestX = Me.X + 5;
                            currDestY = Me.Y + 1;
                        }
                        else if (direction > 45 && direction < 90)
                        {
                            currDestX = Me.X - 1;
                            currDestY = Me.Y - 5;
                        }
                        else if (direction > 90 && direction < 135)
                        {
                            currDestX = Me.X - 1;
                            currDestY = Me.Y + 5;
                        }
                        else if (direction > 135 && direction < 180)
                        {
                            currDestX = Me.X + 5;
                            currDestY = Me.Y - 1;
                        }
                        else if (direction > 180 && direction < 225)
                        {
                            currDestX = Me.X - 5;
                            currDestY = Me.Y - 1;
                        }
                        else if (direction > 225 && direction < 270)
                        {
                            currDestX = Me.X + 1;
                            currDestY = Me.Y + 5;
                        }
                        else if (direction > 270 && direction < 315)
                        {
                            currDestX = Me.X + 1;
                            currDestY = Me.Y - 5;
                        }
                        else if (direction > 315 && direction < 360)
                        {
                            currDestX = Me.X - 5;
                            currDestY = Me.Y + 1;
                        }
                        else
                        {
                            //make a randome move
                            int    dx = currDestX - startX;
                            int    dy = currDestY - startY;
                            double a  = Math.Atan2(dx, dy);
                            a         = Math.Floor(a * 100) + 157;                       // + pi/2;
                            direction = (new Random()).Next((int)a, (int)a + 314) / 100; // + pi
                            currDestX = Convert.ToInt32(Math.Floor(Math.Sin(direction) * 20) + Me.X);
                            currDestY = Convert.ToInt32(Math.Floor(Math.Cos(direction) * 20) + Me.Y);
                        }
                        directionalmove = 0;

                        //########################################
                        thrash = 0;
                        directionalmove++;
                    }
                    else
                    {
                        thrash++;
                    }
                }
                else
                {
                    startX    = Me.X;
                    startY    = Me.Y;
                    currDestX = TargetX;
                    currDestY = TargetY;
                }
            }
            if (Math.Abs(Me.X - TargetX) > 4 || Math.Abs(Me.Y - TargetY) > 4)
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }