| | |
| | | awardInfo = GetChestsAwardInfo(curPlayer, chestsItemID, useCnt, exData)
|
| | | if not awardInfo:
|
| | | return
|
| | | 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))
|
| | | needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount = awardInfo
|
| | | GameWorld.DebugLog(" needSpaceDict=%s,jobAwardItemList=%s,moneyType=%s,moneyCount=%s,notifyItemList=%s,updOpenCount=%s" |
| | | % (needSpaceDict, jobAwardItemList, moneyType, moneyCount, notifyItemList, updOpenCount))
|
| | |
|
| | | for packType, needSpace in needSpaceDict.items():
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChestsOpenCount % chestsItemID, updOpenCount)
|
| | | GameWorld.DebugLog(" 更新宝箱开启次数: %s" % updOpenCount)
|
| | |
|
| | | saveDataDict = {"AwardItem":jobAwardItemDict}
|
| | | saveDataDict = {"AwardItem":jobAwardItemList}
|
| | | ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, ChConfig.ItemDel_Chests, saveDataDict)
|
| | |
|
| | | # 给奖励
|
| | | syncItemList = []
|
| | | for itemID, itemCount in jobAwardItemDict.items():
|
| | | for itemID, itemCount in jobAwardItemList:
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isBind)
|
| | | if not curItem:
|
| | | GameWorld.ErrLog("宝箱创建奖励物品异常!chestsItemID=%s,useCnt=%s,itemID=%s,itemCount=%s,isBind=%s"
|
| | |
| | | def GetChestsAwardInfo(curPlayer, chestsItemID, useCount, exData=0):
|
| | | '''获取宝箱开启奖励
|
| | | @return: None - 获取宝箱奖励失败
|
| | | @return: needSpaceDict, jobAwardItemDict{itemID:itemCount, ...}
|
| | | @return: needSpaceDict, jobAwardItemList [[itemID, itemCount], ...]
|
| | | '''
|
| | |
|
| | | awardIpyData = __GetChestsAwardIpyDataByLV(curPlayer, chestsItemID)
|
| | |
| | |
|
| | | needSpaceDict = {} # {packType:needSpace, ...}
|
| | | notifyItemList = []
|
| | | jobAwardItemDict = {}
|
| | | jobAwardItemList = []
|
| | | for itemID, itemCount in awardItemDict.items():
|
| | | jobItemID = __GetChestsJobItem(chestsItemID, job, itemID, jobItemList)
|
| | | if not jobItemID:
|
| | |
| | | needSpace = int(math.ceil(itemCount / float(itemData.GetPackCount())))
|
| | | needSpaceDict[packType] = needSpaceDict.get(packType, 0) + needSpace
|
| | |
|
| | | jobAwardItemDict[jobItemID] = itemCount
|
| | | # 装备拆开给,需要同步每件装备的属性
|
| | | if ItemCommon.GetIsEquip(itemData):
|
| | | jobAwardItemList.extend([[jobItemID, 1]] * itemCount)
|
| | | else:
|
| | | jobAwardItemList.append([jobItemID, itemCount])
|
| | | if itemID in needNotifyItemList or jobItemID in needNotifyItemList:
|
| | | notifyItemList.append(jobItemID)
|
| | |
|
| | | return needSpaceDict, jobAwardItemDict, awardIpyData.GetMoneyType(), awardIpyData.GetMoneyCount() * useCount, notifyItemList, updOpenCount
|
| | | return needSpaceDict, jobAwardItemList, awardIpyData.GetMoneyType(), awardIpyData.GetMoneyCount() * useCount, notifyItemList, updOpenCount
|
| | |
|
| | | def __GetMaxRandTime(randTimeList):
|
| | | if len(randTimeList) == 1 and type(randTimeList[0]) == int:
|