From c9f2150adf55d0464352ac53fabaaecc572b7a37 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 14 一月 2020 14:10:48 +0800
Subject: [PATCH] 4662 【主干】boss之家内不能换层

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py |   72 +++++++++++++++++++++++++++--------
 1 files changed, 55 insertions(+), 17 deletions(-)

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

--
Gitblit v1.8.0