From a4609786df8768c1c138dc261d1b924860c9f07b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 21 一月 2019 17:52:17 +0800
Subject: [PATCH] 5931 【后端】【1.5.100】诛仙装备开发(诛仙物品背包34、诛仙装备背包35、诛仙装备传奇属性生成规则支持)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py            |   25 ------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearPack.py   |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py      |   76 ++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py |    6 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py             |   20 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py         |    9 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/CrossPlayerData.py  |    2 
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                  |   20 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                |   25 +++++
 9 files changed, 153 insertions(+), 32 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 712fdd3..84a8327 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -935,8 +935,10 @@
 rptPet,             # 宠物背包(用物品存储宠物的数据) 31
 rptDogzItem,        # 神兽物品背包 32
 rptDogzEquip,       # 神兽装备背包 33
+rptZhuXianItem,     # 诛仙物品背包 34
+rptZhuXianEquip,    # 诛仙装备背包 35
 rptMax,             # 最大背包类型数量,放在最后一个
-) = range(28, 28 + 7)  #C++定义的枚举到27
+) = range(28, 28 + 9)  #C++定义的枚举到27
 
 #虚拟背包类型, 从255递减
 Def_VPack_TypeList = (
@@ -1745,6 +1747,22 @@
     dogzetScute,    # 神兽鳞甲
 ) = range(101, 101 + 5)
 
+# 诛仙装备位定义
+ZhuXianEquipPlace = (
+    zxetCloak,      # 诛仙披风 121
+    zxetMask,       # 诛仙面具 122
+    zxetGlove,      # 诛仙手套 123
+    zxetGlove2,     # 诛仙手套 124
+    zxetRuyi,       # 诛仙如意 125
+    zxetPendant,    # 诛仙吊坠 126
+    zxetRing,       # 诛仙戒指 127
+    zxetRing2,      # 诛仙戒指 128
+    zxetWeapon1,    # 诛仙剑1 129
+    zxetWeapon2,    # 诛仙剑2 130
+    zxetWeapon3,    # 诛仙剑3 131
+    zxetWeapon4,    # 诛仙剑4 132
+) = range(121, 121 + 12)
+
 
 # 请求进入副本通用检查结果,优先提示的放前面(即索引越大,提示优先级越低)
 EnterFBAskResult = (
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 57b1728..2305cba 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -359,6 +359,17 @@
 Def_ItemType_DogzEquipScute = 123   # 神兽鳞甲
 Def_ItemType_AddCrossRealmPKCnt = 127 #增加跨服PK次数
 
+Def_ItemType_ZXCloak = 128 # 诛仙披风
+Def_ItemType_ZXMask = 129 # 诛仙面具
+Def_ItemType_ZXGlove = 130 # 诛仙手套
+Def_ItemType_ZXRuyi = 131 # 诛仙如意
+Def_ItemType_ZXPendant = 132 # 诛仙吊坠
+Def_ItemType_ZXRing = 133 # 诛仙戒指
+Def_ItemType_ZXWeapon1 = 134 # 诛仙剑1
+Def_ItemType_ZXWeapon2 = 135 # 诛仙剑2
+Def_ItemType_ZXWeapon3 = 136 # 诛仙剑3
+Def_ItemType_ZXWeapon4 = 137 # 诛仙剑4
+
 #以下定义物品类型下次删除
 Def_Item_Type_Horse = 1000036          #坐骑
 
@@ -368,11 +379,12 @@
                      ShareDefine.rptGatherSoul:'GatherSoulPackCount',
                      }
 
-#虚拟背包可以放入的物品字典
+#背包可以放入的物品字典
 Def_PackItemTypeList_Dict = {
 ShareDefine.rptRune:[Def_ItemType_Rune, Def_ItemType_RuneExp],
 ShareDefine.rptDogzItem:[Def_ItemType_DogzEquipExp, Def_ItemType_DogzEquipHorn, Def_ItemType_DogzEquipEye, 
                          Def_ItemType_DogzEquipTooth, Def_ItemType_DogzEquipClaw, Def_ItemType_DogzEquipScute],
+ShareDefine.rptZhuXianItem:range(Def_ItemType_ZXCloak, Def_ItemType_ZXWeapon4 + 1),
 ShareDefine.rptGatherSoul:[Def_ItemType_GatherSoulExp, Def_ItemType_GatherSoul, Def_ItemType_GatherSoulCore],
                       }
 
