示例#1
0
        public EntTeleport(Wrapped.Wrapped socket, Form1 Mainform)
        {
            int       EID    = socket.readInt();
            int       X      = socket.readInt();
            int       Y      = socket.readInt();
            int       Z      = socket.readInt();
            byte      yaw    = socket.readByte();
            byte      pitch  = socket.readByte();
            functions helper = new functions();

            Classes.Entity thisEnt = helper.getEntbyID(EID, Mainform);

            if (thisEnt != null)
            {
                thisEnt.X     = X;
                thisEnt.Y     = Y;
                thisEnt.Z     = Z;
                thisEnt.yaw   = yaw;
                thisEnt.pitch = pitch;

                if (Mainform.following == true && thisEnt.name == Mainform.fname)
                {
                    Mainform.location[0] = thisEnt.X / 32;
                    Mainform.location[1] = thisEnt.Y / 32;
                    Mainform.location[2] = thisEnt.Z / 32;
                    Mainform.location[3] = thisEnt.Y / 32 + 1;
                }
            }
        }
示例#2
0
        public EntlookRelmove(Wrapped.Wrapped socket, Form1 mainform)
        {
            int       EID    = socket.readInt();
            sbyte     dx     = (sbyte)socket.readByte();
            sbyte     dy     = (sbyte)socket.readByte();
            sbyte     dz     = (sbyte)socket.readByte();
            byte      yaw    = socket.readByte();
            byte      pitch  = socket.readByte();
            functions helper = new functions();

            Classes.Entity thisEnt = helper.getEntbyID(EID, mainform);

            if (thisEnt != null)
            {
                thisEnt.yaw   = yaw;
                thisEnt.pitch = pitch;
                thisEnt.X    += dx;
                thisEnt.Y    += dy;
                thisEnt.Z    += dz;


                if (mainform.following == true && thisEnt.name == mainform.fname)
                {
                    mainform.location[0] = thisEnt.X / 32;
                    mainform.location[1] = thisEnt.Y / 32;
                    mainform.location[2] = thisEnt.Z / 32;
                    mainform.location[3] = thisEnt.Y / 32 + 1;
                }
            }
        }
示例#3
0
文件: teams.cs 项目: SinZ163/Minebot
        // Server-to-Client only

        public teams(Wrapped.Wrapped socket, Form1 Mainform)
        {
            List <string> players;
            string        teamDisplayname;
            string        teamPrefix;
            string        teamSuffix;
            byte          friendlyFire;
            short         playerCount;

            string teamName = socket.readString();
            byte   mode     = socket.readByte();

            if (mode == 0 || mode == 2)
            {
                teamDisplayname = socket.readString();
                teamPrefix      = socket.readString();
                teamSuffix      = socket.readString();
                friendlyFire    = socket.readByte();
            }
            if (mode == 0 || mode == 3 || mode == 4)
            {
                playerCount = socket.readShort();
                players     = new List <string>();

                for (int i = 1; i < playerCount; i++)
                {
                    players.Add(socket.readString());
                }
            }
        }
示例#4
0
        public BlockChange(Wrapped.Wrapped socket, Form1 Mainform)
        {
            int chunkX, chunkZ;

            int   x       = socket.readInt();
            byte  y       = socket.readByte();
            int   z       = socket.readInt();
            short blockID = socket.readShort();

            socket.readByte();

            chunkX = (int)Math.Floor(decimal.Divide(x, 16));
            chunkZ = (int)Math.Floor(decimal.Divide(z, 16));

            Classes.Chunk thisChunk = null;

            foreach (Classes.Chunk b in Mainform.Chunks)
            {
                if (b.x == chunkX & b.z == chunkZ)
                {
                    thisChunk = b;
                    break;
                }
            }

            thisChunk.updateBlock(x, y, z, blockID);
        }
示例#5
0
 public EntEffect(Wrapped.Wrapped socket, Form1 Mainform)
 {
     socket.readInt();
     socket.readByte();
     socket.readByte();
     socket.readShort();
 }
示例#6
0
 public useBed(Wrapped.Wrapped socket, Form1 Mainform)
 {
     socket.readInt();
     socket.readByte();
     socket.readInt();
     socket.readByte();
     socket.readInt();
 }
示例#7
0
 public OpenWindow(Wrapped.Wrapped socket, Form1 mainform)
 {
     socket.readByte();
     socket.readByte();
     socket.readString();
     socket.readByte();
     bool useTitle = socket.readBool();
 }
示例#8
0
 public BlockAction(Wrapped.Wrapped socket, Form1 mainform)
 {
     socket.readInt();
     socket.readShort();
     socket.readInt();
     socket.readByte();
     socket.readByte();
     socket.readShort();
 }
示例#9
0
        void handle()
        {
            int    Dimention  = socket.readInt();
            byte   Difficulty = socket.readByte();
            byte   mode       = socket.readByte();
            short  height     = socket.readShort();
            string leveltype  = socket.readString();

            mainform.Chunks.Clear(); // Clear out the chunks.
        }
