コード例 #1
0
ファイル: Action10007.cs プロジェクト: 0jpq0/Scut
        public override bool TakeAction()
        {
            int sumGold = 0;
            int userGold = ConfigEnvSet.GetInt("UserLand.UseGold");
            int intervalDate = ConfigEnvSet.GetInt("UserLand.IntervalDate");
            UserLand land = new GameDataCacheSet<UserLand>().FindKey(ContextUser.UserID, landPostion);
            if (land != null)
            {
                int subDate = (land.DoRefresh() / intervalDate);
                sumGold = (MathUtils.Addition(subDate, 1, int.MaxValue) * userGold);
            }
            if (Ops == 1)
            {
                this.ErrorCode = 1;
                this.ErrorInfo = string.Format(LanguageManager.GetLang().St10007_DoRefresh, sumGold);
                return false;
            }
            else if (Ops == 2)
            {
                if (ContextUser.GoldNum < sumGold)
                {
                    this.ErrorCode = 2;
                    this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }
                if (land != null && (DateTime.Now - land.GainDate).TotalSeconds < 28800)
                {
                    land.GainDate = MathUtils.SqlMinDate;
                    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue);
                }
            }

            return true;
        }
コード例 #2
0
ファイル: Action1608.cs プロジェクト: dongliang/Scut
        /// <summary>
        /// 双倍材料,月饼道具使用
        /// </summary>
        /// <param name="userItem"></param>
        /// <param name="itemInfo"></param>
        /// <returns></returns>
        private bool DoCaiLiaoYueBingItem(UserItemInfo userItem, ItemBaseInfo itemInfo)
        {
            UserProps props = new GameDataCacheSet <UserProps>().FindKey(ContextUser.UserID, userItem.ItemID);

            if (props != null)
            {
                if (userItem.ItemID == 5200 && props.DoRefresh() > 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1608_CombatPowerNotEnough;
                    return(false);
                }

                props.SurplusNum += itemInfo.EffectNum;
                props.ChangeTime  = DateTime.Now;
                //props.Update();
            }
            else
            {
                UserProps uProps = new UserProps(ContextUser.UserID, itemInfo.ItemID)
                {
                    SurplusNum = itemInfo.EffectNum,
                    ChangeTime = DateTime.Now
                };
                new GameDataCacheSet <UserProps>().Add(uProps, GameEnvironment.CacheUserPeriod);
            }
            return(true);
        }
コード例 #3
0
        public override bool TakeAction()
        {
            int            sumGold = 0;
            UserExpedition userExp = new GameDataCacheSet <UserExpedition>().FindKey(ContextUser.UserID);

            if (userExp == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            if (DateTime.Now.Date == userExp.InsertDate.Date)
            {
                sumGold = MathUtils.Addition(userExp.DoRefresh() / 60, 1, int.MaxValue);
            }

            if (ops == 1)
            {
                this.ErrorCode = 1;
                this.ErrorInfo = string.Format(LanguageManager.GetLang().St11003_DelCodeTime, sumGold);
                return(false);
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum < sumGold)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue);
                userExp.CodeTime    = 0;
            }
            return(true);
        }
コード例 #4
0
ファイル: Action11003.cs プロジェクト: rongxiong/Scut
        public override bool TakeAction()
        {
            int sumGold = 0;
            UserExpedition userExp = new GameDataCacheSet<UserExpedition>().FindKey(ContextUser.UserID);
            if (userExp == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }
            if (DateTime.Now.Date == userExp.InsertDate.Date)
            {
                sumGold = MathUtils.Addition(userExp.DoRefresh() / 60, 1, int.MaxValue);
            }

            if (ops == 1)
            {
                this.ErrorCode = 1;
                this.ErrorInfo = string.Format(LanguageManager.GetLang().St11003_DelCodeTime, sumGold);
                return false;
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum < sumGold)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }
                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue);
                userExp.CodeTime = 0;
            }
            return true;
        }
