From a92b22667c5c3fb2844a69603e2a2eea284c9f26 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 25 五月 2019 15:36:50 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py |   69 +++++++++++++++++++++++++++-------
 1 files changed, 55 insertions(+), 14 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 5d4e613..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,23 +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)
-            for mwType in xrange(1, 6):
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive % (mwType, 0), 0)
-                
-            for keyNum in xrange(8):
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncFirstTouch % 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)
@@ -165,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