Exemple #1
0
        public override bool TakeAction()
        {
            var          package  = UserItemPackage.Get(Uid);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));

            if (userItem == null)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }
            if (ops == 1)
            {
                var ckUserItemArray = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.CangKu);
                if (ckUserItemArray.Count >= ContextUser.WarehouseNum)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St1107_WarehouseNumFull;
                    return(false);
                }
                UserItemHelper.MergerUserItem(ContextUser.UserID, userItemID, ItemStatus.CangKu);
            }
            else if (ops == 2)
            {
                var bbUserItemArray = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);
                if (bbUserItemArray.Count >= ContextUser.GridNum)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St1107_GridNumFull;
                    return(false);
                }
                UserItemHelper.MergerUserItem(ContextUser.UserID, userItemID, ItemStatus.BeiBao);
            }
            return(true);
        }
Exemple #2
0
        /// <summary>
        /// 是否升级
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="itemID"></param>
        /// <returns></returns>
        public static bool IsSynthesis(string userID, int itemID, short userLv)
        {
            ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemID);

            if (itemInfo == null || itemInfo.ItemType == ItemType.TuZhi)
            {
                return(false);
            }
            List <ItemSynthesisInfo> itemSynthesisInfosArray =
                new ShareCacheStruct <ItemSynthesisInfo>().FindAll(m => m.SynthesisID == itemID);

            if (itemSynthesisInfosArray.Count == 0 || itemSynthesisInfosArray[0].DemandLv > userLv)
            {
                return(false);
            }
            List <ItemSynthesisInfo> infoArray =
                new ShareCacheStruct <ItemSynthesisInfo>().FindAll(m => m.ItemID == itemSynthesisInfosArray[0].ItemID);

            foreach (ItemSynthesisInfo info in infoArray)
            {
                var uItemArray = UserItemHelper.GetItems(userID).FindAll(u => u.ItemID == info.SynthesisID && u.ItemType == ItemType.TuZhi && u.ItemStatus != ItemStatus.Sell);

                if (uItemArray.Count > 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #3
0
        public static bool IsNomalHeritage(string userID, int opsType)
        {
            int     itemid  = 0;
            int     itemnum = 0;
            OpsInfo opsInfo = GeneralHelper.HeritageOpsInfo(opsType);

            if (opsInfo != null)
            {
                itemid  = opsInfo.ItemID;
                itemnum = opsInfo.ItemNum;
            }
            if (itemid > 0 && itemnum > 0)
            {
                var package = UserItemPackage.Get(userID);
                if (package != null)
                {
                    int num      = 0;
                    var useritem = package.ItemPackage.FindAll(s => s.ItemID == itemid);
                    foreach (var itemInfo in useritem)
                    {
                        num += itemInfo.Num;
                    }
                    if (num >= itemnum)
                    {
                        UserItemHelper.UseUserItem(userID, itemid, itemnum);
                        return(true);
                    }
                }
            }
            else
            {
                return(true);
            }
            return(false);
        }
Exemple #4
0
        public override bool TakeAction()
        {
            UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);

            if (userTrump != null && userTrump.PropertyInfo.Count > 0)
            {
                GeneralProperty property = userTrump.PropertyInfo.Find(m => m.AbilityType == propertyID);
                if (property != null)
                {
                    if (property.AbilityLv >= TrumpPropertyInfo.MaxTrumpPropertyLv)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1466_OutPropertyMaxLv;
                        return(false);
                    }
                    TrumpPropertyInfo trumpProperty = new ConfigCacheSet <TrumpPropertyInfo>().FindKey(property.AbilityType, property.AbilityLv);
                    if (trumpProperty != null)
                    {
                        int upItemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, trumpProperty.ItemID);
                        if (upItemNum < trumpProperty.ItemNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1462_ItemNumNotEnough;
                            return(false);
                        }
                        if (ContextUser.GameCoin < trumpProperty.GameCoin)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                            return(false);
                        }
                        if (ContextUser.ObtainNum < trumpProperty.ObtainNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_ObtainNumNotEnough;
                            return(false);
                        }
                        ContextUser.ObtainNum = MathUtils.Subtraction(ContextUser.ObtainNum, trumpProperty.ObtainNum);
                        ContextUser.GameCoin  = MathUtils.Subtraction(ContextUser.GameCoin, trumpProperty.GameCoin);
                        UserItemHelper.UseUserItem(ContextUser.UserID, trumpProperty.ItemID, trumpProperty.ItemNum);
                        short             upLv            = MathUtils.Addition(property.AbilityLv, (short)1, (short)TrumpPropertyInfo.MaxTrumpPropertyLv);
                        TrumpPropertyInfo uptrumpProperty = new ConfigCacheSet <TrumpPropertyInfo>().FindKey(property.AbilityType, upLv);
                        property.UpdateNotify(obj =>
                        {
                            property.AbilityLv    = MathUtils.Addition(property.AbilityLv, (short)1, TrumpPropertyInfo.MaxTrumpPropertyLv);
                            property.AbilityValue = uptrumpProperty.PropertyNum;
                            return(true);
                        });
                        var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                        if (usergeneral != null)
                        {
                            usergeneral.RefreshMaxLife();
                        }
                        ErrorCode = 0;
                        ErrorInfo = LanguageManager.GetLang().St1464_UpgradeWasSsuccessful;
                    }
                }
            }
            return(true);
        }
