From 43ec61799c5cc015c49ca6d0ace4b356f50a95af Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 16 五月 2019 15:40:25 +0800
Subject: [PATCH] 6805 【后端】【2.0】副本前端化(增加可否进入自定义场景通用判断,增加回包,木桩怪上限调整为10个)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py      |   76 +++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                  |   30 +++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py |   72 +++++++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py      |   60 --------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py        |    2 
 5 files changed, 148 insertions(+), 92 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index 4d64189..727192d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -315,7 +315,7 @@
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 11
+RegisterPackCount = 13
 
 PacketCMD_1=0xA5
 PacketSubCMD_1=0x08
@@ -361,13 +361,21 @@
 PacketSubCMD_11=0x0A
 PacketCallFunc_11=OnFBBuyBuff
 
+PacketCMD_12=0xA2
+PacketSubCMD_12=0x31
+PacketCallFunc_12=OnClientStartCustomScene
+
+PacketCMD_13=0xA2
+PacketSubCMD_13=0x33
+PacketCallFunc_13=OnClientExitCustomScene
+
 ;玩家相关
 [ChPlayer]
 ScriptName = Player\ChPlayer.py
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 23
+RegisterPackCount = 21
 
 PacketCMD_1 = 0xA5
 PacketSubCMD_1 = 0x04
@@ -445,21 +453,13 @@
 PacketSubCMD_19=0x08
 PacketCallFunc_19=OnRefreshMainServerRole
 
-PacketCMD_20=0xA2
-PacketSubCMD_20=0x31
-PacketCallFunc_20=OnClientStartCustomScene
+PacketCMD_20=0xB2
+PacketSubCMD_20=0x06
+PacketCallFunc_20=OnAddPoint
 
 PacketCMD_21=0xB2
-PacketSubCMD_21=0x06
-PacketCallFunc_21=OnAddPoint
-
-PacketCMD_22=0xA2
-PacketSubCMD_22=0x33
-PacketCallFunc_22=OnClientExitCustomScene
-
-PacketCMD_23=0xB2
-PacketSubCMD_23=0x07
-PacketCallFunc_23=OnResetAttrPoint
+PacketSubCMD_21=0x07
+PacketCallFunc_21=OnResetAttrPoint
 
 ;购买相关的
 [BuySomething]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py
index 13a2f31..207e56b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py
@@ -35,26 +35,12 @@
         GameWorld.DebugAnswer(curPlayer, "开启所有功能: OpenFunc 1")
         GameWorld.DebugAnswer(curPlayer, "开启指定功能: OpenFunc 1 功能ID")
         GameWorld.DebugAnswer(curPlayer, "关闭所有功能: OpenFunc 0")
+        GameWorld.DebugAnswer(curPlayer, "关闭指定功能: OpenFunc 0 功能ID")
     else:
         state = cmdList[0]
         if not state:
-            curPlayer.SetLV(1)
-            curPlayer.SetOfficialRank(0)
-            ipyDataMgr = IpyGameDataPY.IPY_Data()
-            for i in xrange(ipyDataMgr.GetTreasureCount()):
-                ipyData = ipyDataMgr.GetTreasureByIndex(i)
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponLV % ipyData.GetID(), 0)
-                
-            for keyNum in xrange(8):
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncFirstTouch % keyNum, 0)
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState % keyNum, 0)
-                
-            needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit([])
-            for missionID in needMissionIDList:
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_MissionFinish % missionID, 0)
-            
-            GameFuncComm.Sync_FuncOpenState(curPlayer, isSyncUnOpen=True)
-            GameWorld.DebugAnswer(curPlayer, "关闭所有功能!")
+            closeFuncID = cmdList[1] if len(cmdList) > 1 else 0
+            DoGMCloseFunc(curPlayer, closeFuncID)
         else:
             openFuncID = cmdList[1] if len(cmdList) > 1 else 0
             DoGMOpenFunc(curPlayer, openFuncID)
@@ -168,3 +154,55 @@
             needMissionIDList.append(limitMissionID)
     return needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList
 
