Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 随机获得金币、精力奖励
        /// </summary>
        /// <param name="item"></param>
        /// <param name="user"></param>
        public static void GetProbabilityReward(GameUser user, UserItemInfo item)
        {
            ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(item.ItemID);

            if (itemInfo != null)
            {
                var      prizeInfosArray = itemInfo.ItemPack;
                double[] probability     = new double[prizeInfosArray.Count];
                for (int i = 0; i < prizeInfosArray.Count; i++)
                {
                    probability[i] = (double)prizeInfosArray[i].Probability;
                }
                int       index2    = RandomUtils.GetHitIndex(probability);
                PrizeInfo prizeInfo = prizeInfosArray[index2];
                ActivitiesAward.GameUserReward(user.UserID, prizeInfo.Type, prizeInfo.ItemID, prizeInfo.Num);
                UserItemHelper.UseUserItem(user.UserID, item.ItemID, 1);
            }
        }
Exemplo n.º 15
0
        public override bool TakeAction()
        {
            if (NoviceHelper.IsFestivalOpen(festivalID))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().ZhongYuanHuodong;
                return(false);
            }
            var          package  = UserItemPackage.Get(Uid);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));

            if (userItem != null)
            {
                ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
                if (itemInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    //ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                    return(false);
                }
                if (userItem.ItemID == 7003 || userItem.ItemID == 5200)
                {
                    //双倍材料掉落卡
                    if (!DoCaiLiaoYueBingItem(userItem, itemInfo))
                    {
                        return(false);
                    }
                }
                else
                {
                    //其他类型的道具
                    if (!UseProps(ContextUser.UserID, itemInfo))
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1608_CombatPowerNotEnough;
                        return(false);
                    }
                }
                PictureID = itemInfo.PictrueID;
                UserItemHelper.UseUserItem(ContextUser.UserID, userItem.ItemID, 1);
            }
            return(true);
        }
Exemplo n.º 16
0
        public override bool TakeAction()
        {
            DialHelper.CheckDialNum(ContextUser.UserID);
            UserDial userDial = new PersonalCacheStruct <UserDial>().FindKey(ContextUser.UserID);

            if (userDial == null || string.IsNullOrEmpty(userDial.UserItemID))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            if (ops == 1)
            {
                string errContent = string.Empty;
                if (UserPackHelper.PackIsFull(ContextUser, BackpackType.BeiBao, 0, out errContent))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = errContent;
                    return(false);
                }
                int itemid   = UserItemHelper.GetUserItemInfoID(ContextUser.UserID, userDial.UserItemID);
                var itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemid);
                if (itemInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                    return(false);
                }
                // 根据宝箱取得该宝箱对应的钥匙ID
                int itemNum = UserItemHelper.CheckItemNum(ContextUser.UserID, itemInfo.EffectNum);
                if (itemNum <= 0)
                {
                    ItemBaseInfo itemKey = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemInfo.EffectNum);
                    if (itemKey == null)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                        return(false);
                    }
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = string.Format(LanguageManager.GetLang().St12004_ChestKeyNotEnough, itemKey.ItemName);
                    return(false);
                }
                UserItemHelper.UseUserItem(ContextUser.UserID, itemid, 1);
                UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.EffectNum, 1);
                postion = DialHelper.ChestDialPrizePostion(ContextUser);
                postion = MathUtils.Addition(postion, (short)1);

                // 是否还可以继续使用
                //var package = UserItemPackage.Get(ContextUser.UserID);
                bool hasBox = UserItemHelper.IsEnoughBeiBaoItem(ContextUser.UserID, itemid, 1);
                bool hasKey = UserItemHelper.IsEnoughBeiBaoItem(ContextUser.UserID, itemInfo.EffectNum, 1);
                // 如果钥匙和宝箱的数各 >= 1
                if (hasBox && hasKey)
                {
                    hasNextBox = 1;
                }
            }

            //int useGold = 0;
            //if (ops == 1)
            //{
            //    //if (!DialHelper.IsDialFree(ContextUser.UserID))
            //    //{
            //    //    ErrorCode = LanguageManager.GetLang().ErrorCode;
            //    //    ErrorInfo = LanguageManager.GetLang().St12004_FreeNotEnough;
            //    //    return false;
            //    //}
            //}
            //else if (ops == 2)
            //{
            //    useGold = GameConfigSet.SweepstakesRequiredGold;
            //    ErrorCode = ops;
            //    ErrorInfo = string.Format(LanguageManager.GetLang().St12004_SpendSparDraw, useGold, 1);
            //    return false;
            //}
            //else if (ops == 3)
            //{
            //    if (DialHelper.IsDialFree(ContextUser.UserID))
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St12004_FreeNumEnough;
            //        return false;
            //    }
            //    useGold = GameConfigSet.SweepstakesRequiredGold;
            //    if (ContextUser.GoldNum < useGold)
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
            //        return false;
            //    }
            //    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold);
            //}
            //else if (ops == 4)
            //{
            //    useGold = GameConfigSet.FiveRequiredGold;
            //    ErrorCode = ops;
            //    ErrorInfo = string.Format(LanguageManager.GetLang().St12004_SpendSparDraw, useGold, 5);
            //    return false;
            //}
            //else if (ops == 5)
            //{
            //    if (DialHelper.IsDialFree(ContextUser.UserID))
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St12004_FreeNumEnough;
            //        return false;
            //    }
            //    useGold = GameConfigSet.FiveRequiredGold;
            //    if (ContextUser.GoldNum < useGold)
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
            //        return false;
            //    }
            //    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold);
            //}
            //ErrorCode = ops;
            //postion = DialHelper.DialPrizePostion(ContextUser.UserID, ops);
            //postion = MathUtils.Addition(postion, (short)1);
            return(true);
        }
