private void Process(string userID, int fun) { FunctionEnum funEnum = fun.ToEnum<FunctionEnum>(); var cacheSet = new PersonalCacheStruct<UserFunction>(); UserFunction userFunction = cacheSet.FindKey(UserID, funEnum); if (userFunction == null) { userFunction = new UserFunction() { UserID = userID, FunEnum = funEnum, CreateDate = DateTime.Now }; cacheSet.Add(userFunction); } }
private void Process(string userID, int fun) { FunctionEnum funEnum = fun.ToEnum<FunctionEnum>(); var cacheSet = new GameDataCacheSet<UserFunction>(); UserFunction userFunction = cacheSet.FindKey(UserID, funEnum); if (userFunction == null) { userFunction = new UserFunction() { UserID = userID, FunEnum = funEnum, CreateDate = DateTime.Now }; cacheSet.Add(userFunction, GameEnvironment.CacheUserPeriod); } }
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; }
private void EnableFunction() { string[] funList = ConfigEnvSet.GetString("User.DefaultFunction").Split(new[] { ',' }); var cacheSet = new PersonalCacheStruct<UserFunction>(); foreach (string fun in funList) { if (fun.TrimEnd().Length > 0) { UserFunction userFun = new UserFunction(); userFun.UserID = UserId.ToString(); userFun.FunEnum = fun.ToEnum<FunctionEnum>(); userFun.CreateDate = DateTime.Now; cacheSet.Add(userFun); cacheSet.Update(); } } }
/// <summary> /// 开启功能[未完成] /// </summary> /// <param name="user"></param> /// <param name="functionEnum"></param> public static void EnableFunction(GameUser user, FunctionEnum functionEnum) { if (functionEnum <= 0) { return; } var cacheSet = new GameDataCacheSet<UserFunction>(); UserFunction uf = cacheSet.FindKey(user.UserID, functionEnum); if (uf == null) { uf = new UserFunction { UserID = user.UserID, FunEnum = functionEnum, CreateDate = DateTime.Now }; cacheSet.Add(uf); uf = cacheSet.FindKey(user.UserID, functionEnum); } switch (functionEnum) { //case FunctionEnum.Qianghuaqueue: // user.QueueNum = 2; // user.Update(); // break; case FunctionEnum.Qianghua: user.QueueNum = (short)new GameUser().QueueMinNum; //user.Update(); break; case FunctionEnum.Shengmishangdian: UserHelper.RefrshShopsSparData(user, false); break; case FunctionEnum.Mofazheng: InitMagicEmbattle(user.UserID, user.UserLv); break; case FunctionEnum.Zhongzhijiyangshu: GetUserLand(user.UserID); break; case FunctionEnum.Zhongzhijingqianshu: GoinUserQueue(user.UserID); break; case FunctionEnum.Enchant: EnchantHelper.EnchantFunctionOpen(user); break; case FunctionEnum.ReplaceGeneral: GeneralHelper.OpenReplaceGeneral(user); break; default: break; } }
/// <summary> /// 玩家荣誉值升级 /// </summary> /// <param name="user"></param> /// <param name="honourNum"></param> public static void AddUserLv(GameUser user, int honourNum) { short generalMaxLv = GameConfigSet.CurrMaxLv.ToShort(); if (user.UserLv >= generalMaxLv) { CheckFun(user); return; } short rankLv = user.UserLv; user.HonourNum = MathUtils.Addition(user.HonourNum, honourNum); short nextLv = MathUtils.Addition(user.UserLv, 1.ToShort()); while (nextLv <= generalMaxLv) { GeneralEscalateInfo generalEscalate = new ShareCacheStruct<GeneralEscalateInfo>().FindKey(nextLv, GeneralType.YongHu); if (generalEscalate != null && user.HonourNum >= generalEscalate.UpExperience) { user.UserLv = nextLv; user.IsLv = true; UserHelper.OpenMagic(user.UserID, user.UserLv); user.HonourNum = MathUtils.Subtraction(user.HonourNum, generalEscalate.UpExperience); if (generalEscalate.FunctionEnum != null && generalEscalate.FunctionEnum != "") { var feArray = generalEscalate.FunctionEnum.Split(','); foreach (var fun in feArray) { var userFun = _cacheSetUserFun.FindKey(user.UserID, fun); if (userFun == null) { userFun = new UserFunction(); userFun.UserID = user.UserID; userFun.FunEnum = fun.ToEnum<FunctionEnum>(); userFun.CreateDate = DateTime.Now; _cacheSetUserFun.Add(userFun); _cacheSetUserFun.Update(); user.OpenFun.Add(userFun); } } } FestivalHelper.GetUpgradeGiveGift(user.UserID, nextLv); nextLv = MathUtils.Addition(user.UserLv, 1.ToShort()); } else { break; } } if (user.UserLv > rankLv) { Ranking<UserRank> ranking = RankingFactory.Get<UserRank>(CombatRanking.RankingKey); UserRank rankInfo; int rankID; if (ranking.TryGetRankNo(m => m.UserID == user.UserID, out rankID)) { rankInfo = ranking.Find(s => s.UserID == user.UserID); if (rankInfo != null) { rankInfo.UserLv = user.UserLv; rankInfo.TotalCombatNum = user.CombatNum; rankInfo.ObtainNum = user.ObtainNum; } } } CheckFun(user); }
public static void CheckFun(GameUser user) { var generalEscalate = new ShareCacheStruct<GeneralEscalateInfo>().FindAll(s => s.GeneralLv <= user.UserLv && s.GeneralType == GeneralType.YongHu && s.FunctionEnum != "0" && s.FunctionEnum != ""); foreach (var generalEscalateInfo in generalEscalate) { var feArray = generalEscalateInfo.FunctionEnum.Split(','); foreach (var fun in feArray) { var userFun = _cacheSetUserFun.FindKey(user.UserID, fun); if (userFun == null) { userFun = new UserFunction(); userFun.UserID = user.UserID; userFun.FunEnum = fun.ToEnum<FunctionEnum>(); userFun.CreateDate = DateTime.Now; _cacheSetUserFun.Add(userFun); _cacheSetUserFun.Update(); } } } }
/// <summary> /// 开启多人副本活动 /// </summary> /// <param name="userID"></param> public static void GetFunctionEnum(string userID) { var cacheSet = new PersonalCacheStruct<UserFunction>(); UserFunction function = cacheSet.FindKey(userID, FunctionEnum.MorePlotCoin); if (function == null) { function = new UserFunction { UserID = userID, FunEnum = FunctionEnum.MorePlotCoin, CreateDate = DateTime.Now }; cacheSet.Add(function); } function = cacheSet.FindKey(userID, FunctionEnum.MorePlotEnergy); if (function == null) { function = new UserFunction { UserID = userID, FunEnum = FunctionEnum.MorePlotEnergy, CreateDate = DateTime.Now }; cacheSet.Add(function); } }
/// <summary> /// 开启多人副本活动 /// </summary> /// <param name="userID"></param> public static void GetFunctionEnum(string userID) { var cacheSet = new GameDataCacheSet<UserFunction>(); UserFunction function = cacheSet.FindKey(userID, FunctionEnum.MorePlotCoin); if (function == null) { function = new UserFunction { UserID = userID, FunEnum = FunctionEnum.MorePlotCoin, CreateDate = DateTime.Now }; cacheSet.Add(function, GameEnvironment.CacheUserPeriod); } function = cacheSet.FindKey(userID, FunctionEnum.MorePlotEnergy); if (function == null) { function = new UserFunction { UserID = userID, FunEnum = FunctionEnum.MorePlotEnergy, CreateDate = DateTime.Now }; cacheSet.Add(function, GameEnvironment.CacheUserPeriod); } }
private void EnableFunction() { string[] funList = ConfigEnvSet.GetString("User.DefaultFunction").Split(new[] { ',' }); var cacheSet = new GameDataCacheSet<UserFunction>(); foreach (string fun in funList) { if (fun.TrimEnd().Length > 0) { UserFunction userFun = new UserFunction(); userFun.UserID = Uid; userFun.FunEnum = fun.ToEnum<FunctionEnum>(); userFun.CreateDate = DateTime.Now; cacheSet.Add(userFun, GameEnvironment.CacheUserPeriod); cacheSet.Update(); } } }