public NpcDataParser(Locale locale, int flags)
            : base(locale, flags, (int)SubParsersType.Max, typeof(SubParsers))
        {
            parsers = (SubParsers)flags;

            if (parsers.HasFlag(SubParsers.Level))
            {
                Builders[(int)SubParsersType.Level].Setup("creature_template", "entry", false, "minlevel", "maxlevel");
            }

            if (parsers.HasFlag(SubParsers.Money))
            {
                Builders[(int)SubParsersType.Money].Setup("creature_template", "entry", false, "mingold", "maxgold");
            }

            if (parsers.HasFlag(SubParsers.Currency))
            {
                Builders[(int)SubParsersType.Currency].Setup("creature_currency", "entry", false, "currencyId", "currencyAmount");
            }

            if (parsers.HasFlag(SubParsers.Quotes))
            {
                Builders[(int)SubParsersType.Quotes].Setup("creature_quotes", "entry", false, "id", "type", textFields[Locale]);
            }

            if (parsers.HasFlag(SubParsers.Health))
            {
                Builders[(int)SubParsersType.Health].Setup("creature_power", "entry", false, "Normal", "Heroic", "Normal10", "Normal25", "Heroic10", "Heroic25", "RaidFinder25");
            }

            if (parsers.HasFlag(SubParsers.Mana))
            {
                Builders[(int)SubParsersType.Mana].Setup("creature_power", "entry", false, "Mana");
            }

            if (parsers.HasFlag(SubParsers.Faction))
            {
                Builders[(int)SubParsersType.Faction].Setup("creature_faction", "entry", false, "faction_a", "faction_h");
            }

            if (parsers.HasFlag(SubParsers.QuestStart))
            {
                Builders[(int)SubParsersType.QuestStart].Setup("creature_questrelation", "id", false, "quest");
            }

            if (parsers.HasFlag(SubParsers.QuestEnd))
            {
                Builders[(int)SubParsersType.QuestEnd].Setup("creature_involvedrelation", "id", false, "quest");
            }

            #region Creature_currency

            if (parsers.HasFlag(SubParsers.Currency))
            {
                Content.AppendLine(
                    @"DROP TABLE IF EXISTS `creature_currency`;
CREATE TABLE `creature_currency` (
  `entry` int(10) NOT NULL,
  `currencyId` int(10) NOT NULL default '0',
  `currencyAmount` int(10) NOT NULL default '0',
  PRIMARY KEY (`entry`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
                    );
            }

            #endregion

            Content.AppendLine();

            #region Creature_quotes

            if (parsers.HasFlag(SubParsers.Quotes))
            {
                Content.AppendLine(
                    @"DROP TABLE IF EXISTS `creature_quotes`;
CREATE TABLE `creature_quotes` (
  `entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `id` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `text` longtext,
  `text_loc1` longtext,
  `text_loc2` longtext,
  `text_loc3` longtext,
  `text_loc4` longtext,
  PRIMARY KEY (`entry`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
                    );
            }

            #endregion

            Content.AppendLine();

            #region Creature_power

            if (parsers.HasFlag(SubParsers.Health | SubParsers.Mana))
            {
                Content.AppendLine(
                    @"DROP TABLE IF EXISTS `creature_power`;
CREATE TABLE `creature_power` (
  `entry` int(10) NOT NULL,
  `Mana` int(10) NOT NULL default '0',
  `Normal` int(10) NOT NULL default '0',
  `Heroic` int(10) NOT NULL default '0',
  `Normal10` int(10) NOT NULL default '0',
  `Normal25` int(10) NOT NULL default '0',
  `Heroic10` int(10) NOT NULL default '0',
  `Heroic25` int(10) NOT NULL default '0',
  `RaidFinder25` int(10) NOT NULL default '0',
  PRIMARY KEY (`entry`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
                    );
            }

            #endregion

            Content.AppendLine();

            #region Creature_faction

            if (parsers.HasFlag(SubParsers.Faction))
            {
                Content.AppendLine(
                    @"DROP TABLE IF EXISTS `creature_faction`;
CREATE TABLE `creature_faction` (
  `entry` int(10) NOT NULL,
  `faction_a` int(10) NOT NULL default '0',
  `faction_h` int(10) NOT NULL default '0',
  PRIMARY KEY (`entry`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
                    );
            }

            #endregion

            Content.AppendLine();
        }
        public override void Parse(string page, uint id)
        {
            if (parsers.HasFlag(SubParsers.Level))
            {
                Tuple <int, int> levels;
                if (Levels(page, out levels))
                {
                    Builders[(int)SubParsersType.Level].SetKey(id);
                    Builders[(int)SubParsersType.Level].AppendValues(levels.Item1, levels.Item2);
                    Builders[(int)SubParsersType.Level].Flush();
                }
            }

            if (parsers.HasFlag(SubParsers.Money))
            {
                int money;
                if (Money(page, out money))
                {
                    Builders[(int)SubParsersType.Money].SetKey(id);
                    Builders[(int)SubParsersType.Money].AppendValues(money, money);
                    Builders[(int)SubParsersType.Money].Flush();
                }
            }

            if (parsers.HasFlag(SubParsers.Currency))
            {
                Tuple <int, int> currency;
                if (Currency(page, out currency))
                {
                    Builders[(int)SubParsersType.Currency].SetKey(id);
                    Builders[(int)SubParsersType.Currency].AppendValues(currency.Item1, currency.Item2);
                    Builders[(int)SubParsersType.Currency].Flush();
                }
            }

            if (parsers.HasFlag(SubParsers.Quotes))
            {
                Tuple <int, string>[] quotes;
                if (Quotes(page, out quotes))
                {
                    Builders[(int)SubParsersType.Quotes].SetKey(id);
                    for (int i = 0; i < quotes.Length; ++i)
                    {
                        Tuple <int, string> quote = quotes[i];
                        Builders[(int)SubParsersType.Quotes].AppendValues(i, quote.Item1, quote.Item2);
                        Builders[(int)SubParsersType.Quotes].Flush();
                    }
                }
            }

            if (parsers.HasFlag(SubParsers.Health))
            {
                object[] health;
                if (Health(page, out health))
                {
                    Builders[(int)SubParsersType.Health].SetKey(id);
                    Builders[(int)SubParsersType.Health].AppendValues(health);
                    Builders[(int)SubParsersType.Health].Flush();
                }
            }

            if (parsers.HasFlag(SubParsers.Mana))
            {
                int mana;
                if (Mana(page, out mana))
                {
                    Builders[(int)SubParsersType.Mana].SetKey(id);
                    Builders[(int)SubParsersType.Mana].AppendValue(mana);
                    Builders[(int)SubParsersType.Mana].Flush();
                }
            }

            if (parsers.HasFlag(SubParsers.Faction))
            {
                int factionA, factionH;
                if (Faction(page, out factionA, out factionH))
                {
                    Builders[(int)SubParsersType.Faction].SetKey(id);
                    Builders[(int)SubParsersType.Faction].AppendValues(factionA, factionH);
                    Builders[(int)SubParsersType.Faction].Flush();
                }
            }

            if (parsers.HasFlag(SubParsers.QuestStart))
            {
                int[] questIds;
                if (QuestStart(page, out questIds))
                {
                    Builders[(int)SubParsersType.QuestStart].SetKey(id);
                    foreach (int questId in questIds)
                    {
                        Builders[(int)SubParsersType.QuestStart].AppendValue(questId);
                        Builders[(int)SubParsersType.QuestStart].Flush();
                    }
                }
            }

            if (parsers.HasFlag(SubParsers.QuestEnd))
            {
                int[] questIds;
                if (QuestEnd(page, out questIds))
                {
                    Builders[(int)SubParsersType.QuestEnd].SetKey(id);
                    foreach (int questId in questIds)
                    {
                        Builders[(int)SubParsersType.QuestEnd].AppendValue(questId);
                        Builders[(int)SubParsersType.QuestEnd].Flush();
                    }
                }
            }
        }
        public NpcDataParser(Locale locale, int flags)
            : base(locale, flags, (int)SubParsersType.Max, typeof(SubParsers))
        {
            parsers = (SubParsers)flags;

            if (parsers.HasFlag(SubParsers.Level))
                Builders[(int)SubParsersType.Level].Setup("creature_template", "entry", false, "minlevel", "maxlevel");

            if (parsers.HasFlag(SubParsers.Money))
                Builders[(int)SubParsersType.Money].Setup("creature_template", "entry", false, "mingold", "maxgold");

            if (parsers.HasFlag(SubParsers.Currency))
                Builders[(int)SubParsersType.Currency].Setup("creature_currency", "entry", false, "currencyId", "currencyAmount");

            if (parsers.HasFlag(SubParsers.Quotes))
                Builders[(int)SubParsersType.Quotes].Setup("creature_quotes", "entry", false, "id", "type", textFields[Locale]);

            if (parsers.HasFlag(SubParsers.Health))
                Builders[(int)SubParsersType.Health].Setup("creature_power", "entry", false, "Normal", "Heroic", "Normal10", "Normal25", "Heroic10", "Heroic25", "RaidFinder25");

            if (parsers.HasFlag(SubParsers.Mana))
                Builders[(int)SubParsersType.Mana].Setup("creature_power", "entry", false, "Mana");

            if (parsers.HasFlag(SubParsers.Faction))
                Builders[(int)SubParsersType.Faction].Setup("creature_faction", "entry", false, "faction_a", "faction_h");

            if (parsers.HasFlag(SubParsers.QuestStart))
                Builders[(int)SubParsersType.QuestStart].Setup("creature_questrelation", "id", false, "quest");

            if (parsers.HasFlag(SubParsers.QuestEnd))
                Builders[(int)SubParsersType.QuestEnd].Setup("creature_involvedrelation", "id", false, "quest");

            #region Creature_currency

            if (parsers.HasFlag(SubParsers.Currency))
            {
                Content.AppendLine(
             @"DROP TABLE IF EXISTS `creature_currency`;
            CREATE TABLE `creature_currency` (
              `entry` int(10) NOT NULL,
              `currencyId` int(10) NOT NULL default '0',
              `currencyAmount` int(10) NOT NULL default '0',
              PRIMARY KEY (`entry`)
              ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
             );
            }

            #endregion

            Content.AppendLine();

            #region Creature_quotes

            if (parsers.HasFlag(SubParsers.Quotes))
            {
                Content.AppendLine(
            @"DROP TABLE IF EXISTS `creature_quotes`;
            CREATE TABLE `creature_quotes` (
              `entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
              `id` tinyint(3) unsigned NOT NULL DEFAULT '0',
              `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
              `text` longtext,
              `text_loc1` longtext,
              `text_loc2` longtext,
              `text_loc3` longtext,
              `text_loc4` longtext,
              PRIMARY KEY (`entry`,`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
            );
            }

            #endregion

            Content.AppendLine();

            #region Creature_power

            if (parsers.HasFlag(SubParsers.Health | SubParsers.Mana))
            {
                Content.AppendLine(
             @"DROP TABLE IF EXISTS `creature_power`;
            CREATE TABLE `creature_power` (
              `entry` int(10) NOT NULL,
              `Mana` int(10) NOT NULL default '0',
              `Normal` int(10) NOT NULL default '0',
              `Heroic` int(10) NOT NULL default '0',
              `Normal10` int(10) NOT NULL default '0',
              `Normal25` int(10) NOT NULL default '0',
              `Heroic10` int(10) NOT NULL default '0',
              `Heroic25` int(10) NOT NULL default '0',
              `RaidFinder25` int(10) NOT NULL default '0',
              PRIMARY KEY (`entry`)
              ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
             );
            }

            #endregion

            Content.AppendLine();

            #region Creature_faction

            if (parsers.HasFlag(SubParsers.Faction))
            {
                Content.AppendLine(
             @"DROP TABLE IF EXISTS `creature_faction`;
            CREATE TABLE `creature_faction` (
              `entry` int(10) NOT NULL,
              `faction_a` int(10) NOT NULL default '0',
              `faction_h` int(10) NOT NULL default '0',
              PRIMARY KEY (`entry`)
              ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
             );
            }

            #endregion

            Content.AppendLine();
        }