/// <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); }
public override bool TakeAction() { List <UserTakePrize> userPrizeList = new ShareCacheStruct <UserTakePrize>().FindAll(m => !m.IsTasked && m.UserID == ObjectExtend.ToInt(Uid)); if (userPrizeList.Count > 0) { var userPrize = userPrizeList[0]; if (userPrize.ItemPackage.Length > 0) { if (UserItemHelper.CheckItemOut(ContextUser, ItemStatus.BeiBao, PutItemNum(userPrize))) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1107_GridNumFull; return(false); } } if (userPrize.SparePackage.Length > 0) { int currNum = ContextUser.SparePartList.FindAll(m => string.IsNullOrEmpty(m.UserItemID)).Count; currNum = MathUtils.Addition(currNum, PutCrystalSpareNum(userPrize.SparePackage.Split(','), 1)); //原因:零件等于开启格子时提示背包已满 if (currNum > ContextUser.UserExtend.SparePartGridNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1213_GridNumFull; return(false); } } if (userPrize.CrystalPackage.Length > 0) { var package = UserCrystalPackage.Get(ContextUser.UserID); UserCrystalInfo[] crystalArrayErr = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0)).ToArray(); int crystalNum = MathUtils.Addition(crystalArrayErr.Length, PutCrystalSpareNum(userPrize.CrystalPackage.Split(','), 2)); //原因:命运水晶等于开启格子时提示背包已满 if (crystalNum > ContextUser.CrystalNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1307_FateBackpackFull; return(false); } } if (!string.IsNullOrEmpty(userPrize.EnchantPackage) && userPrize.EnchantPackage.Length > 0) { var package = UserEnchant.Get(ContextUser.UserID); if (package != null) { var enchantList = package.EnchantPackage.FindAll(m => string.IsNullOrEmpty(m.UserItemID)); int enchantNum = MathUtils.Addition(enchantList.Count, PutCrystalSpareNum(userPrize.EnchantPackage.Split(','), 2)); if (ContextUser.UserExtend != null && enchantNum > ContextUser.UserExtend.EnchantGridNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1259_EnchantGridNumFull; return(false); } } } if (doProcessPrize(userPrize)) { ErrorInfo = userPrize.MailContent; } else { ErrorCode = LanguageManager.GetLang().ErrorCode; return(false); } } return(true); }