public static void CreateRemakeInfoData(bool writeToFile = true)
        {
            var    table        = TableProcessor.LoadTable(PathHelper.BCSVItemParamRemakeItem, (char)9, 20);
            string templatePath = PathHelper.GetFullTemplatePathTo(itemRemakeRootName);
            string outputPath   = PathHelper.GetFullOutputPathTo(templatePath);
            string preClass     = File.ReadAllText(templatePath);

            int           tabCount  = countCharsBefore(preClass, "{data}");
            List <string> remakeRow = new List <string>();

            ItemRemakePointer = new Dictionary <string, string>();
            foreach (DataRow row in table.Rows)
            {
                string extract = buildDicEntryFromDataRow(row, 18, 20, 38, 22, 39, 41);
                ItemRemakePointer.Add(row[20].ToString(), row[18].ToString());
                extract = extract.Replace("\0", string.Empty);//  + "\r\n"; we don't need rn because the item list has it at the end of each entry and we use it to comment
                for (int i = 0; i < tabCount; ++i)
                {
                    extract = extract + ' ';
                }
                remakeRow.Add(extract);
            }

            string remakeAtEnd = remakeRow[remakeRow.Count - 1].Split("\r\n")[0]; // remove trails from last item

            remakeRow[remakeRow.Count - 1] = remakeAtEnd;
            preClass = replaceData(preClass, string.Join("", remakeRow));
            if (writeToFile)
            {
                writeOutFile(outputPath, preClass);
            }
        }
        public static void CreateRecipeUtil()
        {
            var    table        = TableProcessor.LoadTable(PathHelper.BCSVRecipeItem, (char)9, 20); // ascending key
            string templatePath = PathHelper.GetFullTemplatePathTo(itemRecipeRootName);
            string outputPath   = PathHelper.GetFullOutputPathTo(templatePath);
            string preClass     = File.ReadAllText(templatePath);
            int    tabCount     = countCharsBefore(preClass, "{data}");

            List <string> varIndexes = new List <string>();

            foreach (DataRow row in table.Rows)
            {
                string extract       = row[20].ToString(); // index
                string extractItemId = row[12].ToString();
                int    recipeIndex   = int.Parse(extract);
                extract = "0x" + recipeIndex.ToString("X3");
                string inserter = "{" + extract + ", " + extractItemId.PadLeft(5, '0') + @"}, // " + ItemCreationEngine.ItemLines[int.Parse(extractItemId) + 1];
                for (int i = 0; i < tabCount; ++i)
                {
                    inserter = inserter + ' ';
                }
                varIndexes.Add(inserter);
            }

            string varAtEnd = varIndexes[varIndexes.Count - 1].Split("\r\n")[0]; // remove trails from last item

            varIndexes[varIndexes.Count - 1] = varAtEnd;

            preClass = replaceData(preClass, string.Join("", varIndexes));
            writeOutFile(outputPath, preClass);
        }
        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 CreateRemakeUtil(bool writeToFile = true)
        {
            var    table        = TableProcessor.LoadTable(PathHelper.BCSVItemParamItem, (char)9, "0x54706054"); // "0xFC275E86" is kind "0x54706054" is number
            string templatePath = PathHelper.GetFullTemplatePathTo(itemRemakeUtilRootName);
            string outputPath   = PathHelper.GetFullOutputPathTo(templatePath);
            string preClass     = File.ReadAllText(templatePath);
            int    tabCount     = countCharsBefore(preClass, "{data}");

            List <string> varIndexes = new List <string>();

            ItemRemakeHash = new Dictionary <string, string>();
            foreach (DataRow row in table.Rows)
            {
                string extract = row["0xCB5EB33F"].ToString(); // index of variation
                if (extract == "-1")
                {
                    continue;
                }

                string extractItemId = row["0x54706054"].ToString();
                ItemRemakeHash.Add(extractItemId, extract);
                string inserter = "{" + extractItemId.PadLeft(5, '0') + ", " + extract.PadLeft(4, '0') + @"}, // " + ItemCreationEngine.ItemLines[int.Parse(extractItemId) + 1];
                for (int i = 0; i < tabCount; ++i)
                {
                    inserter = inserter + ' ';
                }
                varIndexes.Add(inserter);
            }

            string varAtEnd = varIndexes[varIndexes.Count - 1].Split("\r\n")[0]; // remove trails from last item

            varIndexes[varIndexes.Count - 1] = varAtEnd;

            preClass = replaceData(preClass, string.Join("", varIndexes));
            if (writeToFile)
            {
                writeOutFile(outputPath, preClass);
            }
        }
        public static void CreateItemKind(bool writeToFile = true)
        {
            const char pad          = ' ';
            var        table        = TableProcessor.LoadTable(PathHelper.BCSVItemParamItem, (char)9, "0x54706054"); // "0xFC275E86" is kind "0x54706054" is number
            string     templatePath = PathHelper.GetFullTemplatePathTo(itemKindRootName);
            string     outputPath   = PathHelper.GetFullOutputPathTo(templatePath);
            string     preClass     = File.ReadAllText(templatePath);

            int tabCount = countCharsBefore(preClass, "{data}");

            List <string> kinds = new List <string>();

            foreach (DataRow row in table.Rows)
            {
                string extract = row["0xFC275E86"].ToString();
                extract = extract.Replace("\0", string.Empty) + ',' + "\r\n";
                for (int i = 0; i < tabCount; ++i)
                {
                    extract = extract + pad;
                }
                if (!kinds.Contains(extract))
                {
                    kinds.Add(extract);
                }
            }

            kinds.Sort();
            string kindAtEnd = kinds[kinds.Count - 1].Split("\r\n")[0]; // remove trails from last item

            kinds[kinds.Count - 1] = kindAtEnd;
            preClass = replaceData(preClass, string.Join("", kinds));
            if (writeToFile)
            {
                writeOutFile(outputPath, preClass);
            }

            // keep the itemkind list but remove stuff we don't want
            ItemKindList = new List <string>();
            foreach (string s in kinds)
            {
                ItemKindList.Add(s.Split(',')[0]);
            }

            // create bytes data
            if (writeToFile)
            {
                string[] itemLines     = ItemCreationEngine.ItemLines;
                byte[]   itemKindBytes = new byte[itemLines.Length];
                for (int i = 0; i < itemLines.Length; ++i)
                {
                    DataRow nRow = table.Rows.Find(i.ToString());
                    if (nRow != null)
                    {
                        string checker = nRow["0xFC275E86"].ToString().Replace("\0", string.Empty) + "\r\n" + "".PadRight(tabCount, pad);
                        itemKindBytes[i] = (byte)ItemKindList.IndexOf(checker.TrimEnd());
                    }
                    else
                    {
                        itemKindBytes[i] = 0;
                    }
                }

                writeOutBytes(PathHelper.OutputPathBytes + Path.DirectorySeparatorChar + itemKindBytesFilename, itemKindBytes);
            }
        }
        private static List <string> createEnumFillerClass(int id, string bscvPath, string filename, int itemRow, string replaceWithNothing = "", int commentRow = -1, bool sort = false)
        {
            var    table        = TableProcessor.LoadTable(bscvPath, (char)9, id);
            string templatePath = PathHelper.GetFullTemplatePathTo(filename);
            string outputPath   = PathHelper.GetFullOutputPathTo(templatePath);
            string preClass     = File.ReadAllText(templatePath);

            int tabCount = countCharsBefore(preClass, "{data}");

            List <string> kinds   = new List <string>();
            List <string> rawData = new List <string>();

            foreach (DataRow row in table.Rows)
            {
                string extract        = row[itemRow].ToString();
                string extractComment = "";
                if (commentRow != -1)
                {
                    extractComment = @" // " + row[commentRow].ToString().Replace("\0", string.Empty);
                }

                string root = extract.Replace("\0", string.Empty);

                if (root == string.Empty || root == "\0")
                {
                    continue;
                }

                if (replaceWithNothing != "")
                {
                    root = root.Replace(replaceWithNothing, string.Empty);
                }

                if (!sort)
                {
                    extract = root + " = " + kinds.Count.ToString() + "," + extractComment + "\r\n";
                }
                else
                {
                    extract = root + "," + extractComment + "\r\n";
                }

                for (int i = 0; i < tabCount; ++i)
                {
                    extract = extract + ' ';
                }
                if (!kinds.Contains(extract))
                {
                    kinds.Add(extract);
                    rawData.Add(root);
                }
            }

            if (sort)
            {
                kinds.Sort();
                rawData.Sort();
            }

            string kindAtEnd = kinds[kinds.Count - 1].Split("\r\n")[0]; // remove trails from last item

            kinds[kinds.Count - 1] = kindAtEnd;

            preClass = replaceData(preClass, string.Join("", kinds));

            writeOutFile(outputPath, preClass);

            return(rawData);
        }