Exemple #5
0
        private void AppenUserItem(ItemSynthesisInfo synthesisInfo, int ugeneralID, ItemStatus istatus, short itemLv)
        {
            //原因:合成黄色装备,物品存放为0
            if (istatus != ItemStatus.YongBing)
            {
                istatus = ItemStatus.BeiBao;
            }
            var package = UserItemPackage.Get(Uid);

            string       uitemID  = Guid.NewGuid().ToString();
            UserItemInfo userItem = new UserItemInfo()
            {
                UserItemID = uitemID,
                ItemID     = synthesisInfo.ItemID,
                ItemLv     = MathUtils.Subtraction(itemLv, (short)5, (short)1),
                ItemStatus = istatus,
                ItemType   = ItemType.ZhuangBei,
                GeneralID  = ugeneralID,
                Num        = 1
            };

            package.SaveItem(userItem);
            //package.DelayChange();
            UserItemHelper.AddItemLog(ContextUser.UserID, synthesisInfo.ItemID, 1, MathUtils.Subtraction(itemLv, (short)5, (short)1), 5, uitemID);
        }
        public override bool TakeAction()
        {
            ItemUseHelper itemuse = new ItemUseHelper();

            itemuse.UseItem(userItemID, Uid);
            if (itemuse.result && itemuse.content != string.Empty)
            {
                content = itemuse.content.Trim(',');
            }
            if (!itemuse.result)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = itemuse.content;
                return(false);
            }

            // 使用还可以继续使用该礼包
            int  itemid  = UserItemHelper.GetUserItemInfoID(ContextUser.UserID, userItemID);
            bool hasGift = UserItemHelper.IsEnoughBeiBaoItem(ContextUser.UserID, itemid, 1);

            if (hasGift)
            {
                hasNextGift = 1;
            }
            return(true);
        }
Exemple #7
0
        private string DoBossItem(GameUser user, BossItem bossItem, int randId)
        {
            string prizeItemMsg = string.Empty;
            ////筛选物品
            var itemInfoList = new ConfigCacheSet <ItemBaseInfo>().FindAll(m => m.ItemType == bossItem.Type && m.MedicineLv == bossItem.ItemLv);

            if (itemInfoList.Count > 0)
            {
                for (int i = 0; i < bossItem.Num; i++)
                {
                    ItemBaseInfo itemInfo = itemInfoList[RandomUtils.GetRandom(0, itemInfoList.Count)];
                    if (itemInfo == null)
                    {
                        continue;
                    }
                    UserItemHelper.AddUserItem(user.UserID, itemInfo.ItemID, 1);
                    if (prizeItemMsg.Length > 0)
                    {
                        prizeItemMsg += " ";
                    }
                    prizeItemMsg += string.Format(LanguageManager.GetLang().St5405_CombatNum, itemInfo.ItemName, 1);
                }
            }
            return(prizeItemMsg);
        }
Exemple #8
0
        /// <summary>
        /// 奖励物品时是否背包已满
        /// </summary>
        /// <param name="user"></param>
        /// <param name="prizeContent"></param>
        /// <returns></returns>
        public static bool IsPrizeItemName(GameUser user, out string prizeContent)
        {
            prizeContent = string.Empty;
            if (!CrystalHelper.CheckAllowCrystall(user))
            {
                prizeContent = LanguageManager.GetLang().St1305_FateBackpackFull;
                return(false);
            }

            if (UserItemHelper.CheckItemOut(user, ItemStatus.BeiBao))
            {
                prizeContent = LanguageManager.GetLang().St1606_GridNumNotEnough;
                return(false);
            }

            if (UserHelper.IsSpareGridNum(user, 0))
            {
                prizeContent = LanguageManager.GetLang().St1213_GridNumFull;
                return(false);
            }

            if (EnchantHelper.IsEnchantPackage(user.UserID))
            {
                prizeContent = LanguageManager.GetLang().St1259_EnchantGridNumFull;
                return(false);
            }
            return(true);
        }
Exemple #9
0
        public override bool TakeAction()
        {
            var          package  = UserItemPackage.Get(ContextUser.UserID);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID == userItemID);

            if (userItem != null)
            {
                UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
                if (userTrump != null && userTrump.TrumpLv >= GameConfigSet.MaxTrumpLv)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1456_OutTrumpMaxLv;
                    return(false);
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
                if (itemInfo != null && itemInfo.PropType == 10)
                {
                    TrumpHelper.CheckTrumpEscalate(ContextUser.UserID, itemInfo.EffectNum);
                    UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1);
                    var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                    if (usergeneral != null)
                    {
                        usergeneral.RefreshMaxLife();
                    }
                }
            }
            return(true);
        }
Exemple #10
0
        public override bool TakeAction()
        {
            var package = UserItemPackage.Get(Uid);

            itemArray = package.ItemPackage.FindAll(
                u =>
            {
                var helper = new UserItemHelper(u);
                return(!u.IsRemove && u.ItemType == ItemType.YaoJi &&
                       helper.DemandLv <= ContextUser.UserLv &&
                       helper.MedicineType == medicineType &&
                       (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu));
            });
            itemArray.QuickSort((x, y) =>
            {
                if (x == null && y == null)
                {
                    return(0);
                }
                if (x != null && y == null)
                {
                    return(1);
                }
                if (x == null)
                {
                    return(-1);
                }
                return(x.ItemID.CompareTo(y.ItemID));
            });
            return(true);
        }
