public NavZoneDef(MpqFileStream stream) { this.NavCellCount = stream.ReadValueS32(); stream.Position += (3 * 4); this.NavCells = stream.ReadSerializedData <NavCell>(this.NavCellCount); this.NeightbourCount = stream.ReadValueS32(); stream.Position += (3 * 4); this.NavCellNeighbours = stream.ReadSerializedData <NavCellLookup>(this.NeightbourCount); this.Float0 = stream.ReadValueF32(); this.Float1 = stream.ReadValueF32(); this.Int2 = stream.ReadValueS32(); this.V0 = new Vector2D(stream); stream.Position += (3 * 4); var pointerGridSquares = stream.GetSerializedDataPointer(); this.GridSquares = stream.ReadSerializedData <NavGridSquare>(pointerGridSquares, pointerGridSquares.Size / 6); this.Int3 = stream.ReadValueS32(); stream.Position += (3 * 4); var pointerCellLookups = stream.GetSerializedDataPointer(); this.CellLookups = stream.ReadSerializedData <NavCellLookup>(pointerCellLookups, pointerCellLookups.Size / 4); this.Int4 = stream.ReadValueS32(); stream.Position += (3 * 4); var pointerBorderData = stream.GetSerializedDataPointer(); this.BorderData = stream.ReadSerializedData <NavCellBorderData>(pointerBorderData, pointerBorderData.Size / 4); }
public void Read(MpqFileStream stream) { var pointer = stream.GetSerializedDataPointer(); this.ChunkCount = stream.ReadValueS32(); stream.Position += (3 * 4); this.SceneChunks = stream.ReadSerializedData <SceneChunk>(pointer, this.ChunkCount); }
public void Read(MpqFileStream stream) { var pointer = stream.GetSerializedDataPointer(); this.DRLGTiles = stream.ReadSerializedData <TileInfo>(pointer, pointer.Size / 72); stream.Position += (14 * 4); this.CommandCount = stream.ReadValueS32(); this.DRLGCommands = stream.ReadSerializedData <DRLGCommand>(this.CommandCount); stream.Position += (3 * 4); this.ParentIndices = stream.ReadSerializedInts(); stream.Position += (2 * 4); this.DRLGTagMap = stream.ReadSerializedItem <TagMap>(); }
public Conversation(MpqFile file) { MpqFileStream stream = file.Open(); this.Header = new Header(stream); this.ConversationType = (ConversationTypes)stream.ReadValueS32(); this.I0 = stream.ReadValueS32(); this.I1 = stream.ReadValueS32(); this.SNOQuest = stream.ReadValueS32(); this.I2 = stream.ReadValueS32(); this.I3 = stream.ReadValueS32(); this.SNOConvPiggyback = stream.ReadValueS32(); this.SNOConvUnlock = stream.ReadValueS32(); this.I4 = stream.ReadValueS32(); this.Unknown = stream.ReadString(128, true); this.SNOPrimaryNpc = stream.ReadValueS32(); this.SNOAltNpc1 = stream.ReadValueS32(); this.SNOAltNpc2 = stream.ReadValueS32(); this.SNOAltNpc3 = stream.ReadValueS32(); this.SNOAltNpc4 = stream.ReadValueS32(); this.I5 = stream.ReadValueS32(); stream.Position += (2 * 4); RootTreeNodes = stream.ReadSerializedData <ConversationTreeNode>(); this.Unknown2 = stream.ReadString(256, true); this.I6 = stream.ReadValueS32(); stream.Position += (2 * 4); SerializableDataPointer compiledScriptPointer = stream.GetSerializedDataPointer(); stream.Position += 44; // these bytes are unaccounted for in the xml this.SNOBossEncounter = stream.ReadValueS32(); // reading compiled script, placed it here so i dont have to move the offset around CompiledScript = new byte[compiledScriptPointer.Size]; stream.Position = compiledScriptPointer.Offset + 16; stream.Read(CompiledScript, 0, compiledScriptPointer.Size); stream.Close(); }
/// <summary> /// Reads a total of n serialized items. /// </summary> /// <typeparam name="T">Item type to read.</typeparam> /// <param name="stream">The MPQFileStream to read from.</param> /// <param name="count">Number of items to read from.</param> /// <returns>List of items.</returns> public static List <T> ReadSerializedData <T>(this MpqFileStream stream, int count) where T : ISerializableData, new() { var pointer = stream.GetSerializedDataPointer(); return(stream.ReadSerializedData <T>(pointer, count)); }