Exemplo n.º 1
0
        public void import()
        {
            if (!File.Exists("imports\\" + Name + ".Cbot"))
            {
                return;
            }

            Packets.chatMessage cm         = new Packets.chatMessage(mainform.nh.socket, mainform, "Importing...", true);
            StreamReader        fileReader = new StreamReader("imports\\" + Name + ".Cbot");
            string    temp = "";
            functions help = new functions();
            int       mx;
            int       myy;
            int       myz;
            int       mtype;

            blocks.Clear();

            while (fileReader.EndOfStream == false)
            {
                blocks.Add(fileReader.ReadLine());
            }
            fileReader.Close();

            cm = new Packets.chatMessage(mainform.nh.socket, mainform, "File Loaded!", true);

            for (int i = 0; i < blocks.Count; i++)
            {
                temp = blocks[i];

                mx    = int.Parse(temp.Substring(0, temp.IndexOf(",")));
                temp  = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1));
                myz   = int.Parse(temp.Substring(0, temp.IndexOf(",")));
                temp  = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1));
                myy   = int.Parse(temp.Substring(0, temp.IndexOf(",")));
                temp  = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1));
                mtype = int.Parse(temp.Substring(0, temp.IndexOf(":")));

                if (mtype != 0)
                {
                    help.moveTo(myz + x, myy + y + 1, mx + z, mainform);

                    //mainform.location[0] = myz + x;
                    //mainform.location[1] = (myy + y) + 1;
                    //mainform.location[2] = mx + z;
                    //mainform.location[3] = mainform.location[1] + 1;
                    Packets.PlayerPosition    pp = new Packets.PlayerPosition(mainform.nh.socket, mainform);
                    Packets.creativeInventory ci = new Packets.creativeInventory(mainform.nh.socket, mainform, 40, ctos(mtype));
                    // System.Threading.Thread.Sleep(100);
                    Packets.placeBlock myblock = new Packets.placeBlock(myz + x, (byte)(myy + y), mx + z, 3, ctos(mtype), mainform.nh.socket);
                }
            }
        }
Exemplo n.º 2
0
        public void import()
        {
            if (!File.Exists("imports\\" + Name + ".Cbot"))
                return;

            Packets.chatMessage cm = new Packets.chatMessage(mainform.nh.socket, mainform, "Importing...", true);
            StreamReader fileReader = new StreamReader("imports\\" + Name + ".Cbot");
            string temp = "";
            functions help = new functions();
            int mx;
            int myy;
            int myz;
            int mtype;
            blocks.Clear();

            while (fileReader.EndOfStream == false) {
                blocks.Add(fileReader.ReadLine());
            }
            fileReader.Close();

            cm = new Packets.chatMessage(mainform.nh.socket, mainform, "File Loaded!", true);

            for (int i = 0; i < blocks.Count; i++) {
                temp = blocks[i];

                mx = int.Parse(temp.Substring(0, temp.IndexOf(",")));
                temp = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1));
                myz = int.Parse(temp.Substring(0, temp.IndexOf(",")));
                temp = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1));
                myy = int.Parse(temp.Substring(0, temp.IndexOf(",")));
                temp = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1));
                mtype = int.Parse(temp.Substring(0,temp.IndexOf(":")));

                if (mtype != 0) {
                    help.moveTo(myz + x, myy + y + 1, mx + z, mainform);

                    //mainform.location[0] = myz + x;
                    //mainform.location[1] = (myy + y) + 1;
                    //mainform.location[2] = mx + z;
                    //mainform.location[3] = mainform.location[1] + 1;
                    Packets.PlayerPosition pp = new Packets.PlayerPosition(mainform.nh.socket, mainform);
                    Packets.creativeInventory ci = new Packets.creativeInventory(mainform.nh.socket,mainform,40,ctos(mtype));
                   // System.Threading.Thread.Sleep(100);
                    Packets.placeBlock myblock = new Packets.placeBlock(myz + x, (byte)(myy + y), mx + z, 3, ctos(mtype), mainform.nh.socket);
                }

            }
        }