| | |
| | | awardInfo = GetChestsAwardInfo(curPlayer, chestsItemID, useCnt, exData)
|
| | | if not awardInfo:
|
| | | return
|
| | | needSpaceDict, jobAwardItemDict, moneyType, moneyCount, notifyItemList = awardInfo
|
| | | GameWorld.DebugLog(" needSpaceDict=%s,jobAwardItemDict=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s" |
| | | % (needSpaceDict, jobAwardItemDict, moneyType, moneyCount, notifyItemList))
|
| | | needSpaceDict, jobAwardItemDict, moneyType, moneyCount, notifyItemList, updOpenCount = awardInfo
|
| | | GameWorld.DebugLog(" needSpaceDict=%s,jobAwardItemDict=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s,updOpenCount=%s" |
| | | % (needSpaceDict, jobAwardItemDict, moneyType, moneyCount, notifyItemList, updOpenCount))
|
| | |
|
| | | for packType, needSpace in needSpaceDict.items():
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace)
|
| | |
| | | if costGoldTotal:
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:chestsItemID}
|
| | | PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGoldTotal, ChConfig.Def_Cost_UseItem, infoDict)
|
| | | |
| | | # 更新开启次数
|
| | | if updOpenCount:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChestsOpenCount % chestsItemID, updOpenCount)
|
| | | GameWorld.DebugLog(" 更新宝箱开启次数: %s" % updOpenCount)
|
| | |
|
| | | saveDataDict = {"AwardItem":jobAwardItemDict}
|
| | | ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, ChConfig.ItemDel_Chests, saveDataDict)
|
| | |
| | | if not __AddChestsRandAwardItem(curPlayer, chestsItemID, useCount, awardItemDict, awardIpyData.GetRandItemList1(), awardIpyData.GetRandTimeList1()):
|
| | | return
|
| | |
|
| | | # 根据宝箱开启次数特殊产出
|
| | | updOpenCount = 0
|
| | | randItemList2DoCount = useCount
|
| | | randItemByUseCountDict = awardIpyData.GetRandItemByUseCount()
|
| | | if randItemByUseCountDict:
|
| | | maxOpenCount = max(randItemByUseCountDict)
|
| | | hisOpenCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChestsOpenCount % chestsItemID)
|
| | | if hisOpenCount < maxOpenCount:
|
| | | updOpenCount = min(hisOpenCount + useCount, maxOpenCount)
|
| | | for specUseCount, randItemList in randItemByUseCountDict.items():
|
| | | if not (hisOpenCount < specUseCount <= updOpenCount):
|
| | | GameWorld.DebugLog(" 不满足特殊次数产出: hisOpenCount=%s,specUseCount=%s,updOpenCount=%s" |
| | | % (hisOpenCount, specUseCount, updOpenCount))
|
| | | continue
|
| | | randItemList2DoCount -= 1
|
| | | randItemInfo = GameWorld.GetResultByRandomList(randItemList)
|
| | | GameWorld.DebugLog(" 根据开启次数特殊产出: specUseCount=%s, %s, randItemList2DoCount=%s" |
| | | % (specUseCount, randItemInfo, randItemList2DoCount))
|
| | | if not randItemInfo:
|
| | | continue
|
| | | if len(randItemInfo) != 2:
|
| | | GameWorld.ErrLog("宝箱开启次数特殊产出随机库配置错误!chestsItemID=%s" % chestsItemID)
|
| | | return
|
| | | itemID, itemCount = randItemInfo
|
| | | if not itemID:
|
| | | continue
|
| | | __AddAwardItem(awardItemDict, itemID, itemCount)
|
| | | |
| | | if randItemList2DoCount != useCount:
|
| | | GameWorld.DebugLog(" 随机物品库2执行次数: %s" % (randItemList2DoCount))
|
| | | |
| | | # 随机物品库2
|
| | | if awardIpyData.GetRandItemList2() and awardIpyData.GetRandTimeList2():
|
| | | if not __AddChestsRandAwardItem(curPlayer, chestsItemID, useCount, awardItemDict, awardIpyData.GetRandItemList2(), awardIpyData.GetRandTimeList2()):
|
| | | if awardIpyData.GetRandItemList2() and awardIpyData.GetRandTimeList2() and randItemList2DoCount:
|
| | | if not __AddChestsRandAwardItem(curPlayer, chestsItemID, randItemList2DoCount, awardItemDict, awardIpyData.GetRandItemList2(), awardIpyData.GetRandTimeList2()):
|
| | | return
|
| | |
|
| | | # 产出特殊物品广播
|
| | |
| | | if itemID in needNotifyItemList or jobItemID in needNotifyItemList:
|
| | | notifyItemList.append(jobItemID)
|
| | |
|
| | | return needSpaceDict, jobAwardItemDict, awardIpyData.GetMoneyType(), awardIpyData.GetMoneyCount() * useCount, notifyItemList
|
| | | return needSpaceDict, jobAwardItemDict, awardIpyData.GetMoneyType(), awardIpyData.GetMoneyCount() * useCount, notifyItemList, updOpenCount
|
| | |
|
| | | def __GetMaxRandTime(randTimeList):
|
| | | if len(randTimeList) == 1 and type(randTimeList[0]) == int:
|