public LoadFromGameHelper()
        {
            CUS_File cusFile = (CUS_File)Xenoverse2.Instance.GetParsedFileFromGame(CUS_PATH);
            CMS_File cmsFile = (CMS_File)Xenoverse2.Instance.GetParsedFileFromGame(CMS_PATH);
            ERS_File ersFile = (ERS_File)Xenoverse2.Instance.GetParsedFileFromGame(ERS_PATH);

            characters     = LoadCharacterNames(cmsFile, ersFile);
            superSkills    = LoadSkillNames(CUS_File.SkillType.Super, cusFile, cmsFile);
            ultimateSkills = LoadSkillNames(CUS_File.SkillType.Ultimate, cusFile, cmsFile);
            evasiveSkills  = LoadSkillNames(CUS_File.SkillType.Evasive, cusFile, cmsFile);
            blastSkills    = LoadSkillNames(CUS_File.SkillType.Blast, cusFile, cmsFile);
            awokenSkills   = LoadSkillNames(CUS_File.SkillType.Awoken, cusFile, cmsFile);
            cmn            = LoadCmnNames(ersFile);
            demo           = LoadDemoNames(ersFile);
        }
Example #2
0
        public GameInterface(Xv2FileIO _fileIO)
        {
            fileIO = _fileIO;

            CUS_File cusFile = CUS_File.Load(fileIO.GetFileFromGame(CUS_PATH));
            CMS_File cmsFile = CMS_File.Load(fileIO.GetFileFromGame(CMS_PATH));
            ERS_File ersFile = ERS_File.Load(fileIO.GetFileFromGame(ERS_PATH));

            characters     = LoadCharacterNames(cmsFile, ersFile);
            superSkills    = LoadSkillNames(CUS_File.SkillType.Super, cusFile, cmsFile);
            ultimateSkills = LoadSkillNames(CUS_File.SkillType.Ultimate, cusFile, cmsFile);
            evasiveSkills  = LoadSkillNames(CUS_File.SkillType.Evasive, cusFile, cmsFile);
            blastSkills    = LoadSkillNames(CUS_File.SkillType.Blast, cusFile, cmsFile);
            awokenSkills   = LoadSkillNames(CUS_File.SkillType.Awoken, cusFile, cmsFile);
            cmn            = LoadCmnNames(ersFile);
            demo           = LoadDemoNames(ersFile);
        }
Example #3
0
        private int GetSkillId(CusIdType idType, CusSkillType skillType, string shortName)
        {
            CUS_File cusFile = (CUS_File)install.GetParsedFile <CUS_File>(CUS_PATH);

            List <Skill> skills = null;

            switch (skillType)
            {
            case CusSkillType.Super:
                skills = cusFile.SuperSkills;
                break;

            case CusSkillType.Ultimate:
                skills = cusFile.UltimateSkills;
                break;

            case CusSkillType.Evasive:
                skills = cusFile.EvasiveSkills;
                break;

            case CusSkillType.Blast:
                skills = cusFile.BlastSkills;
                break;

            case CusSkillType.Awoken:
                skills = cusFile.AwokenSkills;
                break;
            }

            foreach (var skill in skills)
            {
                if (skill.Str_00.ToLower() == shortName)
                {
                    switch (idType)
                    {
                    case CusIdType.ID1:
                        return(int.Parse(skill.Index));

                    case CusIdType.ID2:
                        return(int.Parse(skill.I_10));
                    }
                }
            }

            return(NullTokenInt); //Skill wasn't found
        }