@@ -788,13 +800,16 @@
 
 Def_EquipItemType_TJGAutoEat = xrange(Def_ItemType_retWeapon, Def_ItemType_retShoes + 1)
 #装备类型
-Def_EquipItemType = xrange(Def_ItemType_retWeapon, Def_ItemType_DogzEquipScute + 1)
+Def_EquipItemType = range(Def_ItemType_retWeapon, Def_ItemType_DogzEquipScute + 1) + range(Def_ItemType_ZXCloak, Def_ItemType_ZXWeapon4 + 1)
 
 #武器类型
 Def_WeaponItemType = [Def_ItemType_retWeapon, Def_ItemType_retWeapon2]
 
 #神兽装备类型
 Def_DogzEquiipType = xrange(Def_ItemType_DogzEquipHorn, Def_ItemType_DogzEquipScute + 1)
+
+#诛仙装备类型
+Def_ZhuXianEquiipType = xrange(Def_ItemType_ZXCloak, Def_ItemType_ZXWeapon4 + 1)
 
 # 技能造成实质性伤害的类型
 Def_RealAttack_Type = [Def_HurtType_Normal,         # 普通伤害 1
@@ -854,6 +869,10 @@
 Def_PackCnt_DogzItem = 100
 #初始化神兽装备格子数
 Def_PackCnt_DogzEquip = 100
+#初始化诛仙背包格子数
+Def_PackCnt_ZhuXianItem = 100
+#初始化诛仙装备格子数
+Def_PackCnt_ZhuXianEquip = 12
 #初始化装备栏2
 Def_PackCnt_Equip2 = 0
 #初始化回收站
@@ -1097,6 +1116,8 @@
                                     ShareDefine.rptPet,
                                     ShareDefine.rptDogzItem,
                                     ShareDefine.rptDogzEquip,
+                                    ShareDefine.rptZhuXianItem,
+                                    ShareDefine.rptZhuXianEquip,
                                     ]
 
 #装备可强化背包列表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearPack.py
index 333b989..0d3ca76 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearPack.py
@@ -26,7 +26,7 @@
 #  @remarks 函数详细说明.
 def OnExec(curPlayer, playerList):
     if not playerList:
-        GameWorld.DebugAnswer(curPlayer, "背包类型:1-装备;2-背包;5-仓库;30-寻宝;")
+        GameWorld.DebugAnswer(curPlayer, "背包类型:1-装备;2-背包;5-仓库;30-寻宝;32-神兽;33-神兽装备;;34-诛仙;35-诛仙装备;")
         return
     
     if len(playerList) == 1:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
index 1121a98..1f0c471 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
@@ -1053,31 +1053,6 @@
         suiteLVList.append(suiteLV)
     return suiteLVList
 
-## 获取玩家装备预览信息
-def GetPlayerEquipView(curPlayer):
-    if not curPlayer:
-        return []
-    
-    playerID = curPlayer.GetPlayerID()
-    playerEquipList = []
-    
-    playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
-    #玩家当前可装备的装备类型
-    for equipIndex in xrange(0, playerEquip.GetCount()):
-        
-        if equipIndex not in ShareDefine.RoleEquipType:
-            continue
-        
-        curEquip = playerEquip.GetAt(equipIndex)
-        if curEquip.IsEmpty():
-            continue
-        
-        playerEquipList.append([curEquip.GetItemTypeID(), equipIndex, 0, 0])
-                                #curEquip.GetItemStarLV(), 0])
-    
-    #GameWorld.DebugLog("玩家装备信息:%s" % str(playerEquipList), playerID)
-    return playerEquipList
-
 
 #// A5 03 全身属性激活 #tagCMActiveAllEquipAttr
 #
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 2b18d39..47c70b3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -1097,7 +1097,7 @@
     
     def __CrossServerPutInItem(self, packIndex, tagItem, event=["", False, {}]):
         ## 跨服获得物品
-        if packIndex not in [IPY_GameWorld.rptItem, ShareDefine.rptDogzItem]:
+        if packIndex not in [IPY_GameWorld.rptItem, ShareDefine.rptDogzItem, ShareDefine.rptZhuXianItem]:
             #GameWorld.DebugLog("跨服获得物品不同步, packIndex=%s" % (packIndex))
             return
         curPlayer = self.__Player
@@ -2416,6 +2416,10 @@
     if itemType == ChConfig.Def_ItemType_retWing:
         return __GetAddWingLegendAttr(curItem)
     