Exemple #11
0
        public override void BuildPacket()
        {
            PushIntoStack(userItemArray.Count);
            foreach (var item in userItemArray)
            {
                short isStrong    = 0;
                int   strongMoney = new UserItemHelper(item).StrongMoney;
                if (item.ItemLv >= ContextUser.UserLv || strongMoney > ContextUser.GameCoin)
                {
                    isStrong = 1;
                }
                ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(item.ItemID);
                DataStruct   dsItem   = new DataStruct();

                dsItem.PushIntoStack(item == null ? string.Empty : item.UserItemID.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? 0 : itemInfo.ItemID);
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack(item == null ? LanguageManager.GetLang().shortInt : item.ItemLv);
                dsItem.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : (short)itemInfo.QualityType);
                dsItem.PushIntoStack(item == null ? 0 : strongMoney);
                dsItem.PushIntoStack(coldTime);
                dsItem.PushIntoStack(isStrong);
                dsItem.PushIntoStack(UserHelper.StrongEquPayPrice(Uid, item.UserItemID));

                List <ItemEquAttrInfo> itemEquArray = new ShareCacheStruct <ItemEquAttrInfo>().FindAll(e => e.ItemID.Equals(item.ItemID));
                //当前等级装备属性
                dsItem.PushIntoStack(itemEquArray.Count);
                foreach (ItemEquAttrInfo equ in itemEquArray)
                {
                    DataStruct dsDetail = new DataStruct();
                    dsDetail.PushIntoStack((int)equ.AttributeID);
                    if (equ != null && item != null)
                    {
                        baseNum = MathUtils.Addition(equ.BaseNum, item.ItemLv * equ.IncreaseNum, int.MaxValue);
                    }
                    dsDetail.PushIntoStack(baseNum);
                    dsItem.PushIntoStack(dsDetail);
                }

                //下级别装备属性
                dsItem.PushIntoStack(itemEquArray.Count);
                foreach (ItemEquAttrInfo equ in itemEquArray)
                {
                    DataStruct dsDetail = new DataStruct();
                    dsDetail.PushIntoStack((int)equ.AttributeID);
                    if (equ != null && item != null)
                    {
                        stengBaseNum = MathUtils.Addition(equ.BaseNum, (int)(MathUtils.Addition(item.ItemLv, (short)1, short.MaxValue)) * equ.IncreaseNum, int.MaxValue);
                    }
                    dsDetail.PushIntoStack(stengBaseNum);
                    dsItem.PushIntoStack(dsDetail);
                }



                PushIntoStack(dsItem);
            }
        }
Exemple #12
0
        protected override void ProcessCmd(string[] args)
        {
            int itemID  = args.Length > 0 ? args[0].Trim().ToInt() : 0;
            int itemNum = args.Length > 1 ? args[1].Trim().ToInt() : 1;

            UserItemHelper.AddUserItem(UserID, itemID, itemNum);
            //AddUserItem(UserID, itemID, itemNum);
        }
Exemple #13
0
        public override bool TakeAction()
        {
            int       upitemNum = 0;
            var       cacheSet  = new GameDataCacheSet <UserTrump>();
            UserTrump userTrump = cacheSet.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);

            if (userTrump == null)
            {
                return(false);
            }
            WashConsumeInfo consumeInfo = TrumpHelper.GetWashConsumeInfo(userTrump.MatureNum);

            if (consumeInfo == null)
            {
                return(false);
            }
            upitemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, consumeInfo.ItemID);
            if (ops == 1)
            {
                string success = ((double)consumeInfo.SuccessNum * 100).ToString();
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1458_UseBackDaysOrb, consumeInfo.ItemNum, consumeInfo.MatureNum, success);
                return(false);
            }
            else if (ops == 2)
            {
                ErrorCode = ops;
                if (upitemNum < consumeInfo.ItemNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1458_BackDaysOrbNotEnough;
                    return(false);
                }
                int maxMatrueNum = ConfigEnvSet.GetInt("Trump.MaxMatrueNum");
                if (userTrump.MatureNum >= maxMatrueNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1458_MaxMatrueNumFull;
                    return(false);
                }
                UserItemHelper.UseUserItem(ContextUser.UserID, consumeInfo.ItemID, consumeInfo.ItemNum);
                if (RandomUtils.IsHit(consumeInfo.SuccessNum))
                {
                    userTrump.MatureNum = MathUtils.Addition(userTrump.MatureNum, consumeInfo.MatureNum.ToShort(), maxMatrueNum.ToShort());
                    ErrorInfo           = LanguageManager.GetLang().St1458_XiLianSuccess;
                    var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                    if (usergeneral != null)
                    {
                        usergeneral.RefreshMaxLife();
                    }
                }
                else
                {
                    ErrorInfo = LanguageManager.GetLang().St1458_XiLianFail;
                }
            }
            return(true);
        }