Example #4
0
        private void Uninstall_CUS(string path, _File file)
        {
            try
            {
                CUS_File binaryFile = (CUS_File)GetParsedFile <CUS_File>(path, false);
                CUS_File cpkBinFile = (CUS_File)GetParsedFile <CUS_File>(path, true);

                Section skillsetSection = file.GetSection(Sections.CUS_Skillsets);
                Section superSection    = file.GetSection(Sections.CUS_SuperSkills);
                Section ultimateSection = file.GetSection(Sections.CUS_UltimateSkills);
                Section evasiveSection  = file.GetSection(Sections.CUS_EvasiveSkills);
                Section blastSection    = file.GetSection(Sections.CUS_BlastSkills);
                Section awokenSection   = file.GetSection(Sections.CUS_AwokenSkills);

                if (skillsetSection != null)
                {
                    UninstallEntries(binaryFile.Skillsets, (cpkBinFile != null) ? cpkBinFile.Skillsets : null, skillsetSection.IDs);
                }
                if (superSection != null)
                {
                    UninstallEntries(binaryFile.SuperSkills, (cpkBinFile != null) ? cpkBinFile.SuperSkills : null, superSection.IDs);
                }
                if (ultimateSection != null)
                {
                    UninstallEntries(binaryFile.UltimateSkills, (cpkBinFile != null) ? cpkBinFile.UltimateSkills : null, ultimateSection.IDs);
                }
                if (evasiveSection != null)
                {
                    UninstallEntries(binaryFile.EvasiveSkills, (cpkBinFile != null) ? cpkBinFile.EvasiveSkills : null, evasiveSection.IDs);
                }
                if (blastSection != null)
                {
                    UninstallEntries(binaryFile.BlastSkills, (cpkBinFile != null) ? cpkBinFile.BlastSkills : null, blastSection.IDs);
                }
                if (awokenSection != null)
                {
                    UninstallEntries(binaryFile.AwokenSkills, (cpkBinFile != null) ? cpkBinFile.AwokenSkills : null, awokenSection.IDs);
                }
            }
            catch (Exception ex)
            {
                string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.CUS, path);
                throw new Exception(error, ex);
            }
        }
Example #5
0
        private ObservableCollection <GameEntity> LoadSkillNames(CUS_File.SkillType skillType, CUS_File cusFile, CMS_File cmsFile)
        {
            ObservableCollection <GameEntity> entities = new ObservableCollection <GameEntity>();

            MSG_File nameMsgFile = (skillType != CUS_File.SkillType.Blast) ? MSG_File.Load(fileIO.GetFileFromGame(string.Format("{0}en.msg", cusFile.GetNameMsgPath(skillType)))) : null;
            string   skillDir;

            List <Skill> skills;

            switch (skillType)
            {
            case CUS_File.SkillType.Super:
                skills   = cusFile.SuperSkills;
                skillDir = "skill/SPA";
                break;

            case CUS_File.SkillType.Ultimate:
                skills   = cusFile.UltimateSkills;
                skillDir = "skill/ULT";
                break;

            case CUS_File.SkillType.Evasive:
                skills   = cusFile.EvasiveSkills;
                skillDir = "skill/ESC";
                break;

            case CUS_File.SkillType.Blast:
                skills   = cusFile.BlastSkills;
                skillDir = "skill/BLT";
                break;

            case CUS_File.SkillType.Awoken:
                skills   = cusFile.AwokenSkills;
                skillDir = "skill/MET";
                break;

            default:
                throw new InvalidDataException("LoadSkillNames: unknown skillType = " + skillType);
            }

            foreach (var skill in skills)
            {
                if (skill.I_14.HasFlag(Skill.FilesLoadedFlags.Eepk))
                {
                    string eepkPath;

                    if (skill.Str_28 == "NULL")
                    {
                        //Get skill folder and files name
                        int    skillID2       = int.Parse(skill.I_10);
                        int    cmsId          = (int)Math.Floor(skillID2 / 10f);
                        string charaShortName = cmsFile.GetEntry(cmsId.ToString()).Str_04;

                        //If chara ID belongs to a CAC, the skill is tagged as CMN instead.
                        if (cmsId >= 100 && cmsId < 109)
                        {
                            charaShortName = "CMN";
                        }

                        string folderName = String.Format("{0}_{1}_{2}", skillID2.ToString("D3"), charaShortName, skill.Str_00);
                        eepkPath = String.Format("{0}/{1}/{1}.eepk", skillDir, folderName);
                    }
                    else
                    {
                        //This skill uses another skills EEPK, so we dont have to calculate its folder name
                        eepkPath = String.Format("skill/{0}/{1}.eepk", skill.Str_28, Path.GetFileName(skill.Str_28));
                    }

                    //Get skill name
                    string name = null;

                    if (skillType != CUS_File.SkillType.Blast)
                    {
                        name = nameMsgFile.GetSkillName(int.Parse(skill.I_10), skillType);
                    }

                    if (string.IsNullOrWhiteSpace(name))
                    {
                        name = string.Format("??? ({0} / {1})", skill.I_10, skill.Str_00);
                    }

                    entities.Add(new GameEntity()
                    {
                        Name     = name,
                        EepkPath = eepkPath
                    });
                }
            }
            return(entities);
        }