+    isZhuXianEquip = ItemCommon.GetIsZhuXianEquip(curItem)
+    if isZhuXianEquip:
+        return __GetRandLegendAttr(curItem)
+    
     itemColor = curItem.GetItemColor()
     itemClassLV = ItemCommon.GetItemClassLV(curItem)
     itemQuality = curItem.GetItemQuality()
@@ -2514,6 +2518,76 @@
 #                       % (randAttrIDList, curLegAttrIDList, curLegAttrValueList))
     return [curLegAttrIDList, curLegAttrValueList]
 
+def __GetRandLegendAttr(curItem):
+    # 纯随机类型及数值的规则
+        
+    itemType = curItem.GetType()
+    equipTypeRandGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 2, {}) # 随机传奇属性类型组配置: {(装备类型1, 装备类型2, ...):[传奇属性类型组1, ...], ...}
+    if itemType in equipTypeRandGroupDict:
+        randGroupList = equipTypeRandGroupDict[itemType]
+    else:
+        randGroupList = []
+        for typeTuple, groupList in equipTypeRandGroupDict.items():
+            if not isinstance(typeTuple, tuple):
+                continue
+            if itemType in typeTuple:
+                randGroupList = groupList
+                break
+            
+    if not randGroupList:
+        GameWorld.ErrLog("该物品类型没有传奇属性!itemType=%s" % itemType)
+        return
+    
+    randLegendAttrIDLsit = []
+    legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {1:[传奇属性类型ID组], ...}
+    for groupType in randGroupList:
+        if groupType not in legendAttrGroupDict:
+            GameWorld.ErrLog("没有配置传奇属性组对应传奇属性类型列表! groupType=%s" % groupType)
+            continue
+        randLegendAttrIDLsit += legendAttrGroupDict[groupType]
+    
+    if not randLegendAttrIDLsit:
+        return
+    
+    itemClassLV = ItemCommon.GetItemClassLV(curItem)
+    itemQuality = curItem.GetItemQuality()
+    randCountKey = (itemClassLV, itemQuality)
+    randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {(阶,星):[随机条数A, 随机条数B]], ...}
+    if randCountKey not in randCountDict:
+        GameWorld.ErrLog("没有配置装备阶星对应随机传奇属性条数: itemClassLV=%s, itemQuality=%s" % (itemClassLV, itemQuality))
+        return
+    randCountList = randCountDict[randCountKey]
+    if not randCountList or len(randCountList) != 2:
+        return
+    legAttrCnt = random.randint(randCountList[0], randCountList[1])
+    legAttrCnt = min(len(randLegendAttrIDLsit), legAttrCnt)
+    curLegAttrIDList = random.sample(randLegendAttrIDLsit, legAttrCnt)
+    curLegAttrValueList = []
+    
+    randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {传奇属性类型:[随机数值1, 数值2, ...], ...}
+    maxValueMinCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 5) # 保底最大数值条数: {(阶,星):条数, ...], ...}  没配置的默认0
+    maxValueMinCount = maxValueMinCountDict.get((itemClassLV, itemQuality), 0)
+    if legAttrCnt < maxValueMinCount:
+        GameWorld.ErrLog("传奇属性条数少于保底最大数值条数: itemClassLV=%s, itemQuality=%s, legAttrCnt=%s, maxValueMinCount=%s" 
+                         % (itemClassLV, itemQuality, legAttrCnt, maxValueMinCount))
+        return
+    
+    for i, attrID in enumerate(curLegAttrIDList):
+        if attrID not in randValueListDict:
+            GameWorld.ErrLog("传奇属性没有配置随机数值范围或配置错误: attrID=%s" % (attrID))
+            return
+        randValueList = randValueListDict[attrID]
+        if i < maxValueMinCount:
+            randValue = max(randValueList)
+        else:
+            randValue = random.choice(randValueList)
+        curLegAttrValueList.append(randValue)
+        
+#    GameWorld.DebugLog("itemType=%s,itemClassLV=%s,itemQuality=%s,randLegendAttrIDLsit=%s" % (itemType, itemClassLV, itemQuality, randLegendAttrIDLsit))
+#    GameWorld.DebugLog("legAttrCnt=%s,maxValueMinCount=%s" % (legAttrCnt, maxValueMinCount))
+#    GameWorld.DebugLog("curLegAttrIDList=%s,curLegAttrValueList=%s" % (curLegAttrIDList, curLegAttrValueList))
+    return [curLegAttrIDList, curLegAttrValueList]
+
 def __GetAddWingLegendAttr(curItem):
     # {阶数:条数, ...}
     wingLegAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrCount")
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
index 7f9f3b8..1ba3c18 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
@@ -478,6 +478,8 @@
     if GetIsDogzEquip(curItem):
         # 神兽装备用不同公式
         value = eval(FormulaControl.GetCompileFormula("EquipGSFormula3", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 3)))
