hxp
2025-06-30 388823edfe6308cba6f76ca6dc4f20022c5cb2be
ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
@@ -87,13 +87,22 @@
            GameWorld.Log("###使用GM命令 = %s错误,玩家不是GM"%(callFunName), curPlayer.GetPlayerID())
            return
        
        #把剩余参数转换为整型
        for i in range(0, len(alist)):
            if i == 0:
                continue
            value = GameWorld.ToIntDef(alist[i], None)
            if value == None:
                #GameWorld.DebugAnswer(curPlayer, "参数错误, 参数%s必须为纯数字!" % (i + 1))
                continue
            alist[i] = value
        #非跨服服务器下使用跨服GM命令,则发送到跨服
        if not GameWorld.IsCrossServer():
            callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnGetMergeParam"))
            if callFunc != None:
                extendParamList = callFunc(curPlayer)
                alist.extend(extendParamList)
                CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_GMCMD, alist)
                CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_GMCMD, alist + extendParamList)
                
        callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnExec"))
        if callFunc == None:
@@ -102,17 +111,7 @@
            GameWorld.DebugAnswer(curPlayer, 'no cmd !!!')
            return
        
        #删除命令,只将参数传入
        del alist[0]
        #把剩余参数转换为整型
        for i in range(0, len(alist)):
            value = GameWorld.ToIntDef(alist[i], None)
            if value == None:
                #GameWorld.DebugAnswer(curPlayer, "参数错误, 参数%s必须为纯数字!" % (i + 1))
                continue
            alist[i] = value
        callFunc(curPlayer,alist)
        callFunc(curPlayer, alist[1:])
        
    except BaseException:
        GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看GameServer日志!")
@@ -206,11 +205,8 @@
        callFunc(orderId, cmdDict)
        
    except BaseException:
        GameWorld.Log('GM命令错误 - > %s'%(traceback.format_exc()))
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_GMGSEntranceFail)
        if GameWorld.GetGameWorld().GetDebugLevel():
            raise BaseException(str(traceback.format_exc()))
        GameWorld.RaiseException('GM命令错误\r\n%s'%(traceback.format_exc()))
        return 
    return 
@@ -267,7 +263,7 @@
    ctgInfoList.append(gmCmdDict)
    PyGameData.g_gmtOfflinePlayerInfo[key] = ctgInfoList
    GameWorld.Log("离线玩家添加GMT: g_gmtOfflinePlayerInfo=%s" % str(PyGameData.g_gmtOfflinePlayerInfo))
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, "Player is off line.")
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, "玩家不在线,将在上线后自动处理")
    return
def OnPlayerLogin(curPlayer):
@@ -293,7 +289,7 @@
        if not pack_type:
            continue
        
        callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(pack_type, "OnOfflineCTGInfo"))
        callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(pack_type, "OnOfflineGMTInfo"))
        if callFunc:
            GameWorld.Log("玩家上线执行GMT: %s, tagMapID=%s, %s" % (pack_type, tagMapID, gmCmdDict), curPlayer.GetPlayerID())
            callFunc(curPlayer, tagMapID, gmCmdDict)