コード例 #5
0
ファイル: Action10007.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            int      sumGold      = 0;
            int      userGold     = ConfigEnvSet.GetInt("UserLand.UseGold");
            int      intervalDate = ConfigEnvSet.GetInt("UserLand.IntervalDate");
            UserLand land         = new GameDataCacheSet <UserLand>().FindKey(ContextUser.UserID, landPostion);

            if (land != null)
            {
                int subDate = (land.DoRefresh() / intervalDate);
                sumGold = (MathUtils.Addition(subDate, 1, int.MaxValue) * userGold);
            }
            if (Ops == 1)
            {
                this.ErrorCode = 1;
                this.ErrorInfo = string.Format(LanguageManager.GetLang().St10007_DoRefresh, sumGold);
                return(false);
            }
            else if (Ops == 2)
            {
                if (ContextUser.GoldNum < sumGold)
                {
                    this.ErrorCode = 2;
                    this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                if (land != null && (DateTime.Now - land.GainDate).TotalSeconds < 28800)
                {
                    land.GainDate       = MathUtils.SqlMinDate;
                    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold, int.MaxValue);
                }
            }

            return(true);
        }
コード例 #6
0
ファイル: Action11001.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            int question = 0;
            int index    = 0;

            answerID1 = 1;
            answerID2 = 2;
            int expID       = 0;
            int usegoldTime = GetExpCodeTime(ContextUser.UserID);

            useGold = MathUtils.Addition((usegoldTime / 60), 1, int.MaxValue);
            UserExpedition userExp = new GameDataCacheSet <UserExpedition>().FindKey(ContextUser.UserID);

            if (userExp != null && DateTime.Now.Date == userExp.InsertDate.Date)
            {
                if (userExp.ExpeditionNum >= 10)
                {
                    isEnd = 1;
                }
                else
                {
                    isEnd = 2;
                }
                question = MathUtils.Addition(userExp.ExpeditionNum, 1, int.MaxValue);
                expID    = userExp.ExpID;
                codeTime = userExp.DoRefresh();
            }
            else
            {
                isEnd    = 2;
                question = 1;
            }

            List <ExpeditionInfo> expeditionArray = new ConfigCacheSet <ExpeditionInfo>().FindAll(m => m.GroupID == question);

            if (expeditionArray.Count > 0)
            {
                if (IsAnswer(expeditionArray, expID))
                {
                    expInfo = new ConfigCacheSet <ExpeditionInfo>().FindKey(expID);
                }
                else
                {
                    index   = RandomUtils.GetRandom(0, expeditionArray.Count);
                    expInfo = new ConfigCacheSet <ExpeditionInfo>().FindKey(expeditionArray[index].ExpID);
                    if (userExp != null)
                    {
                        userExp.ExpID = expeditionArray[index].ExpID;
                    }
                }
            }
            return(true);
        }
コード例 #7
0
ファイル: Action1702.cs プロジェクト: zxx0367/Scut-samples
        private int GetPrice()
        {
            int       currGoldNum = 0;
            UserQueue queue       = new GameDataCacheSet <UserQueue>().FindKey(ContextUser.UserID, queueID);

            if (queue != null)
            {
                int queueColdTime = (queue.DoRefresh() / 60);
                currGoldNum = MathUtils.Addition(queueColdTime, 1, int.MaxValue);
            }
            return(currGoldNum);
        }
コード例 #8
0
ファイル: Action1702.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            //消除冷却以分钟为单位
            UserQueue queue = new GameDataCacheSet <UserQueue>().FindKey(ContextUser.UserID, queueID);

            if (queue == null)
            {
                return(false);
            }
            int queueColdTime = queue.DoRefresh();

            queueColdTime = queueColdTime < 0 ? 0 : queueColdTime;
            if (ops == 1)
            {
                //加速所需晶石
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1702_UseGold, GetPrice());
                return(false);
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum >= GetPrice())
                {
                    ErrorCode = ops;

                    if (ContextUser.GoldNum >= GetPrice())
                    {
                        ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GetPrice(), int.MaxValue);
                        //ContextUser.Update();
                        queue.ColdTime      = 0;
                        queue.TotalColdTime = 0;
                        //queue.Update();
                    }
                }
                else
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().UrlElement;
                return(false);
            }
            return(true);
        }