Exemplo n.º 17
0
        public override bool TakeAction()
        {
            int subLifeNum = 0;

            var          package  = UserItemPackage.Get(Uid);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));

            if (userItem == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            //wuzf modify 2012-05-19
            ItemBaseInfo itemInfo   = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
            var          propsArray = new GameDataCacheSet <UserProps>().FindAll(ContextUser.UserID, u => u.PropType == 1);

            if (propsArray.Count > 0 && propsArray[0].SurplusNum > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1605_BandageUse;
                return(false);
            }

            //判断背包是否有血包,没有提示去商城
            var userItems = package.ItemPackage.FindAll(m => !m.IsRemove && new UserItemHelper(m).PropType == 1);

            if (userItems.Count == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1605_UseTwoGold;
                return(false);
            }

            //给佣兵补血
            var userGeneralArray = new GameDataCacheSet <UserGeneral>().FindAll(ContextUser.UserID, u => u.GeneralStatus == GeneralStatus.DuiWuZhong);
            int effectNum        = itemInfo.EffectNum;

            foreach (var userGeneral in userGeneralArray)
            {
                int maxLifeNum = UserHelper.GetMaxLife(ContextUser.UserID, userGeneral.GeneralID);
                if (userGeneral.LifeNum < maxLifeNum)
                {
                    subLifeNum          = MathUtils.Subtraction(maxLifeNum, userGeneral.LifeNum, 0);
                    userGeneral.LifeNum = MathUtils.Addition(userGeneral.LifeNum, effectNum, maxLifeNum);
                    //userGeneral.Update();
                    effectNum = MathUtils.Subtraction(effectNum, subLifeNum, 0);
                }
            }
            var       cacheSet = new GameDataCacheSet <UserProps>();
            UserProps props    = new GameDataCacheSet <UserProps>().FindKey(ContextUser.UserID, userItem.ItemID);

            if (props != null)
            {
                props.SurplusNum = effectNum;
                //props.Update();
            }
            else
            {
                props = new UserProps(ContextUser.UserID, itemInfo.ItemID)
                {
                    SurplusNum = effectNum
                };
                cacheSet.Add(props);
            }

            ContextUser.IsUseupItem = false;
            UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1);
            foreach (UserProps userPropse in propsArray)
            {
                if (userPropse.SurplusNum == 0)
                {
                    cacheSet.Delete(userPropse);
                }
            }
            return(true);
        }
Exemplo n.º 18
0
        public override bool TakeAction()
        {
            if (string.IsNullOrEmpty(ContextUser.MercenariesID) || guildID != ContextUser.MercenariesID)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6011_GuildMemberNotMember;
                return(false);
            }
            UserGuild userGuild = new ShareCacheStruct <UserGuild>().FindKey(guildID);

            if (userGuild == null)
            {
                return(false);
            }
            List <UserGuild> guildArray = new ShareCacheStruct <UserGuild>().FindAll(m => m.GuildName == guildName);

            if (guildArray.Count > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6017_Rename;
                return(false);
            }

            int nameLength = System.Text.Encoding.Default.GetByteCount(guildName);

            if (nameLength < 4 || nameLength > 12)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6017_GuildNameTooLong;
                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 = LanguageManager.GetLang().ErrorCode;
                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().St6007_AuditPermissions;
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            userGuild.GuildName = guildName;
            //userGuild.Update();
            UserItemHelper.UseUserItem(ContextUser.UserID, itemID, 1);
            return(true);
        }