示例#10
0
        public Entlook(Wrapped.Wrapped socket, Form1 mainform)
        {
            int       EID    = socket.readInt();
            byte      yaw    = socket.readByte();
            byte      pitch  = socket.readByte();
            functions helper = new functions();

            Classes.Entity thisEnt = helper.getEntbyID(EID, mainform);
            thisEnt.yaw   = yaw;
            thisEnt.pitch = pitch;
        }
示例#11
0
        public Explosion(Wrapped.Wrapped socket, Form1 mainform)
        {
            double ex = socket.readDouble();
            double ey = socket.readDouble();
            double ez = socket.readDouble();

            socket.readFloat();
            int count = socket.readInt();

            while (count != 0)
            {
                int x = (int)socket.readByte();
                int y = (int)socket.readByte();
                int z = (int)socket.readByte();

                // Convert to Absolute coords

                x = (int)ex + x;
                y = (int)ey + y;
                z = (int)ez + z;

                decimal ChunkX = decimal.Divide(x, 16);
                decimal ChunkZ = decimal.Divide(z, 16);

                ChunkX = Math.Floor(ChunkX);
                ChunkZ = Math.Floor(ChunkZ);

                Chunk thisChunk = null;

                foreach (Classes.Chunk b in mainform.Chunks)
                {
                    if (b.x == ChunkX & b.z == ChunkZ)
                    {
                        thisChunk = b;
                        break;
                    }
                }

                if (thisChunk != null)
                {
                    thisChunk.updateBlock(x, y, z, 0);
                }

                count--;
            }

            socket.readFloat();
            socket.readFloat();
            socket.readFloat();
        }
示例#12
0
        public OpenWindow(Wrapped.Wrapped socket, Form1 mainform)
        {
            int  meh     = socket.readByte();
            byte invType = socket.readByte();

            socket.readString();
            socket.readByte();
            bool useTitle = socket.readBool();

            if (invType == 11)
            {
                socket.readInt();
            }
        }
示例#13
0
        public void readMetadata(Wrapped.Wrapped socket)
        {
            // read metadata from socket
            do
            {
                byte item = socket.readByte();

                if (item == 127)
                {
                    break;
                }
                int index = item & 0x1F;
                int type  = item >> 5;

                switch (type)
                {
                case 0:
                    socket.readByte();
                    break;

                case 1:
                    socket.readShort();
                    break;

                case 2:
                    socket.readInt();
                    break;

                case 3:
                    socket.readFloat();
                    break;

                case 4:
                    socket.readString();
                    break;

                case 5:
                    readSlot(socket);
                    break;

                case 6:
                    socket.readInt();
                    socket.readInt();
                    socket.readInt();
                    break;
                }
            } while (true);
        }
示例#14
0
 public tileEditor(Wrapped.Wrapped socket, Form1 mainForm)
 {
     socket.readByte();
     socket.readInt();
     socket.readInt();
     socket.readInt();
 }
示例#15
0
        // Server-To-Client only

        public updateScore(Wrapped.Wrapped Socket, Form1 Mainform)
        {
            string itemName  = Socket.readString();
            byte   update    = Socket.readByte();
            string scoreName = Socket.readString();
            int    value     = Socket.readInt();
        }
示例#16
0
        public SpawnNamedEntity(Wrapped.Wrapped socket, Form1 mainform)
        {
            int       EID      = socket.readInt();
            string    Name     = socket.readString();
            int       X        = socket.readInt();
            int       Y        = socket.readInt();
            int       Z        = socket.readInt();
            byte      Yaw      = socket.readByte();
            byte      Pitch    = socket.readByte();
            short     heldItem = socket.readShort();
            functions parser   = new functions();

            parser.readMetadata(socket);

            Classes.Entity newPlayer = new Classes.Entity(EID, Name, X, Y, Z, Yaw, Pitch, heldItem);
            mainform.Entitys.Add(newPlayer);
        }
示例#17
0
 public BlockbreakAni(Wrapped.Wrapped socket, Form1 mainform)
 {
     socket.readInt();
     socket.readInt();
     socket.readInt();
     socket.readInt();
     socket.readByte();
 }
示例#18
0
        public SetSlot(Wrapped.Wrapped socket, Form1 mainform)
        {
            byte      windowId = socket.readByte();
            short     slot     = socket.readShort();
            functions Parser   = new functions();

            Parser.readSlot(socket, true, mainform, slot);
        }
示例#19
0
 public SpawnGlobalEntity(Wrapped.Wrapped socket, Form1 mainform)
 {
     socket.readInt();
     socket.readByte();
     socket.readInt();
     socket.readInt();
     socket.readInt();
 }
示例#20
0
 public Namedsound(Wrapped.Wrapped socket, Form1 mainform)
 {
     socket.readString();
     socket.readInt();
     socket.readInt();
     socket.readInt();
     socket.readFloat();
     socket.readByte();
 }
示例#21
0
 public Sound(Wrapped.Wrapped socket, Form1 Mainform)
 {
     socket.readInt();
     socket.readInt();
     socket.readByte();
     socket.readInt();
     socket.readInt();
     socket.readBool();
 }
