public static void CreateVillagerPhraseList(string language) { MSBT loadedMSBT = TableProcessor.LoadMSBT(PathHelper.GetVillagerNPCPhraseItem(PathHelper.Languages[language])); List <string> entries = createTabbedLabelList(loadedMSBT, language); entries.Sort(); WriteOutFile(PathHelper.OutputPath, language, villagerPhraseRootName + language + ".txt", string.Join("", entries)); }
public static void CreateReaction() { var table = TableProcessor.LoadTable(PathHelper.BCSVHumanAnimItem, (char)9, 3); MSBT loadedMSBT = TableProcessor.LoadMSBT(PathHelper.GetReactionNameItem(PathHelper.Languages["en"])); string templatePath = PathHelper.GetFullTemplatePathTo(itemReactionRootName); string outputPath = PathHelper.GetFullOutputPathTo(templatePath); string preClass = File.ReadAllText(templatePath); // player animations only Dictionary <int, string> tableEntries = new Dictionary <int, string>(); foreach (DataRow row in table.Rows) { if (row["0x2C447591"].ToString().StartsWith("MaRe")) { tableEntries.Add(int.Parse(row["0x54706054"].ToString()), row["0x2C447591"].ToString()); } } var dicSort = tableEntries.OrderBy(a => a.Key).ToList(); tableEntries = new Dictionary <int, string>(); foreach (var kvp in dicSort) { tableEntries.Add(kvp.Key, kvp.Value); } List <string> entries = new List <string>(); // fill with empties for (int i = 0; i < tableEntries.Count + 1; ++i) { entries.Add(string.Format("\t\tUNUSED_{0},\r\n", i)); } // now instert with correct indexes for (int i = 0; i < loadedMSBT.LBL1.Labels.Count; ++i) { var currLabel = loadedMSBT.LBL1.Labels[i]; string comment = currLabel.ToString(); var find = tableEntries.First(x => x.Value.Replace("MaRe", "").TrimEnd('\0') == comment); int index = tableEntries.ToList().IndexOf(find); string enumVal = loadedMSBT.FileEncoding.GetString(currLabel.Value); enumVal = new string(enumVal.Where(c => char.IsLetterOrDigit(c)).ToArray()); entries[index] = string.Format("\t\t{0}, // {1} \r\n", enumVal, comment); } entries[0] = "\t\tNone,\r\n"; preClass = replaceData(preClass, string.Join("", entries.ToArray())); writeOutFile(outputPath, preClass); }
public static void CreateVillagerList(string language) { MSBT[] loadedMSBTs = new MSBT[2] { TableProcessor.LoadMSBT(PathHelper.GetVillagerNameItem(PathHelper.Languages[language])), TableProcessor.LoadMSBT(PathHelper.GetVillagerNPCNameItem(PathHelper.Languages[language])) }; List <string> rawEntries = new List <string>(); foreach (MSBT loaded in loadedMSBTs) { List <string> entries = createTabbedLabelList(loaded, language); entries.Sort(); rawEntries.AddRange(entries); } WriteOutFile(PathHelper.OutputPath, language, villagerListRootName + language + ".txt", string.Join("", rawEntries)); }
public static void CreateBodyFabricColorPartsList(string language, bool writeToFile = true) { MSBT[] loadedMSBTs = new MSBT[4] { TableProcessor.LoadMSBT(PathHelper.GetBodyColorNameItem(PathHelper.Languages[language])), // needs to be 0 because I'm lazy TableProcessor.LoadMSBT(PathHelper.GetBodyPartsNameItem(PathHelper.Languages[language])), TableProcessor.LoadMSBT(PathHelper.GetFabricColorNameItem(PathHelper.Languages[language])), // as above, but 2 this time TableProcessor.LoadMSBT(PathHelper.GetFabricPartsNameItem(PathHelper.Languages[language])) }; int[][] separators = new int[][] // how much of a string we want between two separators in the msbt. "_" in this case { new int [] { 1, 2 }, new int [] { 1 }, new int [] { 1, 2 }, new int [] { 1 } }; string[] filenames = new string[4] { bodyColorRootName, bodyPartsRootName, fabricColorRootName, fabricPartsRootName }; for (int i = 0; i < loadedMSBTs.Length; ++i) { MSBT loaded = loadedMSBTs[i]; List <string> entries = createTabbedLabelList(loaded, language, "\t", separators[i]); entries.Sort(); if (writeToFile) { WriteOutFile(PathHelper.OutputPath, language, filenames[i] + language + ".txt", string.Join("", entries)); } if (i == 0) { bodyColorLines = entries.ToArray(); } if (i == 2) { fabricColorLines = entries.ToArray(); } } }