From 5faab9df624b3bf4344d1e116bf80e163aa98b23 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 13 三月 2019 18:00:53 +0800
Subject: [PATCH] 6307 【后端】【2.0】多套装备开发单(外观通知修改)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py          |   67 +++++++++++++++++----------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py    |   11 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py |    5 --
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py    |    3 -
 4 files changed, 46 insertions(+), 40 deletions(-)

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 47d0b0a..840054d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
@@ -108,7 +108,7 @@
     changeItemStoneCnt = 0  #curItem.GetUseStoneCount()
     changeItemHoleCnt = 0  #curItem.GetCanPlaceStoneCount()
     changeItemUseData = curItem.GetUserData()
-    itemQuality = curItem.GetItemQuality()
+    suiteID = curItem.GetSuiteID()
     endureReduceType = curItem.GetEndureReduceType()
     #changeItemIsHorse = (curItem.GetType() == ChConfig.Def_Item_Type_Horse)
     
@@ -127,7 +127,10 @@
     if equipPackIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
         #通知客户端交换物品
         curPlayer.ChangeEquip(changeItemID, equipPackIndex, changeItemStarLV, changeItemHoleCnt, changeItemStoneCnt, changeItemUseData)
-        
+    if suiteID and itemClassLV == GetEquipFacadeClassLV(curPlayer):
+        #穿当前外观阶的套装
+        ChangeEquipfacadeByClassLV(curPlayer, itemClassLV)
+    
     if not endureReduceType:
         EventShell.EventRespons_EquipByPlace(curPlayer, itemClassLV, equipPlace)
     #记录橙装、红装
@@ -354,7 +357,6 @@
     
     ##特殊装备 , 不需要冲刷属性
     if equipPlace in ChConfig.EquipItemNoRefreshState:
-        curPlayer.Sync_UnEquipItem(equipID, equipPackIndex)
         return
     
     #先刷装备BUFF 再计算属性
@@ -366,9 +368,6 @@
     #刷新所有属性
     playControl = PlayerControl.PlayerControl(curPlayer)
     playControl.RefreshPlayerAttrState()
-    
-    if equipPackIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
-        curPlayer.Sync_UnEquipItem(equipID, equipPackIndex)
     return
 
 
@@ -856,31 +855,12 @@
         #没有到刷新间隔,54外挂,不给提示
 #        GameWorld.ErrLog('请求装备显隐, 没有到刷新间隔')
         return
-    
+    curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_RequestEquipShowHide, tick)
     sendPack = IPY_GameWorld.IPY_CRequestEquipShowHide()
-    updEquipShowSwitch = sendPack.GetEquipShowSwitch()
-    oldEquipShowSwitch = curPlayer.GetEquipShowSwitch()
-    if updEquipShowSwitch == oldEquipShowSwitch:
+    classLV = sendPack.GetEquipShowSwitch()
+    if not ChangeEquipfacadeByClassLV(curPlayer, classLV):
         return
-    classLV, isSuite = updEquipShowSwitch/10, updEquipShowSwitch%10
-    equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
-    #验证套装
-    realSuit=True
-    for place in ChConfig.Def_SuitEquipPlaceList:
-        ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place)
-        if not ipyData:
-            realSuit = False
-            break
-        gridIndex = ipyData.GetGridIndex()
-        curEquip = equipPack.GetAt(gridIndex)
-        if not ItemCommon.CheckItemCanUse(curEquip):
-            realSuit = False
-            break
-        if not curEquip.GetSuiteID():
-            realSuit = False
-            break
-    if realSuit != isSuite:
-        GameWorld.DebugLog('SetEquipShowSwitch 前端发的isSuite 和实际不一致!')
+    if curPlayer.GetEquipShowSwitch()/10 == classLV:
         return
     
     #通知外观装备
@@ -895,7 +875,7 @@
         updFaceEquipIndex = updFaceEquipIndex * 1000 + gridIndex
         equipIndexList.append(gridIndex)
     PlayerControl.SetFaceEquipIndex(curPlayer, updFaceEquipIndex)
-    
+    equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
     for equipPackIndex in equipIndexList:
         curEquip = equipPack.GetAt(equipPackIndex)
         if not ItemCommon.CheckItemCanUse(curEquip):