コード例 #9
0
ファイル: Action1702.cs プロジェクト: jinfei426/Scut
        public override bool TakeAction()
        {
            //消除冷却以分钟为单位
            UserQueue queue = new GameDataCacheSet<UserQueue>().FindKey(ContextUser.UserID, queueID);
            if (queue == null)
            {
                return false;
            }
            int queueColdTime = queue.DoRefresh();
            queueColdTime = queueColdTime < 0 ? 0 : queueColdTime;
            if (ops == 1)
            {
                //加速所需晶石
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1702_UseGold, GetPrice());
                return false;
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum >= GetPrice())
                {
                    ErrorCode = ops;

                    if (ContextUser.GoldNum >= GetPrice())
                    {
                        ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GetPrice(), int.MaxValue);
                        //ContextUser.Update();
                        queue.ColdTime = 0;
                        queue.TotalColdTime = 0;
                        //queue.Update();
                    }
                }
                else
                {

                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().UrlElement;
                return false;
            }
            return true;
        }
コード例 #10
0
        /// <summary>
        /// 队列剩余时间
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static int UserQueueCodeTime(string userID, RecruitType type)
        {
            QueueType queueType = QueueType.Nomal;

            if (type == RecruitType.ShiLiTiaoYi)
            {
                queueType = QueueType.ShiLiTiaoYi;
            }
            else if (type == RecruitType.BaiLiTiaoYi)
            {
                queueType = QueueType.BaiLiTiaoYi;
            }
            else if (type == RecruitType.Golden)
            {
                queueType = QueueType.Golden;
            }
            UserQueue userQueue = new GameDataCacheSet <UserQueue>().Find(userID, s => s.QueueType == queueType);

            if (userQueue != null)
            {
                return(userQueue.DoRefresh());
            }
            return(0);
        }
