static void Extract(bool AsLocalized, Locale ExtractAs) { string filename = AsLocalized ? "Localization" : "Data"; if (ExtractAs != Locale.Default) { filename += "_" + ExtractAs.ToString(); } List <DBC> DBCs = new List <DBC> { //DBC.Open<AreaTable> ("AreaTable.dbc"), //DBC.Open<Achievement> ("Achievement.dbc"), //DBC.Open<AchievementCategory> ("Achievement_Category.dbc"), //DBC.Open<AchievementCriteria> ("Achievement_Criteria.dbc"), //DBC.Open<CharTitles> ("CharTitles.dbc"), //DBC.Open<ChrClasses> ("ChrClasses.dbc"), //DBC.Open<ChrRaces> ("ChrRaces.dbc"), //DBC.Open<CreatureFamily> ("CreatureFamily.dbc"), //DBC.Open<CreatureType> ("CreatureType.dbc"), DBC.Open <CurrencyTypes> ("CurrencyTypes.dbc"), //DBC.Open<Faction> ("Faction.dbc"), //DBC.Open<GlyphProperties> ("GlyphProperties.dbc"), //DBC.Open<ItemClass> ("ItemClass.dbc"), //DBC.Open<ItemPetFood> ("ItemPetFood.dbc"), //DBC.Open<ItemSet> ("ItemSet.dbc"), //DBC.Open<ItemSubClass> ("ItemSubClass.dbc"), //DBC.Open<LFGDungeonGroup> ("LFGDungeonGroup.dbc"), //DBC.Open<LFGDungeons> ("LFGDungeons.dbc"), //DBC.Open<Map> ("Map.dbc"), //DBC.Open<QuestInfo> ("QuestInfo.dbc"), //DBC.Open<QuestSort> ("QuestSort.dbc"), //DBC.Open<Resistances> ("Resistances.dbc"), //DBC.Open<SkillLine> ("SkillLine.dbc"), //DBC.Open<Spell> ("Spell.dbc"), //DBC.Open<SpellIcon> ("SpellIcon.dbc"), //DBC.Open<Talent> ("Talent.dbc"), //DBC.Open<TalentTab> ("TalentTab.dbc"), //DBC.Open<WMOAreaTable> ("WMOAreaTable.dbc"), }; Console.WriteLine("Extracting..."); var Writer = new StreamWriter("DBC_" + filename + ".sql"); foreach (DBC dbc in DBCs) { Writer.Write(dbc.ToSQL(AsLocalized)); Console.WriteLine("DBC {0} Extracted.", Path.GetFileName(dbc.Filename)); } Writer.Close(); if (!AsLocalized) { var w = new StreamWriter("DBC_" + filename + ".cs"); foreach (DBC dbc in DBCs) { if (dbc.EntryType.GetCustomAttributes(typeof(AsEnumAttribute), true).Length != 0) { w.Write(dbc.ToEnum()); } //Console.WriteLine("DBC {0} Extracted.", Path.GetFileName(dbc.Filename)); } w.Close(); } var w1 = new StreamWriter("DBC_" + filename + ".xml"); foreach (DBC dbc in DBCs) { if (dbc.EntryType.GetCustomAttributes(typeof(AsEnumAttribute), true).Length != 0) { w1.Write(dbc.ToXML()); } //Console.WriteLine("DBC {0} Extracted.", Path.GetFileName(dbc.Filename)); } w1.Close(); }
public bool FixRow(Locale lang) { string orig; switch (group) { case 12: // Cataclysm Heroic case 5: // Wrath of the Lich King Heroic case 3: // Burning Crusade Heroic orig = DBC.GetString(typeof(LFGDungeons), name); if (!s_translations[lang]["Heroic"].Any(v => orig.EndsWith(v))) { orig += s_translations[lang]["Heroic"][0]; } systemName = DBC.CreateString(typeof(LFGDungeons), orig.Enumize()); fullName = DBC.CreateString(typeof(LFGDungeons), orig); break; case 13: // Cataclysm Normal case 4: // Wrath of the Lich King Normal case 2: // Burning Crusade Normal orig = DBC.GetString(typeof(LFGDungeons), name); if (!s_translations[lang]["Normal"].Any(v => orig.EndsWith(v))) { orig += s_translations[lang]["Normal"][0]; } systemName = DBC.CreateString(typeof(LFGDungeons), orig.Enumize()); fullName = DBC.CreateString(typeof(LFGDungeons), orig); break; case 14: // Cataclysm Raid (25) case 9: // Wrath of the Lich King Raid (25) orig = DBC.GetString(typeof(LFGDungeons), name); if (!s_translations[lang]["25"].Any(v => orig.EndsWith(v))) { orig += s_translations[lang]["25"][0]; } systemName = DBC.CreateString(typeof(LFGDungeons), orig.Enumize()); fullName = DBC.CreateString(typeof(LFGDungeons), orig); break; case 15: // Cataclysm Raid (10) case 8: // Wrath of the Lich King Raid (10) orig = DBC.GetString(typeof(LFGDungeons), name); if (!s_translations[lang]["10"].Any(v => orig.EndsWith(v))) { orig += s_translations[lang]["10"][0]; } systemName = DBC.CreateString(typeof(LFGDungeons), orig.Enumize()); fullName = DBC.CreateString(typeof(LFGDungeons), orig); break; case 7: // Burning Crusade Raid case 6: // Classic Raid case 11: // World Events case 0: // other (zones) case 1: // Classic Dungeons default: systemName = DBC.CreateString(typeof(LFGDungeons), DBC.GetString(typeof(LFGDungeons), name).Enumize()); fullName = name; break; } return(true); }