@@ -907,10 +887,33 @@
         changeItemUseData = curEquip.GetUserData()
         curPlayer.ChangeEquip(changeItemID, equipPackIndex, changeItemStarLV, changeItemHoleCnt, changeItemStoneCnt, changeItemUseData)
     
-    curPlayer.SetEquipShowSwitch(updEquipShowSwitch)
-    curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_RequestEquipShowHide, tick)
     return
 
+def ChangeEquipfacadeByClassLV(curPlayer, classLV):
+    ##变更第X套装备外观
+    oldEquipShowSwitch = curPlayer.GetEquipShowSwitch()
+    realSuit=1
+    equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
+    for place in ChConfig.Def_SuitEquipPlaceList:
+        ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place)
+        if not ipyData:
+            realSuit = 0
+            break
+        gridIndex = ipyData.GetGridIndex()
+        curEquip = equipPack.GetAt(gridIndex)
+        if not ItemCommon.CheckItemCanUse(curEquip):
+            realSuit = 0
+            break
+        if not curEquip.GetSuiteID():
+            realSuit = 0
+            break
+    updEquipShowSwitch = classLV*10+realSuit
+    if oldEquipShowSwitch == updEquipShowSwitch:
+        return
+    curPlayer.SetEquipShowSwitch(updEquipShowSwitch)
+    return True
+#获取当前是第几套装备外观
+def GetEquipFacadeClassLV(curPlayer):return curPlayer.GetEquipShowSwitch()/10
 
 ## 获取公共部位强化熟练度
 def GetEquipPartProficiency(curPlayer, packType, index):
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 e0a3777..ceacf74 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -34,6 +34,7 @@
 import IpyGameDataPY
 import DataRecordPack
 import EventShell
+import ChEquip
 
 import math
 #---------------------------------------------------------------------
@@ -947,6 +948,8 @@
         equipID = curEquip.GetItemTypeID()
         userData = curEquip.GetUserData()
         equipPlace = curEquip.GetEquipPlace()
+        suiteID = curEquip.GetSuiteID()
+        itemClassLV = ItemCommon.GetItemClassLV(curEquip)
         #该物品锁定不执行==============================================
         if curEquip.GetIsLocked():
             PlayerControl.NotifyCode(curPlayer, "RescannotEquip")
@@ -981,6 +984,14 @@
         if not DragItem(curPlayer, IPY_GameWorld.rptEquip, equipIndex, IPY_GameWorld.rptItem, packIndex, curEquipCount):
             return
         self.RefreshStartEquipCount()
+        
+        # 广播卸装
+        if equipIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
+            curPlayer.Sync_UnEquipItem(equipID, equipIndex)
+        if suiteID and itemClassLV == ChEquip.GetEquipFacadeClassLV(curPlayer):
+            #脱当前外观阶的套装
+            ChEquip.ChangeEquipfacadeByClassLV(curPlayer, itemClassLV)
+        
         EventShell.EventRespons_EquipStar(curPlayer)
         dataDict = {'dotype':'UnEquipItem', 'equipID':equipID, 'userData':userData}
         DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipChange, dataDict)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
index 4d93080..d057876 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
@@ -513,11 +513,6 @@
             itemObj = ItemCommon.GetMailItemDict(curItem)
             PlayerControl.SendMailByKey('', [curPlayer.GetID()], [itemObj])
             ItemCommon.DelItem(curPlayer, curItem, 1, False)
-        else:
-            result = ItemControler.PlayerItemControler(curPlayer).UnEquipItem(equipPlace, spaceIndex)
-            if not result:
-                GameWorld.Log('    试用首充武器 卸下原装备失败!!', curPlayer.GetID())
-                return
             
     tryItem = ItemControler.GetOutPutItemObj(tryItemID)
     if ChEquip.DoPlayerEquipItem(curPlayer, tryItem, ItemCommon.GetEquipPackIndex(tryItem), tick):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py
index be27616..8b36283 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py
@@ -1145,9 +1145,6 @@
             PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')
             PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)
             
-    # 广播卸装
-    if equipIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
-        curPlayer.Sync_UnEquipItem(equipID, equipIndex)
     return True
 #---------------------------------------------------------------------
 ##全局定时器调用, 刷新玩家状态

--
Gitblit v1.8.0