Exemplo n.º 19
0
        public override bool TakeAction()
        {
            bool result = true;

            taskInfo = new ConfigCacheSet <StoryTaskInfo>().FindKey(TaskID);
            if (taskInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                //this.ErrorInfo = LanguageManager.GetLang().St3002_NotFind;
                SaveLog(new Exception(string.Format("{0},User:{1},task:{2}", LanguageManager.GetLang().St3002_NotFind, ContextUser.UserID, TaskID)));
                return(false);
            }
            _userGeneral = UserGeneral.GetMainGeneral(Uid);
            //获得奖励
            UserTask userTask = new GameDataCacheSet <UserTask>().FindKey(ContextUser.UserID, TaskID);

            if (userTask == null || userTask.TaskState != TaskState.Completed)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St3007_NoCompleted;
                return(false);
            }
            //交付物品任务扣除材料
            if (taskInfo.TermsType == PlotTermsType.Shouji || taskInfo.TermsType == PlotTermsType.Delivery)
            {
                UserItemHelper.UseUserItem(Uid, taskInfo.TargetItemID, taskInfo.TargetItemNum);
            }
            userTask.TaskState = TaskState.Close;
            UserTaskLog taskLog = new UserTaskLog()
            {
                LogID     = Guid.NewGuid().ToString(),
                TaskID    = userTask.TaskID,
                UserID    = userTask.UserID,
                TaskType  = userTask.TaskType,
                TaskState = userTask.TaskState,
                TaskPrize = string.Format("Experience:{0},GameCoin:{1};GameCoin:{2} ",
                                          taskInfo.Experience,
                                          taskInfo.GameCoin,
                                          ContextUser.GameCoin
                                          ),
                CreateDate = DateTime.Now
            };
            var sender = DataSyncManager.GetDataSender();

            sender.Send(taskLog);

            ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, taskInfo.GameCoin, int.MaxValue);
            if (taskInfo.TaskType == TaskType.Master && ContextUser.TaskProgress < TaskID)
            {
                ContextUser.TaskProgress = TaskID;
            }
            //ContextUser.Update();

            //任务加佣兵经验
            //var userEmbattles = new GameDataCacheSet<UserEmbattle>().FindAll(UserEmbattle.Index_UserID_MagicID, Uid, ContextUser.UseMagicID);
            //foreach (var userEmbattle in userEmbattles)
            //{
            //    UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, userEmbattle.GeneralID);
            //    if (userGeneral == null) continue;
            //    userGeneral.CurrExperience = MathUtils.Addition(userGeneral.CurrExperience, taskInfo.Experience, int.MaxValue);
            //    //userGeneral.Update();
            //}
            UserHelper.UserGeneralExp(ContextUser.UserID, taskInfo.Experience);

            //开启功能
            TaskHelper.EnableFunction(ContextUser, taskInfo.FunctionEnum);

            //下发可接任务
            TaskHelper.SendAllowTask(ContextUser, TaskID);

            //开启副本
            PlotHelper.EnablePlot(Uid, taskInfo.EnablePlot);

            //保留主线任务
            var cacheSet = new GameDataCacheSet <UserTask>();

            if (userTask.TaskType == TaskType.Master)
            {
                //userTask.Update();
            }
            else
            {
                //原因:最后支线任务无限刷新BUG
                if (!TaskHelper.IsLastTask(userTask))
                {
                    cacheSet.Delete(userTask);
                }
            }
            return(result);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 获得物品
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="prize"></param>
        /// <returns></returns>
        public bool DoPrize(GameUser userInfo, List <PrizeInfo> prizeList)
        {
            try
            {
                bool        isDeduct = false;
                CrystalInfo crystal  = new CrystalInfo();
                content = LanguageManager.GetLang().St_SummerThreeGameCoinNotice.Substring(0, 5);
                foreach (PrizeInfo prize in prizeList)
                {
                    int num = prize.Num;
                    switch (prize.Type)
                    {
                    case RewardType.GameGoin:
                        userInfo.GameCoin = MathUtils.Addition(userInfo.GameCoin, num);
                        if (content.Length == 0)
                        {
                            content = string.Format(LanguageManager.GetLang().St_SummerThreeGameCoinNotice, num);
                        }
                        else
                        {
                            content += string.Format(LanguageManager.GetLang().St_GameCoin, num) + ",";
                        }
                        break;

                    case RewardType.Obtion:
                        userInfo.ObtainNum = MathUtils.Addition(userInfo.ObtainNum, num);
                        if (content.Length == 0)
                        {
                            content = string.Format(LanguageManager.GetLang().St_SummerThreeObtionNotice, num);
                        }
                        else
                        {
                            content += string.Format(LanguageManager.GetLang().St_ObtionNum, num) + ",";
                        }
                        break;

                    case RewardType.ExpNum:
                        userInfo.ExpNum = MathUtils.Addition(userInfo.ExpNum, num);
                        if (content.Length == 0)
                        {
                            content = string.Format(LanguageManager.GetLang().St_SummerThreeExpNumNotice, num);
                        }
                        else
                        {
                            content += string.Format(LanguageManager.GetLang().St_ExpNum, num) + ",";
                        }
                        break;

                    case RewardType.EnergyNum:
                        userInfo.EnergyNum = MathUtils.Addition(userInfo.EnergyNum, (short)num, short.MaxValue);
                        if (content.Length == 0)
                        {
                            content = string.Format(LanguageManager.GetLang().St_SummerThreeEnergyNotice, num);
                        }
                        else
                        {
                            content += string.Format(LanguageManager.GetLang().St_EnergyNum, num) + ",";
                        }
                        break;

                    case RewardType.Experience:
                        UserHelper.UserGeneralExp(userInfo.UserID, num);
                        if (content.Length == 0)
                        {
                            content = string.Format(LanguageManager.GetLang().St_SummerThreeExperienceNotice, num);
                        }
                        else
                        {
                            content += string.Format(LanguageManager.GetLang().St_Experience, num) + ",";
                        }
                        break;

                    case RewardType.Gold:
                        userInfo.ItemGold = MathUtils.Addition(userInfo.ItemGold, num);
                        if (content.Length == 0)
                        {
                            content = string.Format(LanguageManager.GetLang().St_SummerThreeGoldNotice, num);
                        }
                        else
                        {
                            content += string.Format(LanguageManager.GetLang().St_GiftGoldNum, num) + ",";
                        }
                        break;

                    case RewardType.Item:
                        if (UserHelper.IsBeiBaoFull(userInfo))
                        {
                            content = LanguageManager.GetLang().St1107_GridNumFull;
                            return(false);
                        }
                        UserItemHelper.AddUserItem(userInfo.UserID, prize.ItemID, num);
                        ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(prize.ItemID);
                        if (itemInfo != null)
                        {
                            if (content.Length == 0)
                            {
                                content = string.Format(LanguageManager.GetLang().St_SummerThreeItemNotice, num);
                            }
                            else
                            {
                                content += string.Format("{0}*{1}", itemInfo.ItemName, num) + ",";
                            }
                        }
                        break;

                    case RewardType.CrystalType:
                        if (!UserCrystalInfo.CheckFull(userInfo.UserID, 0))
                        {
                            content = LanguageManager.GetLang().St1307_FateBackpackFull;
                            return(false);
                        }
                        List <CrystalInfo> crystalArray2 = new ConfigCacheSet <CrystalInfo>().FindAll(m => m.CrystalQuality == prize.CrystalType);
                        if (crystalArray2.Count > 0)
                        {
                            int randomNum = RandomUtils.GetRandom(0, crystalArray2.Count);
                            int crystalID = crystalArray2[randomNum].CrystalID;
                            UserHelper.CrystalAppend(userInfo.UserID, crystalID, 2);
                            CrystalHelper.SendChat(crystalArray2[randomNum].CrystalID, userInfo);
                            crystal = new ConfigCacheSet <CrystalInfo>().FindKey(crystalID);
                            if (crystal != null)
                            {
                                content += string.Format(LanguageManager.GetLang().St_Crystal, CrystalHelper.GetQualityName(crystal.CrystalQuality), crystal.CrystalName) + ",";
                            }
                        }
                        else
                        {
                            TraceLog.WriteError("配置出错");
                            return(false);
                        }
                        break;

                    case RewardType.CrystalId:
                        if (!UserCrystalInfo.CheckFull(userInfo.UserID, 0))
                        {
                            content = LanguageManager.GetLang().St1307_FateBackpackFull;
                            return(false);
                        }
                        UserHelper.CrystalAppend(userInfo.UserID, prize.ItemID, 2);
                        CrystalHelper.SendChat(prize.ItemID, userInfo);
                        crystal = new ConfigCacheSet <CrystalInfo>().FindKey(prize.ItemID);
                        if (crystal != null)
                        {
                            content += string.Format(LanguageManager.GetLang().St_Crystal, CrystalHelper.GetQualityName(crystal.CrystalQuality), crystal.CrystalName) + ",";
                        }
                        break;

                    case RewardType.Spare:
                        int currNum = userInfo.SparePartList.FindAll(m => string.IsNullOrEmpty(m.UserItemID)).Count;
                        if (currNum >= userInfo.UserExtend.SparePartGridNum)
                        {
                            content = LanguageManager.GetLang().St1213_GridNumFull;
                            return(false);
                        }
                        UserSparePart sparePart = UserSparePart.GetRandom(prize.ItemID);
                        SparePartInfo partInfo  = new ConfigCacheSet <SparePartInfo>().FindKey(prize.ItemID);
                        if (partInfo != null && sparePart != null && UserHelper.AddSparePart(userInfo, sparePart))
                        {
                            SendChat(prize, userInfo.NickName, partInfo.Name);
                        }
                        content = string.Empty;
                        break;

                    default:
                        break;
                    }
                    if (prize.Reward == 3 && !string.IsNullOrEmpty(prize.Desc))
                    {
                        content = prize.Desc;
                    }
                    //原因:开启礼包消耗的物品
                    if (prize.DemandItem > 0 && !isDeduct)
                    {
                        UserItemHelper.UseUserItem(userInfo.UserID, prize.DemandItem, prize.DemandNum);
                        isDeduct = true;
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                content = "使用礼包出错!";
                TraceLog.WriteError("使用礼包出错!", ex);
            }
            return(false);
        }
Exemplo n.º 21
0
        public override bool TakeAction()
        {
            ItemBaseInfo itemInfo      = new ShareCacheStruct <ItemBaseInfo>().FindKey(medicineID);
            var          userItemArray = UserItemHelper.GetItems(Uid).FindAll(u => (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu));

            if (userItemArray.Count == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1407_MedicineNum;
                return(false);
            }
            UserGeneral general = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, generalID);

            if (general == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St10006_DoesNotExistTheGeneral;
                return(false);
            }
            if (itemInfo.DemandLv > general.GeneralLv)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                return(false);
            }

            int   sum     = 0;
            short baseNum = 0;
            //佣兵服用ID为medicineID的丹药
            var generalMedicineArray = new PersonalCacheStruct <GeneralMedicine>().FindAll(ContextUser.UserID, g => g.MedicineID.Equals(medicineID) && g.GeneralID == generalID);

            if (generalMedicineArray.Count > 0)
            {
                int mLv  = itemInfo.MedicineLv;
                int mNum = generalMedicineArray.Count;
                if (mLv == 1 && mNum >= 2 || mLv == 2 && mNum >= 3 || mLv == 3 && mNum >= 4 || mLv == 4 && mNum >= 5 || mLv == 5 && mNum >= 6 || mLv == 6 && mNum >= 7)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1407_MedicineNumFull;
                    return(false);
                }

                sum     = mNum * 5; //
                baseNum = MathUtils.Subtraction(itemInfo.MedicineNum, (short)sum, (short)0);
            }
            else
            {
                baseNum = itemInfo.MedicineNum;
            }

            //vip
            int useGold = 0;

            int[] vipMeArray = { 30, 150, 300, 600, 1200, 2400 };
            for (int i = 1; i <= vipMeArray.Length; i++)
            {
                if (itemInfo.MedicineLv == i)
                {
                    useGold = vipMeArray[i - 1];
                }
            }

            if (ops == 0)
            {
                GeneralMedicine generalMedicine = new GeneralMedicine()
                {
                    GeneralMedicineID = Guid.NewGuid().ToString(),
                    UserID            = ContextUser.UserID,
                    GeneralID         = generalID,
                    MedicineID        = medicineID,
                    BaseNum           = (int)baseNum
                };
                var cacheSet = new PersonalCacheStruct <GeneralMedicine>();
                cacheSet.Add(generalMedicine);

                UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1);

                if (itemInfo.MedicineType == 1)
                {
                    general.PowerNum = MathUtils.Addition(general.PowerNum, baseNum, short.MaxValue);
                }
                else if (itemInfo.MedicineType == 2)
                {
                    general.SoulNum = MathUtils.Addition(general.SoulNum, baseNum, short.MaxValue);
                }
                else if (itemInfo.MedicineType == 3)
                {
                    general.IntellectNum = MathUtils.Addition(general.IntellectNum, baseNum, short.MaxValue);
                }
                //general.Update();
            }
            else if (ops == 1)
            {
                ErrorCode = 1;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1407_MedicineUseGold, useGold);
                return(false);
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum < useGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }

                GeneralMedicine generalMedicine = new GeneralMedicine()
                {
                    GeneralMedicineID = Guid.NewGuid().ToString(),
                    UserID            = ContextUser.UserID,
                    GeneralID         = generalID,
                    MedicineID        = medicineID,
                    BaseNum           = (int)baseNum
                };
                var cacheSet = new PersonalCacheStruct <GeneralMedicine>();
                cacheSet.Add(generalMedicine);

                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue);
                //ContextUser.Update();

                if (itemInfo.MedicineType == 1)
                {
                    general.PowerNum = MathUtils.Addition(general.PowerNum, baseNum, short.MaxValue);
                }
                else if (itemInfo.MedicineType == 2)
                {
                    general.SoulNum = MathUtils.Addition(general.SoulNum, baseNum, short.MaxValue);
                }
                else if (itemInfo.MedicineType == 3)
                {
                    general.IntellectNum = MathUtils.Addition(general.IntellectNum, baseNum, short.MaxValue);
                }
                //general.Update();
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().UrlElement;
                return(false);
            }
            return(true);
        }
