private unsafe StaticTile[][][] ReadStaticBlock( int x, int y ) { try { m_IndexReader.BaseStream.Seek( ((x * m_BlockHeight) + y) * 12, SeekOrigin.Begin ); int lookup = m_IndexReader.ReadInt32(); int length = m_IndexReader.ReadInt32(); if ( lookup < 0 || length <= 0 ) { return m_EmptyStaticBlock; } else { int count = length / 7; m_Statics.Seek( lookup, SeekOrigin.Begin ); if ( m_TileBuffer.Length < count ) m_TileBuffer = new StaticTile[count]; StaticTile[] staTiles = m_TileBuffer;//new StaticTile[tileCount]; fixed ( StaticTile *pTiles = staTiles ) { #if !MONO NativeReader.Read( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length ); #else NativeReader.Read( m_Statics.Handle, pTiles, length ); #endif if ( m_Lists == null ) { m_Lists = new TileList[8][]; for ( int i = 0; i < 8; ++i ) { m_Lists[i] = new TileList[8]; for ( int j = 0; j < 8; ++j ) m_Lists[i][j] = new TileList(); } } TileList[][] lists = m_Lists; StaticTile *pCur = pTiles, pEnd = pTiles + count; while ( pCur < pEnd ) { lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( pCur->m_ID, pCur->m_Z ); pCur = pCur + 1; } StaticTile[][][] tiles = new StaticTile[8][][]; for ( int i = 0; i < 8; ++i ) { tiles[i] = new StaticTile[8][]; for ( int j = 0; j < 8; ++j ) tiles[i][j] = lists[i][j].ToArray(); } return tiles; } } } catch ( EndOfStreamException ) { if ( DateTime.Now >= m_NextStaticWarning ) { Console.WriteLine( "Warning: Static EOS for {0} ({1}, {2})", m_Owner, x, y ); m_NextStaticWarning = DateTime.Now + TimeSpan.FromMinutes( 1.0 ); } return m_EmptyStaticBlock; } }
private int PatchStatics( TileMatrix matrix, string dataPath, string indexPath, string lookupPath ) { using ( FileStream fsData = new FileStream( dataPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { using ( FileStream fsIndex = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { using ( FileStream fsLookup = new FileStream( lookupPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { BinaryReader indexReader = new BinaryReader( fsIndex ); BinaryReader lookupReader = new BinaryReader( fsLookup ); int count = (int)(indexReader.BaseStream.Length / 4); TileList[][] lists = new TileList[8][]; for ( int x = 0; x < 8; ++x ) { lists[x] = new TileList[8]; for ( int y = 0; y < 8; ++y ) lists[x][y] = new TileList(); } for ( int i = 0; i < count; ++i ) { int blockID = indexReader.ReadInt32(); int blockX = blockID / matrix.BlockHeight; int blockY = blockID % matrix.BlockHeight; int offset = lookupReader.ReadInt32(); int length = lookupReader.ReadInt32(); lookupReader.ReadInt32(); // Extra if ( offset < 0 || length <= 0 ) { matrix.SetStaticBlock( blockX, blockY, matrix.EmptyStaticBlock ); continue; } fsData.Seek( offset, SeekOrigin.Begin ); int tileCount = length / 7; if ( m_TileBuffer.Length < tileCount ) m_TileBuffer = new StaticTile[tileCount]; StaticTile[] staTiles = m_TileBuffer;//new StaticTile[tileCount]; GCHandle handle = GCHandle.Alloc(staTiles, GCHandleType.Pinned); try { if ( m_Buffer == null || length > m_Buffer.Length ) m_Buffer = new byte[length]; fsData.Read( m_Buffer, 0, length ); Marshal.Copy(m_Buffer, 0, handle.AddrOfPinnedObject(), length); for (int j = 0; j < tileCount; j++) { StaticTile cur = staTiles[j]; lists[cur.m_X & 0x7][cur.m_Y & 0x7].Add( (short)((cur.m_ID & 0x3FFF) + 0x4000), cur.m_Z ); } Tile[][][] tiles = new Tile[8][][]; for ( int x = 0; x < 8; ++x ) { tiles[x] = new Tile[8][]; for ( int y = 0; y < 8; ++y ) tiles[x][y] = lists[x][y].ToArray(); } matrix.SetStaticBlock( blockX, blockY, tiles ); } finally { handle.Free(); } } indexReader.Close(); lookupReader.Close(); return count; } } } }
public MultiComponentList(BinaryReader reader, int count) { var allTiles = m_List = new MultiTileEntry[count]; for (int i = 0; i < count; ++i) { allTiles[i].m_ItemID = reader.ReadUInt16(); allTiles[i].m_OffsetX = reader.ReadInt16(); allTiles[i].m_OffsetY = reader.ReadInt16(); allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_Flags = reader.ReadInt32(); if (_PostHSFormat) { reader.ReadInt32(); // ?? } MultiTileEntry e = allTiles[i]; if (i == 0 || e.m_Flags != 0) { if (e.m_OffsetX < m_Min.m_X) { m_Min.m_X = e.m_OffsetX; } if (e.m_OffsetY < m_Min.m_Y) { m_Min.m_Y = e.m_OffsetY; } if (e.m_OffsetX > m_Max.m_X) { m_Max.m_X = e.m_OffsetX; } if (e.m_OffsetY > m_Max.m_Y) { m_Max.m_Y = e.m_OffsetY; } } } m_Center = new Point2D(-m_Min.m_X, -m_Min.m_Y); m_Width = (m_Max.m_X - m_Min.m_X) + 1; m_Height = (m_Max.m_Y - m_Min.m_Y) + 1; var tiles = new TileList[m_Width][]; m_Tiles = new StaticTile[m_Width][][]; for (int x = 0; x < m_Width; ++x) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new StaticTile[m_Height][]; for (int y = 0; y < m_Height; ++y) { tiles[x][y] = new TileList(); } } for (int i = 0; i < allTiles.Length; ++i) { if (i == 0 || allTiles[i].m_Flags != 0) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; #region Stygian Abyss //tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); tiles[xOffset][yOffset].Add( (ushort)((allTiles[i].m_ItemID & TileData.MaxItemValue) | 0x10000), (sbyte)allTiles[i].m_OffsetZ); #endregion } } for (int x = 0; x < m_Width; ++x) { for (int y = 0; y < m_Height; ++y) { m_Tiles[x][y] = tiles[x][y].ToArray(); } } }
public MultiComponentList( GenericReader reader ) { int version = reader.ReadInt(); switch ( version ) { case 0: { m_Min = reader.ReadPoint2D(); m_Max = reader.ReadPoint2D(); m_Center = reader.ReadPoint2D(); m_Width = reader.ReadInt(); m_Height = reader.ReadInt(); int length = reader.ReadInt(); MultiTileEntry[] allTiles = m_List = new MultiTileEntry[length]; for ( int i = 0; i < length; ++i ) { allTiles[i].m_ItemID = reader.ReadShort(); allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } TileList[][] tiles = new TileList[m_Width][]; m_Tiles = new Tile[m_Width][][]; for ( int x = 0; x < m_Width; ++x ) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new Tile[m_Height][]; for ( int y = 0; y < m_Height; ++y ) tiles[x][y] = new TileList(); } for ( int i = 0; i < allTiles.Length; ++i ) { if ( i == 0 || allTiles[i].m_Flags != 0 ) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; tiles[xOffset][yOffset].Add( (short)((allTiles[i].m_ItemID & 0x3FFF) | 0x4000), (sbyte)allTiles[i].m_OffsetZ ); } } for ( int x = 0; x < m_Width; ++x ) for ( int y = 0; y < m_Height; ++y ) m_Tiles[x][y] = tiles[x][y].ToArray(); break; } } }
public MultiComponentList(GenericReader reader) { int num3; int num4; int num5; int num6; int num7; int num8; int num9; int num10; MultiTileEntry[] entryArray2; int num11 = reader.ReadInt(); if (num11 != 0) { return; } this.m_Min = reader.ReadPoint2D(); this.m_Max = reader.ReadPoint2D(); this.m_Center = reader.ReadPoint2D(); this.m_Width = reader.ReadInt(); this.m_Height = reader.ReadInt(); int num2 = reader.ReadInt(); this.m_List = (entryArray2 = new MultiTileEntry[num2]); MultiTileEntry[] entryArray1 = entryArray2; for (num3 = 0; (num3 < num2); ++num3) { entryArray1[num3].m_ItemID = reader.ReadShort(); entryArray1[num3].m_OffsetX = reader.ReadShort(); entryArray1[num3].m_OffsetY = reader.ReadShort(); entryArray1[num3].m_OffsetZ = reader.ReadShort(); entryArray1[num3].m_Flags = reader.ReadInt(); } TileList[][] listArrayArray1 = new TileList[this.m_Width][]; this.m_Tiles = new Tile[this.m_Width][][]; for (num4 = 0; (num4 < this.m_Width); ++num4) { listArrayArray1[num4] = new TileList[this.m_Height]; this.m_Tiles[num4] = new Tile[this.m_Height][]; for (num5 = 0; (num5 < this.m_Height); ++num5) { listArrayArray1[num4][num5] = new TileList(); } } for (num6 = 0; (num6 < entryArray1.Length); ++num6) { if ((num6 == 0) || (entryArray1[num6].m_Flags != 0)) { num7 = (entryArray1[num6].m_OffsetX + this.m_Center.m_X); num8 = (entryArray1[num6].m_OffsetY + this.m_Center.m_Y); listArrayArray1[num7][num8].Add(((short)((entryArray1[num6].m_ItemID & 16383) | 16384)), ((sbyte)entryArray1[num6].m_OffsetZ)); } } for (num9 = 0; (num9 < this.m_Width); ++num9) { for (num10 = 0; (num10 < this.m_Height); ++num10) { this.m_Tiles[num9][num10] = listArrayArray1[num9][num10].ToArray(); } } }
public MultiComponentList(GenericReader reader) { int version = reader.ReadInt(); m_Min = reader.ReadPoint2D(); m_Max = reader.ReadPoint2D(); m_Center = reader.ReadPoint2D(); m_Width = reader.ReadInt(); m_Height = reader.ReadInt(); int length = reader.ReadInt(); var allTiles = m_List = new MultiTileEntry[length]; if (version == 0) { for (int i = 0; i < length; ++i) { int id = reader.ReadShort(); if (id >= 0x4000) { id -= 0x4000; } allTiles[i].m_ItemID = (ushort)id; allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } } else { for (int i = 0; i < length; ++i) { allTiles[i].m_ItemID = reader.ReadUShort(); allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } } var tiles = new TileList[m_Width][]; m_Tiles = new StaticTile[m_Width][][]; for (int x = 0; x < m_Width; ++x) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new StaticTile[m_Height][]; for (int y = 0; y < m_Height; ++y) { tiles[x][y] = new TileList(); } } for (int i = 0; i < allTiles.Length; ++i) { if (i == 0 || allTiles[i].m_Flags != 0) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; #region Stygian Abyss //tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); tiles[xOffset][yOffset].Add( (ushort)((allTiles[i].m_ItemID & TileData.MaxItemValue) | 0x10000), (sbyte)allTiles[i].m_OffsetZ); #endregion } } for (int x = 0; x < m_Width; ++x) { for (int y = 0; y < m_Height; ++y) { m_Tiles[x][y] = tiles[x][y].ToArray(); } } }
public MultiComponentList( GenericReader reader ) { int version = reader.ReadInt(); switch ( version ) { case 0: { m_Min = reader.ReadPoint2D(); m_Max = reader.ReadPoint2D(); m_Center = reader.ReadPoint2D(); m_Width = reader.ReadInt(); m_Height = reader.ReadInt(); int length = reader.ReadInt(); MultiTileEntry[] allTiles = m_List = new MultiTileEntry[length]; for ( int i = 0; i < length; ++i ) { allTiles[i].m_ItemID = reader.ReadShort(); allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } TileList[][] tiles = new TileList[m_Width][]; m_Tiles = new Tile[m_Width][][]; for ( int x = 0; x < m_Width; ++x ) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new Tile[m_Height][]; for ( int y = 0; y < m_Height; ++y ) tiles[x][y] = new TileList(); } for ( int i = 0; i < allTiles.Length; ++i ) { if ( i == 0 || allTiles[i].m_Flags != 0 ) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; #region SA // Note #1 | 0x8000 produces problems, namely the server doesn't increase your Z when climbing stairs thus the itemid isn't reconized properly. tiles[xOffset][yOffset].Add( (short)((allTiles[i].m_ItemID & 0x7FFF) | 0x4000), (sbyte)allTiles[i].m_OffsetZ ); #endregion } } for ( int x = 0; x < m_Width; ++x ) for ( int y = 0; y < m_Height; ++y ) m_Tiles[x][y] = tiles[x][y].ToArray(); break; } } }
private unsafe int PatchStatics( TileMatrix matrix, string dataPath, string indexPath, string lookupPath ) { using ( FileStream fsData = new FileStream( dataPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { using ( FileStream fsIndex = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { using ( FileStream fsLookup = new FileStream( lookupPath, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { BinaryReader indexReader = new BinaryReader( fsIndex ); BinaryReader lookupReader = new BinaryReader( fsLookup ); int count = (int)(indexReader.BaseStream.Length / 4); TileList[][] lists = new TileList[8][]; for ( int x = 0; x < 8; ++x ) { lists[x] = new TileList[8]; for ( int y = 0; y < 8; ++y ) lists[x][y] = new TileList(); } for ( int i = 0; i < count; ++i ) { int blockID = indexReader.ReadInt32(); int blockX = blockID / matrix.BlockHeight; int blockY = blockID % matrix.BlockHeight; int offset = lookupReader.ReadInt32(); int length = lookupReader.ReadInt32(); lookupReader.ReadInt32(); // Extra if ( offset < 0 || length <= 0 ) { matrix.SetStaticBlock( blockX, blockY, matrix.EmptyStaticBlock ); continue; } fsData.Seek( offset, SeekOrigin.Begin ); int tileCount = length / 7; if ( m_TileBuffer.Length < tileCount ) m_TileBuffer = new StaticTile[tileCount]; StaticTile[] staTiles = m_TileBuffer; fixed ( StaticTile *pTiles = staTiles ) { #if !MONO NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length ); #else NativeReader.Read( fsData.Handle, pTiles, length ); #endif StaticTile *pCur = pTiles, pEnd = pTiles + tileCount; while ( pCur < pEnd ) { lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (ushort)pCur->m_ID, pCur->m_Z ); pCur = pCur + 1; } StaticTile[][][] tiles = new StaticTile[8][][]; for ( int x = 0; x < 8; ++x ) { tiles[x] = new StaticTile[8][]; for ( int y = 0; y < 8; ++y ) tiles[x][y] = lists[x][y].ToArray(); } matrix.SetStaticBlock( blockX, blockY, tiles ); } } indexReader.Close(); lookupReader.Close(); return count; } } } }
public MultiComponentList(GenericReader reader) { int version = reader.ReadInt(); switch (version) { case 1: case 0: { m_Min = reader.ReadPoint2D(); m_Max = reader.ReadPoint2D(); Center = reader.ReadPoint2D(); Width = reader.ReadInt(); Height = reader.ReadInt(); int length = reader.ReadInt(); MultiTileEntry[] allTiles = List = new MultiTileEntry[length]; for (int i = 0; i < length; ++i) { ushort id = reader.ReadUShort(); if (version == 0 && id >= 0x8000) { id -= 0x8000; } allTiles[i].m_ItemID = id; allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } TileList[][] tiles = new TileList[Width][]; Tiles = new Tile[Width][][]; for (int x = 0; x < Width; ++x) { tiles[x] = new TileList[Height]; Tiles[x] = new Tile[Height][]; for (int y = 0; y < Height; ++y) { tiles[x][y] = new TileList(); } } for (int i = 0; i < allTiles.Length; ++i) { if (i == 0 || allTiles[i].m_Flags != 0) { int xOffset = allTiles[i].m_OffsetX + Center.X; int yOffset = allTiles[i].m_OffsetY + Center.Y; tiles[xOffset][yOffset].Add((ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ); } } for (int x = 0; x < Width; ++x) { for (int y = 0; y < Height; ++y) { Tiles[x][y] = tiles[x][y].ToArray(); } } break; } } }
/// <summary> /// Returns component list from the hashtable /// </summary> /// <param name="houseID"></param> /// <returns></returns> public static MultiComponentList GetComponents(string houseID) { MultiComponentList mcl = MultiComponentList.Empty; if (!IsBlueprintLoaded(houseID)) if (!LoadBlueprint(houseID)) return mcl; //grab blueprint HouseBlueprint house = m_BlueprintList[houseID] as HouseBlueprint; if (house == null) return mcl; //now the fun tile processing and mcl setup MultiTileEntry[] allTiles = mcl.List = new MultiTileEntry[house.Multis.Count + house.Deco.Count]; // normal house tiles int i = 0; foreach (MultiStruct multiData in house.Multis) { allTiles[i].m_ItemID = multiData.id; allTiles[i].m_OffsetX = multiData.x; allTiles[i].m_OffsetY = multiData.y; allTiles[i].m_OffsetZ = multiData.z; ++i; } // deco items on the plot, like steps (outside bounding rect) foreach (MultiStruct multiData in house.Deco) { allTiles[i].m_ItemID = multiData.id; allTiles[i].m_OffsetX = multiData.x; allTiles[i].m_OffsetY = multiData.y; allTiles[i].m_OffsetZ = multiData.z; ++i; } mcl.Center = new Point2D(-mcl.Min.X, -mcl.Min.Y); mcl.Width = (mcl.Max.X - mcl.Min.X) + 1; mcl.Height = (mcl.Max.Y - mcl.Min.Y) + 1; TileList[][] tiles = new TileList[mcl.Width][]; mcl.Tiles = new Tile[mcl.Width][][]; for (int x = 0; x < mcl.Width; ++x) { tiles[x] = new TileList[mcl.Height]; mcl.Tiles[x] = new Tile[mcl.Height][]; for (int y = 0; y < mcl.Height; ++y) tiles[x][y] = new TileList(); } if (i == 0) { int xOffset = allTiles[i].m_OffsetX + mcl.Center.X; int yOffset = allTiles[i].m_OffsetY + mcl.Center.Y; tiles[xOffset][yOffset].Add((short)((allTiles[i].m_ItemID & 0x3FFF) | 0x4000), (sbyte)allTiles[i].m_OffsetZ); } for (int x = 0; x < mcl.Width; ++x) for (int y = 0; y < mcl.Height; ++y) mcl.Tiles[x][y] = tiles[x][y].ToArray(); return mcl; }
// END ALAN MOD public MultiComponentList( BinaryReader reader, int count ) { MultiTileEntry[] allTiles = m_List = new MultiTileEntry[count]; for ( int i = 0; i < count; ++i ) { allTiles[i].m_ItemID = reader.ReadUInt16(); allTiles[i].m_OffsetX = reader.ReadInt16(); allTiles[i].m_OffsetY = reader.ReadInt16(); allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_Flags = reader.ReadInt32(); /* // BEGIN ALAN PARSING OUT STUFF (THIS IS TEMPORARY) ================================================== if (allTiles[i].m_Flags == 0) // invisible { int[,] transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; // transformation matrix //Console.WriteLine(allTiles[i].m_ItemID + "\t" + allTiles[i].m_OffsetX + "\t" + allTiles[i].m_OffsetY + "\t" + allTiles[i].m_OffsetZ + "\t" + allTiles[i].m_Flags); int baseMultiID = 0; // this is the "base" multi (northern undamaged boat) used to rotate from in order to connect the pieces int damageLevel = 0; int direction = 0; if (MultiData.currentMultiID == 24) // orc north BASE { if (!MultiEntries.ContainsKey(24)) MultiEntries.Add(24, new MultiEntry(24)); baseMultiID = 24; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 0; direction = 0; } else if (MultiData.currentMultiID == 25) // orc east { baseMultiID = 24; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 0; direction = 1; } else if (MultiData.currentMultiID == 26) // orc south { baseMultiID = 24; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 0; direction =2 ; } else if (MultiData.currentMultiID == 27) // orc west { baseMultiID = 24; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 0; direction = 3; } else if (MultiData.currentMultiID == 28) // orc north damaged 1 { baseMultiID = 24; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 1; direction = 0; } else if (MultiData.currentMultiID == 29) // orc east damaged 1 { baseMultiID = 24; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 1; direction = 1; } else if (MultiData.currentMultiID == 30) // orc south damaged 1 { baseMultiID = 24; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 1; direction = 2; } else if (MultiData.currentMultiID == 31) // orc west damaged 1 { baseMultiID = 24; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 1; direction = 3; } else if (MultiData.currentMultiID == 32) // orc north damaged 2 { baseMultiID = 24; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 2; direction = 0; } else if (MultiData.currentMultiID == 33) // orc east damaged 2 { baseMultiID = 24; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 2; direction = 1; } else if (MultiData.currentMultiID == 34) // orc south damaged 2 { baseMultiID = 24; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 2; direction = 2; } else if (MultiData.currentMultiID == 35) // orc west damaged 2 { baseMultiID = 24; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 2; direction = 3; } else if (MultiData.currentMultiID == 36) // gargoyle north BASE { if (!MultiEntries.ContainsKey(36)) MultiEntries.Add(36, new MultiEntry(36)); baseMultiID = 36; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 0; direction = 0; } else if (MultiData.currentMultiID == 37) // gargoyle east { baseMultiID = 36; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 0; direction = 1; } else if (MultiData.currentMultiID == 38) // gargoyle south { baseMultiID = 36; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 0; direction = 2; } else if (MultiData.currentMultiID == 39) // gargoyle west { baseMultiID = 36; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 0; direction = 3; } else if (MultiData.currentMultiID == 40) // gargoyle north damaged 1 { baseMultiID = 36; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 1; direction = 0; } else if (MultiData.currentMultiID == 41) // gargoyle east damaged 1 { baseMultiID = 36; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 1; direction = 1; } else if (MultiData.currentMultiID == 42) // gargoyle south damaged 1 { baseMultiID = 36; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 1; direction = 2; } else if (MultiData.currentMultiID == 43) // gargoyle west damaged 1 { baseMultiID = 36; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 1; direction = 3; } else if (MultiData.currentMultiID == 44) // gargoyle north damaged 2 { baseMultiID = 36; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 2; direction = 0; } else if (MultiData.currentMultiID == 45) // gargoyle east damaged 2 { baseMultiID = 36; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 2; direction = 1; } else if (MultiData.currentMultiID == 46) // gargoyle south damaged 2 { baseMultiID = 36; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 2; direction = 2; } else if (MultiData.currentMultiID == 47) // gargoyle west damaged 2 { baseMultiID = 36; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 2; direction = 3; } else if (MultiData.currentMultiID == 48) // tokuno north BASE { if (!MultiEntries.ContainsKey(48)) MultiEntries.Add(48, new MultiEntry(48)); baseMultiID = 48; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 0; direction = 0; } else if (MultiData.currentMultiID == 49) // tokuno east { baseMultiID = 48; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 0; direction = 1; } else if (MultiData.currentMultiID == 50) // tokuno south { baseMultiID = 48; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 0; direction = 2; } else if (MultiData.currentMultiID == 51) // tokuno west { baseMultiID = 48; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 0; direction = 3; } else if (MultiData.currentMultiID == 52) // tokuno north damaged 1 { baseMultiID = 48; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 1; direction = 0; } else if (MultiData.currentMultiID == 53) // tokuno east damaged 1 { baseMultiID = 48; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 1; direction = 1; } else if (MultiData.currentMultiID == 54) // tokuno south damaged 1 { baseMultiID = 48; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 1; direction = 2; } else if (MultiData.currentMultiID == 55) // tokuno west damaged 1 { baseMultiID = 48; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 1; direction = 3; } else if (MultiData.currentMultiID == 56) // tokuno north damaged 2 { baseMultiID = 48; transformation = new int[2, 2] { { 1, 0 }, { 0, 1 } }; damageLevel = 2; direction = 0; } else if (MultiData.currentMultiID == 57) // tokuno east damaged 2 { baseMultiID = 48; transformation = new int[2, 2] { { 0, -1 }, { 1, 0 } }; damageLevel = 2; direction = 1; } else if (MultiData.currentMultiID == 58) // tokuno south damaged 2 { baseMultiID = 48; transformation = new int[2, 2] { { -1, 0 }, { 0, -1 } }; damageLevel = 2; direction = 2; } else if (MultiData.currentMultiID == 59) // tokuno west damaged 2 { baseMultiID = 48; transformation = new int[2, 2] { { 0, 1 }, { -1, 0 } }; damageLevel = 2; direction = 3; } if (MultiEntries.ContainsKey(baseMultiID)) { MultiEntry entry = MultiEntries[baseMultiID]; entry.AddMultiEntryComponent(damageLevel, direction, allTiles[i].m_ItemID, new Point3D(allTiles[i].m_OffsetX, allTiles[i].m_OffsetY, allTiles[i].m_OffsetZ), transformation); } else { Console.WriteLine("MultiEntries did not yet contain key " + baseMultiID); } } // END ALAN PARSING OUT STUFF =================================================================== */ if ( _PostHSFormat ) reader.ReadInt32(); // ?? MultiTileEntry e = allTiles[i]; if ( i == 0 || e.m_Flags != 0 ) { if ( e.m_OffsetX < m_Min.m_X ) m_Min.m_X = e.m_OffsetX; if ( e.m_OffsetY < m_Min.m_Y ) m_Min.m_Y = e.m_OffsetY; if ( e.m_OffsetX > m_Max.m_X ) m_Max.m_X = e.m_OffsetX; if ( e.m_OffsetY > m_Max.m_Y ) m_Max.m_Y = e.m_OffsetY; } } m_Center = new Point2D( -m_Min.m_X, -m_Min.m_Y ); m_Width = (m_Max.m_X - m_Min.m_X) + 1; m_Height = (m_Max.m_Y - m_Min.m_Y) + 1; TileList[][] tiles = new TileList[m_Width][]; m_Tiles = new StaticTile[m_Width][][]; for ( int x = 0; x < m_Width; ++x ) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new StaticTile[m_Height][]; for ( int y = 0; y < m_Height; ++y ) tiles[x][y] = new TileList(); } for ( int i = 0; i < allTiles.Length; ++i ) { if ( i == 0 || allTiles[i].m_Flags != 0 ) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); } } for ( int x = 0; x < m_Width; ++x ) for ( int y = 0; y < m_Height; ++y ) m_Tiles[x][y] = tiles[x][y].ToArray(); }
public MultiComponentList(BinaryReader reader, int count) { MultiTileEntry[] allTiles = this.m_List = new MultiTileEntry[count]; for (int i = 0; i < count; ++i) { allTiles[i].m_ItemID = reader.ReadUInt16(); allTiles[i].m_OffsetX = reader.ReadInt16(); allTiles[i].m_OffsetY = reader.ReadInt16(); allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_Flags = reader.ReadInt32(); if (_PostHSFormat) { reader.ReadInt32(); // ?? } MultiTileEntry e = allTiles[i]; if (i == 0 || e.m_Flags != 0) { if (e.m_OffsetX < this.m_Min.m_X) { this.m_Min.m_X = e.m_OffsetX; } if (e.m_OffsetY < this.m_Min.m_Y) { this.m_Min.m_Y = e.m_OffsetY; } if (e.m_OffsetX > this.m_Max.m_X) { this.m_Max.m_X = e.m_OffsetX; } if (e.m_OffsetY > this.m_Max.m_Y) { this.m_Max.m_Y = e.m_OffsetY; } } } this.m_Center = new Point2D(-this.m_Min.m_X, -this.m_Min.m_Y); this.m_Width = (this.m_Max.m_X - this.m_Min.m_X) + 1; this.m_Height = (this.m_Max.m_Y - this.m_Min.m_Y) + 1; TileList[][] tiles = new TileList[this.m_Width][]; this.m_Tiles = new StaticTile[this.m_Width][][]; for (int x = 0; x < this.m_Width; ++x) { tiles[x] = new TileList[this.m_Height]; this.m_Tiles[x] = new StaticTile[this.m_Height][]; for (int y = 0; y < this.m_Height; ++y) { tiles[x][y] = new TileList(); } } for (int i = 0; i < allTiles.Length; ++i) { if (i == 0 || allTiles[i].m_Flags != 0) { int xOffset = allTiles[i].m_OffsetX + this.m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + this.m_Center.m_Y; tiles[xOffset][yOffset].Add((ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ); } } for (int x = 0; x < this.m_Width; ++x) { for (int y = 0; y < this.m_Height; ++y) { this.m_Tiles[x][y] = tiles[x][y].ToArray(); } } }
public MultiComponentList(GenericReader reader) { int version = reader.ReadInt(); this.m_Min = reader.ReadPoint2D(); this.m_Max = reader.ReadPoint2D(); this.m_Center = reader.ReadPoint2D(); this.m_Width = reader.ReadInt(); this.m_Height = reader.ReadInt(); int length = reader.ReadInt(); MultiTileEntry[] allTiles = this.m_List = new MultiTileEntry[length]; if (version == 0) { for (int i = 0; i < length; ++i) { int id = reader.ReadShort(); if (id >= 0x4000) { id -= 0x4000; } allTiles[i].m_ItemID = (ushort)id; allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } } else { for (int i = 0; i < length; ++i) { allTiles[i].m_ItemID = reader.ReadUShort(); allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } } TileList[][] tiles = new TileList[this.m_Width][]; this.m_Tiles = new StaticTile[this.m_Width][][]; for (int x = 0; x < this.m_Width; ++x) { tiles[x] = new TileList[this.m_Height]; this.m_Tiles[x] = new StaticTile[this.m_Height][]; for (int y = 0; y < this.m_Height; ++y) { tiles[x][y] = new TileList(); } } for (int i = 0; i < allTiles.Length; ++i) { if (i == 0 || allTiles[i].m_Flags != 0) { int xOffset = allTiles[i].m_OffsetX + this.m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + this.m_Center.m_Y; tiles[xOffset][yOffset].Add((ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ); } } for (int x = 0; x < this.m_Width; ++x) { for (int y = 0; y < this.m_Height; ++y) { this.m_Tiles[x][y] = tiles[x][y].ToArray(); } } }
public MultiComponentList( GenericReader reader ) { int version = reader.ReadInt(); m_Min = reader.ReadPoint2D(); m_Max = reader.ReadPoint2D(); m_Center = reader.ReadPoint2D(); m_Width = reader.ReadInt(); m_Height = reader.ReadInt(); int length = reader.ReadInt(); MultiTileEntry[] allTiles = m_List = new MultiTileEntry[length]; if ( version == 0 ) { for ( int i = 0; i < length; ++i ) { int id = reader.ReadShort(); if ( id >= 0x4000 ) id -= 0x4000; allTiles[i].m_ItemID = (ushort)id; allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } } else { for ( int i = 0; i < length; ++i ) { allTiles[i].m_ItemID = reader.ReadUShort(); allTiles[i].m_OffsetX = reader.ReadShort(); allTiles[i].m_OffsetY = reader.ReadShort(); allTiles[i].m_OffsetZ = reader.ReadShort(); allTiles[i].m_Flags = reader.ReadInt(); } } TileList[][] tiles = new TileList[m_Width][]; m_Tiles = new StaticTile[m_Width][][]; for ( int x = 0; x < m_Width; ++x ) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new StaticTile[m_Height][]; for ( int y = 0; y < m_Height; ++y ) tiles[x][y] = new TileList(); } for ( int i = 0; i < allTiles.Length; ++i ) { if ( i == 0 || allTiles[i].m_Flags != 0 ) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); } } for ( int x = 0; x < m_Width; ++x ) for ( int y = 0; y < m_Height; ++y ) m_Tiles[x][y] = tiles[x][y].ToArray(); }
public MultiComponentList( BinaryReader reader, int count ) { MultiTileEntry[] allTiles = m_List = new MultiTileEntry[count]; for ( int i = 0; i < count; ++i ) { allTiles[i].m_ItemID = reader.ReadInt16(); allTiles[i].m_OffsetX = reader.ReadInt16(); allTiles[i].m_OffsetY = reader.ReadInt16(); allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_Flags = reader.ReadInt32(); MultiTileEntry e = allTiles[i]; if ( i == 0 || e.m_Flags != 0 ) { if ( e.m_OffsetX < m_Min.m_X ) m_Min.m_X = e.m_OffsetX; if ( e.m_OffsetY < m_Min.m_Y ) m_Min.m_Y = e.m_OffsetY; if ( e.m_OffsetX > m_Max.m_X ) m_Max.m_X = e.m_OffsetX; if ( e.m_OffsetY > m_Max.m_Y ) m_Max.m_Y = e.m_OffsetY; } } m_Center = new Point2D( -m_Min.m_X, -m_Min.m_Y ); m_Width = (m_Max.m_X - m_Min.m_X) + 1; m_Height = (m_Max.m_Y - m_Min.m_Y) + 1; TileList[][] tiles = new TileList[m_Width][]; m_Tiles = new Tile[m_Width][][]; for ( int x = 0; x < m_Width; ++x ) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new Tile[m_Height][]; for ( int y = 0; y < m_Height; ++y ) tiles[x][y] = new TileList(); } for ( int i = 0; i < allTiles.Length; ++i ) { if ( i == 0 || allTiles[i].m_Flags != 0 ) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; #region SA // Note #1 | 0x8000 produces problems, namely the server doesn't increase your Z when climbing stairs thus the itemid isn't reconized properly. tiles[xOffset][yOffset].Add( (short)((allTiles[i].m_ItemID & 0x7FFF) | 0x4000), (sbyte)allTiles[i].m_OffsetZ ); #endregion } } for ( int x = 0; x < m_Width; ++x ) for ( int y = 0; y < m_Height; ++y ) m_Tiles[x][y] = tiles[x][y].ToArray(); }
public MultiComponentList( BinaryReader reader, int count ) { MultiTileEntry[] allTiles = m_List = new MultiTileEntry[count]; for ( int i = 0; i < count; ++i ) { allTiles[i].m_ItemID = reader.ReadUInt16(); allTiles[i].m_OffsetX = reader.ReadInt16(); allTiles[i].m_OffsetY = reader.ReadInt16(); allTiles[i].m_OffsetZ = reader.ReadInt16(); allTiles[i].m_Flags = reader.ReadInt32(); if ( _PostHSFormat ) reader.ReadInt32(); // ?? MultiTileEntry e = allTiles[i]; if ( i == 0 || e.m_Flags != 0 ) { if ( e.m_OffsetX < m_Min.m_X ) m_Min.m_X = e.m_OffsetX; if ( e.m_OffsetY < m_Min.m_Y ) m_Min.m_Y = e.m_OffsetY; if ( e.m_OffsetX > m_Max.m_X ) m_Max.m_X = e.m_OffsetX; if ( e.m_OffsetY > m_Max.m_Y ) m_Max.m_Y = e.m_OffsetY; } } m_Center = new Point2D( -m_Min.m_X, -m_Min.m_Y ); m_Width = (m_Max.m_X - m_Min.m_X) + 1; m_Height = (m_Max.m_Y - m_Min.m_Y) + 1; TileList[][] tiles = new TileList[m_Width][]; m_Tiles = new StaticTile[m_Width][][]; for ( int x = 0; x < m_Width; ++x ) { tiles[x] = new TileList[m_Height]; m_Tiles[x] = new StaticTile[m_Height][]; for ( int y = 0; y < m_Height; ++y ) tiles[x][y] = new TileList(); } for ( int i = 0; i < allTiles.Length; ++i ) { if ( i == 0 || allTiles[i].m_Flags != 0 ) { int xOffset = allTiles[i].m_OffsetX + m_Center.m_X; int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y; tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ ); } } for ( int x = 0; x < m_Width; ++x ) for ( int y = 0; y < m_Height; ++y ) m_Tiles[x][y] = tiles[x][y].ToArray(); }
private Tile[][][] ReadStaticBlock( int x, int y ) { try { m_IndexReader.BaseStream.Seek( ((x * m_BlockHeight) + y) * 12, SeekOrigin.Begin ); int lookup = m_IndexReader.ReadInt32(); int length = m_IndexReader.ReadInt32(); if ( lookup < 0 || length <= 0 ) { return m_EmptyStaticBlock; } else { int count = length / 7; m_Statics.Seek( lookup, SeekOrigin.Begin ); if ( m_Buffer == null || length > m_Buffer.Length ) m_Buffer = new byte[length]; GCHandle handle = GCHandle.Alloc(m_Buffer, GCHandleType.Pinned); try { m_Statics.Read( m_Buffer, 0, length ); if ( m_Lists == null ) { m_Lists = new TileList[8][]; for ( int i = 0; i < 8; ++i ) { m_Lists[i] = new TileList[8]; for ( int j = 0; j < 8; ++j ) m_Lists[i][j] = new TileList(); } } TileList[][] lists = m_Lists; for (int i = 0; i < count; i++) { IntPtr ptr = new IntPtr((long)handle.AddrOfPinnedObject() + i * 7); StaticTile cur = (StaticTile)Marshal.PtrToStructure(ptr, typeof(StaticTile)); lists[cur.m_X & 0x7][cur.m_Y & 0x7].Add( (short)((cur.m_ID & 0x3FFF) + 0x4000), cur.m_Z ); } Tile[][][] tiles = new Tile[8][][]; for ( int i = 0; i < 8; ++i ) { tiles[i] = new Tile[8][]; for ( int j = 0; j < 8; ++j ) tiles[i][j] = lists[i][j].ToArray(); } return tiles; } finally { handle.Free(); } } } catch ( EndOfStreamException ) { if ( Core.Now >= m_NextStaticWarning ) { log.WarnFormat("Static EOS for {0} ({1}, {2})", m_Owner, x, y); m_NextStaticWarning = Core.Now + TimeSpan.FromMinutes( 1.0 ); } return m_EmptyStaticBlock; } }
private unsafe Tile[][][] ReadStaticBlock( int x, int y ) { try { m_IndexReader.BaseStream.Seek( ((x * m_BlockHeight) + y) * 12, SeekOrigin.Begin ); int lookup = m_IndexReader.ReadInt32(); int length = m_IndexReader.ReadInt32(); if ( lookup < 0 || length <= 0 ) { return m_EmptyStaticBlock; } else { int count = length / 7; m_Statics.Seek( lookup, SeekOrigin.Begin ); if ( m_TileBuffer.Length < count ) m_TileBuffer = new StaticTile[count]; StaticTile[] staTiles = m_TileBuffer;//new StaticTile[tileCount]; fixed ( StaticTile *pTiles = staTiles ) { if ( m_Buffer == null || length > m_Buffer.Length ) m_Buffer = new byte[length]; m_Statics.Read( m_Buffer, 0, length ); Marshal.Copy(m_Buffer, 0, new IntPtr(pTiles), length); if ( m_Lists == null ) { m_Lists = new TileList[8][]; for ( int i = 0; i < 8; ++i ) { m_Lists[i] = new TileList[8]; for ( int j = 0; j < 8; ++j ) m_Lists[i][j] = new TileList(); } } TileList[][] lists = m_Lists; for (int i = 0; i < count; i++) { StaticTile *pCur = pTiles + i; lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (short)((pCur->m_ID & 0x3FFF) + 0x4000), pCur->m_Z ); } Tile[][][] tiles = new Tile[8][][]; for ( int i = 0; i < 8; ++i ) { tiles[i] = new Tile[8][]; for ( int j = 0; j < 8; ++j ) tiles[i][j] = lists[i][j].ToArray(); } return tiles; } } } catch ( EndOfStreamException ) { if ( DateTime.Now >= m_NextStaticWarning ) { Console.WriteLine( "Warning: Static EOS for {0} ({1}, {2})", m_Owner, x, y ); m_NextStaticWarning = DateTime.Now + TimeSpan.FromMinutes( 1.0 ); } return m_EmptyStaticBlock; } }
public MultiComponentList(BinaryReader reader, int count) { int num1; MultiTileEntry entry1; int num2; int num3; int num4; int num5; int num6; int num7; int num8; MultiTileEntry[] entryArray2; this.m_List = (entryArray2 = new MultiTileEntry[count]); MultiTileEntry[] entryArray1 = entryArray2; for (num1 = 0; (num1 < count); ++num1) { entryArray1[num1].m_ItemID = reader.ReadInt16(); entryArray1[num1].m_OffsetX = reader.ReadInt16(); entryArray1[num1].m_OffsetY = reader.ReadInt16(); entryArray1[num1].m_OffsetZ = reader.ReadInt16(); entryArray1[num1].m_Flags = reader.ReadInt32(); entry1 = entryArray1[num1]; if ((num1 == 0) || (entry1.m_Flags != 0)) { if (entry1.m_OffsetX < this.m_Min.m_X) { this.m_Min.m_X = entry1.m_OffsetX; } if (entry1.m_OffsetY < this.m_Min.m_Y) { this.m_Min.m_Y = entry1.m_OffsetY; } if (entry1.m_OffsetX > this.m_Max.m_X) { this.m_Max.m_X = entry1.m_OffsetX; } if (entry1.m_OffsetY > this.m_Max.m_Y) { this.m_Max.m_Y = entry1.m_OffsetY; } } } this.m_Center = new Point2D(-this.m_Min.m_X, -this.m_Min.m_Y); this.m_Width = ((this.m_Max.m_X - this.m_Min.m_X) + 1); this.m_Height = ((this.m_Max.m_Y - this.m_Min.m_Y) + 1); TileList[][] listArrayArray1 = new TileList[this.m_Width][]; this.m_Tiles = new Tile[this.m_Width][][]; for (num2 = 0; (num2 < this.m_Width); ++num2) { listArrayArray1[num2] = new TileList[this.m_Height]; this.m_Tiles[num2] = new Tile[this.m_Height][]; for (num3 = 0; (num3 < this.m_Height); ++num3) { listArrayArray1[num2][num3] = new TileList(); } } for (num4 = 0; (num4 < entryArray1.Length); ++num4) { if ((num4 == 0) || (entryArray1[num4].m_Flags != 0)) { num5 = (entryArray1[num4].m_OffsetX + this.m_Center.m_X); num6 = (entryArray1[num4].m_OffsetY + this.m_Center.m_Y); listArrayArray1[num5][num6].Add(((short)((entryArray1[num4].m_ItemID & 16383) | 16384)), ((sbyte)entryArray1[num4].m_OffsetZ)); } } for (num7 = 0; (num7 < this.m_Width); ++num7) { for (num8 = 0; (num8 < this.m_Height); ++num8) { this.m_Tiles[num7][num8] = listArrayArray1[num7][num8].ToArray(); } } }