private void Process_npc_table()
 {
     Log.log("Processing npcdata.txt - Started");
     MySqlCommand sql = MysqlManager.connection.CreateCommand();
     sql.CommandText = "SELECT count(*) FROM npc";
     long count = processInt(sql.ExecuteScalar().ToString());
     sql.CommandText = "SELECT * FROM npc";
     MySqlDataReader rs = sql.ExecuteReader();
     try{
         int i = 0;
         while(rs.Read())
         {
             NpcInfo it = new NpcInfo();
             it.id = rs.GetInt32("idTemplate");
             if (it.getRecord())
             {
                 if (it.name.Length == 0)
                 {
                     it.name = rs.GetString("name");
                 }
                 if (it.title.Length == 0)
                 {
                     it.title = rs.GetString("title");
                 }
                 it.level = rs.GetInt32("level");
                 it.updateOrInsertRecord();
             }
             Log.log2(i++, (int)count);
         }
     } finally{
         rs.Close();
     }
     Log.log("Processing npcdata.txt - Finished");
 }
        private void Process_npcdata_txt(string dir)
        {
            Log.log("Processing npcdata.txt - Started");
            TxtFileParser dp = new TxtFileParser(dir + "l2offscript\\npcdata.txt", "npc");

            for (int i = 0; i < dp.getRecordsCount(); i++)
            {
                NpcInfo it = new NpcInfo();
                it.id = processInt(dp.getValue(i, 1));
                if (it.getRecord())
                {
                    if (it.name.Length == 0)
                    {
                        it.name = dp.getValue(i, 2);
                    }
                    it.level = processInt(dp.getValue(i, "level"));
                    /*it.agro_range = processInt(dp.getValue(i, "agro_range"));
                      string ai = dp.getValue(i, "npc_ai");
                      if (ai==null || ai.IndexOf("{[IsAggressive]=1}")==-1)
                          it.agro_range = 0;*/
                    it.updateOrInsertRecord();
                }
                Log.log2(i + 1, dp.getRecordsCount());
            }
            Log.log("Processing npcdata.txt - Finished");
        }