Exemple #14
0
        /// <summary>
        /// 新手礼包
        /// </summary>
        /// <param name="user"></param>
        /// <param name="item"></param>
        /// <param name="noviceActivities"></param>
        /// <returns></returns>
        public static bool GetNoviceActivities(GameUser user, UserItemInfo item, NoviceActivities noviceActivities)
        {
            List <NoviceReward> noviceArray = noviceActivities.Reward.ToList();
            var package       = UserItemPackage.Get(user.UserID);
            var userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.BeiBao);
            int subPackNum    = MathUtils.Subtraction(user.GridNum, MathUtils.Subtraction(userItemArray.Count, 5, 0), 0);

            if (noviceArray.Count > subPackNum)
            {
                return(false);
            }

            bool isupdate = false;

            foreach (NoviceReward reward in noviceArray)
            {
                if (reward.Type == 1)
                {
                    isupdate       = true;
                    user.EnergyNum = MathUtils.Addition(user.EnergyNum, (short)reward.Num, short.MaxValue);
                }
                if (reward.Type == 2)
                {
                    isupdate      = true;
                    user.GameCoin = MathUtils.Addition(user.GameCoin, reward.Num, int.MaxValue);
                }
                else if (reward.Type == 3)
                {
                    ItemBaseInfo itemInfo    = new ShareCacheStruct <ItemBaseInfo>().FindKey(reward.Reward);
                    UserGeneral  userGeneral = UserGeneral.GetMainGeneral(user.UserID);
                    if (itemInfo.ItemType == ItemType.ZhuangBei && !itemInfo.CheckCareer(userGeneral.CareerID))
                    {
                        continue;
                    }
                    UserItemHelper.AddUserItem(user.UserID, itemInfo.ItemID, reward.Num);
                }
                else if (reward.Type == 4)
                {
                    //晶石
                    isupdate      = true;
                    user.GiftGold = MathUtils.Addition(user.GiftGold, reward.Num, int.MaxValue);
                }
            }
            UserItemHelper.UseUserItem(user.UserID, item.ItemID, 1);

            if (isupdate)
            {
                //user.Update();
            }

            if (item.ItemID == 5000 || item.ItemID == 5001 ||
                item.ItemID == 5002 || item.ItemID == 5003)
            {
                int itemID = MathUtils.Addition(item.ItemID, 1, int.MaxValue);
                UserItemHelper.AddUserItem(user.UserID, itemID, 1);
            }
            return(true);
        }
Exemple #15
0
        public override bool TakeAction()
        {
            StoryTaskInfo storyTask = new ConfigCacheSet <StoryTaskInfo>().FindKey(taskID);

            if (storyTask != null && storyTask.TaskLv <= ContextUser.UserLv)
            {
                UserTask userTask = new GameDataCacheSet <UserTask>().FindKey(ContextUser.UserID, taskID);
                if (userTask != null && userTask.TaskState == TaskState.Close)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1433_RewardAlreadyReceive;
                    return(false);
                }
                int collectNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, storyTask.TargetItemID);
                if (collectNum < storyTask.TargetItemNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1462_ItemNumNotEnough;
                    return(false);
                }
                ItemUseHelper itemuse = new ItemUseHelper();

                if (!itemuse.GeneralPrize(ContextUser, storyTask.Reward.ToList()))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1433_StoryTaskGridNotEnough;
                    return(false);
                }
                if (itemuse.DoPrize(ContextUser, storyTask.Reward.ToList()))
                {
                    UserItemHelper.UseUserItem(ContextUser.UserID, storyTask.TargetItemID, storyTask.TargetItemNum);
                    if (userTask != null && userTask.TaskState != TaskState.Close)
                    {
                        userTask.TaskState = TaskState.Close;
                    }

                    if (userTask == null)
                    {
                        userTask = new UserTask
                        {
                            UserID        = ContextUser.UserID,
                            TaskID        = taskID,
                            TaskType      = storyTask.TaskType,
                            TaskStar      = TaskStar.Star5,
                            TaskState     = TaskState.Close,
                            TaskTargetNum = "0",
                            CompleteNum   = 0,
                            CreateDate    = DateTime.Now
                        };
                        new GameDataCacheSet <UserTask>().Add(userTask, GameEnvironment.CacheUserPeriod);
                    }

                    ErrorCode = 0;
                    ErrorInfo = itemuse.content.Trim(',');
                }
            }
            return(true);
        }
Exemple #16
0
        public override bool TakeAction()
        {
            try
            {
                MaxLength = ConfigEnvSet.GetInt("User.MaxLength");
                itemID    = ConfigEnvSet.GetInt("UserName.ItemID");
                int length = System.Text.Encoding.Default.GetByteCount(_nickName);
                if (length <= 0 || length > MaxLength)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = string.Format(LanguageManager.GetLang().St1005_KingNameTooLong, MaxLength);
                    return(false);
                }
                if (GameUser.IsNickName(_nickName))
                {
                    ErrorCode = 1;
                    ErrorInfo = LanguageManager.GetLang().St1005_Rename;
                    return(false);
                }
                //UserItemLog userItem = UserItemLog.FindKey(itemID);
                var          package  = UserItemPackage.Get(Uid);
                UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.ItemID == itemID);
                if (userItem == null || userItem.Num <= 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    return(false);
                }
                ContextUser.NickName = _nickName;

                int                rankID = 0;
                UserRank           rankInfo;
                Ranking <UserRank> ranking = RankingFactory.Get <UserRank>(CombatRanking.RankingKey);
                if (ranking.TryGetRankNo(m => m.UserID == ContextUser.UserID, out rankID))
                {
                    rankInfo = ranking.Find(s => s.UserID == ContextUser.UserID);
                    if (rankInfo != null)
                    {
                        rankInfo.NickName = _nickName;
                    }
                }
                //ContextUser.Update();
                //UserGeneral usergen = UserGeneral.GetMainGeneral(ContextUser.UserID);
                //if (usergen != null)
                //{
                //    usergen.GeneralName = _nickName;
                //    //usergen.Update();
                //}
                UserItemHelper.UseUserItem(ContextUser.UserID, itemID, 1);

                return(true);
            }
            catch (Exception ex)
            {
                SaveLog(ex);
                return(false);
            }
        }