Exemplo n.º 22
0
        public override bool TakeAction()
        {
            UserHelper.ChechDailyRestrain(ContextUser.UserID);
            int maxNum = 0;
            int useNum = 0;
            DailyRestrainSet restrainSet = new ShareCacheStruct <DailyRestrainSet>().FindKey(RestrainType.DragonHolyWater);

            if (restrainSet != null)
            {
                maxNum = restrainSet.MaxNum;
            }

            int         _itemID = 5050;
            UserGeneral general = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, generalID);

            if (general == null || general.SaturationNum == 0)
            {
                return(false);
            }

            var          package       = UserItemPackage.Get(ContextUser.UserID);
            var          userItemArray = package.ItemPackage.FindAll(m => m.ItemID.Equals(_itemID));
            UserItemInfo useritem      = new UserItemInfo();

            if (userItemArray.Count > 0)
            {
                useritem = userItemArray[0];
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1423_UserItemNotEnough;
                return(false);
            }
            ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(useritem.ItemID);

            if (itemInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }
            var cacheSet = new GameDataCacheSet <UserDailyRestrain>();
            UserDailyRestrain userRestrain = cacheSet.FindKey(ContextUser.UserID);

            if (userRestrain != null && userRestrain.UserExtend != null && userRestrain.UserExtend.WaterNum.Count > 0)
            {
                List <DailyRestrain> daliyrestrainList = userRestrain.UserExtend.WaterNum.FindAll(m => m.ID == generalID);
                useNum = daliyrestrainList.Count;
            }
            if (ops == 1)
            {
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1423_ClearCurrSatiation, itemInfo.ItemName);
                return(false);
            }
            else if (ops == 2)
            {
                if (useNum >= maxNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1423_DragonHolyWater;
                    return(false);
                }
                if (general.SaturationNum > 0)
                {
                    ErrorCode             = ops;
                    general.SaturationNum = 0; //general.SaturationNum.Subtraction(itemInfo.SatiationNum, 0);
                    DailyRestrain restrain = new DailyRestrain();
                    restrain.ID = generalID;
                    if (userRestrain != null)
                    {
                        userRestrain.UserExtend.UpdateNotify(obj =>
                        {
                            userRestrain.UserExtend.WaterNum.Add(restrain);
                            return(true);
                        });
                    }
                    UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1);
                }
            }
            return(true);
        }
