コード例 #1
0
ファイル: Action5106.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            UserDailyRestrain dailyRestrain = new GameDataCacheSet <UserDailyRestrain>().FindKey(ContextUser.UserID);

            if (RankingHelper.IsGainSportsReward(ContextUser.UserID) && dailyRestrain != null && dailyRestrain.UserExtend != null)
            {
                var envSet = ServerEnvSet.Get(ServerEnvKey.JingJiChangReward, "");
                SportsRewardInfo sportsInfo = new ConfigCacheSet <SportsRewardInfo>().FindKey(dailyRestrain.UserExtend.UserRankID);
                { if (envSet != null && sportsInfo != null)
                  {
                      if (envSet.ToDateTime().Date > dailyRestrain.Funtion11.Date && dailyRestrain.UserExtend.UserRankID > 0)
                      {
                          dailyRestrain.Funtion11             = DateTime.Now;
                          dailyRestrain.UserExtend.UserRankID = 0;
                          //dailyRestrain.Update();

                          ContextUser.ObtainNum = MathUtils.Addition(ContextUser.ObtainNum, sportsInfo.RewardObtian, int.MaxValue);
                          ContextUser.GameCoin  = MathUtils.Addition(ContextUser.GameCoin, sportsInfo.RewardGoin, int.MaxValue);
                          //ContextUser.Update();
                          UserHelper.Contribution(ContextUser.UserID, sportsInfo.RewardObtian);
                          ErrorInfo = string.Format(LanguageManager.GetLang().St5106_JingJiChangRankReward, sportsInfo.RewardObtian, sportsInfo.RewardGoin);
                      }
                  }
                }
            }
            return(true);
        }
コード例 #2
0
ファイル: Action1012.cs プロジェクト: xushenghan/Scut-samples
        public override bool TakeAction()
        {
            UserFunction userFunction = new PersonalCacheStruct <UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Xiulian);

            if (userFunction != null)
            {
                UserHelper.XiuLianGianExperience(ContextUser.UserID); //修炼完成后更改修炼状态

                int inerDate = (int)(DateTime.Now - ContextUser.OnlineDate).TotalSeconds;
                if (inerDate > 300 && ContextUser.UserStatus != UserStatus.XiuLian)
                {
                    int totalTime = 0;
                    GeneralPracticeInfo generalpractice = new ShareCacheStruct <GeneralPracticeInfo>().FindKey(ContextUser.UserLv);
                    if (VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.XiuLianYanChangErShiSiXiaoShi))
                    {
                        totalTime = ConfigEnvSet.GetInt("User.XiuLianDate");
                    }
                    else
                    {
                        if (generalpractice != null)
                        {
                            totalTime = (generalpractice.MaxHour * 60 * 60);
                        }
                    }

                    if (inerDate > 300 && ContextUser.UserStatus != UserStatus.XiuLian && ContextUser.UserStatus != UserStatus.FightCombat)
                    {
                        ContextUser.UserStatus = UserStatus.XiuLian;
                        //ContextUser.Update();

                        List <UserQueue> userQueueArray = new PersonalCacheStruct <UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.XiuLian);
                        if (userQueueArray.Count > 0)
                        {
                            UserQueue userQueue = userQueueArray[0];
                            userQueue.TotalColdTime = totalTime;
                            userQueue.ColdTime      = totalTime;
                            userQueue.Timing        = DateTime.Now;
                            userQueue.IsSuspend     = false;
                            userQueue.StrengNum     = 0;
                            //userQueue.Update();
                        }
                        _statusList.Add(MessageState.XiuLian);
                    }
                }
            }

            UserDailyRestrain dailyRestrain = new PersonalCacheStruct <UserDailyRestrain>().FindKey(ContextUser.UserID);

            if (new TjxChatService(ContextUser).HasMessage(ContextUser.ChatVesion))
            {
                _statusList.Add(MessageState.Chat);
            }

            if (NoviceHelper.CheckOnlinePrize(Uid))
            {
                _statusList.Add(MessageState.TakeOnline);
            }

            if (NoviceHelper.CheckLoginPrize(Uid))
            {
                _statusList.Add(MessageState.TakeLogin);
            }
            if (new TjxBroadcastService(ContextUser).HasMessage())
            {
                _statusList.Add(MessageState.Broadcast);
            }

            if (NoviceHelper.CheckDailyExpPrize(Uid))
            {
                _statusList.Add(MessageState.TakeDailyExp);
            }

            if (RankingHelper.IsGainSportsReward(ContextUser.UserID))
            {
                _statusList.Add(MessageState.JingJiChangReward);
            }

            UserFunction countryFunction = new PersonalCacheStruct <UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Country);

            if (countryFunction != null && dailyRestrain != null && dailyRestrain.Funtion8 < VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.LingQuFengLu))
            {
                _statusList.Add(MessageState.LingQuFengLv);
            }

            if (NoviceHelper.DailyEnergy(ContextUser.UserID))
            {
                _statusList.Add(MessageState.SurplusEnergy);
            }
            if (new GameActiveCenter(Uid).HasActive())
            {
                _statusList.Add(MessageState.Huodong);
            }
            if (NoviceHelper.IsAugustSecondWeekEnergy(ContextUser))
            {
                _statusList.Add(MessageState.FestivalEnergy);
            }
            if (NoviceHelper.IsWingFestivalInfo(ContextUser.UserID))
            {
                _statusList.Add(MessageState.Wing);
            }

            if (GuildFightBroadcast(ContextUser.UserID, stakecount, ContextUser.MercenariesID))
            {
                _statusList.Add(MessageState.GuildFight);
            }
            else
            {
                stakecount = 0;
            }

            var userPrizeList = new ShareCacheStruct <UserTakePrize>().FindAll(m => !m.IsTasked && m.UserID == Uid.ToInt());

            if (userPrizeList.Count > 0)
            {
                _statusList.Add(MessageState.TaskPrize);
            }
            return(true);
        }