예제 #1
0
 ConfigBuffengineEntity CreateNewFlow(ConfigBuffengineEntity src, decimal point, decimal percent)
 {
     return(new ConfigBuffengineEntity()
     {
         Id = src.Id,
         SkillCode = src.SkillCode,
         SkillLevel = src.SkillLevel,
         BuffSrcType = src.BuffSrcType,
         BuffUnitType = src.BuffUnitType,
         LiveFlag = src.LiveFlag,
         CheckMode = src.CheckMode,
         CheckKey = src.CheckKey,
         CalcMode = src.CalcMode,
         SrcDir = src.SrcDir,
         SrcMode = src.SrcMode,
         SrcKey = src.SrcKey,
         DstDir = src.DstDir,
         DstMode = src.DstMode,
         DstKey = src.DstKey,
         BuffMap = src.BuffMap,
         BuffVal = point,
         BuffPer = percent,
         BuffArg = src.BuffArg,
         PropIndexList = src.PropIndexList,
         AsBuffUnitType = src.AsBuffUnitType
     });
 }
        /// <summary>
        /// 将IDataReader的当前记录读取到ConfigBuffengineEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ConfigBuffengineEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ConfigBuffengineEntity();

            obj.Id           = (System.Int32)reader["Id"];
            obj.SkillCode    = (System.String)reader["SkillCode"];
            obj.SkillLevel   = (System.Int32)reader["SkillLevel"];
            obj.BuffSrcType  = (System.Int32)reader["BuffSrcType"];
            obj.BuffUnitType = (System.Int32)reader["BuffUnitType"];
            obj.LiveFlag     = (System.Int32)reader["LiveFlag"];
            obj.CheckMode    = (System.Int32)reader["CheckMode"];
            obj.CheckKey     = (System.String)reader["CheckKey"];
            obj.CalcMode     = (System.Int32)reader["CalcMode"];
            obj.SrcDir       = (System.Int32)reader["SrcDir"];
            obj.SrcMode      = (System.Int32)reader["SrcMode"];
            obj.SrcKey       = (System.String)reader["SrcKey"];
            obj.DstDir       = (System.Int32)reader["DstDir"];
            obj.DstMode      = (System.Int32)reader["DstMode"];
            obj.DstKey       = (System.String)reader["DstKey"];
            obj.BuffMap      = (System.String)reader["BuffMap"];
            obj.BuffVal      = (System.Decimal)reader["BuffVal"];
            obj.BuffPer      = (System.Decimal)reader["BuffPer"];
            obj.BuffArg      = (System.String)reader["BuffArg"];
            obj.Memo         = (System.String)reader["Memo"];
            obj.RowTime      = (System.DateTime)reader["RowTime"];

            return(obj);
        }
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2015/10/19 10:43:37</remarks>
        public bool Update(ConfigBuffengineEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigBuffengine_Update");

            database.AddInParameter(commandWrapper, "@Id", DbType.Int32, entity.Id);
            database.AddInParameter(commandWrapper, "@SkillCode", DbType.AnsiString, entity.SkillCode);
            database.AddInParameter(commandWrapper, "@SkillLevel", DbType.Int32, entity.SkillLevel);
            database.AddInParameter(commandWrapper, "@BuffSrcType", DbType.Int32, entity.BuffSrcType);
            database.AddInParameter(commandWrapper, "@BuffUnitType", DbType.Int32, entity.BuffUnitType);
            database.AddInParameter(commandWrapper, "@LiveFlag", DbType.Int32, entity.LiveFlag);
            database.AddInParameter(commandWrapper, "@CheckMode", DbType.Int32, entity.CheckMode);
            database.AddInParameter(commandWrapper, "@CheckKey", DbType.AnsiString, entity.CheckKey);
            database.AddInParameter(commandWrapper, "@CalcMode", DbType.Int32, entity.CalcMode);
            database.AddInParameter(commandWrapper, "@SrcDir", DbType.Int32, entity.SrcDir);
            database.AddInParameter(commandWrapper, "@SrcMode", DbType.Int32, entity.SrcMode);
            database.AddInParameter(commandWrapper, "@SrcKey", DbType.AnsiString, entity.SrcKey);
            database.AddInParameter(commandWrapper, "@DstDir", DbType.Int32, entity.DstDir);
            database.AddInParameter(commandWrapper, "@DstMode", DbType.Int32, entity.DstMode);
            database.AddInParameter(commandWrapper, "@DstKey", DbType.AnsiString, entity.DstKey);
            database.AddInParameter(commandWrapper, "@BuffMap", DbType.AnsiString, entity.BuffMap);
            database.AddInParameter(commandWrapper, "@BuffVal", DbType.Currency, entity.BuffVal);
            database.AddInParameter(commandWrapper, "@BuffPer", DbType.Currency, entity.BuffPer);
            database.AddInParameter(commandWrapper, "@BuffArg", DbType.AnsiString, entity.BuffArg);
            database.AddInParameter(commandWrapper, "@Memo", DbType.String, entity.Memo);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }

            entity.Id = (System.Int32)database.GetParameterValue(commandWrapper, "@Id");

            return(Convert.ToBoolean(results));
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>ConfigBuffengineEntity</returns>
        /// <remarks>2015/10/19 10:43:37</remarks>
        public ConfigBuffengineEntity GetById(System.Int32 id)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigBuffengine_GetById");

            database.AddInParameter(commandWrapper, "@Id", DbType.Int32, id);


            ConfigBuffengineEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
