Example #1
0
        public override Task Load()
        {
            return(Task.Run(() =>
            {
                string path = Path.Combine(FileManager.UoFolderPath, "multi.mul");
                string pathidx = Path.Combine(FileManager.UoFolderPath, "multi.idx");

                if (File.Exists(path) && File.Exists(pathidx))
                {
                    _file = new UOFileMul(path, pathidx, Constants.MAX_MULTI_DATA_INDEX_COUNT, 14);
                }
                else
                {
                    throw new FileNotFoundException();
                }

                Count = _itemOffset = FileManager.ClientVersion >= ClientVersions.CV_7090 ? UnsafeMemoryManager.SizeOf <MultiBlockNew>() : UnsafeMemoryManager.SizeOf <MultiBlock>();


                string uopPath = Path.Combine(FileManager.UoFolderPath, "MultiCollection.uop");

                if (File.Exists(uopPath))
                {
                    Count = Constants.MAX_MULTI_DATA_INDEX_COUNT;
                    _fileUop = new UOFileUopNoFormat(uopPath);
                    _reader = new DataReader();

                    for (int i = 0; i < _fileUop.Entries.Length; i++)
                    {
                        long offset = _fileUop.Entries[i].Offset;
                        int csize = _fileUop.Entries[i].Length;
                        int dsize = _fileUop.Entries[i].DecompressedLength;

                        _fileUop.Seek(offset);
                        byte[] cdata = _fileUop.ReadArray <byte>(csize);
                        byte[] ddata = new byte[dsize];

                        ZLib.Decompress(cdata, 0, ddata, dsize);
                        _reader.SetData(ddata, dsize);

                        uint id = _reader.ReadUInt();

                        if (id < Constants.MAX_MULTI_DATA_INDEX_COUNT && id < _file.Entries.Length)
                        {
                            ref UOFileIndex3D index = ref _file.Entries[id];
                            int count = _reader.ReadInt();

                            index = new UOFileIndex3D(offset, csize, dsize, (int)MathHelper.Combine(count, index.Extra));
                        }
                    }

                    _reader.ReleaseData();
                }
            }));
Example #2
0
        public override void Load()
        {
            int[] un = { 0x40000, 0x10000, 0x20000, 0x20000, 0x20000 };
            Dictionary <ulong, UopFileData> hashes = new Dictionary <ulong, UopFileData>();

            for (int i = 0; i < 5; i++)
            {
                string pathmul = Path.Combine(FileManager.UoFolderPath, "anim" + (i == 0 ? string.Empty : (i + 1).ToString()) + ".mul");
                string pathidx = Path.Combine(FileManager.UoFolderPath, "anim" + (i == 0 ? string.Empty : (i + 1).ToString()) + ".idx");

                if (File.Exists(pathmul) && File.Exists(pathidx))
                {
                    _mulFiles[i] = new UOFileMul(pathmul, pathidx, un[i], i == 0 ? 6 : -1);
                }

                if (i > 0 && FileManager.ClientVersion >= ClientVersions.CV_7000)
                {
                    string pathuop = Path.Combine(FileManager.UoFolderPath, $"AnimationFrame{i}.uop");

                    if (File.Exists(pathuop))
                    {
                        _uopFiles[i - 1] = new UOFileUopNoFormat(pathuop, i - 1);
                        _uopFiles[i - 1].LoadEx(ref hashes);
                    }
                }
            }

            for (int animID = 0; animID < Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT; animID++)
            {
                for (int grpID = 0; grpID < 100; grpID++)
                {
                    string hashstring = $"build/animationlegacyframe/{animID:D6}/{grpID:D2}.bin";
                    ulong  hash       = UOFileUop.CreateHash(hashstring);

                    if (hashes.TryGetValue(hash, out UopFileData data) && data.Offset != 0)
                    {
                        _animationIsUop[animID, grpID] = data;

                        //for (int d = 0; d < 5; d++)
                        //{
                        //    ref var anim = ref _animations[animID, grpID, d];
                        //}
                    }
                }
            }


            ReadMobTypes();
            ReadBody();
            ReadBodyconv();
            ReadCorpse();

            //LoadAnimations(0x029A, 1, 0);
        }