+def DoGMCloseFunc(curPlayer, closeFuncID):
+    ## GM关闭功能
+    if not closeFuncID:
+        curPlayer.SetLV(1)
+        curPlayer.SetOfficialRank(0)
+        ipyDataMgr = IpyGameDataPY.IPY_Data()
+        for i in xrange(ipyDataMgr.GetTreasureCount()):
+            ipyData = ipyDataMgr.GetTreasureByIndex(i)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponLV % ipyData.GetID(), 0)
+            
+        for keyNum in xrange(8):
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncFirstTouch % keyNum, 0)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState % keyNum, 0)
+            
+        needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit([])
+        for missionID in needMissionIDList:
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_MissionFinish % missionID, 0)
+        
+        GameFuncComm.Sync_FuncOpenState(curPlayer, isSyncUnOpen=True)
+        GameWorld.DebugAnswer(curPlayer, "关闭所有功能!")
+        return
+    
+    if not GameFuncComm.GetFuncCanUse(curPlayer, closeFuncID):
+        GameWorld.DebugLog("功能已关闭,不需要重复关闭! closeFuncID=%s" % closeFuncID, curPlayer.GetPlayerID())
+        return
+    
+    ipyData = IpyGameDataPY.GetIpyGameData("FuncOpenLV", closeFuncID)
+    if not ipyData:
+        return
+    
+    limitLV = ipyData.GetLimitLV()
+    if limitLV and curPlayer.GetLV() >= limitLV:
+        curPlayer.SetLV(max(1, limitLV - 1))
+        PlayerControl.SetPlayerTotalExp(curPlayer, 0)
+        
+    limitRealmLV = ipyData.GetLimiRealmLV()
+    if limitRealmLV and curPlayer.GetOfficialRank() >= limitRealmLV:
+        curPlayer.SetOfficialRank(max(0, limitRealmLV - 1))
+        
+    limitMagicWeaponID = ipyData.GetLimitMagicWeapon()
+    if limitMagicWeaponID:
+        mwID = limitMagicWeaponID / 100
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponLV % mwID, 0)
+        
+    limitMissionID = ipyData.GetLimitMissionID()
+    if limitMissionID:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_MissionFinish % limitMissionID, 0)
+            
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GameFuncFirstTouch, closeFuncID, 0)
+    GameFuncComm.Sync_FuncOpenState(curPlayer, isSyncUnOpen=True)
+    GameWorld.DebugAnswer(curPlayer, "关闭功能: %s" % closeFuncID)
+    return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 00217a8..382d5a4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -1959,7 +1959,7 @@
     ''' 召唤私有专属木桩怪
     '''
     
-    maxCount = 5
+    maxCount = 10
     nowCount = 0
     # 只允许存在一个私有木桩
     indexList = range(curPlayer.GetSummonCount())
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 09a9291..1c183d8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -229,64 +229,6 @@
     
     return
 
-#// A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
-#
-#struct    tagCMClientStartCustomScene
-#{
-#    tagHead        Head;
-#    DWORD        MapID;
-#    WORD        FuncLineID;
-#};
-def OnClientStartCustomScene(index, clientData, tick):
-    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
-    DoEnterCustomScene(curPlayer, clientData.MapID, clientData.FuncLineID)
-    return
-
-#// A2 33 前端退出自定义场景 #tagCMClientExitCustomScene
-#
-#struct    tagCMClientExitCustomScene
-#{
-#    tagHead        Head;
-#};
-def OnClientExitCustomScene(index, clientData, tick):
-    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
-    DoExitCustomScene(curPlayer)
-    return
-
-def DoEnterCustomScene(curPlayer, mapID, lineID):
-    ## 进入自定义场景状态
-    curPlayer.SetCanAttack(False)
-    curPlayer.SetVisible(False)
-    curPlayer.SetSight(0)
-    curPet = curPlayer.GetPetMgr().GetFightPet()
-    if curPet:
-        curPet.SetVisible(False)
-        
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneMapID, mapID)
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneLineID, lineID)
-    GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
-    if mapID:
-        FBLogic.OnEnterCustomScene(curPlayer, mapID, lineID)
-    return
-
-def DoExitCustomScene(curPlayer):
-    ## 退出自定义场景状态
-    curPlayer.SetCanAttack(True)
-    curPlayer.SetVisible(True)
-    curPlayer.SetSight(1)
-    curPlayer.RefreshView()
-    curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
-    curPlayer.RefreshView()
-    curPet = curPlayer.GetPetMgr().GetFightPet()
-    if curPet:
-        curPet.SetVisible(True)
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneMapID, 0)
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneLineID, 0)
-    GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
-    return
-
 #// A1 08 刷新主服角色信息 #tagCMRefreshMainServerRole
 #
 #struct tagCMRefreshMainServerRole
