Esempio n. 1
0
        public override Task Load()
        {
            return(Task.Run
                   (
                       () =>
            {
                if (SkillsCount > 0)
                {
                    return;
                }

                string path = UOFileManager.GetUOFilePath("skills.mul");
                string pathidx = UOFileManager.GetUOFilePath("Skills.idx");

                FileSystemHelper.EnsureFileExists(path);
                FileSystemHelper.EnsureFileExists(pathidx);

                _file = new UOFileMul(path, pathidx, 0, 16);
                _file.FillEntries(ref Entries);

                for (int i = 0, count = 0; i < Entries.Length; i++)
                {
                    ref UOFileIndex entry = ref GetValidRefEntry(i);

                    if (entry.Length > 0)
                    {
                        _file.SetData(entry.Address, entry.FileSize);
                        _file.Seek(entry.Offset);
                        bool hasAction = _file.ReadBool();

                        string name = Encoding.UTF8.GetString(_file.ReadArray <byte>(entry.Length - 1)).TrimEnd('\0');

                        /*
                         * if(skillUseless.Contains(name))  // giga487, UoMars
                         * {
                         *  continue;  // se carico le skill che ho messo dentro il vettore string skillUseless vado avanti.
                         * }
                         */

                        SkillEntry skill = new SkillEntry(count++, name, hasAction);
                        Skills.Add(skill);
                    }
                }

                SortedSkills.AddRange(Skills);
                SortedSkills.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.InvariantCulture));
            }
Esempio n. 2
0
        public override Task Load()
        {
            return(Task.Run
                   (
                       () =>
            {
                if (SkillsCount > 0)
                {
                    return;
                }

                string path = UOFileManager.GetUOFilePath("skills.mul");
                string pathidx = UOFileManager.GetUOFilePath("Skills.idx");

                FileSystemHelper.EnsureFileExists(path);
                FileSystemHelper.EnsureFileExists(pathidx);

                _file = new UOFileMul(path, pathidx, 0, 16);
                _file.FillEntries(ref Entries);

                for (int i = 0, count = 0; i < Entries.Length; i++)
                {
                    ref UOFileIndex entry = ref GetValidRefEntry(i);

                    if (entry.Length > 0)
                    {
                        _file.Seek(entry.Offset);
                        bool hasAction = _file.ReadBool();

                        string name = Encoding.UTF8.GetString
                                          (_file.ReadArray <byte>(entry.Length - 1))
                                      .TrimEnd('\0');

                        SkillEntry skill = new SkillEntry(count++, name, hasAction);

                        Skills.Add(skill);
                    }
                }

                SortedSkills.AddRange(Skills);
                SortedSkills.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.InvariantCulture));
            }