Exemple #17
0
        public override bool TakeAction()
        {
            if (_chatType == ChatType.Guild && string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9203_ChaTypeNotGuildMember;
                return(false);
            }

            //查找背包中的聊天道具
            var chatLeng    = ConfigEnvSet.GetInt("Chat.ContentLeng");
            int chatItemId  = ConfigEnvSet.GetInt("UserItem.ChatItemID");
            int charItemNum = UserItemHelper.CheckItemNum(ContextUser.UserID, chatItemId);

            //判断是否有聊天道具
            if (charItemNum <= 0)
            {
                ErrorCode = 3;
                ErrorInfo = LanguageManager.GetLang().St9203_ItemEmpty;
                return(false);
            }

            if (_content.IndexOf("<label") >= 0 || _content.IndexOf("<image") >= 0)
            {
                chatLeng += 150;
            }
            if (_content.Trim().Length == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9201_contentNotEmpty;
                return(false);
            }
            //LogHelper.WriteError(string.Format("contentLength={0};length={1};content={2}", _content.Length, chatLeng, _content));
            if (_content.Length >= chatLeng)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9201_TheInputTextTooLong;
                return(false);
            }

            if (!TjxChatService.IsAllow(ContextUser, _chatType))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9203_ChatNotSend;
                return(false);
            }

            NoviceHelper.WingFestival(ContextUser.UserID, _content);
            NoviceHelper.WingZhongYuanFestival(ContextUser, _content);
            //使用聊天道具
            UserItemHelper.UseUserItem(ContextUser.UserID, chatItemId, 1);
            var chatService = new TjxChatService(ContextUser);

            chatService.Send(_chatType, _content);

            return(true);
        }
Exemple #18
0
        public override bool TakeAction()
        {
            UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);

            if (userTrump == null)
            {
                return(false);
            }
            if (userTrump.WorshipLv >= GameConfigSet.MaxWorshipLv)
            {
                return(false);
            }
            short       uplv        = (short)MathUtils.Addition((int)userTrump.WorshipLv, 1, GameConfigSet.MaxWorshipLv);
            WorshipInfo worshipInfo = new ShareCacheStruct <WorshipInfo>().FindKey(TrumpInfo.CurrTrumpID, uplv);

            if (worshipInfo == null)
            {
                return(false);
            }

            if (ContextUser.GameCoin < worshipInfo.GameCoin)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                return(false);
            }
            if (ContextUser.ObtainNum < worshipInfo.ObtainNum)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_ObtainNumNotEnough;
                return(false);
            }
            int upitemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, worshipInfo.ItemID);

            if (upitemNum < worshipInfo.ItemNum)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1462_ItemNumNotEnough;
                return(false);
            }
            ContextUser.GameCoin  = MathUtils.Subtraction(ContextUser.GameCoin, worshipInfo.GameCoin, 0);
            ContextUser.ObtainNum = MathUtils.Subtraction(ContextUser.ObtainNum, worshipInfo.ObtainNum, 0);
            UserItemHelper.UseUserItem(ContextUser.UserID, worshipInfo.ItemID, worshipInfo.ItemNum);
            ErrorCode = 0;
            if (RandomUtils.IsHit(worshipInfo.SuccessNum))
            {
                userTrump.WorshipLv = MathUtils.Addition(userTrump.WorshipLv, (short)1, GameConfigSet.MaxWorshipLv);
                ErrorInfo           = LanguageManager.GetLang().St1464_WorshipSuccess;
            }
            else
            {
                ErrorInfo = LanguageManager.GetLang().St1464_WorshipFail;
            }
            return(true);
        }
Exemple #19
0
        private string DoBossItem(GameUser user, BossItem bossItem, int randId)
        {
            string prizeItemMsg = string.Empty;
            //筛选物品
            var itemInfoList = new ConfigCacheSet <ItemBaseInfo>().FindAll(m =>
            {
                bool result = false;
                if (m.ItemType == bossItem.Type)
                {
                    if (m.ItemID == bossItem.ItemId)
                    {
                        return(true);
                    }
                    if (m.ItemType == ItemType.TuZhi)
                    {
                        result = m.MedicineLv <= bossItem.ItemLv;
                    }
                    else
                    {
                        if (bossItem.ItemLv > 0 && bossItem.Quality > 0)
                        {
                            result = m.DemandLv == bossItem.ItemLv && (short)m.QualityType == bossItem.Quality;
                        }
                        else if (bossItem.ItemLv > 0)
                        {
                            result = m.DemandLv == bossItem.ItemLv;
                        }
                        else if (bossItem.Quality > 0)
                        {
                            result = (short)m.QualityType == bossItem.Quality;
                        }
                    }
                }
                return(result);
            });

            if (itemInfoList.Count > 0)
            {
                for (int i = 0; i < bossItem.Num; i++)
                {
                    ItemBaseInfo itemInfo = itemInfoList[RandomUtils.GetRandom(0, itemInfoList.Count)];
                    if (itemInfo == null)
                    {
                        continue;
                    }
                    UserItemHelper.AddUserItem(user.UserID, itemInfo.ItemID, 1);
                    if (prizeItemMsg.Length > 0)
                    {
                        prizeItemMsg += " ";
                    }
                    prizeItemMsg += string.Format("{0}*{1}", itemInfo.ItemName, 1);
                }
            }
            return(prizeItemMsg);
        }
