From fa10596d9f3abf523f8e900d7b920e4af8ea6bc5 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 07 三月 2019 14:45:41 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py |  100 ++++++++++++++++++++++++++------------------------
 1 files changed, 52 insertions(+), 48 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
index 94ead76..607a13c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
@@ -32,7 +32,7 @@
 import ShareDefine
 import EquipZhuXian
 
-
+g_stoneCanPlaceList = [] #可镶嵌的位置
 
 def OnLogin(curPlayer):
     ###登录发包同步客户端宝石信息
@@ -41,23 +41,30 @@
 
 def GetAllStoneEquipIndexList():
     ###得到所有可镶嵌宝石装备位列表
-    
+    global g_stoneCanPlaceList
+    if g_stoneCanPlaceList:
+        return g_stoneCanPlaceList
     #获得宝石类型数量
     GemTypeCount = IpyGameDataPY.GetFuncCfg("GemTypeCount")
     #获得所有可镶嵌宝石装备位
-    stoneCanPlaceList = []      
+    g_stoneCanPlaceList = []      
     for stoneTypeIndex in xrange(1, GemTypeCount + 1):
         #循环宝石类型对应的装备位
         placeList = IpyGameDataPY.GetFuncEvalCfg("GemType%s" % stoneTypeIndex, 1)
         for place in placeList:
-            if place not in stoneCanPlaceList:
-                stoneCanPlaceList.append(place)
-    return stoneCanPlaceList
+            ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'EquipPlace':place}, True)
+            if not ipyDataList:
+                continue
+            for ipyData in ipyDataList:
+                gridIndex = ipyData.GetGridIndex()
+                if gridIndex not in g_stoneCanPlaceList:
+                    g_stoneCanPlaceList.append(gridIndex)
+    return g_stoneCanPlaceList
 
 def GetAllEquipPlaceHoleIndex():
     ### 得到装备位所有孔位
-    gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
-    maxEquipHoleCnt = len(gemOpenClassLVList) # 最大装备阶级开放孔数
+    gemOpenNeedStarList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
+    maxEquipHoleCnt = len(gemOpenNeedStarList) # 最大装备阶级开放孔数
      
     gemOpenVipList = IpyGameDataPY.GetFuncEvalCfg("GemOpenVip", 1)
     maxHoleVipCnt = len(gemOpenVipList)# 最大Vip开放孔数
@@ -94,14 +101,14 @@
 
 def GetPackTypeByEquipPlace(equipPlace):
     ##目前支持镶嵌普通装备、诛仙装备
-    if equipPlace in ShareDefine.ZhuXianEquipPlace:
-        equipPackType = ShareDefine.rptZhuXianEquip
-        stonePackType = ShareDefine.rptZhuXianItem
-        placeIndex = EquipZhuXian.GetZhuXianEquipIndexByPlace(equipPlace)
-    else:
-        equipPackType = IPY_GameWorld.rptEquip
-        stonePackType = IPY_GameWorld.rptItem
-        placeIndex = equipPlace
+#    if equipPlace in ShareDefine.ZhuXianEquipPlace:
+#        equipPackType = ShareDefine.rptZhuXianEquip
+#        stonePackType = ShareDefine.rptZhuXianItem
+#        placeIndex = EquipZhuXian.GetZhuXianEquipIndexByPlace(equipPlace)
+#    else:
+    equipPackType = IPY_GameWorld.rptEquip
+    stonePackType = IPY_GameWorld.rptItem
+    placeIndex = equipPlace
     return equipPackType, stonePackType, placeIndex
 
 #//A3 04 宝石镶嵌或替换 #tagCMEquipEnchase
@@ -157,8 +164,8 @@
                       % (stoneItemID, stoneEffType, stoneCanPlaceList, equipPlace), playerID)
         return
     
