hxp
2021-04-14 9ed7a50c30881fd97a44c9fef82e1e4d97fcdff8
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/GMShell.py
@@ -30,6 +30,7 @@
import traceback
import PlayerTJG
import FBLogic
import GameObj
#---------------------------------------------------------------------
#---------------------------------------------------------------------
@@ -103,7 +104,7 @@
            del inputList[0]
            #把剩余参数转换为整型
            for i in range(0, len(inputList)):
                value = GameWorld.ToIntDef(inputList[i], None)
                value = GameWorld.ToNumDef(inputList[i], None)
                if value == None:
                    #GameWorld.DebugAnswer(curPlayer, "参数错误, 必须为纯数字!")
                    continue
@@ -113,14 +114,14 @@
            DR_UseGMCMD(curPlayer, inputStr)
            return
        
        # curPlayer 的 Get、Set函数
        if hasattr(curPlayer, callFunName):
            callObj = getattr(curPlayer, callFunName)
        # GameObj 的 Get、Set函数
        if hasattr(GameObj, callFunName):
            callObj = getattr(GameObj, callFunName)
            argcount = callObj.func_code.co_argcount # 函数参数个数
            
            if argcount == 1 and callFunName.startswith("Get"): # 这个得到的参数个数竟然是1!!!暂时先这样写
                value = callObj()
            elif argcount == 1 and callFunName.startswith("Set"):
            if argcount == 1 and callFunName.startswith("Get"):
                value = callObj(curPlayer)
            elif argcount >= 2 and callFunName.startswith("Set"):
                if len(inputList) < 2:
                    GameWorld.DebugAnswer(curPlayer, "必须设定一定参数值")
                    return
@@ -128,12 +129,9 @@
                if value == None:
                    GameWorld.DebugAnswer(curPlayer, "参数错误, 必须为纯数字!")
                    return
                if callFunName == "SetHappyPoint":
                    PlayerTJG.SetTJGTime(curPlayer, value)
                else:
                    callObj(value)
                callObj(curPlayer, value)
            else:
                GameWorld.DebugAnswer(curPlayer, "不支持该命令!curPlayer.%s" % callFunName)
                GameWorld.DebugAnswer(curPlayer, "不支持该命令!GameObj.%s" % callFunName)
                return
            
            GameWorld.DebugAnswer(curPlayer, "%s : %s" % (callFunName, value))
@@ -164,6 +162,33 @@
            DR_UseGMCMD(curPlayer, inputStr)
            return
        
        # curPlayer 的 Get、Set函数
        if hasattr(curPlayer, callFunName):
            callObj = getattr(curPlayer, callFunName)
            argcount = callObj.func_code.co_argcount # 函数参数个数
            if argcount == 1 and callFunName.startswith("Get"): # 这个得到的参数个数竟然是1!!!暂时先这样写
                value = callObj()
            elif argcount == 1 and callFunName.startswith("Set"):
                if len(inputList) < 2:
                    GameWorld.DebugAnswer(curPlayer, "必须设定一定参数值")
                    return
                value = GameWorld.ToIntDef(inputList[1], None)
                if value == None:
                    GameWorld.DebugAnswer(curPlayer, "参数错误, 必须为纯数字!")
                    return
                if callFunName == "SetHappyPoint":
                    PlayerTJG.SetTJGTime(curPlayer, value)
                else:
                    callObj(value)
            else:
                GameWorld.DebugAnswer(curPlayer, "不支持该命令!curPlayer.%s" % callFunName)
                return
            GameWorld.DebugAnswer(curPlayer, "%s : %s" % (callFunName, value))
            DR_UseGMCMD(curPlayer, inputStr)
            return
        curPlayer.GameServer_GMCmd(inputStr)
    except BaseException:
        GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看所在地图日志!")