Exemplo n.º 23
0
        public bool UseItem(string userItemID, string userID)
        {
            var package = UserItemPackage.Get(userID);

            if (package == null)
            {
                return(false);
            }
            UserItemInfo useritem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));

            //UserItem useritem = UserItem.FindKey(userItemID);
            if (useritem == null || useritem.Num <= 0)
            {
                content = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }
            GameUser userInfo = new GameDataCacheSet <GameUser>().FindKey(userID);

            if (userInfo == null)
            {
                content = LanguageManager.GetLang().Load_User_Error;
                return(false);
            }
            ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(useritem.ItemID);

            if (itemInfo == null)
            {
                content = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }
            if (itemInfo.ItemType != ItemType.VipItem && itemInfo.DemandLv > userInfo.UserLv)
            {
                content = LanguageManager.GetLang().St_LevelNotEnough;
                return(false);
            }
            int beibaonum = 0;
            int crystalid = 0;
            int sparenum  = 0;

            List <PrizeInfo> prizeInfosArray = itemInfo.ItemPack.ToList();

            foreach (PrizeInfo info in prizeInfosArray)
            {
                if (info.Type == RewardType.CrystalId || info.Type == RewardType.CrystalType)
                {
                    if (info.Reward == 2 && crystalid > 0)
                    {
                        continue;
                    }
                    crystalid++;
                }
                else if (info.Type == RewardType.Item)
                {
                    if (info.Reward == 2 && beibaonum > 0)
                    {
                        continue;
                    }
                    beibaonum++;
                }
                else if (info.Type == RewardType.Spare)
                {
                    if (info.Reward == 2 && sparenum > 0)
                    {
                        continue;
                    }
                    sparenum++;
                }
                //原因:开启礼包消耗的物品
                if (info.DemandItem > 0)
                {
                    int demandItemNum = UserHelper.GetUserItemNum(userID, info.DemandItem);
                    if (demandItemNum < info.DemandNum)
                    {
                        ItemBaseInfo itembaseInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(info.DemandItem);
                        if (itembaseInfo != null)
                        {
                            content = string.Format(LanguageManager.GetLang().St1606_OpenPackLackItem, itembaseInfo.ItemName, itemInfo.ItemName);
                            return(false);
                        }
                    }
                }
            }

            if (beibaonum > 0 && crystalid > 0 && sparenum > 0)
            {
                if (UserHelper.IsBeiBaoFull(userInfo, 0))
                {
                    content = LanguageManager.GetLang().St1107_GridNumFull;
                    return(false);
                }

                if (!UserCrystalInfo.CheckFull(userInfo.UserID, 0))
                {
                    content = LanguageManager.GetLang().St1307_FateBackpackFull;
                    return(false);
                }

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

            if (beibaonum > 0 && UserHelper.IsBeiBaoFull(userInfo, beibaonum))
            {
                content = LanguageManager.GetLang().St1107_GridNumFull;
                return(false);
            }

            if (crystalid > 0 && !UserCrystalInfo.CheckFull(userInfo.UserID, crystalid))
            {
                content = LanguageManager.GetLang().St1307_FateBackSpaceFull;
                return(false);
            }

            if (sparenum > 0 && UserHelper.IsSpareGridNum(userInfo, sparenum))
            {
                content = LanguageManager.GetLang().St1213_GridNumFull;
                return(false);
            }

            List <PrizeInfo> prize = GetPrizeInfo(itemInfo);

            if (prize.Count == 0)
            {
                content = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }

            if (DoPrize(userInfo, prize))
            {
                UserItemHelper.UseUserItem(userInfo.UserID, useritem.ItemID, 1);
                result = true;
                return(true);
            }
            return(false);
        }
Exemplo n.º 24
0
        public override bool TakeAction()
        {
            UserHelper.ChechDailyRestrain(ContextUser.UserID);
            UserGeneral general = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, generalID);

            if (general == null)
            {
                return(false);
            }
            if (general.FeelLv >= GiftHelper.maxFeelLv)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1422_MaxFeelFull;
                return(false);
            }
            int     useGold         = ConfigEnvSet.GetInt("User.PresentationGold");
            int     feelNum         = ConfigEnvSet.GetInt("User.PresentationFeelNum");
            int     maxSatiationNum = ConfigEnvSet.GetInt("User.FeelMaxSatiationNum");
            decimal generalEffect   = ConfigEnvSet.GetDecimal("Gift.GeneralEffectNum");

            if (ops == 1)
            {
                var package  = UserItemPackage.Get(ContextUser.UserID);
                var useritem = package.ItemPackage.Find(m => m.UserItemID.Equals(userItemID));
                if (useritem == null)
                {
                    return(false);
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(useritem.ItemID);
                if (itemInfo != null)
                {
                    if (general.SaturationNum >= maxSatiationNum)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1422_FeelMaxSatiationNum;
                        return(false);
                    }
                    int giftEffect = itemInfo.EffectNum;
                    //佣兵喜欢类型的礼物,好感度加成
                    GeneralInfo generalInfo = new ConfigCacheSet <GeneralInfo>().FindKey(generalID);
                    if (generalInfo != null && itemInfo.GiftType == generalInfo.GiftType)
                    {
                        decimal sumGeneralEffect = MathUtils.Addition(generalEffect, 1, decimal.MaxValue);
                        giftEffect = MathUtils.RoundCustom(giftEffect * sumGeneralEffect).ToShort();
                    }
                    GiftHelper.GeneralFeelUpgrade(general, giftEffect, itemInfo.SatiationNum);
                    UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1);
                    ErrorCode = ops;
                    ErrorInfo = string.Format(LanguageManager.GetLang().St1422_PresentationFeelNum, giftEffect);
                }
            }
            else if (ops == 2)
            {
                int addNum = UseGoldZengSong(ContextUser.UserID);
                useGold   = MathUtils.Addition(useGold, addNum);
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1422_PresentationUseGold, useGold, feelNum);
                return(false);
            }
            else if (ops == 3)
            {
                if (GiftHelper.SurplusGoldNum(ContextUser.UserID) <= 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1422_PresentationGoldNum;
                    return(false);
                }
                UserDailyRestrain userDaily = new GameDataCacheSet <UserDailyRestrain>().FindKey(ContextUser.UserID);
                int addNum = UseGoldZengSong(ContextUser.UserID);
                useGold = MathUtils.Addition(useGold, addNum);
                if (ContextUser.GoldNum < useGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }

                if (userDaily != null)
                {
                    if (userDaily.UserExtend == null)
                    {
                        userDaily.UserExtend = new DailyUserExtend();
                    }
                    userDaily.UserExtend.UpdateNotify(obj =>
                    {
                        userDaily.UserExtend.GoldNum = MathUtils.Addition(userDaily.UserExtend.GoldNum, (short)1);
                        return(true);
                    });
                }
                int feelExp = general.FeelExperience;
                int upExp   = MathUtils.Addition(feelExp, feelNum);
                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold);
                GiftHelper.GeneralFeelUpgrade(general, feelNum, 0);
                //TraceLog.ReleaseWrite(string.Format("玩家{0}(通行证ID)的佣兵{1}(ID){2}使用晶石赠送增加好感度{3}。好感度从{4}上升到{5}。",
                //    ContextUser.Pid,
                //    ContextUser.UserID,
                //    ContextUser.NickName, feelNum,
                //    feelExp, upExp));
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1422_PresentationFeelNum, feelNum);
            }
            return(true);
        }