コード例 #11
0
        /// <summary>
        /// 是否有冷却时间
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="recruitRule"></param>
        /// <returns></returns>
        public static bool GeneralRecruitColdTime(string userID, RecruitType recruitType)
        {
            QueueType queueType = QueueType.ShiLiTiaoYi;

            if (recruitType == RecruitType.ShiLiTiaoYi)
            {
                queueType = QueueType.ShiLiTiaoYi;
            }
            else if (recruitType == RecruitType.BaiLiTiaoYi)
            {
                queueType = QueueType.BaiLiTiaoYi;
            }
            else if (recruitType == RecruitType.Golden)
            {
                queueType = QueueType.Golden;
            }
            UserQueue userQueue = new GameDataCacheSet <UserQueue>().Find(userID, s => s.QueueType == queueType);

            if (userQueue != null && userQueue.DoRefresh() > 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #12
0
ファイル: GeneralHelper.cs プロジェクト: jinfei426/Scut
 /// <summary>
 /// 是否有冷却时间
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="recruitRule"></param>
 /// <returns></returns>
 public static bool GeneralRecruitColdTime(string userID, RecruitType recruitType)
 {
     QueueType queueType = QueueType.ShiLiTiaoYi;
     if (recruitType == RecruitType.ShiLiTiaoYi)
     {
         queueType = QueueType.ShiLiTiaoYi;
     }
     else if (recruitType == RecruitType.BaiLiTiaoYi)
     {
         queueType = QueueType.BaiLiTiaoYi;
     }
     else if (recruitType == RecruitType.Golden)
     {
         queueType = QueueType.Golden;
     }
     UserQueue userQueue = new GameDataCacheSet<UserQueue>().Find(userID, s => s.QueueType == queueType);
     if (userQueue != null && userQueue.DoRefresh() > 0)
     {
         return true;
     }
     return false;
 }
コード例 #13
0
ファイル: Action1608.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 双倍材料,月饼道具使用
        /// </summary>
        /// <param name="userItem"></param>
        /// <param name="itemInfo"></param>
        /// <returns></returns>
        private bool DoCaiLiaoYueBingItem(UserItemInfo userItem, ItemBaseInfo itemInfo)
        {
            UserProps props = new GameDataCacheSet<UserProps>().FindKey(ContextUser.UserID, userItem.ItemID);
            if (props != null)
            {
                if (userItem.ItemID == 5200 && props.DoRefresh() > 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1608_CombatPowerNotEnough;
                    return false;
                }

                props.SurplusNum += itemInfo.EffectNum;
                props.ChangeTime = DateTime.Now;
                //props.Update();

            }
            else
            {
                UserProps uProps = new UserProps(ContextUser.UserID, itemInfo.ItemID)
                                       {
                                           SurplusNum = itemInfo.EffectNum,
                                           ChangeTime = DateTime.Now
                                       };
                new GameDataCacheSet<UserProps>().Add(uProps, GameEnvironment.CacheUserPeriod);
            }
            return true;
        }
コード例 #14
0
ファイル: GeneralHelper.cs プロジェクト: jinfei426/Scut
 /// <summary>
 /// 队列剩余时间
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static int UserQueueCodeTime(string userID, RecruitType type)
 {
     QueueType queueType = QueueType.Nomal;
     if (type == RecruitType.ShiLiTiaoYi)
     {
         queueType = QueueType.ShiLiTiaoYi;
     }
     else if (type == RecruitType.BaiLiTiaoYi)
     {
         queueType = QueueType.BaiLiTiaoYi;
     }
     else if (type == RecruitType.Golden)
     {
         queueType = QueueType.Golden;
     }
     UserQueue userQueue = new GameDataCacheSet<UserQueue>().Find(userID, s => s.QueueType == queueType);
     if (userQueue != null)
     {
         return userQueue.DoRefresh();
     }
     return 0;
 }
コード例 #15
0
ファイル: Action1702.cs プロジェクト: jinfei426/Scut
 private int GetPrice()
 {
     int currGoldNum = 0;
     UserQueue queue = new GameDataCacheSet<UserQueue>().FindKey(ContextUser.UserID, queueID);
     if (queue != null)
     {
         int queueColdTime = (queue.DoRefresh() / 60);
         currGoldNum = MathUtils.Addition(queueColdTime, 1, int.MaxValue);
     }
     return currGoldNum;
 }
コード例 #16
0
        public override bool TakeAction()
        {
            //List<UserQueue> queueArray = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.TianXianStrong);

            //if (queueArray.Count > 0)
            //{
            //    int codeDate = queueArray[0].DoRefresh();
            //    if (codeDate > 0)
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St11002_Colding;
            //        return false;
            //    }
            //}

            UserExpedition userExpedition = new GameDataCacheSet <UserExpedition>().FindKey(ContextUser.UserID);

            if (userExpedition != null && userExpedition.ExpeditionNum >= 10 && userExpedition.InsertDate.Date == DateTime.Now.Date)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St11002_ExpeditionFull;
                return(false);
            }

            if (userExpedition != null && userExpedition.DoRefresh() > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St11002_Colding;
                return(false);
            }

            int sumGold = MathUtils.Addition((GetExpCodeTime(ContextUser.UserID) / 60), 1);

            if (isRemove == 1)
            {
                if (ContextUser.GoldNum < sumGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                codeTime = 0;

                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold);
            }
            else if (isRemove == 2)
            {
                codeTime = GetExpCodeTime(ContextUser.UserID);

                //if (queueArray.Count > 0)
                //{
                //    queueArray[0].ColdTime = codeTime;
                //    queueArray[0].TotalColdTime = codeTime;
                //    queueArray[0].Timing = DateTime.Now;
                //    //queueArray[0].Update();
                //}
                //else
                //{
                //    UserQueue queue = new UserQueue()
                //    {
                //        QueueID = Guid.NewGuid().ToString(),
                //        QueueType = QueueType.TianXianStrong,
                //        QueueName = QueueType.TianXianStrong.ToString(),
                //        UserID = ContextUser.UserID,
                //        ColdTime = codeTime,
                //        IsSuspend = false,
                //        TotalColdTime = codeTime,
                //        Timing = DateTime.Now,
                //    };
                //    new GameDataCacheSet<UserQueue>().Add(queue, ContextUser.UserID.ToInt());
                //}
            }

            if (userExpedition == null)
            {
                userExpedition = new UserExpedition()
                {
                    UserID = ContextUser.UserID,
                };
                new GameDataCacheSet <UserExpedition>().Add(userExpedition, ContextUser.UserID.ToInt());
            }
            if (DateTime.Now.Date == userExpedition.InsertDate.Date)
            {
                userExpedition.ExpeditionNum = MathUtils.Addition(userExpedition.ExpeditionNum, 1, int.MaxValue);
            }
            else
            {
                userExpedition.ExpeditionNum = 1;
            }
            userExpedition.CodeTime   = codeTime;
            userExpedition.InsertDate = DateTime.Now;

            ExpeditionInfo expInfo = new ConfigCacheSet <ExpeditionInfo>().FindKey(questionID);

            if (expInfo != null)
            {
                if (answerID == 1)
                {
                    rewardShowArray = expInfo.RewardNum1.ToList();
                }
                else if (answerID == 2)
                {
                    rewardShowArray = expInfo.RewardNum2.ToList();
                }
                GuildMember member = new ShareCacheStruct <GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID);

                foreach (RewardShow show in rewardShowArray)
                {
                    if (show.RewardType == RewardType.Obtion)
                    {
                        if (member != null)
                        {
                            GuildMemberLog.AddLog(member.GuildID, new MemberLog()
                            {
                                UserID     = ContextUser.UserID,
                                LogType    = 1,
                                IdolID     = 0,
                                GainObtion = show.RewardNum,
                                GainAura   = 0,
                                Experience = show.RewardNum,
                                InsertDate = DateTime.Now
                            });
                            UserHelper.Contribution(ContextUser.UserID, show.RewardNum);
                        }
                        ContextUser.ObtainNum = MathUtils.Addition(ContextUser.ObtainNum, show.RewardNum, int.MaxValue);
                    }
                    else if (show.RewardType == RewardType.GameGoin)
                    {
                        ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, (show.RewardNum * ContextUser.UserLv), int.MaxValue);
                    }
                    else if (show.RewardType == RewardType.ExpNum)
                    {
                        ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, show.RewardNum, int.MaxValue);
                    }
                    else if (show.RewardType == RewardType.Experience)
                    {
                        UserHelper.UserGeneralExp(ContextUser.UserID, (show.RewardNum * ContextUser.UserLv));
                    }
                    else if (show.RewardType == RewardType.EnergyNum)
                    {
                        ContextUser.EnergyNum = MathUtils.Addition(ContextUser.EnergyNum, (short)show.RewardNum, short.MaxValue);
                    }
                    else if (show.RewardType == RewardType.Gold)
                    {
                        ContextUser.GiftGold = MathUtils.Addition(ContextUser.GiftGold, show.RewardNum, int.MaxValue);
                    }
                }
                string prizeContent = string.Empty;
                MysteryHelper.IsTriggerMyStery(ContextUser, MysteryType.Meiritanxian, out prizeContent);
                MysteryInfo mysteryInfo = new ConfigCacheSet <MysteryInfo>().FindKey(MysteryType.Meiritanxian);
                if (!string.IsNullOrEmpty(prizeContent) && mysteryInfo != null)
                {
                    string prompt           = string.Format(mysteryInfo.Prompt, prizeContent);
                    string broadContent     = string.Format(mysteryInfo.Broadcast, ContextUser.NickName, prizeContent);
                    var    broadcastService = new TjxBroadcastService(null);
                    var    msg = broadcastService.Create(NoticeType.System, broadContent);
                    broadcastService.Send(msg);
                    ErrorCode = 1;
                    ErrorInfo = prompt;
                }
            }
            return(true);
        }
