Beispiel #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));
                }
            }
Beispiel #2
0
            public ZoneEntities(byte[] data)
            {
                Data = data;

                using (BinaryReader br = new BinaryReader(new MemoryStream(data)))
                {
                    Length = br.ReadUInt32();
                    Furniture = new EntityFurniture[br.ReadByte()];
                    NPCs = new EntityNPC[br.ReadByte()];
                    Warps = new EntityWarp[br.ReadByte()];
                    Triggers = new EntityTrigger[br.ReadByte()];
                    for (int i = 0; i < Furniture.Length; i++)
                        Furniture[i] = new EntityFurniture(br.ReadBytes(Furniture.Length));
                    for (int i = 0; i < NPCs.Length; i++)
                        NPCs[i] = new EntityNPC(br.ReadBytes(NPCs.Length));
                    for (int i = 0; i < Warps.Length; i++)
                        Warps[i] = new EntityWarp(br.ReadBytes(Warps.Length));
                    for (int i = 0; i < Triggers.Length; i++)
                        Triggers[i] = new EntityTrigger(br.ReadBytes(Triggers.Length));
                    ScriptData = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position));
                }
            }
Beispiel #3
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));
                }
            }