Exemplo n.º 25
0
        public override bool TakeAction()
        {
            Int16 potenceNum          = 0;
            Int16 thoughtNum          = 0;
            Int16 intelligenceNum     = 0;
            var   cacheSetUserGeneral = new GameDataCacheSet <UserGeneral>();
            var   cacheSetUserItem    = new GameDataCacheSet <UserItemPackage>();
            var   cacheSetBringUp     = new ConfigCacheSet <BringUpInfo>();

            if (_ops == 1)
            {
                var   attributeSetArray = ConfigEnvSet.GetString("UserBringUp.Set").Split(',');
                short multiple          = attributeSetArray[_multipleType.ToShort() - 1].ToShort();
                var   bringUpInfo       = cacheSetBringUp.FindKey(_bringUpType.ToInt());
                var   userItem          = cacheSetUserItem.FindKey(UserId.ToString());
                var   item = userItem != null && userItem.ItemPackage != null
                               ? userItem.ItemPackage.Find(s => s.ItemID == ConfigEnvSet.GetInt("User.DrugItemID"))
                               : null;

                var userGeneral = cacheSetUserGeneral.FindKey(UserId.ToString(), _generalId);
                if (_bringUpType == BringUpType.BaiJinPeiYang && ContextUser.VipLv < 3)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1217_NotBaiJin;
                    return(false);
                }
                if (_bringUpType == BringUpType.ZhiZunPeiYang && ContextUser.VipLv < 5)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1217_NotZhiZhun;
                    return(false);
                }
                if (userGeneral == null || bringUpInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().LoadDataError;
                    return(false);
                }
                if (userGeneral.Potential <= 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1217_NotPotential;
                    return(false);
                }

                if (bringUpInfo.UseUpType == 2 && ContextUser.GoldNum < (bringUpInfo.UseUpNum * multiple))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                if (bringUpInfo.UseUpType == 1 && (item == null || item.Num < (bringUpInfo.UseUpNum * multiple)))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1217_NotItem;
                    return(false);
                }
                var attributeChancePren = new int[3];
                var attributeChance     = bringUpInfo.AttributeChance;
                attributeChancePren[0] = attributeChance.PotenceNum * 10;
                attributeChancePren[1] = attributeChance.ThoughtNum * 10;
                attributeChancePren[2] = attributeChance.IntelligenceNum * 10;
                GetGeneralAttribute(attributeChancePren);

                foreach (var attributeIndex in _attributeIndexD)
                {
                    switch (attributeIndex.Value)
                    {
                    //力量
                    case 0:
                        var potenceValueArray = bringUpInfo.AttributeValueChance.PotenceValue.Split(',');
                        var potenceNumArray   = bringUpInfo.AttributeValueChance.PotenceNum.Split(',');
                        potenceNum = GetAttributeValue(potenceValueArray, potenceNumArray);
                        potenceNum = (potenceNum * multiple).ToShort();

                        break;

                    //魂力
                    case 1:
                        var thoughtValueArray = bringUpInfo.AttributeValueChance.ThoughtValue.Split(',');
                        var thoughtNumArray   = bringUpInfo.AttributeValueChance.ThoughtNum.Split(',');
                        thoughtNum = GetAttributeValue(thoughtValueArray, thoughtNumArray);
                        thoughtNum = (thoughtNum * multiple).ToShort();
                        break;

                    //智力
                    case 2:
                        var intelligenceValueArray = bringUpInfo.AttributeValueChance.IntelligenceValue.Split(',');
                        var intelligenceNumArray   = bringUpInfo.AttributeValueChance.IntelligenceNum.Split(',');
                        intelligenceNum = GetAttributeValue(intelligenceValueArray, intelligenceNumArray);
                        intelligenceNum = (intelligenceNum * multiple).ToShort();
                        break;
                    }
                }
                userGeneral.PotenceNum      = potenceNum;
                userGeneral.ThoughtNum      = thoughtNum;
                userGeneral.IntelligenceNum = intelligenceNum;
                _potenceNum      = userGeneral.PowerNum + potenceNum;
                _thoughtNum      = userGeneral.SoulNum + thoughtNum;
                _intelligenceNum = userGeneral.IntellectNum + intelligenceNum;
                if (userGeneral.Potential <= 0 || userGeneral.Potential < (userGeneral.PotenceNum + userGeneral.ThoughtNum + userGeneral.IntelligenceNum))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1217_NotPotential;
                    return(false);
                }
                switch (bringUpInfo.UseUpType)
                {
                case 1:
                    UserItemHelper.UseUserItem(ContextUser.UserID, item.ItemID, (bringUpInfo.UseUpNum * multiple));
                    break;

                case 2:
                    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, (bringUpInfo.UseUpNum * multiple));
                    break;
                }
                _potential = userGeneral.Potential;
            }
            else
            {
                if (_ops == 2)
                {
                    var userGeneral = cacheSetUserGeneral.FindKey(UserId.ToString(), _generalId);
                    if (userGeneral == null)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().LoadDataError;
                        return(false);
                    }
                    int attributeValue = userGeneral.PotenceNum + userGeneral.ThoughtNum + userGeneral.IntelligenceNum;
                    if (attributeValue > 0)
                    {
                        userGeneral.PowerNum     = MathUtils.Addition(userGeneral.PowerNum, userGeneral.PotenceNum);
                        userGeneral.SoulNum      = MathUtils.Addition(userGeneral.SoulNum, userGeneral.ThoughtNum);
                        userGeneral.IntellectNum = MathUtils.Addition(userGeneral.IntellectNum, userGeneral.IntelligenceNum);
                        userGeneral.Potential    = MathUtils.Subtraction(userGeneral.Potential, attributeValue);
                    }
                    else
                    {
                        userGeneral.Potential = MathUtils.Addition(userGeneral.Potential, -attributeValue);
                    }
                    userGeneral.PotenceNum      = 0;
                    userGeneral.ThoughtNum      = 0;
                    userGeneral.IntelligenceNum = 0;
                    _potential = userGeneral.Potential;
                }
            }

            return(true);
        }
