Beispiel #1
0
        void move(string text)
        {
            string[] args = text.Split(new char[1] {
                ' '
            }, 4);
            string axis = args[2];

            args[3] = args[3].Replace(" ", "");
            float position = float.Parse(args[3]);

            if (position > 10 || -10 > position)
            {
                return;
            }

            switch (axis.ToLower())
            {
            case "x":
                Mainform.location[0] += position;
                break;

            case "y":
                Mainform.location[1] += position;
                Mainform.location[3]  = Mainform.location[1] + 1;
                break;

            case "z":
                Mainform.location[2] += position;
                break;
            }

            Packets.PlayerPosition pos = new Packets.PlayerPosition(Socket, Mainform);
        }
Beispiel #2
0
 public void moveTo(int x, int y, int z, Form1 Mainform)
 {
     if (Math.Abs(Mainform.location[0] - x) < 10 && Math.Abs(Mainform.location[1] - y) < 10 && Math.Abs(Mainform.location[2] - z) < 10) {
         Mainform.location[0] = x;
         Mainform.location[1] = y;
         Mainform.location[2] = z;
         Mainform.location[3] = Mainform.location[1] + 1;
         Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
         return;
     } else {
         Mainform.moving = true;
         while (Mainform.moving) {
             while ((int)Mainform.location[1] != y) {
                 if (Mainform.location[1] < y) {
                     Mainform.location[1] += 1;
                     Mainform.location[3] = Mainform.location[1] + 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 } else {
                     Mainform.location[1] -= 1;
                     Mainform.location[3] = Mainform.location[1] + 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
             }
             while ((int)Mainform.location[0] != x) {
                 if (Mainform.location[0] < x) {
                     Mainform.location[0] += 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 } else {
                     Mainform.location[0] -= 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
             }
             while ((int)Mainform.location[2] != z) {
                 if (Mainform.location[2] < z) {
                     Mainform.location[2] += 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 } else {
                     Mainform.location[2] -= 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
             }
             Mainform.moving = false;
         }
     }
 }
Beispiel #3
0
 public void moveTo(int x, int y, int z, Form1 Mainform)
 {
     if (Math.Abs(Mainform.location[0] - x) < 10 && Math.Abs(Mainform.location[1] - y) < 10 && Math.Abs(Mainform.location[2] - z) < 10)
     {
         Mainform.location[0] = x;
         Mainform.location[1] = y;
         Mainform.location[2] = z;
         Mainform.location[3] = Mainform.location[1] + 1;
         Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
         return;
     }
     else
     {
         Mainform.moving = true;
         while (Mainform.moving)
         {
             while ((int)Mainform.location[1] != y)
             {
                 if (Mainform.location[1] < y)
                 {
                     Mainform.location[1] += 1;
                     Mainform.location[3]  = Mainform.location[1] + 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
                 else
                 {
                     Mainform.location[1] -= 1;
                     Mainform.location[3]  = Mainform.location[1] + 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
             }
             while ((int)Mainform.location[0] != x)
             {
                 if (Mainform.location[0] < x)
                 {
                     Mainform.location[0] += 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
                 else
                 {
                     Mainform.location[0] -= 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
             }
             while ((int)Mainform.location[2] != z)
             {
                 if (Mainform.location[2] < z)
                 {
                     Mainform.location[2] += 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
                 else
                 {
                     Mainform.location[2] -= 1;
                     Packets.PlayerPosition pp = new Packets.PlayerPosition(Mainform.nh.socket, Mainform);
                 }
             }
             Mainform.moving = false;
         }
     }
 }