-    equipClassLV = ItemCommon.GetItemClassLV(curEquip)
-    if not __CheckStoneHoleCanUse(curPlayer, equipClassLV, holeIndex, equipPackType):
+    equipStar = ChEquip.GetEquipPartStar(curEquip)
+    if not __CheckStoneHoleCanUse(curPlayer, equipStar, holeIndex, equipPackType):
         return
     
     # 扣除宝石
@@ -329,12 +336,7 @@
     level = curStoneEff.GetEffectValue(1)
     upgradeStoneID = curStoneEff.GetEffectValue(2)
     
-    stoneTypeItemIDDict = IpyGameDataPY.GetFuncEvalCfg("GemUpCostFormula", 1)
-    GameWorld.DebugLog("stoneEffType=%s,stoneTypeItemIDDict=%s,level=%s,upgradeStoneID=%s" 
-                       % (stoneEffType, stoneTypeItemIDDict, level, upgradeStoneID))
-    if stoneEffType not in stoneTypeItemIDDict:
-        return
-    stoneTypeItemID = stoneTypeItemIDDict[stoneEffType]
+    GameWorld.DebugLog("stoneEffType=%s,level=%s,upgradeStoneID=%s" % (stoneEffType, level, upgradeStoneID))
     
     if not upgradeStoneID:
         GameWorld.Log("该宝石已是最大级,不能升级!stoneIndex=%s,stoneItemID=%s,curEffID=%s,upgradeStoneID=%s"
@@ -344,6 +346,10 @@
     if not needCount:
         return
     if upWay == 0: #仙玉
+        stoneTypeItemIDDict = IpyGameDataPY.GetFuncEvalCfg("GemUpCostFormula", 1)
+        if stoneEffType not in stoneTypeItemIDDict:
+            return
+        stoneTypeItemID = stoneTypeItemIDDict[stoneEffType]
         unitPrice = ItemCommon.GetShopItemPrice(stoneTypeItemID, IPY_GameWorld.TYPE_Price_Gold_Money)
         if not unitPrice:
             return
@@ -357,7 +363,7 @@
             return
     else:
         #同级宝石
-        costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, stoneItemID)
+        costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, stoneItemID, packType=stonePackType)
         if bindCnt + unBindCnt < needCount-1:
             GameWorld.DebugLog("同级宝石不足 %s!" % (needCount-1))
             return
@@ -383,7 +389,7 @@
     DoStoneSuccess(curPlayer)
     return
 
-def __CheckStoneHoleCanUse(curPlayer, equipClassLV, holeIndex, equipPackType):
+def __CheckStoneHoleCanUse(curPlayer, equipStar, holeIndex, equipPackType):
     ##验证孔合法性
     
     holeIndexList = GetAllEquipPlaceHoleIndex()
@@ -392,19 +398,17 @@
         return False
     
     openCommHoleCnt = 0 # 已经开放装备常规孔数
-    if equipPackType == ShareDefine.rptZhuXianEquip:
-        gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 2)
-    else:
-        gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
-    for holeCnt, openClassLV in enumerate(gemOpenClassLVList, 1):
-        if equipClassLV >= openClassLV:
+    
+    gemOpenNeedStarList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
+    for holeCnt, openStar in enumerate(gemOpenNeedStarList, 1):
+        if equipStar >= openStar:
             openCommHoleCnt = holeCnt
             
     # VIP孔
     if holeIndex >= ChConfig.Def_Stone_VipHole:
         
         if openCommHoleCnt <= 0:
-            GameWorld.Log("装备未开启任何普通宝石孔,无法开启VIP孔位! equipClassLV=%s,openCommHoleCnt=%s" % (equipClassLV, openCommHoleCnt))
+            GameWorld.Log("装备未开启任何普通宝石孔,无法开启VIP孔位! equipStar=%s,openCommHoleCnt=%s" % (equipStar, openCommHoleCnt))
             return False
         gemOpenVipList = IpyGameDataPY.GetFuncEvalCfg("GemOpenVip", 1)
         
@@ -426,8 +430,8 @@
         
     # 常规孔
     elif holeIndex >= openCommHoleCnt:
-        GameWorld.Log("该装备宝石孔为开放!equipClassLV=%s,holeIndex=%s,openCommHoleCnt=%s" 
-                      % (equipClassLV, holeIndex, openCommHoleCnt), curPlayer.GetPlayerID())
+        GameWorld.Log("该装备宝石孔为开放!equipStar=%s,holeIndex=%s,openCommHoleCnt=%s" 
+                      % (equipStar, holeIndex, openCommHoleCnt), curPlayer.GetPlayerID())
         return False
     
     return True
@@ -445,7 +449,7 @@
         itemCount = 1
         # 摘除的宝石都绑定
         if ItemCommon.CheckPackHasSpace(curPlayer, stonePackType):
-            ItemControler.GivePlayerItem(curPlayer, stoneID, itemCount, True if stoneIsBind else False,
+            ItemControler.GivePlayerItem(curPlayer, stoneID, itemCount, 0,
                                          [stonePackType], 
                                          event=[ChConfig.ItemGive_StonePickoff, False, {"EquipPlace":equipPlace, "HoleIndex":holeIndex}])
         else:
@@ -472,22 +476,22 @@
     return
 
 
-def DoMoveEquipStone(curPlayer, equipPlace): 
+def DoMoveEquipStone(curPlayer, equipPackIndex): 
     ###替换装备时宝石转移
-    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPlace)
+    equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPackIndex)
     equipPack = curPlayer.GetItemManager().GetPack(equipPackType)
     curEquip = equipPack.GetAt(placeIndex)
     if not ItemCommon.CheckItemCanUse(curEquip):
         return
     
-    #获得装备阶级孔信息
-    gemOpenClassLVList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
-    maxEquipHoleCnt = len(gemOpenClassLVList) # 最大装备阶级开放孔数
+    #获得装备星级孔信息
+    gemOpenNeedStarList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
+    maxEquipHoleCnt = len(gemOpenNeedStarList) # 最大装备星级开放孔数
     
     openEquipHoleCnt = 0 # 已经开放孔数
-    equipClassLV = ItemCommon.GetItemClassLV(curEquip)
-    for holeCnt, openClassLV in enumerate(gemOpenClassLVList, 1):
-        if equipClassLV >= openClassLV:
+    partStar = ChEquip.GetEquipPartStarByRank(curPlayer, equipPackIndex, curEquip)
+    for holeCnt, openStar in enumerate(gemOpenNeedStarList, 1):
+        if partStar >= openStar:
             openEquipHoleCnt = holeCnt
             
     #需要拆卸宝石的孔列表
@@ -497,10 +501,10 @@
     for holeIndex in xrange(maxEquipHoleCnt):      
         if holeIndex < openEquipHoleCnt:
             continue
-        curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)[0]
+        curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPackIndex, holeIndex)[0]
         if curGemID == 0:
             continue       
-        pickoffHoleList.append([equipPlace, holeIndex])
+        pickoffHoleList.append([equipPackIndex, holeIndex])
         
     #没有开启普通装备孔,需摘除VIP孔
     if not openEquipHoleCnt:
@@ -509,10 +513,10 @@
         maxVipHoleCnt = len(gemOpenVipList)# 最大VIP开放孔数
         #判断VIP等级孔信息
         for holeIndex in xrange(ChConfig.Def_Stone_VipHole, ChConfig.Def_Stone_VipHole + maxVipHoleCnt): 
-            curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPlace, holeIndex)[0]
+            curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipPackIndex, holeIndex)[0]
             if curGemID == 0:                             
                 continue
-            pickoffHoleList.append([equipPlace, holeIndex])
+            pickoffHoleList.append([equipPackIndex, holeIndex])
             
     # 脱装备的外层刷属性, 这里不刷
     __DoSysPickoffEquipStone(curPlayer, equipPackType, stonePackType, pickoffHoleList, "EquipChange", False)

--
Gitblit v1.8.0