Exemplo n.º 26
0
        public override bool TakeAction()
        {
            if (!UserHelper.IsOpenFunction(ContextUser.UserID, FunctionEnum.Trump))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_NoFun;
                return(false);
            }
            if (UserHelper.IsOpenFunction(ContextUser.UserID, FunctionEnum.TrumpPractice))
            {
                return(false);
            }
            if (!TrumpHelper.IsTrumpPractice(ContextUser.UserID))
            {
                return(false);
            }
            var       cacheTrump = new PersonalCacheStruct <UserTrump>();
            UserTrump userTrump  = cacheTrump.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);

            if (userTrump == null)
            {
                TrumpInfo trumpInfo = new ShareCacheStruct <TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, 1);
                if (trumpInfo == null)
                {
                    return(false);
                }
                StoryTaskInfo[] storyTaskArray = new ShareCacheStruct <StoryTaskInfo>().FindAll(m => m.TaskType == TaskType.Trump).ToArray();
                foreach (StoryTaskInfo taskInfo in storyTaskArray)
                {
                    UserItemHelper.UseUserItem(ContextUser.UserID, taskInfo.TargetItemID, taskInfo.TargetItemNum);
                }
                userTrump            = new UserTrump(ContextUser.UserID, TrumpInfo.CurrTrumpID);
                userTrump.TrumpLv    = 1;
                userTrump.WorshipLv  = 1;
                userTrump.LiftNum    = trumpInfo.MaxLift;
                userTrump.Experience = 0;
                userTrump.MatureNum  = trumpInfo.BeseMature;
                userTrump.Zodiac     = TrumpHelper.GetZodiacType(ZodiacType.NoZodiac);
                //userTrump.SkillInfo = new List<SkillInfo>();
                //userTrump.PropertyInfo = new List<GeneralProperty>();
                cacheTrump.Add(userTrump);
                cacheTrump.Update();
            }
            var          cacheSet     = new PersonalCacheStruct <UserFunction>();
            UserFunction userFunction = cacheSet.FindKey(ContextUser.UserID, FunctionEnum.TrumpPractice);

            if (userFunction == null)
            {
                UserFunction function = new UserFunction()
                {
                    FunEnum    = FunctionEnum.TrumpPractice,
                    UserID     = ContextUser.UserID,
                    CreateDate = DateTime.Now,
                };
                cacheSet.Add(function);
                cacheSet.Update();
            }
            var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);

            if (userTrump.LiftNum > 0 && usergeneral != null)
            {
                usergeneral.RefreshMaxLife();
            }
            return(true);
        }
Exemplo n.º 27
0
        public override bool TakeAction()
        {
            ItemBaseInfo itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(medicineID);

            if (itemInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            if (ops == 1)
            {
                ErrorCode = 1;
                ErrorInfo = string.Format(LanguageManager.GetLang().St11415_ClearMedicine, itemInfo.ItemName, itemInfo.MedicineLv, itemInfo.EffectNum);
                return(false);
            }

            UserGeneral general = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, generalID);

            if (general == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St10006_DoesNotExistTheGeneral;
                return(false);
            }
            var cacheSet = new PersonalCacheStruct <GeneralMedicine>();
            List <GeneralMedicine> generalMedicineArray = cacheSet.FindAll(ContextUser.UserID, g => g.MedicineID.Equals(medicineID) && g.GeneralID == generalID);

            generalMedicineArray.QuickSort((x, y) =>
            {
                if (x == null && y == null)
                {
                    return(0);
                }
                if (x != null && y == null)
                {
                    return(1);
                }
                if (x == null)
                {
                    return(-1);
                }
                return(x.BaseNum.CompareTo(y.BaseNum));
            });
            if (generalMedicineArray.Count <= 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
                return(false);
            }
            if (UserHelper.IsBeiBaoFull(ContextUser))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1415_GridNumNotEnough;
                return(false);
            }

            //UserItem[] userItemArray = UserItem.FindAll(UserItem.Index_UserID, u => (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu) && u.ItemID == itemID, ContextUser.UserID);
            var package = UserItemPackage.Get(Uid);
            List <UserItemInfo> userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemID == itemID);
            //药剂摘除道不足
            int Num = itemInfo.MedicineLv;

            if (userItemArray.Count <= 0 || UserItemMedicineNum(userItemArray) < Num)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
                return(false);
            }
            UserItemHelper.UseUserItem(ContextUser.UserID, itemID, Num);
            if (RandomUtils.GetRandom() <= itemInfo.EffectNum)
            {
                short propertyNum = MedicinePropertyNum(ContextUser.UserID, medicineID, generalID);
                switch (itemInfo.MedicineType)
                {
                case 1:
                    general.PowerNum = MathUtils.Subtraction(general.PowerNum, propertyNum);
                    break;

                case 2:
                    general.SoulNum = MathUtils.Subtraction(general.SoulNum, propertyNum);
                    break;

                case 3:
                    general.IntellectNum = MathUtils.Subtraction(general.IntellectNum, propertyNum);
                    break;

                default:
                    general.PowerNum = general.PowerNum;;
                    break;
                }
                //general.Update();
                cacheSet.Delete(generalMedicineArray[0]);
                ErrorCode = 2;
                UserItemHelper.AddUserItem(ContextUser.UserID, medicineID, 1);
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St11415_Clearfail;
                return(false);
            }

            return(true);
        }
Exemplo n.º 28
0
        public override bool TakeAction()
        {
            if (!TrumpHelper.IsLearnProperty(ContextUser))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1466_WorshipPropertyNotEnough;
                return(false);
            }
            UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);

            if (userTrump == null)
            {
                return(false);
            }
            UserItemInfo userItem = null;
            var          package  = UserItemPackage.Get(ContextUser.UserID);

            if (package != null)
            {
                userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID == userItemID);
                if (userItem == null || (userItem.ItemType != ItemType.DaoJu && userItem.PropType == 13))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1466_ItemPropertyNotEnough;
                    return(false);
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
                if (itemInfo != null)
                {
                    GeneralProperty property = null;
                    if (userTrump.PropertyInfo.Count > 0)
                    {
                        property = userTrump.PropertyInfo.Find(m => m.AbilityType == itemInfo.AbilityType);
                        if (property != null)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1466_ItemPropertyExite;
                            return(false);
                        }
                    }
                    else
                    {
                        userTrump.PropertyInfo.Clear();
                    }
                    short             baseLv        = 1;
                    TrumpPropertyInfo trumpProperty =
                        new ConfigCacheSet <TrumpPropertyInfo>().FindKey(itemInfo.AbilityType, baseLv);
                    if (trumpProperty != null)
                    {
                        property              = new GeneralProperty();
                        property.AbilityType  = itemInfo.AbilityType;
                        property.AbilityLv    = 1;
                        property.AbilityValue = trumpProperty.PropertyNum;
                        userTrump.PropertyInfo.Add(property);
                        TraceProperty(userTrump);
                        UserItemHelper.UseUserItem(ContextUser.UserID, userItem.ItemID, trumpProperty.ItemNum);

                        var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                        if (usergeneral != null)
                        {
                            usergeneral.RefreshMaxLife();
                        }

                        ErrorCode = 0;
                        ErrorInfo = LanguageManager.GetLang().St1466_LearningSuccess;
                    }
                }
            }

            return(true);
        }
