From ee187412fd4ac950aa33b493e8214d6a0701357f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 12 三月 2019 10:40:27 +0800
Subject: [PATCH] 6323 【后端】【2.0】装备传奇属性生成规则

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py |   59 +++++++++++++++++++++++------------------------------------
 1 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index cb28e8c..2d17a15 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -2403,10 +2403,8 @@
         if itemColor >= ChConfig.Def_Quality_Purple:
             GameWorld.DebugLog("该装备没有传奇属性: itemID=%s" % (itemID))
         return
-    fixedLegendAttrCount = attrCountIpyData.GetFixedLegendAttrCount()
-    goodLegendAttrCount = attrCountIpyData.GetGoodLegendAttrCount()
-    otherLegendAttrCount = attrCountIpyData.GetOtherLegendAttrCount()
-    if fixedLegendAttrCount <= 0 and goodLegendAttrCount <= 0 and otherLegendAttrCount <= 0:
+    legendAttrCountInfoList = attrCountIpyData.GetLegendAttrCountInfo() # 传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
+    if not legendAttrCountInfoList:
         return
     
     if not curPlayer:
@@ -2418,53 +2416,42 @@
     attrTypeIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrType", itemType)
     if not attrTypeIpyData:
         return
-    fixedLegendAttrList = attrTypeIpyData.GetFixedLegendAttrList()
-    goodLegendAttrList = attrTypeIpyData.GetGoodLegendAttrList()
-    commLegendAttrList = attrTypeIpyData.GetCommLegendAttrList()
+    legendAttrTypeLibDict = attrTypeIpyData.GetLegendAttrTypeLib() # 传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
+    
     curLegAttrIDList = []
     curLegAttrValueList = []
+    itemClassLV = ItemCommon.GetItemClassLV(curItem)
     if isAllAttr:
         if curPlayer.GetGMLevel() != 90:
             return
-        curLegAttrIDList = fixedLegendAttrList + goodLegendAttrList + commLegendAttrList
+        for attrIDList in legendAttrTypeLibDict.values():
+            curLegAttrIDList += attrIDList
+        #GameWorld.DebugLog("所有传奇属性: %s" % (curLegAttrIDList), playerID)
     else:
-        if fixedLegendAttrCount:
-            if len(fixedLegendAttrList) < fixedLegendAttrCount:
-                GameWorld.ErrLog("装备固定传奇属性配置不足!itemID=%s,itemType=%s,fixedLegendAttrCount=%s,fixedLegendAttrList=%s" 
-                                 % (itemID, itemType, fixedLegendAttrCount, fixedLegendAttrList), playerID)
-                return
-            curLegAttrIDList += fixedLegendAttrList[:fixedLegendAttrCount]
-            
-        if goodLegendAttrCount:
-            if len(goodLegendAttrList) < goodLegendAttrCount:
-                GameWorld.ErrLog("装备追求传奇属性配置不足!itemID=%s,itemType=%s,goodLegendAttrCount=%s,goodLegendAttrList=%s" 
-                                 % (itemID, itemType, goodLegendAttrCount, goodLegendAttrList), playerID)
-                return
-            curLegAttrIDList += random.sample(goodLegendAttrList, goodLegendAttrCount)
-            
-        if otherLegendAttrCount:
-            otherLegendAttrList = list(goodLegendAttrList) + list(commLegendAttrList)
+        #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" 
+        #                   % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
+        for attrCount, libNumList in legendAttrCountInfoList:
+            attrIDList = []
+            for libNum in libNumList:
+                attrIDList.extend(legendAttrTypeLibDict.get(libNum, []))
             for curAttrID in curLegAttrIDList:
-                if curAttrID in otherLegendAttrList:
-                    otherLegendAttrList.remove(curAttrID)
-            if len(otherLegendAttrList) < otherLegendAttrCount:
-                GameWorld.ErrLog("装备一般传奇属性配置不足!itemID=%s,itemType=%s,otherLegendAttrCount=%s,otherLegendAttrList=%s" 
-                                 % (itemID, itemType, otherLegendAttrCount, otherLegendAttrList), playerID)
+                if curAttrID in attrIDList:
+                    attrIDList.remove(curAttrID)
+            if len(attrIDList) < attrCount:
+                GameWorld.ErrLog("装备传奇属性ID库配置不够条数随机!itemID=%s,itemType=%s,legendAttrCountInfoList=%s,legendAttrTypeLibDict=%s" 
+                                 % (itemID, itemType, legendAttrCountInfoList, legendAttrTypeLibDict), playerID)
                 return
-            curLegAttrIDList += random.sample(otherLegendAttrList, otherLegendAttrCount)
+            curLegAttrIDList += random.sample(attrIDList, attrCount)
+            #GameWorld.DebugLog("    随机传奇属性: attrCount=%s,libNumList=%s,attrIDList=%s,curLegAttrIDList=%s" 
+            #                   % (attrCount, libNumList, attrIDList, curLegAttrIDList), playerID)
             
     # 3. 定数值
-    itemClassLV = ItemCommon.GetItemClassLV(curItem)
     attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrValue", itemType, itemClassLV, itemColor, isSuit)
     if not attrValueIpyData:
         GameWorld.ErrLog("传奇属性等级数值表找不到配置!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" 
                          % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
         return
-    #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" 
-    #                   % (itemID, itemType, itemClassLV, itemColor, isSuit, ), playerID)
-    #GameWorld.DebugLog("    固定条数=%s-%s,追求条数=%s-%s,其他条数=%s-%s" 
-    #                   % (fixedLegendAttrCount, fixedLegendAttrList, goodLegendAttrCount, goodLegendAttrList, 
-    #                      otherLegendAttrCount, commLegendAttrList), playerID) 
+    
     attrLVLibNumDict = attrValueIpyData.GetLVLegendAttrLibNumInfo() # {属性ID:{等级:库编号, ...}}
     for attrID in curLegAttrIDList:
         if attrID not in attrLVLibNumDict:

--
Gitblit v1.8.0