/// <summary> /// 奖励物品时是否背包已满 /// </summary> /// <param name="user"></param> /// <param name="prizeContent"></param> /// <returns></returns> public static bool IsPrizeItemName(GameUser user, out string prizeContent) { prizeContent = string.Empty; if (!CrystalHelper.CheckAllowCrystall(user)) { prizeContent = LanguageManager.GetLang().St1305_FateBackpackFull; return(false); } if (UserItemHelper.CheckItemOut(user, ItemStatus.BeiBao)) { prizeContent = LanguageManager.GetLang().St1606_GridNumNotEnough; return(false); } if (UserHelper.IsSpareGridNum(user, 0)) { prizeContent = LanguageManager.GetLang().St1213_GridNumFull; return(false); } if (EnchantHelper.IsEnchantPackage(user.UserID)) { prizeContent = LanguageManager.GetLang().St1259_EnchantGridNumFull; return(false); } return(true); }
/// <summary> /// 奖励配置 /// </summary> /// <param name="user"></param> public static void ChestGetUserTake(TreasureInfo prize, GameUser user) { switch (prize.Type) { case RewardType.GameGoin: user.GameCoin = MathUtils.Addition(user.GameCoin, prize.Num.ToInt()); break; case RewardType.Obtion: user.ObtainNum = MathUtils.Addition(user.ObtainNum, prize.Num.ToInt()); break; case RewardType.ExpNum: user.ExpNum = MathUtils.Addition(user.ExpNum, prize.Num.ToInt()); break; case RewardType.EnergyNum: user.EnergyNum = MathUtils.Addition(user.EnergyNum, prize.Num.ToShort()); break; case RewardType.Experience: break; case RewardType.Gold: user.GiftGold = MathUtils.Addition(user.GiftGold, prize.Num.ToInt()); break; case RewardType.Item: if (!UserAbilityHelper.UseUserItem(user.UserID, prize.ItemID)) { UserItemHelper.AddUserItem(user.UserID, prize.ItemID, prize.Num.ToInt()); } break; case RewardType.CrystalId: short crystalLv = prize.ItemLv > 0 ? prize.ItemLv : 1.ToShort(); CrystalHelper.AppendCrystal(user.UserID, prize.ItemID, crystalLv); break; case RewardType.Spare: AppendSpare(user, prize.ItemID); break; case RewardType.Enchant: short enchantLv = prize.ItemLv > 0 ? prize.ItemLv : 1.ToShort(); EnchantHelper.AppendEnchat(user.UserID, prize.ItemID, enchantLv); break; default: break; } }
/// <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; } }