Exemple #20
0
        public override bool TakeAction()
        {
            UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);

            if (userTrump != null && userTrump.SkillInfo.Count > 0)
            {
                SkillInfo skillInfo = userTrump.SkillInfo.Find(m => m.AbilityID == skillID);
                if (skillInfo != null)
                {
                    if (skillInfo.AbilityLv >= GameConfigSet.MaxSkillLv)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1462_OutMaxTrumpLv;
                        return(false);
                    }
                    SkillLvInfo skillLvInfo = new ConfigCacheSet <SkillLvInfo>().FindKey(skillInfo.AbilityID, skillInfo.AbilityLv);
                    if (skillLvInfo != null)
                    {
                        if (ContextUser.GameCoin < skillLvInfo.GameCoin)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                            return(false);
                        }
                        if (ContextUser.ObtainNum < skillLvInfo.ObtainNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_ObtainNumNotEnough;
                            return(false);
                        }
                        int upitemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, skillLvInfo.ItemID);
                        if (upitemNum < skillLvInfo.ItemNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1462_ItemNumNotEnough;
                            return(false);
                        }
                        if (TrumpHelper.IsMeetUpSkillLv(ContextUser, skillLvInfo))
                        {
                            ContextUser.GameCoin  = MathUtils.Subtraction(ContextUser.GameCoin, skillLvInfo.GameCoin, 0);
                            ContextUser.ObtainNum = MathUtils.Subtraction(ContextUser.ObtainNum, skillLvInfo.ObtainNum, 0);
                            UserItemHelper.UseUserItem(ContextUser.UserID, skillLvInfo.ItemID, skillLvInfo.ItemNum);
                            skillInfo.UpdateNotify(obj =>
                            {
                                skillInfo.AbilityLv = MathUtils.Addition(skillInfo.AbilityLv, (short)1, GameConfigSet.MaxTrumpLv.ToShort());
                                return(true);
                            });
                            ErrorCode = 0;
                            ErrorInfo = LanguageManager.GetLang().St1464_UpgradeWasSsuccessful;
                        }
                    }
                }
            }
            return(true);
        }
Exemple #21
0
        public override bool TakeAction()
        {
            if (string.IsNullOrEmpty(ContextUser.MercenariesID) || guildID != ContextUser.MercenariesID)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9203_ChaTypeNotGuildMember;
                return(false);
            }
            UserGuild userGuild = new ShareCacheStruct <UserGuild>().FindKey(guildID);

            if (userGuild == null)
            {
                return(false);
            }
            GuildMember member = new ShareCacheStruct <GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID);

            if (member != null)
            {
                if (member.PostType == PostType.Member)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St6024_AuditPermissions;
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            //UserItem userItem = UserItem.FindKey(itemID);
            var          package  = UserItemPackage.Get(Uid);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.ItemID == itemID);

            if (userItem == null || userItem.Num <= 0)
            {
                ErrorCode = 1;
                return(false);
            }
            if (userGuild.AddMember >= maxMember)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6024_GuildAddMemberToLong;
                return(false);
            }
            ItemBaseInfo item = new ConfigCacheSet <ItemBaseInfo>().FindKey(itemID);

            if (item != null)
            {
                addMember = item.EffectNum;
            }
            userGuild.AddMember += addMember;
            //userGuild.Update();
            UserItemHelper.UseUserItem(ContextUser.UserID, itemID, 1);
            return(true);
        }
Exemple #22
0
        public override bool TakeAction()
        {
            string publicUserID = string.Empty;

            if (string.IsNullOrEmpty(toUserID))
            {
                publicUserID = ContextUser.UserID;
            }
            else
            {
                publicUserID = toUserID;
                UserCacheGlobal.LoadOffline(publicUserID);
            }
            user = new PersonalCacheStruct <GameUser>().FindKey(publicUserID);
            if (user == null)
            {
                return(false);
            }
            if (user.UserExtend == null)
            {
                user.UserExtend = new GameUserExtend();
            }
            var userItemArray = UserItemHelper.GetItems(publicUserID).FindAll(
                u => u.GeneralID.Equals(_genealID) && new UserItemHelper(u).EquPartsID.Equals(_equPart) && u.ItemStatus == ItemStatus.YongBing);

            if (userItemArray.Count > 0)
            {
                string itemID       = userItemArray[0].UserItemID ?? "";
                var    tempPartList = user.SparePartList.FindAll(m => m.UserItemID.Equals(itemID));
                for (int i = 0; i < tempPartList.Count; i++)
                {
                    var part = tempPartList[i];
                    if (part != null && part.Position > 0 && part.Position - 1 < _sparePartList.Length)
                    {
                        part.UpdateNotify(obj =>
                        {
                            _sparePartList[part.Position - 1] = part;
                            return(true);
                        });
                        //_sparePartList[part.Position - 1] = part;
                    }
                    else if (part != null && part.Position == 0 && !string.IsNullOrEmpty(part.UserItemID))
                    {
                        //修正灵石在装备上位置为同一的
                        part.UpdateNotify(obj =>
                        {
                            part.UserItemID = string.Empty;
                            return(true);
                        });
                    }
                }
            }
            return(true);
        }