@@ -316,7 +258,7 @@
         CrossRealmPlayer.DoExitCrossRealm(curPlayer)
         
     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
-        DoExitCustomScene(curPlayer)
+        PlayerFB.DoExitCustomScene(curPlayer)
         
     msgInfo = ""
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "RefreshMainServerRole", msgInfo, len(msgInfo))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
index 7380b23..cf0ec44 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -453,6 +453,82 @@
     FBLogic.OnClientStartFB(curPlayer, tick)
     return
 
+#// A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
+#
+#struct    tagCMClientStartCustomScene
+#{
+#    tagHead        Head;
+#    DWORD        MapID;
+#    WORD        FuncLineID;
+#};
+def OnClientStartCustomScene(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    mapID = clientData.MapID
+    funcLineID = clientData.FuncLineID
+    DoEnterCustomScene(curPlayer, mapID, funcLineID, tick)
+    return
+
+#// A2 33 前端退出自定义场景 #tagCMClientExitCustomScene
+#
+#struct    tagCMClientExitCustomScene
+#{
+#    tagHead        Head;
+#};
+def OnClientExitCustomScene(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    DoExitCustomScene(curPlayer)
+    return
+
+def DoEnterCustomScene(curPlayer, mapID, lineID, tick):
+    ## 进入自定义场景状态
+    
+    resultPack = ChPyNetSendPack.tagMCStartCustomSceneResult()
+    resultPack.MapID = mapID
+    resultPack.FuncLineID = lineID
+    
+    #进入副本通用检查
+    fbIpyData = None if not mapID else FBCommon.GetFBIpyData(mapID)
+    fbLineIpyData = None if not mapID else FBCommon.GetFBLineIpyData(mapID, lineID)
+    if PlayerControl.CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK:
+        resultPack.Result = 0
+        NetPackCommon.SendFakePack(curPlayer, resultPack)
+        return
+    
+    curPlayer.SetCanAttack(False)
+    curPlayer.SetVisible(False)
+    curPlayer.SetSight(0)
+    curPet = curPlayer.GetPetMgr().GetFightPet()
+    if curPet:
+        curPet.SetVisible(False)
+        
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneMapID, mapID)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneLineID, lineID)
+    GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
+    if mapID:
+        FBLogic.OnEnterCustomScene(curPlayer, mapID, lineID)
+        
+    #通知进入状态
+    resultPack.Result = 1
+    NetPackCommon.SendFakePack(curPlayer, resultPack)
+    return
+
+def DoExitCustomScene(curPlayer):
+    ## 退出自定义场景状态
+    curPlayer.SetCanAttack(True)
+    curPlayer.SetVisible(True)
+    curPlayer.SetSight(1)
+    curPlayer.RefreshView()
+    curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
+    curPlayer.RefreshView()
+    curPet = curPlayer.GetPetMgr().GetFightPet()
+    if curPet:
+        curPet.SetVisible(True)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneMapID, 0)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneLineID, 0)
+    GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
+    return
 
 #// B1 08 刷新自定义副本奖励 #tagCMRefreshCustomFBPrize
 #

--
Gitblit v1.8.0