Exemplo n.º 1
0
        public CustomHousePlane(PacketReader reader)
        {
            byte[] data = reader.ReadBytes(4);
            Index = data[0];
            int uncompressedsize = data[1] + ((data[3] & 0xF0) << 4);
            int compressedLength = data[2] + ((data[3] & 0xF) << 8);
            ItemData = new byte[uncompressedsize];
            Compression.Unpack(ItemData, ref uncompressedsize, reader.ReadBytes(compressedLength), compressedLength);

            IsFloor = ((Index & 0x20) == 0x20);
            Index &= 0x1F;
        }
Exemplo n.º 2
0
        public CompressedGumpPacket(PacketReader reader)
            : base(0xDD, "Compressed Gump")
        {
            Serial = reader.ReadInt32();
            GumpID = reader.ReadInt32();
            X = reader.ReadInt32();
            Y = reader.ReadInt32();

            int compressedLength = reader.ReadInt32() - 4;
            int decompressedLength = reader.ReadInt32();
            byte[] compressedData = reader.ReadBytes(compressedLength);
            byte[] decompressedData = new byte[decompressedLength];

            if (Compression.Unpack(decompressedData, ref decompressedLength, compressedData, compressedLength) != ZLibError.Okay)
            {
                // Problem decompressing, go ahead and quit.
                return;
            }
            else
            {
                GumpData = Encoding.ASCII.GetString(decompressedData);

                int numTextLines = reader.ReadInt32();
                int compressedTextLength = reader.ReadInt32() - 4;
                int decompressedTextLength = reader.ReadInt32();
                byte[] decompressedText = new byte[decompressedTextLength];
                if (numTextLines > 0 && decompressedTextLength > 0)
                {
                    byte[] compressedTextData = reader.ReadBytes(compressedTextLength);
                    Compression.Unpack(decompressedText, ref decompressedTextLength, compressedTextData, compressedTextLength);
                    int index = 0;
                    List<string> lines = new List<string>();
                    for (int i = 0; i < numTextLines; i++)
                    {
                        int length = decompressedText[index] * 256 + decompressedText[index + 1];
                        index += 2;
                        byte[] b = new byte[length * 2];
                        Array.Copy(decompressedText, index, b, 0, length * 2);
                        index += length * 2;
                        lines.Add(Encoding.BigEndianUnicode.GetString(b));
                    }
                    TextLines = lines.ToArray();
                }
                else
                {
                    TextLines = new string[0];
                }
            }
        }
Exemplo n.º 3
0
 // This is called when the packet is received.
 public TargetCursorMultiPacket(PacketReader reader)
     : base(0x99, "Target Cursor For Multi")
 {
     reader.ReadByte(); // (0x01 from server, 0x00 from client)
     _deedSerial = reader.ReadInt32();
     reader.ReadByte(); // flag byte. Harmful = 1, Beneficial = 2. Unused.
     reader.ReadBytes(11); // unknown (all 0)
     _multiModel = reader.ReadInt16();
     _offsetX = reader.ReadInt16();
     _offsetY = reader.ReadInt16();
     _offsetZ = reader.ReadInt16();
 }