Exemple #23
0
        public override bool TakeAction()
        {
            if (ops == 1)
            {
                ErrorCode = ops;
                ErrorInfo = LanguageManager.GetLang().St1457_UseLifeExtension;
                return(false);
            }
            else if (ops == 2)
            {
                var            package       = UserItemPackage.Get(ContextUser.UserID);
                UserItemInfo[] userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemType == ItemType.DaoJu && m.PropType == 11).ToArray();
                if (userItemArray.Length == 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1457_LifeExtensionNotEnough;
                    return(false);
                }
                ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(userItemArray[0].ItemID);
                if (itemInfo == null)
                {
                    return(false);
                }
                UserTrump userTrump = new PersonalCacheStruct <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
                if (userTrump != null)
                {
                    TrumpInfo trumpInfo = new ShareCacheStruct <TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, userTrump.TrumpLv);
                    if (trumpInfo != null)
                    {
                        if (userTrump.LiftNum < trumpInfo.MaxLift)
                        {
                            userTrump.LiftNum = MathUtils.Addition(userTrump.LiftNum, itemInfo.EffectNum, trumpInfo.MaxLift);
                            UserItemHelper.UseUserItem(ContextUser.UserID, userItemArray[0].ItemID, 1);
                            var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                            if (userTrump.LiftNum > 0 && usergeneral != null)
                            {
                                usergeneral.RefreshMaxLife();
                            }
                            ErrorCode = ops;
                            ErrorInfo = string.Format(LanguageManager.GetLang().St1457_ChangeLifeNum, itemInfo.EffectNum);
                        }
                        else
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1457_MaxLifeExtension;
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Exemple #24
0
        private static bool IsGridNumFull(GameUser user)
        {
            int itemid         = 5019;
            var userItemsArray = UserItemHelper.GetItems(user.UserID).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);

            if (userItemsArray.Count < user.GridNum)
            {
                UserItemHelper.AddUserItem(user.UserID, itemid, 1);
                return(true);
            }
            return(false);
        }
Exemple #25
0
        public override bool TakeAction()
        {
            var package       = UserItemPackage.Get(Uid);
            var userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.BeiBao);

            if (userItemArray.Count >= ContextUser.GridNum)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St7004_BeiBaoTimeOut;
                return(false);
            }

            ItemBaseInfo itemInfo  = new ConfigCacheSet <ItemBaseInfo>().FindKey(itemID);
            int          mallPrice = 0;

            if (itemInfo != null)
            {
                mallPrice = itemInfo.MysteryPrice; //itemInfo.PackMaxNum * itemInfo.SalePrice;
            }
            if (itemInfo != null && mallPrice > ContextUser.GameCoin)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                return(false);
            }
            if (ContextUser.UserExtend != null && ContextUser.UserExtend.UserShops != null)
            {
                List <MysteryShops> mysteryList = ContextUser.UserExtend.UserShops.ToList();
                MysteryShops        shops       = mysteryList.Find(m => m.ItemID == itemID);
                if (shops != null)
                {
                    if (shops.BuyNum > 0)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St7005_HavePurchasedItem;
                        return(false);
                    }

                    if (shops.BuyNum > 0)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St7005_HavePurchasedItem;
                        return(false);
                    }
                    shops.BuyNum         = 1;
                    ContextUser.GameCoin = MathUtils.Subtraction(ContextUser.GameCoin, mallPrice, 0);
                    //ContextUser.Update();

                    UserItemHelper.AddUserItem(ContextUser.UserID, itemID, itemNum);
                }
            }
            return(true);
        }
Exemple #26
0
        /// <summary>
        /// 合成后装备
        /// </summary>
        /// <param name="itemID"></param>
        /// <param name="info"></param>
        private void UpdateUserItem(int itemID, UserItemInfo info)
        {
            //原因:合成黄色装备,物品存放为0
            info.ItemID = itemID;
            info.ItemLv = MathUtils.Subtraction(info.ItemLv, (short)5, (short)1);
            var package = UserItemPackage.Get(Uid);

            info.ItemType = ItemType.ZhuangBei;
            package.SaveItem(info);
            //package.DelayChange();
            UserItemHelper.AddItemLog(ContextUser.UserID, itemID, 1, info.ItemLv, 5, info.UserItemID);
        }
