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 +++++++++++------------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py      |   24 +++---------
 PySysDB/PySysDBPY.h                                                                       |    8 +---
 3 files changed, 31 insertions(+), 60 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index b5b5762..5f13a33 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -133,9 +133,7 @@
 	BYTE		_ItemType;	//物品类型
 	BYTE		_ItemColor;	//物品颜色
 	BYTE		_IsSuit;	//是否套装
-	BYTE		FixedLegendAttrCount;	//固定传奇属性条数
-	BYTE		GoodLegendAttrCount;	//追求传奇属性保底条数
-	BYTE		OtherLegendAttrCount;	//其他随机传奇属性条数
+	list		LegendAttrCountInfo;	//传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
 };
 
 //装备传奇属性类型表
@@ -143,9 +141,7 @@
 struct tagEquipLegendAttrType
 {
 	BYTE		_ItemType;	//物品类型
-	list		FixedLegendAttrList;	//固定传奇属性列表
-	list		GoodLegendAttrList;	//追求传奇属性列表
-	list		CommLegendAttrList;	//一般传奇属性列表
+	dict		LegendAttrTypeLib;	//传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
 };
 
 //装备传奇属性值库表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 5c0ee33..ed5d401 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -129,16 +129,12 @@
                         ("BYTE", "ItemType", 1),
                         ("BYTE", "ItemColor", 1),
                         ("BYTE", "IsSuit", 1),
-                        ("BYTE", "FixedLegendAttrCount", 0),
-                        ("BYTE", "GoodLegendAttrCount", 0),
-                        ("BYTE", "OtherLegendAttrCount", 0),
+                        ("list", "LegendAttrCountInfo", 0),
                         ),
 
                 "EquipLegendAttrType":(
                         ("BYTE", "ItemType", 1),
-                        ("list", "FixedLegendAttrList", 0),
-                        ("list", "GoodLegendAttrList", 0),
-                        ("list", "CommLegendAttrList", 0),
+                        ("dict", "LegendAttrTypeLib", 0),
                         ),
 
                 "EquipLegendAttrLib":(
@@ -1617,32 +1613,24 @@
         self.ItemType = 0
         self.ItemColor = 0
         self.IsSuit = 0
-        self.FixedLegendAttrCount = 0
-        self.GoodLegendAttrCount = 0
-        self.OtherLegendAttrCount = 0
+        self.LegendAttrCountInfo = []
         return
         
     def GetItemType(self): return self.ItemType # 物品类型
     def GetItemColor(self): return self.ItemColor # 物品颜色
     def GetIsSuit(self): return self.IsSuit # 是否套装
-    def GetFixedLegendAttrCount(self): return self.FixedLegendAttrCount # 固定传奇属性条数
-    def GetGoodLegendAttrCount(self): return self.GoodLegendAttrCount # 追求传奇属性保底条数
-    def GetOtherLegendAttrCount(self): return self.OtherLegendAttrCount # 其他随机传奇属性条数
+    def GetLegendAttrCountInfo(self): return self.LegendAttrCountInfo # 传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
 
 # 装备传奇属性类型表
 class IPY_EquipLegendAttrType():
     
     def __init__(self):
         self.ItemType = 0
-        self.FixedLegendAttrList = []
-        self.GoodLegendAttrList = []
-        self.CommLegendAttrList = []
+        self.LegendAttrTypeLib = {}
         return
         
     def GetItemType(self): return self.ItemType # 物品类型
-    def GetFixedLegendAttrList(self): return self.FixedLegendAttrList # 固定传奇属性列表
-    def GetGoodLegendAttrList(self): return self.GoodLegendAttrList # 追求传奇属性列表
-    def GetCommLegendAttrList(self): return self.CommLegendAttrList # 一般传奇属性列表
+    def GetLegendAttrTypeLib(self): return self.LegendAttrTypeLib # 传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
 
 # 装备传奇属性值库表
 class IPY_EquipLegendAttrLib():
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