示例#22
0
        public SpawnObj(Wrapped.Wrapped socket, Form1 mainform)
        {
            socket.readInt();
            socket.readByte();
            socket.readInt();
            socket.readInt();
            socket.readInt();
            socket.readByte();
            socket.readByte();
            // --
            int value = socket.readInt();

            if (value != 0)
            {
                socket.readShort();
                socket.readShort();
                socket.readShort();
            }
        }
示例#23
0
 public CloseWindow(Wrapped.Wrapped socket, Form1 mainform, bool outgoing = false)
 {
     if (outgoing)
     {
         socket.writeByte(0x65);
         socket.writeByte(0);
     }
     else
     {
         socket.readByte();
     }
 }
示例#24
0
        public updateTileEntity(Wrapped.Wrapped socket, Form1 mainform)
        {
            socket.readInt();
            socket.readShort();
            socket.readInt();
            socket.readByte();
            int length = socket.readShort();

            if (length != 0)
            {
                socket.readByteArray(length);
            }
        }
示例#25
0
        public SpawnMob(Wrapped.Wrapped socket, Form1 Mainform)
        {
            int  EID       = socket.readInt();
            byte type      = socket.readByte();
            int  X         = socket.readInt();
            int  Y         = socket.readInt();
            int  Z         = socket.readInt();
            byte Pitch     = socket.readByte();
            byte headPitch = socket.readByte();
            byte Yaw       = socket.readByte();

            socket.readShort();
            socket.readShort();
            socket.readShort();

            functions parser = new functions();

            parser.readMetadata(socket);

            Classes.Entity newMob = new Classes.Entity(EID, ((functions.entityId)type).ToString(), X, Y, Z, Yaw, Pitch, 0);
            Mainform.Entitys.Add(newMob);
        }
示例#26
0
        public DestroyEnt(Wrapped.Wrapped socket, Form1 mainform)
        {
            int times = (int)socket.readByte();

            while (times != 0)
            {
                int       EID = socket.readInt();
                functions a   = new functions();
                a.deleteEnt(EID, mainform);

                times--;
            }
        }
示例#27
0
        public BlockChange(Wrapped.Wrapped socket, Form1 Mainform)
        {
            int chunkX, chunkZ;

            int   x       = socket.readInt();
            byte  y       = socket.readByte();
            int   z       = socket.readInt();
            short blockID = socket.readShort();

            socket.readByte();

            chunkX = (int)Math.Floor(decimal.Divide(x, 16));
            chunkZ = (int)Math.Floor(decimal.Divide(z, 16));

            Classes.Chunk thisChunk = null;

            foreach (Classes.Chunk b in Mainform.Chunks)
            {
                if (b.x == chunkX & b.z == chunkZ)
                {
                    thisChunk = b;
                    break;
                }
            }

            if (blockID == 15 && Mainform.importing == true)
            {
                Mainform.importing = false;
                Classes.Importer Importer = new Classes.Importer(Mainform, Mainform.importName, x, (int)y, z);
                //  Thread importThread = new Thread(Importer.import);
                // importThread.Start();
                Importer.import();
            }
            if (thisChunk != null)
            {
                thisChunk.updateBlock(x, y, z, blockID);
            }
        }
示例#28
0
        public ConfirmTransaction(Wrapped.Wrapped socket, Form1 mainform)
        {
            // Should only be sent if we actually receive one with a "false" for accepted.
            byte  windowID     = socket.readByte();
            short actionNumber = socket.readShort();
            bool  accepted     = socket.readBool();

            if (accepted == false)
            {
                socket.writeByte(0x6A);
                socket.writeByte(windowID);
                socket.writeShort(actionNumber);
                socket.writeBool(accepted);
                ClickWindow cw = new ClickWindow(socket, mainform, -999, 0, 0, null); // If we're holding something on our cursor, drop it.
            }
        }
示例#29
0
        public entProps(Wrapped.Wrapped socket, Form1 mainform)
        {
            int entId     = socket.readInt();
            int propCount = socket.readInt();

            for (int b = 0; b < propCount; b++)
            {
                string key        = socket.readString();
                double value      = socket.readDouble();
                short  listLength = socket.readShort();

                for (int i = 0; i < listLength; i++)
                {
                    long   msb     = socket.readLong();
                    long   lsb     = socket.readLong();
                    double ammount = socket.readDouble();
                    byte   op      = socket.readByte();
                }
            }
        }
示例#30
0
        public Classes.Item returnSlot(Wrapped.Wrapped socket)
        {
            int blockID = socket.readShort();

            if (blockID == -1)
            {
                return(null);
            }

            byte  itemCount = socket.readByte();
            short damage    = socket.readShort();
            int   NBTLength = socket.readShort();

            if (NBTLength == -1)
            {
                return(new Classes.Item(blockID, itemCount, damage, 0));
            }

            socket.readByteArray(NBTLength);

            return(new Classes.Item(blockID, itemCount, damage, 0));
        }