//private readonly List<uint> _usedIndex = new List<uint>(); public override void Load() { string path = Path.Combine(FileManager.UoFolderPath, "gumpartLegacyMUL.uop"); if (File.Exists(path)) { _file = new UOFileUop(path, ".tga", Constants.MAX_GUMP_DATA_INDEX_COUNT, true); FileManager.UseUOPGumps = true; } else { path = Path.Combine(FileManager.UoFolderPath, "Gumpart.mul"); string pathidx = Path.Combine(FileManager.UoFolderPath, "Gumpidx.mul"); if (File.Exists(path) && File.Exists(pathidx)) { _file = new UOFileMul(path, pathidx, Constants.MAX_GUMP_DATA_INDEX_COUNT, 12); } FileManager.UseUOPGumps = false; } string pathdef = Path.Combine(FileManager.UoFolderPath, "gump.def"); if (!File.Exists(pathdef)) { return; } using (DefReader defReader = new DefReader(pathdef, 3)) { while (defReader.Next()) { int ingump = defReader.ReadInt(); if (ingump < 0 || ingump >= Constants.MAX_GUMP_DATA_INDEX_COUNT || ingump >= _file.Entries.Length || _file.Entries[ingump].Length > 0) { continue; } int[] group = defReader.ReadGroup(); for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < 0 || checkIndex >= Constants.MAX_GUMP_DATA_INDEX_COUNT || checkIndex >= _file.Entries.Length || _file.Entries[checkIndex].Length <= 0) { continue; } _file.Entries[ingump] = _file.Entries[checkIndex]; break; } } } }
public override Task Load() { return(Task.Run ( () => { string path = UOFileManager.GetUOFilePath("texmaps.mul"); string pathidx = UOFileManager.GetUOFilePath("texidx.mul"); FileSystemHelper.EnsureFileExists(path); FileSystemHelper.EnsureFileExists(pathidx); _file = new UOFileMul(path, pathidx, Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT, 10); _file.FillEntries(ref Entries); string pathdef = UOFileManager.GetUOFilePath("TexTerr.def"); if (!File.Exists(pathdef)) { return; } using (DefReader defReader = new DefReader(pathdef)) { while (defReader.Next()) { int index = defReader.ReadInt(); if (index < 0 || index >= Entries.Length) { continue; } int[] group = defReader.ReadGroup(); if (group == null) { continue; } for (int i = 0; i < group.Length; i++) { int checkindex = group[i]; if (checkindex < 0 || checkindex >= Entries.Length) { continue; } Entries[index] = Entries[checkindex]; } } } _spriteInfos = new SpriteInfo[Entries.Length]; } )); }
private void ReadCorpse() { FileInfo file = new FileInfo(Path.Combine(FileManager.UoFolderPath, "Corpse.def")); if (!file.Exists) { return; } using (DefReader defReader = new DefReader(file.FullName, 1)) { while (defReader.Next()) { int index = defReader.ReadInt(); if (index >= Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT) { continue; } int[] group = defReader.ReadGroup(); int color = defReader.ReadInt(); for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex >= Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT) { continue; } if (!_corpses.TryGetValue(index, out var list) || list == null) { list = new List <CorpseInfo>(); _corpses.Add(index, list); } list.Add(new CorpseInfo((ushort)checkIndex, (ushort)color)); } } } }
public override Task Load() { return(Task.Run ( () => { string path = UOFileManager.GetUOFilePath("soundLegacyMUL.uop"); if (Client.IsUOPInstallation && File.Exists(path)) { _file = new UOFileUop(path, "build/soundlegacymul/{0:D8}.dat"); Entries = new UOFileIndex[Math.Max(((UOFileUop)_file).TotalEntriesCount, Constants.MAX_SOUND_DATA_INDEX_COUNT)]; } else { path = UOFileManager.GetUOFilePath("sound.mul"); string idxpath = UOFileManager.GetUOFilePath("soundidx.mul"); if (File.Exists(path) && File.Exists(idxpath)) { _file = new UOFileMul(path, idxpath, Constants.MAX_SOUND_DATA_INDEX_COUNT); } else { throw new FileNotFoundException("no sounds found"); } } _file.FillEntries(ref Entries); string def = UOFileManager.GetUOFilePath("Sound.def"); if (File.Exists(def)) { using (DefReader reader = new DefReader(def)) { while (reader.Next()) { int index = reader.ReadInt(); if (index < 0 || index >= Constants.MAX_SOUND_DATA_INDEX_COUNT || index >= _file.Length || Entries[index].Length != 0) { continue; } int[] group = reader.ReadGroup(); if (group == null) { continue; } for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < -1 || checkIndex >= Constants.MAX_SOUND_DATA_INDEX_COUNT) { continue; } ref UOFileIndex ind = ref Entries[index]; if (checkIndex == -1) { ind = default; } else { ref readonly UOFileIndex outInd = ref Entries[checkIndex];
//private readonly List<uint> _usedIndex = new List<uint>(); public override Task Load() { return(Task.Run(() => { string path = UOFileManager.GetUOFilePath("texmaps.mul"); string pathidx = UOFileManager.GetUOFilePath("texidx.mul"); FileSystemHelper.EnsureFileExists(path); FileSystemHelper.EnsureFileExists(pathidx); _file = new UOFileMul(path, pathidx, Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT, 10); _file.FillEntries(ref Entries); string pathdef = UOFileManager.GetUOFilePath("TexTerr.def"); if (!File.Exists(pathdef)) { return; } using (DefReader defReader = new DefReader(pathdef)) { while (defReader.Next()) { int index = defReader.ReadInt(); if (index < 0 || index >= Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT) { continue; } int[] group = defReader.ReadGroup(); for (int i = 0; i < group.Length; i++) { int checkindex = group[i]; if (checkindex < 0 || checkindex >= Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT) { continue; } Entries[index] = Entries[checkindex]; } } } //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 >= TEXTMAP_COUNT) // 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 >= TEXTMAP_COUNT) // continue; // _file.Entries[index] = _file.Entries[checkindex]; // } // } //} })); }
public override Task Load() { return(Task.Run(() => { string path = Path.Combine(FileManager.UoFolderPath, "soundLegacyMUL.uop"); if (File.Exists(path)) { _file = new UOFileUop(path, ".dat", Constants.MAX_SOUND_DATA_INDEX_COUNT); } else { path = Path.Combine(FileManager.UoFolderPath, "sound.mul"); string idxpath = Path.Combine(FileManager.UoFolderPath, "soundidx.mul"); if (File.Exists(path) && File.Exists(idxpath)) { _file = new UOFileMul(path, idxpath, Constants.MAX_SOUND_DATA_INDEX_COUNT); } else { throw new FileNotFoundException("no sounds found"); } } string def = Path.Combine(FileManager.UoFolderPath, "Sound.def"); if (File.Exists(def)) { using (DefReader reader = new DefReader(def)) { while (reader.Next()) { int index = reader.ReadInt(); if (index < 0 || index >= Constants.MAX_SOUND_DATA_INDEX_COUNT || index >= _file.Length || _file.Entries[index].Length != 0) { continue; } int[] group = reader.ReadGroup(); if (group == null) { continue; } for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < -1 || checkIndex >= Constants.MAX_SOUND_DATA_INDEX_COUNT) { continue; } ref UOFileIndex3D ind = ref _file.Entries[index]; if (checkIndex == -1) { ind = default; } else { ref readonly UOFileIndex3D outInd = ref _file.Entries[checkIndex];
public override Task Load() { return(Task.Run(() => { string path = UOFileManager.GetUOFilePath("gumpartLegacyMUL.uop"); if (Client.IsUOPInstallation && File.Exists(path)) { _file = new UOFileUop(path, "build/gumpartlegacymul/{0:D8}.tga", true); Entries = new UOFileIndex[Constants.MAX_GUMP_DATA_INDEX_COUNT]; Client.UseUOPGumps = true; } else { path = UOFileManager.GetUOFilePath("gumpart.mul"); string pathidx = UOFileManager.GetUOFilePath("gumpidx.mul"); if (!File.Exists(path)) { path = UOFileManager.GetUOFilePath("Gumpart.mul"); } if (!File.Exists(pathidx)) { pathidx = UOFileManager.GetUOFilePath("Gumpidx.mul"); } _file = new UOFileMul(path, pathidx, Constants.MAX_GUMP_DATA_INDEX_COUNT, 12); Client.UseUOPGumps = false; } _file.FillEntries(ref Entries); string pathdef = UOFileManager.GetUOFilePath("gump.def"); if (!File.Exists(pathdef)) { return; } using (DefReader defReader = new DefReader(pathdef, 3)) { while (defReader.Next()) { int ingump = defReader.ReadInt(); if (ingump < 0 || ingump >= Constants.MAX_GUMP_DATA_INDEX_COUNT || ingump >= Entries.Length || Entries[ingump].Length > 0) { continue; } int[] group = defReader.ReadGroup(); if (group == null) { continue; } for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < 0 || checkIndex >= Constants.MAX_GUMP_DATA_INDEX_COUNT || checkIndex >= Entries.Length || Entries[checkIndex].Length <= 0) { continue; } Entries[ingump] = Entries[checkIndex]; Entries[ingump].Hue = (ushort)defReader.ReadInt(); 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)) { 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 && checkIndex < LandData.Length && index < LandData.Length && !LandData[checkIndex].Equals(default) && LandData[index].Equals(default))
public override Task Load() { return(Task.Run(() => { string path = UOFileManager.GetUOFilePath("gumpartLegacyMUL.uop"); if (File.Exists(path)) { _file = new UOFileUop(path, "build/gumpartlegacymul/{0:D8}.tga", true); Entries = new UOFileIndex[Constants.MAX_GUMP_DATA_INDEX_COUNT]; Client.UseUOPGumps = true; } else { //Changed these filenames to be all lower-case as it was causing problems with File.Exists on iOS //Checked a few shard installations, these files seem to be all lower-case anyways path = UOFileManager.GetUOFilePath("gumpart.mul"); string pathidx = UOFileManager.GetUOFilePath("gumpidx.mul"); if (File.Exists(path) && File.Exists(pathidx)) { _file = new UOFileMul(path, pathidx, Constants.MAX_GUMP_DATA_INDEX_COUNT, 12); } Client.UseUOPGumps = false; } _file.FillEntries(ref Entries); string pathdef = UOFileManager.GetUOFilePath("gump.def"); if (!File.Exists(pathdef)) { return; } using (DefReader defReader = new DefReader(pathdef, 3)) { while (defReader.Next()) { int ingump = defReader.ReadInt(); if (ingump < 0 || ingump >= Constants.MAX_GUMP_DATA_INDEX_COUNT || ingump >= Entries.Length || Entries[ingump].Length > 0) { continue; } int[] group = defReader.ReadGroup(); for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < 0 || checkIndex >= Constants.MAX_GUMP_DATA_INDEX_COUNT || checkIndex >= Entries.Length || Entries[checkIndex].Length <= 0) { continue; } Entries[ingump] = Entries[checkIndex]; break; } } } })); }
//private readonly List<uint> _usedIndex = new List<uint>(); public override void Load() { string path = Path.Combine(FileManager.UoFolderPath, "texmaps.mul"); string pathidx = Path.Combine(FileManager.UoFolderPath, "texidx.mul"); if (!File.Exists(path) || !File.Exists(pathidx)) { throw new FileNotFoundException(); } _file = new UOFileMul(path, pathidx, Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT, 10); string pathdef = Path.Combine(FileManager.UoFolderPath, "TexTerr.def"); if (!File.Exists(pathdef)) { return; } using (DefReader defReader = new DefReader(pathdef, 2)) { while (defReader.Next()) { int index = defReader.ReadInt(); if (index < 0 || index >= Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT) { continue; } int[] group = defReader.ReadGroup(); for (int i = 0; i < group.Length; i++) { int checkindex = group[i]; if (checkindex < 0 || checkindex >= Constants.MAX_LAND_TEXTURES_DATA_INDEX_COUNT) { continue; } _file.Entries[index] = _file.Entries[checkindex]; } } } //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 >= TEXTMAP_COUNT) // 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 >= TEXTMAP_COUNT) // continue; // _file.Entries[index] = _file.Entries[checkindex]; // } // } //} }