예제 #5
0
        public static bool Update(ConfigBuffengineEntity configBuffengineEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigBuffengineProvider(zoneId);

            return(provider.Update(configBuffengineEntity, trans));
        }
예제 #6
0
        public void ProcBuffFlow(List <DTOBuffPlayer> buffDest, DTOBuffPack buffPack, bool homeFlag, string skillKey, ConfigBuffengineEntity buffFlow)
        {
            var buffList = buffFlow.PropIndexList;

            if (null == buffList || buffList.Length == 0)
            {
                return;
            }
            double buffVal   = (double)buffFlow.BuffVal;
            double buffPer   = (double)buffFlow.BuffPer;
            int    skillStar = 0;
            int    skillLv   = 0;

            string[] args = skillKey.Split('.');
            if (args.Length >= 2 && !int.TryParse(args[1], out skillStar) || skillStar <= 0)
            {
                skillStar = 0;
            }
            if (args.Length >= 3 && !int.TryParse(args[2], out skillLv) || skillLv <= 0)
            {
                skillLv = 1;
            }
            foreach (var dst in buffDest)
            {
                foreach (int idx in buffList)
                {
                    if (idx >= 0 && idx < dst.Props.Length)
                    {
                        dst.Props[idx].Point   += buffVal * (100 + skillLv - 1 + skillStar * 20) / 100d;
                        dst.Props[idx].Percent += buffPer * (100 + skillLv - 1 + skillStar * 20) / 100d;
                    }
                }
            }
        }
예제 #7
0
        public void ProcBuffFlow(List <DTOBuffPlayer> buffDest, DTOBuffPack buffPack, bool homeFlag, string skillKey, ConfigBuffengineEntity buffFlow)
        {
            var buffList = buffFlow.PropIndexList;

            if (null == buffList || buffList.Length == 0)
            {
                return;
            }
            double buffVal = (double)buffFlow.BuffVal;
            double buffPer = (double)buffFlow.BuffPer;
            string args    = skillKey.Substring(skillKey.LastIndexOf('.') + 1);
            int    fact    = 0;

            if (!int.TryParse(args, out fact) || fact <= 0)
            {
                fact = 1;
            }
            foreach (var dst in buffDest)
            {
                foreach (int idx in buffList)
                {
                    if (idx >= 0 && idx < dst.Props.Length)
                    {
                        dst.Props[idx].Point   += buffVal * fact;
                        dst.Props[idx].Percent += buffPer * fact;
                    }
                }
            }
        }
예제 #8
0
 public void ProcBuffFlow(List <DTOBuffPlayer> buffDest, DTOBuffPack buffPack, bool homeFlag, string skillKey, ConfigBuffengineEntity buffFlow)
 {
     ProcBuffPool(buffDest, skillKey, buffFlow.PropIndexList, (double)buffFlow.BuffVal, (double)buffFlow.BuffPer);
 }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015/10/19 10:43:37</remarks>
 public bool Update(ConfigBuffengineEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2015/10/19 10:43:37</remarks>
 public bool Insert(ConfigBuffengineEntity entity)
 {
     return(Insert(entity, null));
 }