From 30a4b0bd9f63d27e633c5b3aac319eafb03ebf1e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 29 七月 2025 12:02:01 +0800
Subject: [PATCH] 1111 【btmdb2】增加GMTExec命令: TotalRecharge
---
ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py | 50 +++++++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
index 2bc0744..c7b5484 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
@@ -19,6 +19,7 @@
import GameWorld
import Commands
import IPY_GameServer
+import CrossRealmMsg
import PyGameData
import traceback
import GMCommon
@@ -86,15 +87,23 @@
GameWorld.Log("###使用GM命令 = %s错误,玩家不是GM"%(callFunName), curPlayer.GetPlayerID())
return
- #非跨服服务器下使用跨服专属GM命令,则发送到跨服
+ #把剩余参数转换为整型
+ 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)
- #MergeChildMsg.SendMergerChildToCenterStringData(ShareDefine.ClientServerMsg_GMCMD, alist)
- return
-
+ CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_GMCMD, {"cmdMsgList":alist + extendParamList})
+
callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnExec"))
if callFunc == None:
#没有此命令
@@ -102,18 +111,11 @@
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
+ isSendToDB = callFunc(curPlayer, alist[1:])
+ if isSendToDB:
+ msg = str(alist)
+ GameWorld.GetGameWorld().SendDBLogic(ChConfig.gstDBLogic_GMCmd, 0, msg, len(msg))
- callFunc(curPlayer,alist)
-
except BaseException:
GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看GameServer日志!")
errorMsg = str(traceback.format_exc())
@@ -206,11 +208,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
@@ -245,7 +244,12 @@
return cmdDict
## 收到子服务器发送的GM命令
-def ClientServerMsg_GMCMD(cmdMsgList, tick):
+def ClientServerMsg_GMCMD(msgData, tick):
+ cmdMsgList = msgData["cmdMsgList"]
+ dbAnswerList = msgData.get("dbAnswerList", [])
+ for dbAnswer in dbAnswerList:
+ GameWorld.DebugAnswer(None, dbAnswer)
+
if len(cmdMsgList) == 0:
return
@@ -267,7 +271,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 +297,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)
--
Gitblit v1.8.0