コード例 #17
0
ファイル: Action11002.cs プロジェクト: kehaoran74/Scut
        public override bool TakeAction()
        {
            //List<UserQueue> queueArray = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.TianXianStrong);

            //if (queueArray.Count > 0)
            //{
            //    int codeDate = queueArray[0].DoRefresh();
            //    if (codeDate > 0)
            //    {
            //        ErrorCode = LanguageManager.GetLang().ErrorCode;
            //        ErrorInfo = LanguageManager.GetLang().St11002_Colding;
            //        return false;
            //    }
            //}

            UserExpedition userExpedition = new GameDataCacheSet<UserExpedition>().FindKey(ContextUser.UserID);
            if (userExpedition != null && userExpedition.ExpeditionNum >= 10 && userExpedition.InsertDate.Date == DateTime.Now.Date)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St11002_ExpeditionFull;
                return false;
            }

            if (userExpedition != null && userExpedition.DoRefresh() > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St11002_Colding;
                return false;
            }

            int sumGold = MathUtils.Addition((GetExpCodeTime(ContextUser.UserID) / 60), 1);
            if (isRemove == 1)
            {
                if (ContextUser.GoldNum < sumGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }
                codeTime = 0;

                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, sumGold);
            }
            else if (isRemove == 2)
            {
                codeTime = GetExpCodeTime(ContextUser.UserID);

                //if (queueArray.Count > 0)
                //{
                //    queueArray[0].ColdTime = codeTime;
                //    queueArray[0].TotalColdTime = codeTime;
                //    queueArray[0].Timing = DateTime.Now;
                //    //queueArray[0].Update();
                //}
                //else
                //{
                //    UserQueue queue = new UserQueue()
                //    {
                //        QueueID = Guid.NewGuid().ToString(),
                //        QueueType = QueueType.TianXianStrong,
                //        QueueName = QueueType.TianXianStrong.ToString(),
                //        UserID = ContextUser.UserID,
                //        ColdTime = codeTime,
                //        IsSuspend = false,
                //        TotalColdTime = codeTime,
                //        Timing = DateTime.Now,
                //    };
                //    new GameDataCacheSet<UserQueue>().Add(queue, ContextUser.UserID.ToInt());
                //}
            }

            if (userExpedition == null)
            {
                userExpedition = new UserExpedition()
                 {
                     UserID = ContextUser.UserID,
                 };
                new GameDataCacheSet<UserExpedition>().Add(userExpedition, ContextUser.UserID.ToInt());
            }
            if (DateTime.Now.Date == userExpedition.InsertDate.Date)
            {
                userExpedition.ExpeditionNum = MathUtils.Addition(userExpedition.ExpeditionNum, 1, int.MaxValue);
            }
            else
            {
                userExpedition.ExpeditionNum = 1;
            }
            userExpedition.CodeTime = codeTime;
            userExpedition.InsertDate = DateTime.Now;

            ExpeditionInfo expInfo = new ConfigCacheSet<ExpeditionInfo>().FindKey(questionID);
            if (expInfo != null)
            {
                if (answerID == 1)
                {
                    rewardShowArray = expInfo.RewardNum1.ToList();
                }
                else if (answerID == 2)
                {
                    rewardShowArray = expInfo.RewardNum2.ToList();
                }
                GuildMember member = new ShareCacheStruct<GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID);

                foreach (RewardShow show in rewardShowArray)
                {
                    if (show.RewardType == RewardType.Obtion)
                    {
                        if (member != null)
                        {
                            GuildMemberLog.AddLog(member.GuildID, new MemberLog()
                                                                      {
                                                                          UserID = ContextUser.UserID,
                                                                          LogType = 1,
                                                                          IdolID = 0,
                                                                          GainObtion = show.RewardNum,
                                                                          GainAura = 0,
                                                                          Experience = show.RewardNum,
                                                                          InsertDate = DateTime.Now
                                                                      });
                            UserHelper.Contribution(ContextUser.UserID, show.RewardNum);
                        }
                        ContextUser.ObtainNum = MathUtils.Addition(ContextUser.ObtainNum, show.RewardNum, int.MaxValue);
                    }
                    else if (show.RewardType == RewardType.GameGoin)
                    {
                        ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, (show.RewardNum * ContextUser.UserLv), int.MaxValue);
                    }
                    else if (show.RewardType == RewardType.ExpNum)
                    {
                        ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, show.RewardNum, int.MaxValue);
                    }
                    else if (show.RewardType == RewardType.Experience)
                    {
                        UserHelper.UserGeneralExp(ContextUser.UserID, (show.RewardNum * ContextUser.UserLv));
                    }
                    else if (show.RewardType == RewardType.EnergyNum)
                    {
                        ContextUser.EnergyNum = MathUtils.Addition(ContextUser.EnergyNum, (short)show.RewardNum, short.MaxValue);
                    }
                    else if (show.RewardType == RewardType.Gold)
                    {
                        ContextUser.GiftGold = MathUtils.Addition(ContextUser.GiftGold, show.RewardNum, int.MaxValue);
                    }
                }
                string prizeContent = string.Empty;
                MysteryHelper.IsTriggerMyStery(ContextUser, MysteryType.Meiritanxian, out prizeContent);
                MysteryInfo mysteryInfo = new ConfigCacheSet<MysteryInfo>().FindKey(MysteryType.Meiritanxian);
                if (!string.IsNullOrEmpty(prizeContent) && mysteryInfo != null)
                {
                    string prompt = string.Format(mysteryInfo.Prompt, prizeContent);
                    string broadContent = string.Format(mysteryInfo.Broadcast, ContextUser.NickName, prizeContent);
                    var broadcastService = new TjxBroadcastService(null);
                    var msg = broadcastService.Create(NoticeType.System, broadContent);
                    broadcastService.Send(msg);
                    ErrorCode = 1;
                    ErrorInfo = prompt;
                }
            }
            return true;
        }
