Exemplo n.º 1
0
        public void Read(ByteArrayStreamReader reader)
        {
            OperatingSystem = (OperatingSystem)reader.ReadUShort();

            Version = reader.ReadUShort();

            TibiaDat = reader.ReadUInt();

            TibiaSpr = reader.ReadUInt();

            TibiaPic = reader.ReadUInt();

            reader.ReadByte();

            Keys = new uint[]
            {
                reader.ReadUInt(),

                    reader.ReadUInt(),

                    reader.ReadUInt(),

                    reader.ReadUInt()
            };

            Account = reader.ReadString();

            Password = reader.ReadString();

            LocaleId = reader.ReadByte();

            Locate = Encoding.Default.GetString(reader.ReadBytes(3));

            TotalRam = reader.ReadUShort();

            reader.ReadBytes(6);

            Cpu = Encoding.Default.GetString(reader.ReadBytes(9));

            reader.ReadBytes(2);

            CpuClock = reader.ReadUShort();

            CpuClock2 = reader.ReadUShort();

            reader.ReadBytes(4);

            Cpu = Encoding.Default.GetString(reader.ReadBytes(9));

            VideoRam = reader.ReadUShort();

            ResolutionHorizontal = reader.ReadUShort();

            ResolutionVertical = reader.ReadUShort();

            RefreshRate = reader.ReadByte();
        }
Exemplo n.º 2
0
        public static Sprite Load(bool invisible, ByteArrayStreamReader reader)
        {
            byte[] pixels = new byte[4 * 32 * 32];

            int pixel = 0;

            byte red = reader.ReadByte();

            byte green = reader.ReadByte();

            byte blue = reader.ReadByte();

            int length = reader.ReadUShort();

            while (true)
            {
                if (length <= 0)
                {
                    break;
                }

                ushort transparent = reader.ReadUShort();

                length -= 2;

                if (invisible)
                {
                    pixel += transparent * 4;
                }
                else
                {
                    for (int i = 0; i < transparent; i++)
                    {
                        pixels[pixel++] = blue;

                        pixels[pixel++] = green;

                        pixels[pixel++] = red;

                        pixels[pixel++] = 255;
                    }
                }

                if (length <= 0)
                {
                    break;
                }

                ushort colored = reader.ReadUShort();

                length -= 2;

                byte[] coloredBytes = reader.ReadBytes(3 * colored);

                length -= 3 * colored;

                for (int i = 0; i < 3 * colored; i += 3)
                {
                    pixels[pixel++] = coloredBytes[i + 2];

                    pixels[pixel++] = coloredBytes[i + 1];

                    pixels[pixel++] = coloredBytes[i];

                    pixels[pixel++] = 255;
                }
            }

            Sprite sprite = new Sprite();

            sprite.Red = red;

            sprite.Green = green;

            sprite.Blue = blue;

            sprite.Pixels = pixels;

            return sprite;
        }
Exemplo n.º 3
0
        public static Item Load(ByteArrayFileTreeStream stream, ByteArrayStreamReader reader)
        {
            Item item = new Item();

            item.Group = (ItemGroup)reader.ReadByte();

            item.Flags = (ItemFlags)reader.ReadUInt();

            while (true)
            {
                OtbAttribute attribute = (OtbAttribute)reader.ReadByte();

                stream.Seek(Origin.Current, 2);

                switch (attribute)
                {
                case OtbAttribute.OpenTibiaId:

                    item.OpenTibiaId = reader.ReadUShort();

                    break;

                case OtbAttribute.TibiaId:

                    item.TibiaId = reader.ReadUShort();

                    break;

                case OtbAttribute.Speed:

                    item.Speed = reader.ReadUShort();

                    break;

                case OtbAttribute.SpriteHash:

                    item.SpriteHash = reader.ReadBytes(16);

                    break;

                case OtbAttribute.MinimapColor:

                    item.MinimapColor = reader.ReadUShort();

                    break;

                case OtbAttribute.MaxReadWriteChars:

                    item.MaxReadWriteChars = reader.ReadUShort();

                    break;

                case OtbAttribute.MaxReadChars:

                    item.MaxReadChars = reader.ReadUShort();

                    break;

                case OtbAttribute.Light:

                    item.LightLevel = reader.ReadUShort();

                    item.LightColor = reader.ReadUShort();

                    break;

                case OtbAttribute.TopOrder:

                    item.TopOrder = (TopOrder)reader.ReadByte();

                    break;

                default:

                    stream.Seek(Origin.Current, -3);

                    return(item);
                }
            }
        }