예제 #1
0
파일: mob.cs 프로젝트: kerchunk/GizMaker
        // Get a collection of mobs in the room.
        public static mob[] GetRoomMobs(int MobAreaID, int intRoomID, int CoordX, int CoordY, int CoordZ)
        {
            mob[] mobs = new mob[250];

            // Configure database connection elements.
            OleDbDataAdapter da         = new OleDbDataAdapter();
            OleDbConnection  connection = new OleDbConnection();

            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("mobs");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;

                strSQL += " select  [MobID], [RoomID], [ShortDesc] ";
                strSQL += " from    [mob]  ";
                strSQL += " where   [MobID] in ( ";
                strSQL += "         select  [MobID] ";
                strSQL += "         from    [RoomMobs] ";
                strSQL += "         where   SpawnAreaID = " + MobAreaID + " ";
                strSQL += "                 and RoomNumber = " + intRoomID + " ";
                strSQL += "                 and CoordX = " + CoordX + " ";
                strSQL += "                 and CoordY = " + CoordY + " ";
                strSQL += "                 and CoordZ = " + CoordZ + " ";
                strSQL += "         ) ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                int iRow = 0;
                while (iRow <= ds.Tables[0].Rows.Count - 1)
                {
                    mob oMob = new mob();

                    oMob.mobID     = (int)ds.Tables[0].Rows[iRow]["MobID"];
                    oMob.mobVNUM   = (int)ds.Tables[0].Rows[iRow]["VNUM"];
                    oMob.ShortDesc = (string)ds.Tables[0].Rows[iRow]["ShortDesc"];

                    mobs[iRow] = oMob;

                    iRow++;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return(mobs);
        }
예제 #2
0
파일: mob.cs 프로젝트: kerchunk/GizMaker
        // Get a mob by MobID.
        public static mob GetMob(int MobID)
        {
            mob oMob = new mob();

            // Configure database connection elements.
            OleDbDataAdapter da         = new OleDbDataAdapter();
            OleDbConnection  connection = new OleDbConnection();

            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("mob");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [MobID], [VNUM], [ShortDesc] ";
                strSQL += " from   [Mob] ";
                strSQL += " where  MobID = " + MobID + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    oMob.mobID     = (int)ds.Tables[0].Rows[0]["MobID"];
                    oMob.mobVNUM   = (int)ds.Tables[0].Rows[0]["VNUM"];
                    oMob.ShortDesc = (string)ds.Tables[0].Rows[0]["ShortDesc"];
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return(oMob);
        }
예제 #3
0
파일: mob.cs 프로젝트: kerchunk/GizMaker
        // Get a mob by MobID.
        public static mob GetMob(int MobID)
        {
            mob oMob = new mob();

            // Configure database connection elements.
            OleDbDataAdapter da = new OleDbDataAdapter();
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("mob");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [MobID], [VNUM], [ShortDesc] ";
                strSQL += " from   [Mob] ";
                strSQL += " where  MobID = " + MobID + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    oMob.mobID = (int)ds.Tables[0].Rows[0]["MobID"];
                    oMob.mobVNUM = (int)ds.Tables[0].Rows[0]["VNUM"];
                    oMob.ShortDesc = (string)ds.Tables[0].Rows[0]["ShortDesc"];
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return oMob;
        }
예제 #4
0
파일: mob.cs 프로젝트: kerchunk/GizMaker
        // Get a collection of mobs in the room.
        public static mob[] GetRoomMobs(int MobAreaID, int intRoomID, int CoordX, int CoordY, int CoordZ)
        {
            mob[] mobs = new mob[250];

            // Configure database connection elements.
            OleDbDataAdapter da = new OleDbDataAdapter();
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("mobs");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;

                strSQL += " select  [MobID], [RoomID], [ShortDesc] ";
                strSQL += " from    [mob]  ";
                strSQL += " where   [MobID] in ( ";
                strSQL += "         select  [MobID] ";
                strSQL += "         from    [RoomMobs] ";
                strSQL += "         where   SpawnAreaID = " + MobAreaID + " ";
                strSQL += "                 and RoomNumber = " + intRoomID + " ";
                strSQL += "                 and CoordX = " + CoordX + " ";
                strSQL += "                 and CoordY = " + CoordY + " ";
                strSQL += "                 and CoordZ = " + CoordZ + " ";
                strSQL += "         ) ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                int iRow = 0;
                while (iRow <= ds.Tables[0].Rows.Count - 1)
                {
                    mob oMob = new mob();

                    oMob.mobID = (int)ds.Tables[0].Rows[iRow]["MobID"];
                    oMob.mobVNUM = (int)ds.Tables[0].Rows[iRow]["VNUM"];
                    oMob.ShortDesc = (string)ds.Tables[0].Rows[iRow]["ShortDesc"];

                    mobs[iRow] = oMob;

                    iRow++;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return mobs;
        }