Example #1
0
 public override bool TakeAction()
 {
     var package = UserItemPackage.Get(ContextUser.UserID);
     UserItemInfo useritem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));
     if (useritem != null)
     {
         ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(useritem.ItemID);
         if (itemInfo != null && itemInfo.DemandLv > ContextUser.VipLv)
         {
             ErrorCode = LanguageManager.GetLang().ErrorCode;
             ErrorInfo = LanguageManager.GetLang().St_VipNotEnough;
             return false;
         }
     }
     ItemUseHelper itemuse = new ItemUseHelper();
     itemuse.UseItem(userItemID, Uid);
     if (itemuse.result && itemuse.content != string.Empty)
     {
         ErrorCode = 0;
     }
     if (!itemuse.result)
     {
         ErrorCode = LanguageManager.GetLang().ErrorCode;
     }
     ErrorInfo = itemuse.content.Trim(',');
     return true;
 }
Example #2
0
        public override bool TakeAction()
        {
            ItemUseHelper itemuse = new ItemUseHelper();
            itemuse.UseItem(userItemID, Uid);
            if (itemuse.result && itemuse.content != string.Empty)
            {
                content = itemuse.content.Trim(',');
            }
            if (!itemuse.result)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = itemuse.content;
                return false;
            }

            // 使用还可以继续使用该礼包
            int itemid = UserItemHelper.GetUserItemInfoID(ContextUser.UserID, userItemID);
            bool hasGift = UserItemHelper.IsEnoughBeiBaoItem(ContextUser.UserID, itemid, 1);
            if (hasGift)
            {
                hasNextGift = 1;
            }
            return true;
        }