protected override bool LoadInternal() { String[] strings = EmbadedSentenseLoader.LoadSentense(_embadedPath); _setter(strings); return(true); }
protected override TxtEntry[] PrepareEntries() { String[] abilityNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.AbilityNames); String[] abilityHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.AbilityHelps); return(AbilityFormatter.Build(Prefix, abilityNames, abilityHelps)); }
protected override TxtEntry[] PrepareEntries() { String[] itemNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.KeyItemNames); String[] itemHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.KeyItemHelps); String[] itemDescs = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.KeyItemDescriptions); return(KeyItemFormatter.Build(Prefix, itemNames, itemHelps, itemDescs)); }
protected override TxtEntry[] PrepareEntries() { String[] itemNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.ItemNames); String[] itemHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.ItemHelps); String[] itemBattle = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.ItemBattle); return(ItemFormatter.Build(Prefix, itemNames, itemHelps, itemBattle)); }
protected override Boolean LoadInternal() { String[] skillNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.SkillNames); String[] skillHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.SkillHelps); FF9TextToolAccessor.SetActionAbilityName(skillNames); FF9TextToolAccessor.SetActionAbilityHelpDesc(skillHelps); return(true); }
protected override Boolean LoadInternal() { String[] commandNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.CommandNames); String[] commandHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.CommandHelps); FF9TextToolAccessor.SetCommandName(commandNames); FF9TextToolAccessor.SetCommandHelpDesc(commandHelps); return(true); }
protected override Boolean LoadInternal() { String[] abilityNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.AbilityNames); String[] abilityHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.AbilityHelps); FF9TextToolAccessor.SetSupportAbilityName(abilityNames); FF9TextToolAccessor.SetSupportAbilityHelpDesc(abilityHelps); return(true); }
public void Export() { try { Log.Message($"[{nameof(LocationNameExporter)}] Exporting..."); Int32 skipped = 0; String text = EmbadedSentenseLoader.LoadText(EmbadedTextResources.LocationNames); Dictionary <Int32, String> locationNames = new Dictionary <Int32, String>(); String[] array = text.Split('\r'); for (int i = 0; i < array.Length; i++) { String str = array[i]; str = str.Replace("\n", String.Empty); if (!String.IsNullOrEmpty(str)) { String key = str.Split(':')[0]; String value = str.Split(':')[1]; locationNames[int.Parse(key)] = FF9TextTool.RemoveOpCode(value); } } Dictionary <String, LinkedList <TxtEntry> > entries = LocationNameFormatter.Build(locationNames); String directory = ModTextResources.Export.LocationNamesDirectory; Directory.CreateDirectory(directory); Char[] invalidChars = Path.GetInvalidFileNameChars(); foreach (KeyValuePair <String, LinkedList <TxtEntry> > pair in entries) { String outputPath = Path.Combine(directory, "Names of " + pair.Key.ReplaceChars("_", invalidChars) + ".strings"); if (File.Exists(outputPath)) { skipped++; continue; } TxtWriter.WriteStrings(outputPath, pair.Value.ToArray()); } if (skipped > 0) { Log.Warning($"[{nameof(LocationNameExporter)}] Exporting completed but [{skipped}/{entries.Count}] files has been skipped because already exists."); } else { Log.Message($"[{nameof(LocationNameExporter)}] Exporting completed successfully."); } } catch (Exception ex) { Log.Error(ex, $"[{nameof(LocationNameExporter)}] Failed to export resource."); } }
protected override Boolean LoadInternal() { String[] itemNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.KeyItemNames); String[] itemHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.KeyItemHelps); String[] itemDescs = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.KeyItemDescriptions); FF9TextToolAccessor.SetImportantItemName(itemNames); FF9TextToolAccessor.SetImportantItemHelpDesc(itemHelps); FF9TextToolAccessor.SetImportantSkinDesc(itemDescs); return(true); }
protected override Boolean LoadInternal() { String[] itemNames = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.ItemNames); String[] itemHelps = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.ItemHelps); String[] itemBattle = EmbadedSentenseLoader.LoadSentense(EmbadedTextResources.ItemBattle); FF9TextToolAccessor.SetItemName(itemNames); FF9TextToolAccessor.SetItemHelpDesc(itemHelps); FF9TextToolAccessor.SetItemBattleDesc(itemBattle); return(true); }
protected override Boolean LoadInternal() { Int32 battleZoneId = FF9TextToolAccessor.GetBattleZoneId(); String path = EmbadedTextResources.GetCurrentPath("/Battle/" + battleZoneId + ".mes"); String[] text = EmbadedSentenseLoader.LoadSentense(path); if (text != null) { FF9TextToolAccessor.SetBattleText(text); } return(true); }
private static Boolean ReadEmbadedText(Int32 fieldZoneId, out String[] text) { String path = EmbadedTextResources.GetCurrentPath("/Field/" + FF9TextToolInterceptor.GetFieldTextFileName(fieldZoneId) + ".mes"); String raw = EmbadedSentenseLoader.LoadText(path); if (raw != null) { raw = TextOpCodeModifier.Modify(raw); text = FF9TextToolInterceptor.ExtractSentense(raw); return(true); } text = null; return(false); }
public void Export() { try { String directory = ModTextResources.Export.FieldsDirectory; if (Directory.Exists(directory)) { Log.Warning($"[{nameof(FieldExporter)}] Some fields refer to each other. They should be exported together."); Log.Warning($"[{nameof(FieldExporter)}] Export was skipped bacause the directory already exists: [{directory}]."); return; } Log.Message($"[{nameof(FieldExporter)}] Exporting..."); FieldFormatter formatter = new FieldFormatter(); foreach (KeyValuePair <Int32, String> pair in FF9DBAll.EventDB) { Int32 fieldZoneId = pair.Key; String path = EmbadedTextResources.GetCurrentPath("/Field/" + GetFieldTextFileName(fieldZoneId) + ".mes"); String text = EmbadedSentenseLoader.LoadText(path); if (text == null) { continue; } String name = fieldZoneId.ToString("D4", CultureInfo.InvariantCulture) + '_' + pair.Value; text = TextOpCodeModifier.Modify(text); String[] lines = FF9TextToolInterceptor.ExtractSentense(text); TxtEntry[] commands = formatter.Build(name, lines); Directory.CreateDirectory(directory); String outputPath = Path.Combine(directory, name + ".strings"); TxtWriter.WriteStrings(outputPath, commands); } ExportTags(directory, formatter); Log.Message($"[{nameof(FieldExporter)}] Exporting completed successfully."); } catch (Exception ex) { Log.Error(ex, $"[{nameof(FieldExporter)}] Failed to export resource."); } }
protected override Boolean LoadInternal() { String text = EmbadedSentenseLoader.LoadText(EmbadedTextResources.LocationNames); Dictionary <Int32, String> locationNames = FF9TextToolAccessor.GetLocationName(); String[] array = text.Split('\r'); for (Int32 i = 0; i < array.Length; i++) { String str = array[i]; str = str.Replace("\n", String.Empty); if (!String.IsNullOrEmpty(str)) { String key = str.Split(':')[0]; String value = str.Split(':')[1]; locationNames[Int32.Parse(key)] = FF9TextTool.RemoveOpCode(value); } } return(true); }
private void Initialize() { Dictionary <String, String> dic; if (!TryLoadReplacements(out dic)) { return; } Log.Message($"[{TypeName}] Loading..."); foreach (KeyValuePair <String, Int32> pair in FF9BattleDB.SceneData) { Int32 index = pair.Value; if (index == 220 || index == 238) // Junk? { continue; } String path = EmbadedTextResources.GetCurrentPath("/Battle/" + index + ".mes"); String[] text = EmbadedSentenseLoader.LoadSentense(path); if (text != null) { for (Int32 i = 0; i < text.Length; i++) { String key = BattleFormatter.GetKey(text[i]); String value; if (dic.TryGetValue(key, out value)) { text[i] = value; } } } _cache[index] = text; } _initialized = true; }
private static void ExportSceneSafe(String battleSceneName) { try { String relativePath = "BattleMap/BattleScene/EVT_BATTLE_" + battleSceneName + '/'; String outputDirectory = Path.Combine(Configuration.Export.Path, relativePath); String outputPath = outputDirectory + "Main.json"; if (File.Exists(outputPath)) { //Log.Warning($"[BattleSceneExporter] Export was skipped bacause a file already exists: [{outputPath}]."); //return; } Log.Message("[BattleSceneExporter] Exporting [{0}]...", battleSceneName); Int32 battleZoneId = FF9BattleDB.SceneData["BSC_" + battleSceneName]; String textEmbadedPath = EmbadedTextResources.GetCurrentPath("/Battle/" + battleZoneId + ".mes"); String[] text = EmbadedSentenseLoader.LoadSentense(textEmbadedPath); BTL_SCENE btlScene = new BTL_SCENE(); btlScene.ReadBattleScene(battleSceneName); String directoryPath = Path.GetDirectoryName(outputPath); if (directoryPath != null) { Directory.CreateDirectory(directoryPath); } SerializeScene(btlScene, outputDirectory, text); CompileScene(outputDirectory); Log.Message("[BattleSceneExporter] Exporting completed successfully."); } catch (Exception ex) { Log.Error(ex, "[BattleSceneExporter] Failed to export map [{0}].", battleSceneName); } }
protected override TxtEntry[] PrepareEntries() { Dictionary <String, String> dic = new Dictionary <String, String>(1024); foreach (KeyValuePair <String, Int32> pair in FF9BattleDB.SceneData) { Int32 index = pair.Value; if (index == 220 || index == 238) // Junk? { continue; } String path = EmbadedTextResources.GetCurrentPath("/Battle/" + index + ".mes"); String[] text = EmbadedSentenseLoader.LoadSentense(path); if (text == null) { continue; } foreach (String line in text) { if (String.IsNullOrEmpty(line)) { continue; } String key = BattleFormatter.GetKey(line); if (!dic.ContainsKey(key)) { dic.Add(key, BattleFormatter.GetValue(line)); } } } return(dic.Select(p => new TxtEntry { Prefix = p.Key, Value = p.Value }).ToArray()); }
protected override TxtEntry[] PrepareEntries() { String[] itemNames = EmbadedSentenseLoader.LoadSentense(_embadedPath); return(EtcFormatter.Build(_prefix, itemNames)); }