Ejemplo n.º 1
0
            public ZoneEntities(byte[] data)
            {
                Data = data;

                using (BinaryReader br = new BinaryReader(new MemoryStream(data)))
                {
                    // Load Header
                    Length = br.ReadInt32();
                    Furniture = new EntityFurniture[FurnitureCount = br.ReadByte()];
                    NPCs = new EntityNPC[NPCCount = br.ReadByte()];
                    Warps = new EntityWarp[WarpCount = br.ReadByte()];
                    Triggers1 = new EntityTrigger1[TriggerCount = br.ReadByte()];
                    Triggers2 = new EntityTrigger2[UnknownCount = br.ReadInt32()]; // not sure if there's other types or if the remaining 3 bytes are padding.

                    // Load Entitites
                    for (int i = 0; i < FurnitureCount; i++)
                        Furniture[i] = new EntityFurniture(br.ReadBytes(EntityFurniture.Size));
                    for (int i = 0; i < NPCCount; i++)
                        NPCs[i] = new EntityNPC(br.ReadBytes(EntityNPC.Size));
                    for (int i = 0; i < WarpCount; i++)
                        Warps[i] = new EntityWarp(br.ReadBytes(EntityWarp.Size));
                    for (int i = 0; i < TriggerCount; i++)
                        Triggers1[i] = new EntityTrigger1(br.ReadBytes(EntityTrigger1.Size));
                    for (int i = 0; i < UnknownCount; i++)
                        Triggers2[i] = new EntityTrigger2(br.ReadBytes(EntityTrigger2.Size));

                    // Load Script Data
                    int len = br.ReadInt32();
                    br.BaseStream.Position -= 4;
                    Script = new Script(br.ReadBytes(len));
                }
            }
Ejemplo n.º 2
0
            public ZoneEntities(byte[] data)
            {
                Data = data;

                using (BinaryReader br = new BinaryReader(new MemoryStream(data)))
                {
                    // Load Header
                    Length = br.ReadInt32();
                    Furniture = new EntityFurniture[FurnitureCount = br.ReadByte()];
                    NPCs = new EntityNPC[NPCCount = br.ReadByte()];
                    Warps = new EntityWarp[WarpCount = br.ReadByte()];
                    Triggers1 = new EntityTrigger1[TriggerCount = br.ReadByte()];
                    Triggers2 = new EntityTrigger2[UnknownCount = br.ReadInt32()]; // not sure if there's other types or if the remaining 3 bytes are padding.

                    // Load Entitites
                    for (int i = 0; i < FurnitureCount; i++)
                        Furniture[i] = new EntityFurniture(br.ReadBytes(EntityFurniture.Size));
                    for (int i = 0; i < NPCCount; i++)
                        NPCs[i] = new EntityNPC(br.ReadBytes(EntityNPC.Size));
                    for (int i = 0; i < WarpCount; i++)
                        Warps[i] = new EntityWarp(br.ReadBytes(EntityWarp.Size));
                    for (int i = 0; i < TriggerCount; i++)
                        Triggers1[i] = new EntityTrigger1(br.ReadBytes(EntityTrigger1.Size));
                    for (int i = 0; i < UnknownCount; i++)
                        Triggers2[i] = new EntityTrigger2(br.ReadBytes(EntityTrigger2.Size));

                    // Load Script Data
                    int len = br.ReadInt32();
                    br.BaseStream.Position -= 4;
                    Script = new Script(br.ReadBytes(len));
                }
            }