Exemple #27
0
        public override bool TakeAction()
        {
            var         package     = UserItemPackage.Get(ContextUser.UserID);
            UserGeneral userGeneral = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, generalID);
            GeneralInfo general     = new ShareCacheStruct <GeneralInfo>().FindKey(generalID);

            if (package == null || general == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            if (userGeneral == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1442_SelectMercenaryUpgrade;
                return(false);
            }
            if (string.IsNullOrEmpty(userGeneral.GeneralCard))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1442_SelectTheExperienceCard;
                return(false);
            }
            string[] itemStr = userGeneral.GeneralCard.Split(',');
            bool     isUse   = false;

            foreach (var str in itemStr)
            {
                var useritem = package.ItemPackage.Find(s => !s.IsRemove && s.UserItemID == str);
                if (useritem == null)
                {
                    continue;
                }
                int          exprience = 0;
                ItemBaseInfo itemInfo  = new ShareCacheStruct <ItemBaseInfo>().FindKey(useritem.ItemID);
                if (itemInfo != null)
                {
                    exprience = itemInfo.EffectNum;
                    if (general.ItemID == itemInfo.ItemID)
                    {
                        exprience = (exprience * GameConfigSet.ExpMultiple).ToInt();
                    }
                    //GeneralHelper.UserGeneralExp(ContextUser.UserID, generalID, exprience);
                    UserItemHelper.UseUserItem(ContextUser.UserID, useritem.ItemID, 1);
                    isUse = true;
                }
            }
            if (isUse)
            {
                userGeneral.GeneralCard = string.Empty;
            }
            return(true);
        }
Exemple #28
0
        /// <summary>
        /// 奖励配置
        /// </summary>
        /// <param name="user"></param>
        public static void ChestGetUserTake(TreasureInfo prize, GameUser user)
        {
            switch (prize.Type)
            {
            case RewardType.GameGoin:
                user.GameCoin = MathUtils.Addition(user.GameCoin, prize.Num.ToInt());
                break;

            case RewardType.Obtion:
                user.ObtainNum = MathUtils.Addition(user.ObtainNum, prize.Num.ToInt());
                break;

            case RewardType.ExpNum:
                user.ExpNum = MathUtils.Addition(user.ExpNum, prize.Num.ToInt());
                break;

            case RewardType.EnergyNum:
                user.EnergyNum = MathUtils.Addition(user.EnergyNum, prize.Num.ToShort());
                break;

            case RewardType.Experience:
                break;

            case RewardType.Gold:
                user.GiftGold = MathUtils.Addition(user.GiftGold, prize.Num.ToInt());
                break;

            case RewardType.Item:
                if (!UserAbilityHelper.UseUserItem(user.UserID, prize.ItemID))
                {
                    UserItemHelper.AddUserItem(user.UserID, prize.ItemID, prize.Num.ToInt());
                }
                break;

            case RewardType.CrystalId:
                short crystalLv = prize.ItemLv > 0 ? prize.ItemLv : 1.ToShort();
                CrystalHelper.AppendCrystal(user.UserID, prize.ItemID, crystalLv);
                break;

            case RewardType.Spare:
                AppendSpare(user, prize.ItemID);
                break;

            case RewardType.Enchant:
                short enchantLv = prize.ItemLv > 0 ? prize.ItemLv : 1.ToShort();
                EnchantHelper.AppendEnchat(user.UserID, prize.ItemID, enchantLv);
                break;

            default:
                break;
            }
        }
Exemple #29
0
        public override bool TakeAction()
        {
            var chatService = new TjxChatService(ContextUser);

            _currVersion           = chatService.CurrVersion;
            _chatArray             = chatService.Receive();
            ContextUser.ChatVesion = _currVersion;
            //查找背包中的聊天道具
            int chatItemId = ConfigEnvSet.GetInt("UserItem.ChatItemID");

            _charItemNum = UserItemHelper.CheckItemNum(ContextUser.UserID, chatItemId);
            return(true);
        }
Exemple #30
0
        /// <summary>
        /// 活动奖励
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="reward"></param>
        /// <param name="num"></param>
        public static void GameUserReward(string userID, RewardType reward, int itemID, int num)
        {
            GameUser userInfo = new GameDataCacheSet <GameUser>().FindKey(userID);

            if (userInfo != null)
            {
                if (reward == RewardType.GameGoin)
                {
                    userInfo.GameCoin = MathUtils.Addition(userInfo.GameCoin, num, int.MaxValue);
                    //userInfo.Update();
                }
                else if (reward == RewardType.Obtion)
                {
                    userInfo.ObtainNum = MathUtils.Addition(userInfo.ObtainNum, num, int.MaxValue);
                    //userInfo.Update();
                }
                else if (reward == RewardType.EnergyNum)
                {
                    userInfo.EnergyNum = MathUtils.Addition(userInfo.EnergyNum, (short)num, short.MaxValue);
                    //userInfo.Update();
                }
                else if (reward == RewardType.ExpNum)
                {
                    userInfo.ExpNum = MathUtils.Addition(userInfo.ExpNum, num, int.MaxValue);
                    //userInfo.Update();
                }
                else if (reward == RewardType.Gold)
                {
                    userInfo.ItemGold = MathUtils.Addition(userInfo.ItemGold, num, int.MaxValue);
                    //userInfo.Update();
                }
                else if (reward == RewardType.Experience)
                {
                    UserHelper.UserGeneralExp(userID, num);
                }
                else if (reward == RewardType.Item)
                {
                    UserItemHelper.AddUserItem(userID, itemID, num);
                }
                else if (reward == RewardType.CrystalType)
                {
                    CrystalQualityType qualityType = CrystalQualityType.PurPle;
                    GetUserCrystal(userInfo, qualityType);
                }
                else if (reward == RewardType.CrystalId)
                {
                    UserHelper.CrystalAppend(userID, itemID, 2);
                }
            }
        }