7140 【后端】【2.0】新增智能部位保底掉落规则
| | |
| | | dict EquipColorMaxDropCount; //装备颜色最大掉落物品数 {颜色:上限数量,...}
|
| | | dict EquipColorSuitInfo; //装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | dict EquipPartKeyRateInfo; //装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | BYTE ColorSuitPartOptimization; //部位颜色套评分优选掉落,十位代表颜色,个位代表套装
|
| | | dict KillCountDropEquipPub; //第x次击杀附加必掉装备 {次数:[阶,颜色,是否套装,部位集合key], ...}
|
| | | dict ItemIDDropRate; //指定物品ID掉率信息 {物品ID:概率, ...}
|
| | | dict ItemIDMaxDropCount; //指定物品ID最大掉落个数,没配默认1次 {物品ID:随机次数,...}
|
| | |
| | | ("dict", "EquipColorMaxDropCount", 0),
|
| | | ("dict", "EquipColorSuitInfo", 0),
|
| | | ("dict", "EquipPartKeyRateInfo", 0),
|
| | | ("BYTE", "ColorSuitPartOptimization", 0),
|
| | | ("dict", "KillCountDropEquipPub", 0),
|
| | | ("dict", "ItemIDDropRate", 0),
|
| | | ("dict", "ItemIDMaxDropCount", 0),
|
| | |
| | | self.EquipColorMaxDropCount = {}
|
| | | self.EquipColorSuitInfo = {}
|
| | | self.EquipPartKeyRateInfo = {}
|
| | | self.ColorSuitPartOptimization = 0
|
| | | self.KillCountDropEquipPub = {}
|
| | | self.ItemIDDropRate = {}
|
| | | self.ItemIDMaxDropCount = {}
|
| | |
| | | def GetEquipColorMaxDropCount(self): return self.EquipColorMaxDropCount # 装备颜色最大掉落物品数 {颜色:上限数量,...}
|
| | | def GetEquipColorSuitInfo(self): return self.EquipColorSuitInfo # 装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | def GetEquipPartKeyRateInfo(self): return self.EquipPartKeyRateInfo # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | def GetColorSuitPartOptimization(self): return self.ColorSuitPartOptimization # 部位颜色套评分优选掉落,十位代表颜色,个位代表套装
|
| | | def GetKillCountDropEquipPub(self): return self.KillCountDropEquipPub # 第x次击杀附加必掉装备 {次数:[阶,颜色,是否套装,部位集合key], ...}
|
| | | def GetItemIDDropRate(self): return self.ItemIDDropRate # 指定物品ID掉率信息 {物品ID:概率, ...}
|
| | | def GetItemIDMaxDropCount(self): return self.ItemIDMaxDropCount # 指定物品ID最大掉落个数,没配默认1次 {物品ID:随机次数,...}
|
| | |
| | | colorMaxDropCntDict = ipyDrop.GetEquipColorMaxDropCount() # {颜色:上限数量,...}
|
| | | colorSuitRateDict = ipyDrop.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | colorSuitPartOptimization = ipyDrop.GetColorSuitPartOptimization() # 部位颜色套评分优选掉落,十位代表颜色,个位代表套装
|
| | | optColor, optIsSuit = colorSuitPartOptimization / 10, colorSuitPartOptimization % 10
|
| | | optPlace = None # 优选部位
|
| | | |
| | | for dropEquipInfo in dropEquipInfoList:
|
| | | classLV, color = dropEquipInfo[:2]
|
| | | if color in colorMaxDropCntDict:
|
| | |
| | | GameWorld.ErrLog("未配置颜色是否套装对应部位集合key! npcID=%s,color=%s,isSuit=%s" % (npcID, color, isSuit))
|
| | | continue
|
| | | placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
|
| | | # 掉落优选部位处理
|
| | | if color == optColor and isSuit == optIsSuit and placeKey in placeKeyListDict and optPlace == None:
|
| | | optPlace = __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, placeKeyListDict[placeKey])
|
| | | jobList = itemJobList
|
| | | if placeKey not in placeKeyListDict:
|
| | | GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey))
|
| | | continue
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | if optPlace > 0:
|
| | | GameWorld.DebugLog(" 最终优选部位: %s" % optPlace)
|
| | | placeList = [optPlace]
|
| | | jobList = [dropPlayer.GetJob()]
|
| | | optPlace = 0 # 只有一次性的,置为0
|
| | | else:
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, jobList)
|
| | | if not randEquipIDList:
|
| | | continue
|
| | |
| | | GameWorld.ErrLog("Boss没有掉落物品,NPCID=%s" % (npcID), dropPlayer.GetPlayerID())
|
| | | return dropIDList, auctionIDList, dropMoneyCnt, moneyValue
|
| | |
|
| | | def __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, optPlaceList):
|
| | | ''' 获取掉落优选部位
|
| | | 几个默认规则
|
| | | 1. 颜色大于指定优选颜色的,无论是否套装都不计算在内
|
| | | 2. 颜色小于指定优选颜色的,无论是否套装都计算在内
|
| | | '''
|
| | | #GameWorld.DebugLog("处理优选部位掉落: classLV=%s,optColor=%s,optIsSuit=%s,optPlaceList=%s" % (classLV, optColor, optIsSuit, optPlaceList))
|
| | | minGSPlace = None
|
| | | minGS = None
|
| | | equipPack = dropPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for optPlace in optPlaceList:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, optPlace)
|
| | | if not ipyData:
|
| | | continue
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | curEquip = equipPack.GetAt(equipIndex)
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | #GameWorld.DebugLog(" 没穿装备,直接默认返回该部位: optPlace=%s" % optPlace)
|
| | | return optPlace
|
| | | curColor = curEquip.GetItemColor()
|
| | | curIsSuit = 1 if curEquip.GetSuiteID() else 0
|
| | | if curColor > optColor:
|
| | | # 超过优选指定颜色的不算,无论是否有套装
|
| | | #GameWorld.DebugLog(" 颜色超过优选颜色,不算该部位: optPlace=%s,curColor=%s,curIsSuit=%s" % (optPlace, curColor, curIsSuit))
|
| | | continue
|
| | | if curColor == optColor and curIsSuit >= optIsSuit:
|
| | | # 与优选指定颜色相同,且满足是否套装的不算
|
| | | #GameWorld.DebugLog(" 颜色套装满足优选,不算该部位: optPlace=%s,curColor=%s,curIsSuit=%s" % (optPlace, curColor, curIsSuit))
|
| | | continue
|
| | | curGS = ItemCommon.GetEquipGearScore(curEquip)
|
| | | if minGS == None or curGS < minGS:
|
| | | minGS = curGS
|
| | | minGSPlace = optPlace
|
| | | |
| | | return minGSPlace
|
| | |
|
| | | def __GetNPCDropDoCountChange(doCount, doCountRate, doCountAdd):
|
| | | ## 获取掉落执行次数变更结果,可能增加 或 减少
|
| | | if doCountRate != ChConfig.Def_MaxRateValue:
|