示例#1
0
        private ObservableCollection <GameEntity> LoadCharacterNames(CMS_File cmsFile, ERS_File ersFile)
        {
            ObservableCollection <GameEntity> entities = new ObservableCollection <GameEntity>();

            MSG_File characterMsgFile = MSG_File.Load(fileIO.GetFileFromGame(CHARACTER_MSG_PATH));

            foreach (var ersEntry in ersFile.GetSubentryList(2))
            {
                CMS_Entry cmsEntry = cmsFile.GetEntry(ersEntry.Index);
                string    name     = null;
                string    eepkPath = string.Format("vfx/{0}", ersEntry.FILE_PATH);

                if (cmsEntry != null)
                {
                    name = characterMsgFile.GetCharacterName(cmsEntry.Str_04);


                    if (string.IsNullOrWhiteSpace(name))
                    {
                        name = String.Format("??? ({0} / {1})", cmsEntry.Index, cmsEntry.Str_04);
                    }
                }


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

            return(entities);
        }
示例#2
0
 private bool ValidateMsgFiles(List <MSG_File> MsgFiles, string path)
 {
     foreach (var msgFile in MsgFiles)
     {
         if (msgFile.MSG_Entries.Count != MsgFiles[0].MSG_Entries.Count)
         {
             //Entries out of sync betwen languages.
             MSG_File.SynchronizeMsgFiles(MsgFiles);
         }
     }
     return(true);
 }
示例#3
0
        private void Uninstall_MSG(string path, _File file)
        {
            try
            {
                MSG_File binaryFile = (MSG_File)GetParsedFile <MSG_File>(path, false);
                MSG_File cpkBinFile = (MSG_File)GetParsedFile <MSG_File>(path, true);

                Section section = file.GetSection(Sections.MSG_Entries);

                if (section != null)
                {
                    UninstallEntries(binaryFile.MSG_Entries, (cpkBinFile != null) ? cpkBinFile.MSG_Entries : null, section.IDs);
                }
            }
            catch (Exception ex)
            {
                string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.MSG, path);
                throw new Exception(error, ex);
            }
        }
示例#4
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);
        }