| | |
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import PlayerRune
|
| | | import NPCCommon
|
| | | import ChConfig
|
| | | import ChItem
|
| | |
|
| | | import random
|
| | | import math
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
| | | if awardIpyData.GetRandItemList2() and awardIpyData.GetRandTimeList2() and randItemList2DoCount:
|
| | | if not __AddChestsRandAwardItem(curPlayer, chestsItemID, randItemList2DoCount, awardItemDict, awardIpyData.GetRandItemList2(), awardIpyData.GetRandTimeList2()):
|
| | | return
|
| | | |
| | | # 装备库
|
| | | if awardIpyData.GetPieRateDrop() or awardIpyData.GetIndepRateDrop():
|
| | | if not __AddChestsEquipItem(curPlayer, chestsItemID, useCount, awardItemDict, awardIpyData):
|
| | | return
|
| | |
|
| | | # 产出特殊物品广播
|
| | | needNotifyItemList = awardIpyData.GetNeedNotifyItemList()
|
| | |
| | | itemID = itemInfo[0] # 有配置物品ID,需判断该物品ID是否合法可开出等,支持配置空物品ID
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | GameWorld.ErrLog("宝箱奖励物品不存在! chestsItemID=%s,itemID=%s" % (chestsItemID, itemID))
|
| | | return False
|
| | |
|
| | | # 符印判断是否已经解锁
|
| | |
| | |
|
| | | return True
|
| | |
|
| | | def __AddChestsEquipItem(curPlayer, chestsItemID, useCount, awardItemDict, awardIpyData):
|
| | | ## 获取宝箱装备库产出
|
| | | |
| | | dropEquipInfoList = []
|
| | | itemJobList = [curPlayer.GetJob()] if awardIpyData.GetIsDropJobSelf() else IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1) # 掉落装备职业列表
|
| | | |
| | | # 饼图概率随机装备
|
| | | pieRateDoCnt = awardIpyData.GetPieRateDoCnt() * useCount
|
| | | pieRateDropList = awardIpyData.GetPieRateDrop() # 饼图概率掉落信息 [(概率,0),(概率,(阶,颜色)),...]
|
| | | for _ in xrange(pieRateDoCnt):
|
| | | dropInfo = GameWorld.GetResultByRandomList(pieRateDropList)
|
| | | if dropInfo:
|
| | | dropEquipInfoList.append(dropInfo)
|
| | | GameWorld.DebugLog("饼图装备掉落结果: pieRateDoCnt=%s, %s" % (pieRateDoCnt, dropEquipInfoList))
|
| | | |
| | | # 独立概率随机装备
|
| | | Def_NPCMaxDropRate = NPCCommon.Def_NPCMaxDropRate
|
| | | indepRateDict = awardIpyData.GetIndepRateDrop() # 独立概率掉落信息 {(阶,颜色):概率,...}
|
| | | for _ in xrange(useCount):
|
| | | for dropInfo, rate in indepRateDict.iteritems():
|
| | | dropRate = rate
|
| | | mustDropCount = dropRate / Def_NPCMaxDropRate
|
| | | dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
|
| | | GameWorld.DebugLog(" dropInfo=%s,rate=%s,mustDropCount=%s,dropRate=%s" % (dropInfo, rate, mustDropCount, dropRate))
|
| | | curDropCount = mustDropCount
|
| | | if GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
|
| | | curDropCount += 1
|
| | | if not curDropCount:
|
| | | continue
|
| | | |
| | | for _ in xrange(curDropCount):
|
| | | dropEquipInfoList.append(dropInfo)
|
| | | |
| | | GameWorld.DebugLog("装备库产出: dropEquipInfoList=%s" % dropEquipInfoList)
|
| | | |
| | | placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1)
|
| | | colorSuitRateDict = awardIpyData.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | colorSuitPlaceKeyInfoDict = awardIpyData.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | for classLV, color in dropEquipInfoList:
|
| | | isSuit = 0
|
| | | if color in colorSuitRateDict:
|
| | | suitRate = colorSuitRateDict[color]
|
| | | isSuit = GameWorld.CanHappen(suitRate, maxRate=Def_NPCMaxDropRate)
|
| | | colorSuitKey = (color, isSuit)
|
| | | if colorSuitKey not in colorSuitPlaceKeyInfoDict:
|
| | | GameWorld.ErrLog("未配置颜色套装对应部位集合key! chestsItemID=%s,color=%s,isSuit=%s" % (chestsItemID, color, isSuit))
|
| | | continue
|
| | | placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
|
| | | jobList = itemJobList
|
| | | if placeKey not in placeKeyListDict:
|
| | | GameWorld.ErrLog("部位集合key不存在!chestsItemID=%s,placeKey=%s" % (chestsItemID, placeKey))
|
| | | continue
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | randEquipIDList = NPCCommon.__GetEquipIDList(chestsItemID, classLV, color, isSuit, placeList, itemJobList, findType="ChestsItem")
|
| | | if not randEquipIDList:
|
| | | continue
|
| | | randItemID = random.choice(randEquipIDList)
|
| | | __AddAwardItem(awardItemDict, randItemID, 1)
|
| | | GameWorld.DebugLog("开出装备: chestsItemID=%s,itemID=%s,classLV=%s,color=%s,isSuit=%s,placeKey=%s,jobList=%s,randEquipIDList=%s" |
| | | % (chestsItemID, randItemID, classLV, color, isSuit, placeKey, jobList, randEquipIDList))
|
| | | |
| | | return True
|
| | |
|
| | | def __GetChestsJobItem(chestsItemID, job, itemID, jobItemList):
|
| | | ## 获取宝箱物品奖励对应的职业物品, 职业从1开始
|
| | | for jobItemIDList in jobItemList:
|