コード例 #18
0
ファイル: Action11001.cs プロジェクト: rongxiong/Scut
        public override bool TakeAction()
        {
            int question = 0;
            int index = 0;
            answerID1 = 1;
            answerID2 = 2;
            int expID = 0;
            int usegoldTime = GetExpCodeTime(ContextUser.UserID);
            useGold = MathUtils.Addition((usegoldTime / 60), 1, int.MaxValue);
            UserExpedition userExp = new GameDataCacheSet<UserExpedition>().FindKey(ContextUser.UserID);

            if (userExp != null && DateTime.Now.Date == userExp.InsertDate.Date)
            {
                if (userExp.ExpeditionNum >= 10)
                {
                    isEnd = 1;
                }
                else
                {
                    isEnd = 2;
                }
                question = MathUtils.Addition(userExp.ExpeditionNum, 1, int.MaxValue);
                expID = userExp.ExpID;
                codeTime = userExp.DoRefresh();
            }
            else
            {
                isEnd = 2;
                question = 1;
            }

            List<ExpeditionInfo> expeditionArray = new ConfigCacheSet<ExpeditionInfo>().FindAll(m => m.GroupID == question);
            if (expeditionArray.Count > 0)
            {
                if (IsAnswer(expeditionArray, expID))
                {
                    expInfo = new ConfigCacheSet<ExpeditionInfo>().FindKey(expID);
                }
                else
                {
                    index = RandomUtils.GetRandom(0, expeditionArray.Count);
                    expInfo = new ConfigCacheSet<ExpeditionInfo>().FindKey(expeditionArray[index].ExpID);
                    if (userExp != null)
                    {
                        userExp.ExpID = expeditionArray[index].ExpID;
                    }
                }
            }
            return true;
        }