Example #1
0
 /// <summary>
 /// 强化
 /// </summary>
 private void UpdateUserItem(GameUser user, UserItemInfo userItem, int strongMoney)
 {
     if (user.GameCoin >= strongMoney)
     {
         user.GameCoin = MathUtils.Subtraction(user.GameCoin, strongMoney, 0);
         var package = UserItemPackage.Get(user.UserID);
         strongLv = 0;
         VipLvInfo vipLvInfo = new ConfigCacheSet <VipLvInfo>().FindKey(user.VipLv);
         for (int i = 0; i < ops; i++)
         {
             EquStreng streng = null;
             if (vipLvInfo != null && vipLvInfo.EquStreng != null)
             {
                 streng = vipLvInfo.EquStreng;
             }
             if (streng != null && RandomUtils.IsHit(streng.probability))
             {
                 strongLv += (short)RandomUtils.GetRandom(streng.start, streng.end);
             }
             else
             {
                 strongLv += 1;
             }
         }
         userItem.ItemLv = MathUtils.Addition(userItem.ItemLv, strongLv);
         package.SaveItem(userItem);
         UserLogHelper.AppenStrongLog(user.UserID, 1, userItem.UserItemID, userItem.ItemID, 2, userItem.ItemLv, 0, userItem.GeneralID);
     }
 }
Example #2
0
        protected override object this[string index]
        {
            get
            {
                #region
                switch (index)
                {
                case "VipLv": return(VipLv);

                case "PayGold": return(PayGold);

                case "DailyRestrain": return(DailyRestrain);

                case "ExpandFun": return(ExpandFun);

                case "EquStreng": return(EquStreng);

                default: throw new ArgumentException(string.Format("VipLvInfo index[{0}] isn't exist.", index));
                }
                #endregion
            }
            set
            {
                #region
                switch (index)
                {
                case "VipLv":
                    _VipLv = value.ToShort();
                    break;

                case "PayGold":
                    _PayGold = value.ToInt();
                    break;

                case "DailyRestrain":
                    _DailyRestrain = ConvertCustomField <CacheList <DailyRestrain> >(value, index);
                    break;

                case "ExpandFun":
                    _ExpandFun = value.ToNotNullString();
                    break;

                case "EquStreng":
                    _EquStreng = ConvertCustomField <EquStreng>(value, index);
                    break;

                default: throw new ArgumentException(string.Format("VipLvInfo index[{0}] isn't exist.", index));
                }
                #endregion
            }
        }
Example #3
0
 public VipLvInfo()
     : base(AccessLevel.ReadOnly)
 {
     DailyRestrain = new CacheList <DailyRestrain>(0, true);
     _EquStreng    = new EquStreng();
 }