From 8bd70716e5e64b399b1d3dab025e6fe971ab9fb3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 23 八月 2018 22:21:21 +0800
Subject: [PATCH] Fix: 2848 【后端】部位掉落保护规则优化;

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 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 2f075dd..1a98920 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -822,13 +822,28 @@
     tagPlaceSortList.sort() # 升序排序
     tagPlaceSortList2.sort() # 升序排序
     if isKillCountDropEquipEx:
-        GameWorld.DebugLog("都不满足目标装备的优先级信息: npcID=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, tagPlaceSortList), playerID)
-        GameWorld.DebugLog("部分满足目标装备的优先级信息: npcID=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, tagPlaceSortList2), playerID)
-    tagPlaceSortList += tagPlaceSortList2
-    if tagPlaceSortList:
-        tagPlace = tagPlaceSortList[0][-2]
-        tagJob = tagPlaceSortList[0][-1]
-        
+        GameWorld.DebugLog("都不满足目标装备的优先级信息: npcID=%s, 数量=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, len(tagPlaceSortList), tagPlaceSortList), playerID)
+        GameWorld.DebugLog("部分满足目标装备的优先级信息: npcID=%s, 数量=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, len(tagPlaceSortList2), tagPlaceSortList2), playerID)
+    if tagPlaceSortList or tagPlaceSortList2:
+        isOptimalPlace = IpyGameDataPY.GetFuncCfg("DropEquipPlaceMode", 1) # 是否取最优解部位
+        if isOptimalPlace:
+            tagPlaceSortList += tagPlaceSortList2
+            if tagPlaceSortList:
+                tagPlace = tagPlaceSortList[0][-2]
+                tagJob = tagPlaceSortList[0][-1]
+                GameWorld.DebugLog("掉落目标部位取最优解: tagPlace=%s,tagJob=%s" % (tagPlace, tagJob), playerID)
+        else:
+            randPlaceCountLimit = IpyGameDataPY.GetFuncCfg("DropEquipPlaceMode", 2) # 全不满足目标条件部位有几个时才优先随机
+            if len(tagPlaceSortList) < randPlaceCountLimit:
+                tagPlaceSortList += tagPlaceSortList2
+            else:
+                GameWorld.DebugLog("优先随机都不满足目标装备的,randPlaceCountLimit=%s" % randPlaceCountLimit, playerID)
+            randPlaceIndex = random.randint(0, len(tagPlaceSortList) - 1)
+            GameWorld.DebugLog("掉落目标部位随机, randPlaceIndex=%s, 颜色,阶,星,评分,部位,职业=%s" % (randPlaceIndex, tagPlaceSortList), playerID)
+            tagPlace = tagPlaceSortList[randPlaceIndex][-2]
+            tagJob = tagPlaceSortList[randPlaceIndex][-1]
+            GameWorld.DebugLog("掉落目标部位随机不满足条件的: tagPlace=%s,tagJob=%s" % (tagPlace, tagJob), playerID)
+            
     if isKillCountDropEquipEx:
         GameWorld.DebugLog("附加掉落指定目标装备信息: npcID=%s,玩家最少的击杀次数=%s,目标击杀数=%s,tagClassLV=%s,tagColor=%s,tagStar=%s,tagStarMin=%s,tagPlace=%s,tagJob=%s" 
                            % (npcID, dropEquipExKillCount, tagKillCount, tagClassLV, tagColor, tagStar, tagStarMin, tagPlace, tagJob), playerID)

--
Gitblit v1.8.0