Exemplo n.º 29
0
        public override bool TakeAction()
        {
            short        opType            = 0;
            UserItemInfo synthesisUserItem = null;
            var          package           = UserItemPackage.Get(Uid);
            UserItemInfo userItem          = null;

            if (!string.IsNullOrEmpty(_userItemID))
            {
                var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(_userItemID));
                foreach (var item in userItemList)
                {
                    if (item.ItemStatus == ItemStatus.Sell)
                    {
                        package.RemoveItem(userItem);
                        continue;
                    }
                    else if (item.SoldDate > MathUtils.SqlMinDate)
                    {
                        item.SoldDate = MathUtils.SqlMinDate;
                        //package.Update();
                        userItem = item;
                    }
                    else
                    {
                        userItem = item;
                    }
                }
                if (userItem == null)
                {
                    return(false);
                }
                ItemBaseInfo itemBaseOpType = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
                if (itemBaseOpType == null)
                {
                    return(false);
                }
                if (itemBaseOpType.ItemType == ItemType.TuZhi)
                {
                    opType = 1;
                }
                else
                {
                    opType = 2;
                }
            }
            else if (!string.IsNullOrEmpty(_userEquID))
            {
                opType   = 1;
                userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(_userEquID));
            }
            if (userItem == null)
            {
                return(false);
            }
            int genlv = ContextUser.UserLv;
            CacheList <SynthesisInfo> synthesisInfoList = new CacheList <SynthesisInfo>();
            short itemLv = 0;
            List <ItemSynthesisInfo> itemSynthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.SynthesisID == userItem.ItemID); //图纸ID

            if (itemSynthesisArray.Count > 0)
            {
                ItemSynthesisInfo synthesisInfo = itemSynthesisArray[0];
                if (synthesisInfo == null)
                {
                    return(false);
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesisInfo.ItemID);
                if (itemInfo != null && itemInfo.ItemType == ItemType.ZhuangBei && itemInfo.DemandLv > genlv)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                    return(false);
                }
                List <ItemSynthesisInfo> synthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.ItemID == synthesisInfo.ItemID);//合成物品的材料数组
                if (synthesisArray.Count == 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().LoadDataError;
                    return(false);
                }
                int useGold = GetSytnthesisGold(ContextUser.UserID, synthesisInfo.ItemID);
                if (_ops == 1)
                {
                    #region 普通合成
                    if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv < 4)
                    {
                        ErrorCode = 3;
                        ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough;
                        return(false);
                    }
                    if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv >= 4)
                    {
                        ErrorCode = 2;
                        ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough + "," + string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold);
                        return(false);
                    }
                    foreach (ItemSynthesisInfo synthesis in synthesisArray)
                    {
                        ItemBaseInfo itemsInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesis.SynthesisID);
                        if (itemInfo == null)
                        {
                            return(false);
                        }
                        if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID && itemsInfo != null && itemInfo.ItemType == ItemType.ZhuangBei)
                        {
                            if (userItem.ItemStatus == ItemStatus.YongBing)
                            {
                                //if (UserHelper.IsItemEquSpare(ContextUser, userItem.UserItemID))
                                //{
                                //    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                //    ErrorInfo = LanguageManager.GetLang().St_ItemEquIndexOfSpare;
                                //    return false;
                                //}
                                if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID))
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                                    return(false);
                                }
                                UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID);
                                synthesisInfoList.Add(new SynthesisInfo()
                                {
                                    DemandID = userItem.ItemID, Num = 1
                                });
                                //package.SyncCache(() =>
                                //{
                                //    userItem.IsRemove = true;
                                //    package.ItemPackage.Remove(userItem);
                                //    package.DelayChange();
                                //});
                            }
                        }
                        else
                        {
                            if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei)
                            {
                                synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID);
                                if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID))
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                                    return(false);
                                }
                                //synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID);
                            }
                            else
                            {
                                synthesisInfoList.Add(new SynthesisInfo()
                                {
                                    DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum
                                });
                                UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum);
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(_userEquID))
                    {
                        itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1);
                        UpdateUserItem(synthesisInfo.ItemID, userItem);
                        UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv);
                    }
                    else
                    {
                        if (synthesisUserItem != null)
                        {
                            itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1);
                            UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem);
                            UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv);
                        }
                        else
                        {
                            UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum);
                            UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv);
                        }
                    }
                    #endregion
                }
                else if (_ops == 2)
                {
                    #region 晶石合成
                    if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.JuanZouZhiJieWanCheng))
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
                        return(false);
                    }
                    ErrorCode = 1;
                    ErrorInfo = string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold);
                    return(false);

                    #endregion
                }
                else if (_ops == 3)
                {
                    #region 确认晶石合成
                    if (ContextUser.GoldNum < useGold)
                    {
                        ErrorCode = 1;
                        ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                        return(false);
                    }
                    //原因:配置材料不使用晶石合成时提示
                    string userItemName = UseritemGoldName(ContextUser.UserID, synthesisArray);
                    if (!string.IsNullOrEmpty(userItemName))
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = string.Format(LanguageManager.GetLang().St_ItemIsGold, userItemName);
                        return(false);
                    }

                    foreach (ItemSynthesisInfo synthesis in synthesisArray)
                    {
                        int          curNum    = 0;
                        ItemBaseInfo itemsInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesis.SynthesisID);
                        if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID)
                        {
                            if (userItem.ItemStatus == ItemStatus.YongBing)
                            {
                                if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID))
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                                    return(false);
                                }

                                UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID);
                                synthesisInfoList.Add(new SynthesisInfo()
                                {
                                    DemandID = userItem.ItemID, Num = 1
                                });
                            }
                        }
                        else
                        {
                            if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei)
                            {
                                synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID);
                                if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID))
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                                    return(false);
                                }
                            }
                            else
                            {
                                var itemArray = UserItemHelper.GetItems(Uid).FindAll(u => u.ItemID.Equals(synthesis.SynthesisID) && (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu));
                                if (itemArray.Count > 0)
                                {
                                    foreach (var item in itemArray)
                                    {
                                        curNum += item.Num;
                                    }
                                    if (synthesis.DemandNum < curNum)
                                    {
                                        UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum);
                                        synthesisInfoList.Add(new SynthesisInfo()
                                        {
                                            DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum
                                        });
                                    }
                                    else
                                    {
                                        UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, curNum);
                                        synthesisInfoList.Add(new SynthesisInfo()
                                        {
                                            DemandID = synthesis.SynthesisID, Num = curNum
                                        });
                                    }
                                }
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(_userEquID))
                    {
                        itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1);
                        UpdateUserItem(synthesisInfo.ItemID, userItem);
                        UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv);
                    }
                    else
                    {
                        if (synthesisUserItem != null)
                        {
                            itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1);
                            UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem);
                            UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv);
                        }
                        else
                        {
                            UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum);
                            UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv);
                        }
                    }

                    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue);
                    // ContextUser.Update();

                    #endregion
                }
            }
            return(true);
        }