From 243dd6333418b5b9260a9809a857286fe4423f20 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 05 七月 2019 11:46:19 +0800 Subject: [PATCH] 7843 【后端】【主干】掉落、宝箱装备部位集合优化 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 39 insertions(+), 10 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py index 0ad6b8a..9117541 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py @@ -793,7 +793,6 @@ dropEquipInfoList.append([classLV, color, dropCount]) GameWorld.DebugLog(" 装备掉落结果: killCount=%s,[阶,颜色,件数]=%s" % (killCount, dropEquipInfoList), playerID) - placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1) colorSuitRateDict = ipyDrop.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...} colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...} dropEquipIDDict = {} @@ -813,10 +812,10 @@ GameWorld.ErrLog("未配置颜色是否套装对应部位集合key! npcID=%s,color=%s,isSuit=%s" % (npcID, color, isSuit)) continue placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey] - if placeKey not in placeKeyListDict: + placeList = GetEquipPlaceByPlaceKey(placeKey) + if not placeList: GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey)) continue - placeList = placeKeyListDict[placeKey] randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, itemJobList) if not randEquipIDList: continue @@ -1023,7 +1022,6 @@ gradeColorSuitRateDict = fbGradeColorSuitRateDict[npcID] curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade) - placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1) colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...} colorMaxDropCntDict = ipyDrop.GetEquipColorMaxDropCount() # {颜色:上限数量,...} colorSuitRateDict = ipyDrop.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...} @@ -1060,19 +1058,22 @@ 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]) + if color == optColor and isSuit == optIsSuit and optPlace == None: + allEquipPlaceList = GetAllEquipPlaceByPlaceKey(placeKey) + #GameWorld.DebugLog(" 所有可优选部位: %s" % allEquipPlaceList) + if allEquipPlaceList: + optPlace = __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, allEquipPlaceList) jobList = itemJobList - if placeKey not in placeKeyListDict: - GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey)) - continue if optPlace > 0: GameWorld.DebugLog(" 最终优选部位: %s" % optPlace) placeList = [optPlace] jobList = [dropPlayer.GetJob()] optPlace = 0 # 只有一次性的,置为0 else: - placeList = placeKeyListDict[placeKey] + placeList = GetEquipPlaceByPlaceKey(placeKey) + if not placeList: + GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey)) + continue randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, jobList) if not randEquipIDList: continue @@ -1142,6 +1143,34 @@ GameWorld.ErrLog("Boss没有掉落物品,NPCID=%s" % (npcID), dropPlayer.GetPlayerID()) return dropIDList, auctionIDList, dropMoneyCnt, moneyValue +def GetAllEquipPlaceByPlaceKey(placeKey): + placeKeyRateListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 2) # {集合数字key1:[[概率1,部位1],...],...} + if placeKey in placeKeyRateListDict: + return [rateInfo[1] for rateInfo in placeKeyRateListDict[placeKey]] + placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1) # {集合数字key1:[部位1,部位2,...],...} + if placeKey in placeKeyListDict: + return placeKeyListDict[placeKey] + return [] + +def GetEquipPlaceByPlaceKey(placeKey): + ## 获取装备位集合对应的部位信息,集合ID重复时,优先饼图 + placeList = [] + placeKeyRateListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 2) # {集合数字key1:[[概率1,部位1],...],...} + if placeKey in placeKeyRateListDict: + placeRateList = placeKeyRateListDict[placeKey] + place = GameWorld.GetResultByRandomList(placeRateList) + if place: + placeList = [place] + #GameWorld.DebugLog(" 掉落部位概率集合: placeKey=%s,placeRateList=%s,place=%s,placeList=%s" % (placeKey, placeRateList, place, placeList)) + + if not placeList: + placeKeyListDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1) # {集合数字key1:[部位1,部位2,...],...} + if placeKey in placeKeyListDict: + placeList = placeKeyListDict[placeKey] + #GameWorld.DebugLog(" 掉落部位均衡集合: placeKey=%s,placeList=%s" % (placeKey, placeList)) + + return placeList + def __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, optPlaceList): ''' 获取掉落优选部位 几个默认规则 -- Gitblit v1.8.0