| | |
| | | GameWorld.DebugLog("需要激活本体的武将未激活不可选择!itemID=%s" % itemID)
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("重选心愿库对应ID汇总: %s" % selectLibItemDict)
|
| | | hisOutDict = {} # 历史选择已产出过的心愿物品记录 {wishID:outCnt, ...}
|
| | | for libIDStr, wishCnt in wishLibSelect.items():
|
| | | libID = int(libIDStr)
|
| | | selectLibWishIDList = selectLibItemDict.get(libID, [])
|
| | | if len(selectLibWishIDList) != wishCnt:
|
| | | if selectLibWishIDList and len(selectLibWishIDList) != wishCnt:
|
| | | GameWorld.DebugLog("选择心愿库的物品数量与设定的心愿物品数量不一致!libID=%s,wishCnt=%s,selectCnt=%s,%s"
|
| | | % (libID, wishCnt, len(selectLibWishIDList), selectLibWishIDList))
|
| | | return
|
| | |
| | | GameWorld.DebugLogEx("已经产出过的心愿物品不可从选择中去除! outCnt=%s,wishID=%s not in %s", outCnt, wishID, selectLibWishIDList)
|
| | | return
|
| | | hisOutDict[wishID] = outCnt
|
| | | GameWorld.DebugLog("历史已产出心愿ID次数: %s" % hisOutDict)
|
| | |
|
| | | # 验证通过,保存
|
| | | for libID, wishIDList in selectLibItemDict.items():
|
| | | for wishIndex, wishID in enumerate(wishIDList):
|
| | | for libIDStr, wishCnt in wishLibSelect.items():
|
| | | libID = int(libIDStr)
|
| | | wishIDList = selectLibItemDict.get(libID, [])
|
| | | for wishIndex in range(wishCnt):
|
| | | wishID = wishIDList[wishIndex] if len(wishIDList) > wishIndex else 0
|
| | | outCnt = hisOutDict.get(wishID, 0)
|
| | | SetWishInfo(curPlayer, treasureType, libID, wishIndex, wishID, outCnt)
|
| | | GameWorld.DebugLog("保存心愿选择: libID=%s,wishIndex=%s,wishID=%s,outCnt=%s" % (libID, wishIndex, wishID, outCnt))
|
| | |
| | | gridLibInfoDict = ipyData.GetGridLibInfo() # 格子编号对应库ID {"编号":物品库ID, ...}
|
| | |
|
| | | # 心愿
|
| | | wishSelectState = False # 心愿物品是否已选择
|
| | | canOutWishDict = {} # 还可产出的心愿物品 {libID:{wishID:[wishIndex, canOut], ...}, ...}
|
| | | wishOutputRule = setIpyData.GetWishOutput() # 心愿产出规则:心愿产出完毕后: 0 - 可继续产出该库物品; 1 - 不可再产出该库物品
|
| | | wishLibSelect = setIpyData.GetWishLibSelect()
|
| | | for libIDStr, selectCnt in wishLibSelect.items():
|
| | | libID = int(libIDStr)
|
| | | if libID not in canOutWishDict:
|
| | | canOutWishDict[libID] = {}
|
| | | for wishIndex in range(selectCnt):
|
| | | wishID, outCnt = GetWishInfo(curPlayer, treasureType, libID, wishIndex)
|
| | | if not wishID:
|
| | | continue
|
| | | wishSelectState = True
|
| | | libItemIpyData = IpyGameDataPY.GetIpyGameDataByCondition("TreasureItemLib", {"ID":wishID}, False)
|
| | | if not libItemIpyData:
|
| | | continue
|
| | |
| | | if not outCntLimit:
|
| | | # 非心愿物品
|
| | | continue
|
| | | if libID not in canOutWishDict:
|
| | | canOutWishDict[libID] = {}
|
| | | if outCnt >= outCntLimit:
|
| | | # 该心愿物品产出次数已用完
|
| | | continue
|
| | | libWishCanOutDict = canOutWishDict[libID]
|
| | | canOut = outCntLimit - outCnt
|
| | | libWishCanOutDict[wishID] = [wishIndex, canOut]
|
| | | if canOutWishDict:
|
| | | if not wishSelectState:
|
| | | if wishLibSelect:
|
| | | if not canOutWishDict:
|
| | | GameWorld.DebugLog("心愿物品还未选择!", playerID)
|
| | | else:
|
| | | GameWorld.DebugLog("还可产出的心愿库对应WishID还可产出次数: %s" % canOutWishDict, playerID)
|
| | | GameWorld.DebugLog("已选的还可产出的心愿库对应WishID还可产出次数: %s" % canOutWishDict, playerID)
|
| | |
|
| | | # 单抽产出优先级: 幸运物品 > 必出 > 保底 > 普通
|
| | | # 连抽没有优先级限制,只要满足条件即可产出
|