Exemplo n.º 1
0
        public static int updateRoleStart(string nOperatorName, int nVersionNo, long nAccountId, int nServerId, int nRoleId)
        {
            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(ConstAspect.mOperator);
            }

            int result_ = ConstAspect.mFail;

            SqlConnection sqlConnection_ = new SqlConnection();

            sqlConnection_.ConnectionString = ConstAspect.mConnectionString;
            sqlConnection_.Open();

            SqlCommand sqlCommand_ = new SqlCommand();

            sqlCommand_.Connection  = sqlConnection_;
            sqlCommand_.CommandType = CommandType.Text;
            sqlCommand_.CommandText = string.Format(mUpdateRoleStart, nServerId, nRoleId, gameName_, nAccountId);
            try
            {
                sqlCommand_.ExecuteNonQuery();
                result_ = ConstAspect.mSucess;
            }
            catch (SqlException)
            {
                result_ = ConstAspect.mSql;
            }
            sqlConnection_.Close();
            return(result_);
        }
Exemplo n.º 2
0
        public static int getRoleCount(string nOperatorName, int nVersionNo, long nAccountId, int nServerId)
        {
            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(0);
            }

            SqlConnection sqlConnection_ = new SqlConnection();

            sqlConnection_.ConnectionString = ConstAspect.mConnectionString;
            sqlConnection_.Open();

            SqlCommand sqlCommand_ = new SqlCommand();

            sqlCommand_.Connection  = sqlConnection_;
            sqlCommand_.CommandType = CommandType.Text;
            sqlCommand_.CommandText = string.Format(mRoleCount, gameName_, nAccountId, nServerId);
            SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader();
            int           roleCount_     = 0;

            if (sqlDataReader_.Read())
            {
                roleCount_ = sqlDataReader_.GetInt32(0);
            }
            sqlDataReader_.Close();
            sqlConnection_.Close();
            return(roleCount_);
        }
Exemplo n.º 3
0
        public static bool createRole(string nOperatorName, int nVersionNo, long nAccountId, int nServerId, string nRoleName, short nRoleRace)
        {
            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(false);
            }

            SqlConnection sqlConnection_ = new SqlConnection();

            sqlConnection_.ConnectionString = ConstAspect.mConnectionString;
            sqlConnection_.Open();

            SqlCommand sqlCommand_ = new SqlCommand();

            sqlCommand_.Connection  = sqlConnection_;
            sqlCommand_.CommandType = CommandType.Text;
            sqlCommand_.CommandText = string.Format(mCreateRole, gameName_, nAccountId, nServerId, nServerId, nRoleName, nRoleRace);
            bool result_ = false;

            try
            {
                sqlCommand_.ExecuteNonQuery();
                result_ = true;
            }
            catch (SqlException)
            {
                result_ = false;
            }
            sqlConnection_.Close();
            return(result_);
        }
Exemplo n.º 4
0
        public static void pushNetIp(List <NetIp> nNetIps, string nOperatorName, int nVersionNo, int nClassify)
        {
            initSocial(false);

            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return;
            }

            mGameStates[gameName_].pushNetIp(nNetIps, nClassify);
        }
Exemplo n.º 5
0
        public static AgentInfo getIdleAgent(string nOperatorName, int nVersionNo, int nClassify)
        {
            initAgent(false);

            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(null);
            }

            return(mAgentStates[gameName_].getIdleAgent(nClassify));
        }
Exemplo n.º 6
0
        public static ServerInfo getServerInfo(string nOperatorName, int nVersionNo, int nServerId)
        {
            initServerState(false);

            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(null);
            }

            return(mServerStates[gameName_].getServerInfo(nServerId));
        }
Exemplo n.º 7
0
        public static List <ServerItem> getServerItems(string nOperatorName, int nVersionNo)
        {
            initServerState(false);

            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(null);
            }

            return(mServerStates[gameName_].getServerItems());
        }
Exemplo n.º 8
0
        public static int getServerId(string nOperatorName, int nVersionNo)
        {
            initServerState(false);

            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(0);
            }

            return(mServerStates[gameName_].getServerId());
        }
Exemplo n.º 9
0
        public static List <UpInt> getUpints(string nOperatorName, int nVersionNo)
        {
            initUpint(false);

            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(null);
            }

            if (!mUpInts.ContainsKey(gameName_))
            {
                return(null);
            }
            return(mUpInts[gameName_]);
        }
Exemplo n.º 10
0
        public static List <RoleItem> getRoleList(string nOperatorName, int nVersionNo, long nAccountId)
        {
            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(null);
            }

            List <RoleItem> roleItems_ = null;

            SqlConnection sqlConnection_ = new SqlConnection();

            sqlConnection_.ConnectionString = ConstAspect.mConnectionString;
            sqlConnection_.Open();

            SqlCommand sqlCommand_ = new SqlCommand();

            sqlCommand_.Connection  = sqlConnection_;
            sqlCommand_.CommandType = CommandType.Text;
            sqlCommand_.CommandText = string.Format(mRoleList, gameName_, nAccountId);
            SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader();

            while (sqlDataReader_.Read())
            {
                if (null == roleItems_)
                {
                    roleItems_ = new List <RoleItem>();
                }
                RoleItem roleItem_ = new RoleItem();
                roleItem_.mServerId  = sqlDataReader_.GetInt32(0);
                roleItem_.mRoleId    = sqlDataReader_.GetInt32(1);
                roleItem_.mRoleType  = sqlDataReader_.GetInt16(2);
                roleItem_.mRoleName  = sqlDataReader_.GetString(3).Trim();
                roleItem_.mRoleRace  = sqlDataReader_.GetInt16(4);
                roleItem_.mRoleStep  = sqlDataReader_.GetInt16(5);
                roleItem_.mRoleLevel = sqlDataReader_.GetInt32(6);
                roleItems_.Add(roleItem_);
            }
            sqlDataReader_.Close();
            sqlConnection_.Close();
            return(roleItems_);
        }
Exemplo n.º 11
0
        public static RoleItem getRoleInfo(string nOperatorName, int nVersionNo, long nAccountId, int nRoleId, int nServerId)
        {
            string gameName_ = OperatorAspect.getGameName(nOperatorName, nVersionNo);

            if ("" == gameName_)
            {
                return(null);
            }

            RoleItem roleItem_ = null;

            SqlConnection sqlConnection_ = new SqlConnection();

            sqlConnection_.ConnectionString = ConstAspect.mConnectionString;
            sqlConnection_.Open();

            SqlCommand sqlCommand_ = new SqlCommand();

            sqlCommand_.Connection  = sqlConnection_;
            sqlCommand_.CommandType = CommandType.Text;
            sqlCommand_.CommandText = string.Format(mRoleInfo, gameName_, nAccountId, nRoleId, nServerId);
            SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader();

            if (sqlDataReader_.Read())
            {
                roleItem_            = new RoleItem();
                roleItem_.mServerId  = nServerId;
                roleItem_.mRoleId    = nRoleId;
                roleItem_.mRoleType  = sqlDataReader_.GetInt16(0);
                roleItem_.mRoleName  = sqlDataReader_.GetString(1).Trim();
                roleItem_.mRoleRace  = sqlDataReader_.GetInt16(2);
                roleItem_.mRoleStep  = sqlDataReader_.GetInt16(3);
                roleItem_.mRoleLevel = sqlDataReader_.GetInt32(4);
            }
            sqlDataReader_.Close();
            sqlConnection_.Close();
            return(roleItem_);
        }