4717 【主干】【长尾】【BT】修行之路 领取符印奖励没有判断符印背包满
| | |
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | def CheckPackEnough(curPlayer, itemInfo, isNotify=True):
|
| | | ## 检查放入物品的背包空间是否足够
|
| | | # @param itemInfo: 支持 {itemID:itemCount, ...} or [[itemID, itemCount], ...]
|
| | | |
| | | if isinstance(itemInfo, dict):
|
| | | itemList = []
|
| | | for itemID, itemCount in itemInfo.items():
|
| | | itemList.append([itemID, itemCount])
|
| | | else:
|
| | | itemList = itemInfo
|
| | | |
| | | needPackSpaceDict = {}
|
| | | for item in itemList:
|
| | | itemID, itemCount = item[:2]
|
| | | isAuctionItem = item[2] if len(item) > 2 else 0
|
| | | |
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | packType = ChConfig.GetItemPackType(itemData.GetType())
|
| | | needSpace = ItemControler.GetItemNeedPackCount(packType, itemData, itemCount, isAuctionItem)
|
| | | needPackSpaceDict[packType] = needPackSpaceDict.get(packType, 0) + needSpace
|
| | | |
| | | #GameWorld.DebugLog("CheckPackEnough %s,needPackSpaceDict=%s" % (itemInfo, needPackSpaceDict))
|
| | | for packType, needSpace in needPackSpaceDict.items():
|
| | | if needSpace > GetItemPackSpace(curPlayer, packType, needSpace):
|
| | | if isNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packType])
|
| | | return False
|
| | | |
| | | return True
|
| | |
|
| | | ## 获得背包剩余空间(参数 -> 当前玩家,背包索引)
|
| | | # @param curPlayer 当前玩家
|
| | | # @param packindex 背包索引
|
| | |
| | |
|
| | | # 检查背包
|
| | | if isGiveItem:
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = len(itemDict)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | if not ItemCommon.CheckPackEnough(curPlayer, itemDict):
|
| | | return
|
| | | # packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | # needSpace = len(itemDict)
|
| | | # if needSpace > packSpace:
|
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | # return
|
| | |
|
| | | # 更新领奖记录
|
| | | if isPassport:
|