Example #1
0
 public override bool TakeAction()
 {
     userTrump = new GameDataCacheSet<UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
     if (userTrump != null)
     {
         worshipLv = userTrump.WorshipLv;
         growth = userTrump.MatureNum.ToString();
         trumpLv = userTrump.TrumpLv;
         matureType = TrumpHelper.GetEnumMatureType(userTrump.MatureNum).ToShort();
         TrumpInfo trumpInfo = new ConfigCacheSet<TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, userTrump.TrumpLv);
         if (trumpInfo != null && trumpInfo.Property.Count > 0)
         {
             currLiftNum = TrumpHelper.GetTrumpProperty(trumpInfo, AbilityType.ShengMing).ToInt();
             powerNum = TrumpHelper.GetTrumpProperty(trumpInfo, AbilityType.PowerNum);
             soulNum = TrumpHelper.GetTrumpProperty(trumpInfo, AbilityType.SoulNum);
             intelligenceNum = TrumpHelper.GetTrumpProperty(trumpInfo, AbilityType.IntelligenceNum);
             upLiftNum = (int)Math.Floor(currLiftNum * TrumpHelper.GetMatureNum(userTrump.MatureNum));
             upPower = (short)Math.Floor(powerNum * TrumpHelper.GetMatureNum(userTrump.MatureNum));
             upSoul = (short)Math.Floor(soulNum * TrumpHelper.GetMatureNum(userTrump.MatureNum));
             upIntelligence = (short)Math.Floor(intelligenceNum * TrumpHelper.GetMatureNum(userTrump.MatureNum));
         }
         totalNum = userTrump.PropertyInfo.Count;
         skcount = userTrump.SkillInfo.Count;
     }
     trumpInfoArray = new ConfigCacheSet<TrumpInfo>().FindAll(m => m.SkillID > 0 && m.TrumpID == TrumpInfo.CurrTrumpID).ToArray();
     worshipInfoInfoArray = new ConfigCacheSet<WorshipInfo>().FindAll(m => m.IsOpen && m.TrumpID == TrumpInfo.CurrTrumpID).ToArray();
     return true;
 }
Example #2
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 GameDataCacheSet<UserTrump>();
     UserTrump userTrump = cacheTrump.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
     if (userTrump == null)
     {
         TrumpInfo trumpInfo = new ConfigCacheSet<TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, 1);
         if (trumpInfo == null)
         {
             return false;
         }
         StoryTaskInfo[] storyTaskArray = new ConfigCacheSet<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 GameDataCacheSet<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;
 }
Example #3
0
        private void TraceProperty(UserTrump userTrump)
        {
            var worshipInfoInfoArray = new ConfigCacheSet<WorshipInfo>().FindAll(m => m.IsOpen && m.TrumpID == TrumpInfo.CurrTrumpID).ToArray();
            int index = 0;

            int worshipLv = userTrump.WorshipLv;
            string str = "";
            foreach (var item in worshipInfoInfoArray)
            {
                var generalProperty = GetPropertyType(ContextUser.UserID, index);
                str += string.Format("add propertyinfo userTrump-{0} is {1},worshipLv:{2} \r\n",
                    index,
                    generalProperty == null ? "false" : "true",
                    worshipLv >= item.WorshipLv ? (short)1 : (short)0);

                index++;
            }
            TraceLog.ReleaseWriteFatal(str);
        }