public override Task Load() { return(Task.Run ( () => { string path = UOFileManager.GetUOFilePath("hues.mul"); FileSystemHelper.EnsureFileExists(path); UOFileMul file = new UOFileMul(path); int groupSize = Marshal.SizeOf <HuesGroup>(); int entrycount = (int)file.Length / groupSize; HuesCount = entrycount * 8; HuesRange = new HuesGroup[entrycount]; ulong addr = (ulong)file.StartAddress; for (int i = 0; i < entrycount; i++) { HuesRange[i] = Marshal.PtrToStructure <HuesGroup>((IntPtr)(addr + (ulong)(i * groupSize))); } path = UOFileManager.GetUOFilePath("radarcol.mul"); FileSystemHelper.EnsureFileExists(path); UOFileMul radarcol = new UOFileMul(path); RadarCol = radarcol.ReadArray <ushort>((int)radarcol.Length >> 1); file.Dispose(); radarcol.Dispose(); } )); }
public static unsafe void Load() { string path = Path.Combine(FileManager.UoFolderPath, "speech.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul file = new UOFileMul(path, false); List <SpeechEntry> entries = new List <SpeechEntry>(); while (file.Position < file.Length) { int id = (file.ReadByte() << 8) | file.ReadByte(); int length = (file.ReadByte() << 8) | file.ReadByte(); if (length > 0) { entries.Add(new SpeechEntry(id, string.Intern(Encoding.UTF8.GetString((byte *)file.PositionAddress, length)))); file.Skip(length); } } _speech = entries.ToArray(); file.Dispose(); }
public override void Load() { string path = Path.Combine(FileManager.UoFolderPath, "hues.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul file = new UOFileMul(path, false); int groupSize = Marshal.SizeOf <HuesGroup>(); int entrycount = (int)file.Length / groupSize; HuesCount = entrycount * 8; HuesRange = new HuesGroup[entrycount]; ulong addr = (ulong)file.StartAddress; for (int i = 0; i < entrycount; i++) { HuesRange[i] = Marshal.PtrToStructure <HuesGroup>((IntPtr)(addr + (ulong)(i * groupSize))); } path = Path.Combine(FileManager.UoFolderPath, "radarcol.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul radarcol = new UOFileMul(path, false); RadarCol = radarcol.ReadArray <ushort>((int)radarcol.Length >> 1); file.Dispose(); radarcol.Dispose(); }
public override unsafe Task Load() { return(Task.Run(() => { string path = UOFileManager.GetUOFilePath("speech.mul"); if (!File.Exists(path)) { _speech = Array.Empty <SpeechEntry>(); return; } UOFileMul file = new UOFileMul(path); List <SpeechEntry> entries = new List <SpeechEntry>(); while (file.Position < file.Length) { int id = file.ReadUShortReversed(); int length = file.ReadUShortReversed(); if (length > 0) { entries.Add(new SpeechEntry(id, string.Intern(Encoding.UTF8.GetString((byte *)file.PositionAddress, length)))); file.Skip(length); } } _speech = entries.ToArray(); file.Dispose(); })); }
public override void CleanResources() { _file?.Dispose(); _file = null; _anims.Clear(); _instance = null; }
public override void ClearResources() { base.ClearResources(); _file?.Dispose(); _file = null; _instance = null; }
public static void Load() { string path = Path.Combine(FileManager.UoFolderPath, "tiledata.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul tiledata = new UOFileMul(path, false); bool isold = FileManager.ClientVersion < ClientVersions.CV_7090; int staticscount = !isold ? (int)(tiledata.Length - 512 * UnsafeMemoryManager.SizeOf <LandGroupNew>()) / UnsafeMemoryManager.SizeOf <StaticGroupNew>() : (int)(tiledata.Length - 512 * UnsafeMemoryManager.SizeOf <LandGroupOld>()) / UnsafeMemoryManager.SizeOf <StaticGroupOld>(); if (staticscount > 2048) { staticscount = 2048; } tiledata.Seek(0); LandData = new LandTiles[512 * 32]; StaticData = new StaticTiles[staticscount * 32]; byte[] bufferString = new byte[20]; for (int i = 0; i < 512; i++) { tiledata.Skip(4); for (int j = 0; j < 32; j++) { if (tiledata.Position + (isold ? 4 : 8) + 2 + 20 > tiledata.Length) { goto END; } int idx = i * 32 + j; LandData[idx].Flags = isold ? tiledata.ReadUInt() : tiledata.ReadULong(); LandData[idx].TexID = tiledata.ReadUShort(); tiledata.Fill(bufferString, 20); LandData[idx].Name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); } } END: for (int i = 0; i < staticscount; i++) { if (tiledata.Position >= tiledata.Length) { goto END_2; } tiledata.Skip(4); for (int j = 0; j < 32; j++) { if (tiledata.Position + (isold ? 4 : 8) + 13 + 20 > tiledata.Length) { goto END_2; } int idx = i * 32 + j; StaticData[idx].Flags = isold ? tiledata.ReadUInt() : tiledata.ReadULong(); StaticData[idx].Weight = tiledata.ReadByte(); StaticData[idx].Layer = tiledata.ReadByte(); StaticData[idx].Count = tiledata.ReadInt(); StaticData[idx].AnimID = tiledata.ReadUShort(); StaticData[idx].Hue = tiledata.ReadUShort(); StaticData[idx].LightIndex = tiledata.ReadUShort(); StaticData[idx].Height = tiledata.ReadByte(); tiledata.Fill(bufferString, 20); StaticData[idx].Name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); } } END_2: tiledata.Dispose(); //string pathdef = Path.Combine(FileManager.UoFolderPath, "art.def"); //if (!File.Exists(pathdef)) // return; //using (StreamReader reader = new StreamReader(File.OpenRead(pathdef))) //{ // string line; // while ((line = reader.ReadLine()) != null) // { // line = line.Trim(); // if (line.Length <= 0 || line[0] == '#') // continue; // string[] defs = line.Split(new[] { '\t', ' ', '#' }, StringSplitOptions.RemoveEmptyEntries); // if (defs.Length < 2) // continue; // int index = int.Parse(defs[0]); // if (index < 0 || index >= MAX_LAND_DATA_INDEX_COUNT + StaticData.Length) // continue; // int first = defs[1].IndexOf("{"); // int last = defs[1].IndexOf("}"); // string[] newdef = defs[1].Substring(first + 1, last - 1).Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); // foreach (string s in newdef) // { // int checkindex = int.Parse(s); // if (checkindex < 0 || checkindex >= MAX_LAND_DATA_INDEX_COUNT + StaticData.Length) // continue; // //_file.Entries[index] = _file.Entries[checkindex]; // if (index < MAX_LAND_DATA_INDEX_COUNT && checkindex < MAX_LAND_DATA_INDEX_COUNT && LandData.Length > checkindex && !LandData[checkindex].Equals(default) && (LandData.Length <= index || LandData[index].Equals(default))) // { // LandData[index] = LandData[checkindex]; // } // else if (index >= MAX_LAND_DATA_INDEX_COUNT && checkindex >= MAX_LAND_DATA_INDEX_COUNT) // { // checkindex -= MAX_LAND_DATA_INDEX_COUNT; // checkindex &= 0x3FFF; // index -= MAX_LAND_DATA_INDEX_COUNT; // if ( (StaticData.Length <= index || StaticData[index].Equals(default)) && // StaticData.Length > checkindex && !StaticData[checkindex].Equals(default)) // { // StaticData[index] = StaticData[checkindex]; // break; // } // } // } // } //} }
public override Task Load() { return(Task.Run ( () => { string path = UOFileManager.GetUOFilePath("tiledata.mul"); FileSystemHelper.EnsureFileExists(path); UOFileMul tileData = new UOFileMul(path); bool isold = Client.Version < ClientVersion.CV_7090; const int LAND_SIZE = 512; int land_group = isold ? Marshal.SizeOf <LandGroupOld>() : Marshal.SizeOf <LandGroupNew>(); int static_group = isold ? Marshal.SizeOf <StaticGroupOld>() : Marshal.SizeOf <StaticGroupNew>(); int staticscount = (int)((tileData.Length - LAND_SIZE * land_group) / static_group); if (staticscount > 2048) { staticscount = 2048; } tileData.Seek(0); _landData = new LandTiles[Constants.MAX_LAND_DATA_INDEX_COUNT]; _staticData = new StaticTiles[staticscount * 32]; byte[] bufferString = new byte[20]; for (int i = 0; i < 512; i++) { tileData.Skip(4); for (int j = 0; j < 32; j++) { if (tileData.Position + (isold ? 4 : 8) + 2 + 20 > tileData.Length) { goto END; } int idx = i * 32 + j; ulong flags = isold ? tileData.ReadUInt() : tileData.ReadULong(); ushort textId = tileData.ReadUShort(); tileData.Fill(ref bufferString, 20); string name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); LandData[idx] = new LandTiles(flags, textId, name); } } END: for (int i = 0; i < staticscount; i++) { if (tileData.Position >= tileData.Length) { break; } tileData.Skip(4); for (int j = 0; j < 32; j++) { if (tileData.Position + (isold ? 4 : 8) + 13 + 20 > tileData.Length) { goto END_2; } int idx = i * 32 + j; ulong flags = isold ? tileData.ReadUInt() : tileData.ReadULong(); byte weight = tileData.ReadByte(); byte layer = tileData.ReadByte(); int count = tileData.ReadInt(); ushort animId = tileData.ReadUShort(); ushort hue = tileData.ReadUShort(); ushort lightIndex = tileData.ReadUShort(); byte height = tileData.ReadByte(); tileData.Fill(ref bufferString, 20); string name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); StaticData[idx] = new StaticTiles ( flags, weight, layer, count, animId, hue, lightIndex, height, name ); } } //path = Path.Combine(FileManager.UoFolderPath, "tileart.uop"); //if (File.Exists(path)) //{ // UOFileUop uop = new UOFileUop(path, ".bin"); // DataReader reader = new DataReader(); // for (int i = 0; i < uop.Entries.Length; i++) // { // long offset = uop.Entries[i].Offset; // int csize = uop.Entries[i].Length; // int dsize = uop.Entries[i].DecompressedLength; // if (offset == 0) // continue; // uop.Seek(offset); // byte[] cdata = uop.ReadArray<byte>(csize); // byte[] ddata = new byte[dsize]; // ZLib.Decompress(cdata, 0, ddata, dsize); // reader.SetData(ddata, dsize); // ushort version = reader.ReadUShort(); // uint stringDicOffset = reader.ReadUInt(); // uint tileID = reader.ReadUInt(); // reader.Skip(1 + // bool unk // 1 + // unk // 4 + // float unk // 4 + // float unk // 4 + // fixed zero ? // 4 + // old id ? // 4 + // unk // 4 + // unk // 1 + // unk // 4 + // 3F800000 // 4 + // unk // 4 + // float light // 4 + // float light // 4 // unk // ); // ulong flags = reader.ReadULong(); // ulong flags2 = reader.ReadULong(); // reader.Skip(4); // unk // reader.Skip(24); // EC IMAGE OFFSET // byte[] imageOffset = reader.ReadArray(24); // 2D IMAGE OFFSET // if (tileID + 0x4000 == 0xa28d) // { // TileFlag f = (TileFlag) flags; // } // int count = reader.ReadByte(); // for (int j = 0; j < count; j++) // { // byte prop = reader.ReadByte(); // uint value = reader.ReadUInt(); // } // count = reader.ReadByte(); // for (int j = 0; j < count; j++) // { // byte prop = reader.ReadByte(); // uint value = reader.ReadUInt(); // } // count = reader.ReadInt(); // Gold Silver // for (int j = 0; j < count; j++) // { // uint amount = reader.ReadUInt(); // uint id = reader.ReadUInt(); // } // count = reader.ReadInt(); // for (int j = 0; j < count; j++) // { // byte val = reader.ReadByte(); // if (val != 0) // { // if (val == 1) // { // byte unk = reader.ReadByte(); // uint unk1 = reader.ReadUInt(); // } // } // else // { // int subCount = reader.ReadInt(); // for (int k = 0; k < subCount; k++) // { // uint unk = reader.ReadUInt(); // uint unk1 = reader.ReadUInt(); // } // } // } // count = reader.ReadByte(); // if (count != 0) // { // uint unk = reader.ReadUInt(); // uint unk1 = reader.ReadUInt(); // uint unk2 = reader.ReadUInt(); // uint unk3 = reader.ReadUInt(); // } // if (StaticData[tileID].AnimID == 0) // { // //StaticData[tileID] = new StaticTiles(flags, 0, 0, 0, ); // } // } // uop.Dispose(); // reader.ReleaseData(); //} END_2: tileData.Dispose(); } )); }
public override void Load() { string path = Path.Combine(FileManager.UoFolderPath, "tiledata.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul tiledata = new UOFileMul(path, false); bool isold = FileManager.ClientVersion < ClientVersions.CV_7090; int staticscount = !isold ? (int)(tiledata.Length - 512 * UnsafeMemoryManager.SizeOf <LandGroupNew>()) / UnsafeMemoryManager.SizeOf <StaticGroupNew>() : (int)(tiledata.Length - 512 * UnsafeMemoryManager.SizeOf <LandGroupOld>()) / UnsafeMemoryManager.SizeOf <StaticGroupOld>(); if (staticscount > 2048) { staticscount = 2048; } tiledata.Seek(0); LandData = new LandTiles[Constants.MAX_LAND_DATA_INDEX_COUNT]; StaticData = new StaticTiles[staticscount * 32]; byte[] bufferString = new byte[20]; for (int i = 0; i < 512; i++) { tiledata.Skip(4); for (int j = 0; j < 32; j++) { if (tiledata.Position + (isold ? 4 : 8) + 2 + 20 > tiledata.Length) { goto END; } int idx = i * 32 + j; ulong flags = isold ? tiledata.ReadUInt() : tiledata.ReadULong(); ushort textId = tiledata.ReadUShort(); tiledata.Fill(ref bufferString, 20); string name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); LandData[idx] = new LandTiles(flags, textId, name); } } END: for (int i = 0; i < staticscount; i++) { if (tiledata.Position >= tiledata.Length) { goto END_2; } tiledata.Skip(4); for (int j = 0; j < 32; j++) { if (tiledata.Position + (isold ? 4 : 8) + 13 + 20 > tiledata.Length) { goto END_2; } int idx = i * 32 + j; ulong flags = isold ? tiledata.ReadUInt() : tiledata.ReadULong(); byte weight = tiledata.ReadByte(); byte layer = tiledata.ReadByte(); int count = tiledata.ReadInt(); ushort animId = tiledata.ReadUShort(); ushort hue = tiledata.ReadUShort(); ushort lightIndex = tiledata.ReadUShort(); byte height = tiledata.ReadByte(); tiledata.Fill(ref bufferString, 20); string name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); StaticData[idx] = new StaticTiles(flags, weight, layer, count, animId, hue, lightIndex, height, name); } } END_2: tiledata.Dispose(); //path = Path.Combine(FileManager.UoFolderPath, "tileart.uop"); //if (File.Exists(path)) //{ // UOFileUop uop = new UOFileUop(path, ".bin"); // DataReader reader = new DataReader(); // for (int i = 0; i < uop.Entries.Length; i++) // { // long offset = uop.Entries[i].Offset; // int csize = uop.Entries[i].Length; // int dsize = uop.Entries[i].DecompressedLength; // if (offset == 0) // continue; // uop.Seek(offset); // byte[] cdata = uop.ReadArray<byte>(csize); // byte[] ddata = new byte[dsize]; // ZLib.Decompress(cdata, 0, ddata, dsize); // reader.SetData(ddata, dsize); // ushort version = reader.ReadUShort(); // uint stringDicOffset = reader.ReadUInt(); // uint tileID = reader.ReadUInt(); // reader.Skip(1 + // bool unk // 1 + // unk // 4 + // float unk // 4 + // float unk // 4 + // fixed zero ? // 4 + // old id ? // 4 + // unk // 4 + // unk // 1 + // unk // 4 + // 3F800000 // 4 + // unk // 4 + // float light // 4 + // float light // 4 // unk // ); // ulong flags = reader.ReadULong(); // ulong flags2 = reader.ReadULong(); // reader.Skip(4); // unk // reader.Skip(24); // EC IMAGE OFFSET // byte[] imageOffset = reader.ReadArray(24); // 2D IMAGE OFFSET // if (tileID + 0x4000 == 0xa28d) // { // TileFlag f = (TileFlag) flags; // } // int count = reader.ReadByte(); // for (int j = 0; j < count; j++) // { // byte prop = reader.ReadByte(); // uint value = reader.ReadUInt(); // } // count = reader.ReadByte(); // for (int j = 0; j < count; j++) // { // byte prop = reader.ReadByte(); // uint value = reader.ReadUInt(); // } // count = reader.ReadInt(); // Gold Silver // for (int j = 0; j < count; j++) // { // uint amount = reader.ReadUInt(); // uint id = reader.ReadUInt(); // } // count = reader.ReadInt(); // for (int j = 0; j < count; j++) // { // byte val = reader.ReadByte(); // if (val != 0) // { // if (val == 1) // { // byte unk = reader.ReadByte(); // uint unk1 = reader.ReadUInt(); // } // } // else // { // int subCount = reader.ReadInt(); // for (int k = 0; k < subCount; k++) // { // uint unk = reader.ReadUInt(); // uint unk1 = reader.ReadUInt(); // } // } // } // count = reader.ReadByte(); // if (count != 0) // { // uint unk = reader.ReadUInt(); // uint unk1 = reader.ReadUInt(); // uint unk2 = reader.ReadUInt(); // uint unk3 = reader.ReadUInt(); // } // if (StaticData[tileID].AnimID == 0) // { // //StaticData[tileID] = new StaticTiles(flags, 0, 0, 0, ); // } // } // uop.Dispose(); // reader.ReleaseData(); //} //string pathdef = Path.Combine(FileManager.UoFolderPath, "FileManager.Art.def"); //if (!File.Exists(pathdef)) // return; //using (StreamReader reader = new StreamReader(File.OpenRead(pathdef))) //{ // string line; // while ((line = reader.ReadLine()) != null) // { // line = line.Trim(); // if (line.Length <= 0 || line[0] == '#') // continue; // string[] defs = line.Split(new[] { '\t', ' ', '#' }, StringSplitOptions.RemoveEmptyEntries); // if (defs.Length < 2) // continue; // int index = int.Parse(defs[0]); // if (index < 0 || index >= MAX_LAND_DATA_INDEX_COUNT + StaticData.Length) // continue; // int first = defs[1].IndexOf("{"); // int last = defs[1].IndexOf("}"); // string[] newdef = defs[1].Substring(first + 1, last - 1).Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); // foreach (string s in newdef) // { // int checkindex = int.Parse(s); // if (checkindex < 0 || checkindex >= MAX_LAND_DATA_INDEX_COUNT + StaticData.Length) // continue; // //_file.Entries[index] = _file.Entries[checkindex]; // if (index < MAX_LAND_DATA_INDEX_COUNT && checkindex < MAX_LAND_DATA_INDEX_COUNT && LandData.Length > checkindex && !LandData[checkindex].Equals(default) && (LandData.Length <= index || LandData[index].Equals(default))) // { // LandData[index] = LandData[checkindex]; // } // else if (index >= MAX_LAND_DATA_INDEX_COUNT && checkindex >= MAX_LAND_DATA_INDEX_COUNT) // { // checkindex -= MAX_LAND_DATA_INDEX_COUNT; // checkindex &= 0x3FFF; // index -= MAX_LAND_DATA_INDEX_COUNT; // if ( (StaticData.Length <= index || StaticData[index].Equals(default)) && // StaticData.Length > checkindex && !StaticData[checkindex].Equals(default)) // { // StaticData[index] = StaticData[checkindex]; // break; // } // } // } // } //} }
public override void Load() { string path = Path.Combine(FileManager.UoFolderPath, "tiledata.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul tiledata = new UOFileMul(path, true); bool isold = FileManager.ClientVersion < ClientVersions.CV_7090; int staticscount = !isold ? (int)(tiledata.Length - 512 * UnsafeMemoryManager.SizeOf <LandGroupNew>()) / UnsafeMemoryManager.SizeOf <StaticGroupNew>() : (int)(tiledata.Length - 512 * UnsafeMemoryManager.SizeOf <LandGroupOld>()) / UnsafeMemoryManager.SizeOf <StaticGroupOld>(); if (staticscount > 2048) { staticscount = 2048; } tiledata.Seek(0); LandData = new LandTiles[Constants.MAX_LAND_DATA_INDEX_COUNT]; StaticData = new StaticTiles[staticscount * 32]; byte[] bufferString = new byte[20]; for (int i = 0; i < 512; i++) { tiledata.Skip(4); for (int j = 0; j < 32; j++) { if (tiledata.Position + (isold ? 4 : 8) + 2 + 20 > tiledata.Length) { goto END; } int idx = i * 32 + j; ulong flags = isold ? tiledata.ReadUInt() : tiledata.ReadULong(); ushort textId = tiledata.ReadUShort(); tiledata.Fill(ref bufferString, 20); string name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); LandData[idx] = new LandTiles(flags, textId, name); } } END: for (int i = 0; i < staticscount; i++) { if (tiledata.Position >= tiledata.Length) { break; } tiledata.Skip(4); for (int j = 0; j < 32; j++) { if (tiledata.Position + (isold ? 4 : 8) + 13 + 20 > tiledata.Length) { goto END_2; } int idx = i * 32 + j; ulong flags = isold ? tiledata.ReadUInt() : tiledata.ReadULong(); byte weight = tiledata.ReadByte(); byte layer = tiledata.ReadByte(); int count = tiledata.ReadInt(); ushort animId = tiledata.ReadUShort(); ushort hue = tiledata.ReadUShort(); ushort lightIndex = tiledata.ReadUShort(); byte height = tiledata.ReadByte(); tiledata.Fill(ref bufferString, 20); string name = string.Intern(Encoding.UTF8.GetString(bufferString).TrimEnd('\0')); StaticData[idx] = new StaticTiles(flags, weight, layer, count, animId, hue, lightIndex, height, name); } } //path = Path.Combine(FileManager.UoFolderPath, "tileart.uop"); //if (File.Exists(path)) //{ // UOFileUop uop = new UOFileUop(path, ".bin"); // DataReader reader = new DataReader(); // for (int i = 0; i < uop.Entries.Length; i++) // { // long offset = uop.Entries[i].Offset; // int csize = uop.Entries[i].Length; // int dsize = uop.Entries[i].DecompressedLength; // if (offset == 0) // continue; // uop.Seek(offset); // byte[] cdata = uop.ReadArray<byte>(csize); // byte[] ddata = new byte[dsize]; // ZLib.Decompress(cdata, 0, ddata, dsize); // reader.SetData(ddata, dsize); // ushort version = reader.ReadUShort(); // uint stringDicOffset = reader.ReadUInt(); // uint tileID = reader.ReadUInt(); // reader.Skip(1 + // bool unk // 1 + // unk // 4 + // float unk // 4 + // float unk // 4 + // fixed zero ? // 4 + // old id ? // 4 + // unk // 4 + // unk // 1 + // unk // 4 + // 3F800000 // 4 + // unk // 4 + // float light // 4 + // float light // 4 // unk // ); // ulong flags = reader.ReadULong(); // ulong flags2 = reader.ReadULong(); // reader.Skip(4); // unk // reader.Skip(24); // EC IMAGE OFFSET // byte[] imageOffset = reader.ReadArray(24); // 2D IMAGE OFFSET // if (tileID + 0x4000 == 0xa28d) // { // TileFlag f = (TileFlag) flags; // } // int count = reader.ReadByte(); // for (int j = 0; j < count; j++) // { // byte prop = reader.ReadByte(); // uint value = reader.ReadUInt(); // } // count = reader.ReadByte(); // for (int j = 0; j < count; j++) // { // byte prop = reader.ReadByte(); // uint value = reader.ReadUInt(); // } // count = reader.ReadInt(); // Gold Silver // for (int j = 0; j < count; j++) // { // uint amount = reader.ReadUInt(); // uint id = reader.ReadUInt(); // } // count = reader.ReadInt(); // for (int j = 0; j < count; j++) // { // byte val = reader.ReadByte(); // if (val != 0) // { // if (val == 1) // { // byte unk = reader.ReadByte(); // uint unk1 = reader.ReadUInt(); // } // } // else // { // int subCount = reader.ReadInt(); // for (int k = 0; k < subCount; k++) // { // uint unk = reader.ReadUInt(); // uint unk1 = reader.ReadUInt(); // } // } // } // count = reader.ReadByte(); // if (count != 0) // { // uint unk = reader.ReadUInt(); // uint unk1 = reader.ReadUInt(); // uint unk2 = reader.ReadUInt(); // uint unk3 = reader.ReadUInt(); // } // if (StaticData[tileID].AnimID == 0) // { // //StaticData[tileID] = new StaticTiles(flags, 0, 0, 0, ); // } // } // uop.Dispose(); // reader.ReleaseData(); //} string pathdef = Path.Combine(FileManager.UoFolderPath, "art.def"); if (!File.Exists(pathdef)) { return; } using (DefReader reader = new DefReader(pathdef, 1)) { while (reader.Next()) { int index = reader.ReadInt(); if (index < 0 || index >= Constants.MAX_LAND_DATA_INDEX_COUNT + StaticData.Length) { continue; } int[] group = reader.ReadGroup(); for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < 0 || checkIndex >= Constants.MAX_LAND_DATA_INDEX_COUNT + StaticData.Length) { continue; } if (index < Constants.MAX_LAND_DATA_INDEX_COUNT && checkIndex < Constants.MAX_LAND_DATA_INDEX_COUNT && tiledata.Entries[checkIndex].Length != 0 && tiledata.Entries[index].Length == 0) { LandData[index] = LandData[checkIndex]; break; } if (index >= Constants.MAX_LAND_DATA_INDEX_COUNT && checkIndex >= Constants.MAX_LAND_DATA_INDEX_COUNT) { checkIndex -= Constants.MAX_LAND_DATA_INDEX_COUNT; checkIndex &= 0x3FFF; index -= Constants.MAX_LAND_DATA_INDEX_COUNT; if (tiledata.Entries[index].Length == 0 && tiledata.Entries[checkIndex].Length != 0) { StaticData[index] = StaticData[checkIndex]; } } } } } END_2: tiledata.Dispose(); }