Beispiel #1
0
        public override bool TakeAction()
        {
            var          package  = UserItemPackage.Get(Uid);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));

            if (userItem == null)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough;
                return(false);
            }
            if (ops == 1)
            {
                var ckUserItemArray = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.CangKu);
                if (ckUserItemArray.Count >= ContextUser.WarehouseNum)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St1107_WarehouseNumFull;
                    return(false);
                }
                UserItemHelper.MergerUserItem(ContextUser.UserID, userItemID, ItemStatus.CangKu);
            }
            else if (ops == 2)
            {
                var bbUserItemArray = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);
                if (bbUserItemArray.Count >= ContextUser.GridNum)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St1107_GridNumFull;
                    return(false);
                }
                UserItemHelper.MergerUserItem(ContextUser.UserID, userItemID, ItemStatus.BeiBao);
            }
            return(true);
        }