+    elif GetIsZhuXianEquip(curItem):
+        value = eval(FormulaControl.GetCompileFormula("EquipGSFormula4", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 4)))
     else:
         value = eval(FormulaControl.GetCompileFormula("EquipGSFormula", IpyGameDataPY.GetFuncCfg("EquipGSFormula")))
     return value
@@ -1742,6 +1744,10 @@
     ## 返回是否神兽装备
     return curItem.GetType() in ChConfig.Def_DogzEquiipType
 
+def GetIsZhuXianEquip(curItem):
+    ## 返回是否诛仙装备
+    return curItem.GetType() in ChConfig.Def_ZhuXianEquiipType
+
 ## 返回是否武器
 #  @param curItem 当前物品
 #  @return None
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 3d85fb2..d27e877 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -1252,6 +1252,15 @@
     curPack.SetCount(ChConfig.Def_PackCnt_DogzEquip)
     curPack.Sync_PackCanUseCount()
     
+    #初始化诛仙物品背包
+    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianItem)
+    curPack.SetCount(ChConfig.Def_PackCnt_ZhuXianItem)
+    curPack.Sync_PackCanUseCount()
+    #初始化诛仙装备背包
+    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianEquip)
+    curPack.SetCount(ChConfig.Def_PackCnt_ZhuXianEquip)
+    curPack.Sync_PackCanUseCount()
+    
     #初始化临时交换背包
     curPack = itemManager.GetPack(ShareDefine.rptTempSwap)
     curPack.SetCount(ChConfig.Def_PackCnt_TempSwap)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/CrossPlayerData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/CrossPlayerData.py
index 91f317a..e0ae076 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/CrossPlayerData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/CrossPlayerData.py
@@ -262,7 +262,7 @@
     itemsDict = {}
     # 影响战力的物品,新功能注意添加,下次需要加上诛仙塔
     
-    packList = [IPY_GameWorld.rptEquip, ShareDefine.rptPet, ShareDefine.rptDogzEquip]
+    packList = [IPY_GameWorld.rptEquip, ShareDefine.rptPet, ShareDefine.rptDogzEquip, ShareDefine.rptZhuXianEquip]
     for packIndex in packList:
         curPack = curPlayer.GetItemManager().GetPack(packIndex)
         for i in range(curPack.GetCount()):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 712fdd3..84a8327 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -935,8 +935,10 @@
 rptPet,             # 宠物背包(用物品存储宠物的数据) 31
 rptDogzItem,        # 神兽物品背包 32
 rptDogzEquip,       # 神兽装备背包 33
+rptZhuXianItem,     # 诛仙物品背包 34
+rptZhuXianEquip,    # 诛仙装备背包 35
 rptMax,             # 最大背包类型数量,放在最后一个
-) = range(28, 28 + 7)  #C++定义的枚举到27
+) = range(28, 28 + 9)  #C++定义的枚举到27
 
 #虚拟背包类型, 从255递减
 Def_VPack_TypeList = (
@@ -1745,6 +1747,22 @@
     dogzetScute,    # 神兽鳞甲
 ) = range(101, 101 + 5)
 
+# 诛仙装备位定义
+ZhuXianEquipPlace = (
+    zxetCloak,      # 诛仙披风 121
+    zxetMask,       # 诛仙面具 122
+    zxetGlove,      # 诛仙手套 123
+    zxetGlove2,     # 诛仙手套 124
+    zxetRuyi,       # 诛仙如意 125
+    zxetPendant,    # 诛仙吊坠 126
+    zxetRing,       # 诛仙戒指 127
+    zxetRing2,      # 诛仙戒指 128
+    zxetWeapon1,    # 诛仙剑1 129
+    zxetWeapon2,    # 诛仙剑2 130
+    zxetWeapon3,    # 诛仙剑3 131
+    zxetWeapon4,    # 诛仙剑4 132
+) = range(121, 121 + 12)
+
 
 # 请求进入副本通用检查结果,优先提示的放前面(即索引越大,提示优先级越低)
 EnterFBAskResult = (

--
Gitblit v1.8.0