From 353abbde135d54f74b70d66d4a04679313f85f34 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 10 一月 2020 15:15:37 +0800
Subject: [PATCH] 8346 【恺英】【后端】协助系统(副本boss协助完成增加发送退出副本倒计时)

---
 ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py |   86 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 64 insertions(+), 22 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
index 8378604..6f97c43 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
@@ -19,9 +19,11 @@
 import GameWorld
 import Commands
 import IPY_GameServer
-import MergeChildMsg
+import CrossRealmMsg
+import PyGameData
 import traceback
 import GMCommon
+import ShareDefine
 import os
 #---------------------------------------------------------------------
 g_broadCastList = []
@@ -69,13 +71,13 @@
     try:
         gmCmd = IPY_GameServer.IPY_GGMCmd()
         inputStr = gmCmd.GetMsg()
-        list = inputStr.split()
-        if len(list) == 0:
+        alist = inputStr.split()
+        if len(alist) == 0:
             return 
         
         curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
         
-        callFunName = list[0]
+        callFunName = alist[0]
         # 特殊的命令不验证GM等级,在MapServer已验证账号
         if callFunName.startswith("@"):
             callFunName = "GMS_%s" % (callFunName[1:].capitalize())
@@ -85,15 +87,14 @@
             GameWorld.Log("###使用GM命令 = %s错误,玩家不是GM"%(callFunName), curPlayer.GetPlayerID())
             return
         
-        #非跨服服务器下使用跨服专属GM命令,则发送到跨服
-        if not GameWorld.IsMergeServer():
+        #非跨服服务器下使用跨服GM命令,则发送到跨服
+        if not GameWorld.IsCrossServer():
             callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnGetMergeParam"))
             if callFunc != None:
                 extendParamList = callFunc(curPlayer)
-                list.extend(extendParamList)
-                MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_SendGMCMD, list)
-                return
-            
+                alist.extend(extendParamList)
+                CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_GMCMD, alist)
+                
         callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnExec"))
         if callFunc == None:
             #没有此命令
@@ -102,25 +103,25 @@
             return
         
         #删除命令,只将参数传入
-        del list[0]
+        del alist[0]
         #把剩余参数转换为整型
-        for i in range(0, len(list)):
-            if i == 0 and callFunName in ["testMail", "SetPlayerDBGSEvent"]:
-                continue
-            value = GameWorld.ToIntDef(list[i], None)
+        for i in range(0, len(alist)):
+            value = GameWorld.ToIntDef(alist[i], None)
             if value == None:
-                GameWorld.DebugAnswer(curPlayer, "参数错误, 参数%s必须为纯数字!" % (i + 1))
-                return
-            list[i] = value
+                #GameWorld.DebugAnswer(curPlayer, "参数错误, 参数%s必须为纯数字!" % (i + 1))
+                continue
+            alist[i] = value
             
-        callFunc(curPlayer,list)
+        callFunc(curPlayer,alist)
         
     except BaseException:
         GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看GameServer日志!")
         errorMsg = str(traceback.format_exc())
         GameWorld.ErrLog('GM命令错误 - > %s'%(errorMsg) , curPlayer.GetPlayerID())
-        if GameWorld.GetGameWorld().GetDebugLevel():
-            raise BaseException(errorMsg)
+        #=======================================================================
+        # if GameWorld.GetGameWorld().GetDebugLevel():
+        #    raise BaseException(errorMsg)
+        #=======================================================================
         return
 #---------------------------------------------------------------------
 #===============================================================================
@@ -244,7 +245,7 @@
     return cmdDict
 
 ## 收到子服务器发送的GM命令
-def ClientServer_SendGMCMD(cmdMsgList, tick):
+def ClientServerMsg_GMCMD(cmdMsgList, tick):
     if len(cmdMsgList) == 0:
         return 
     
@@ -258,3 +259,44 @@
     #只将实际参数传入
     callFunc(cmdMsgList[1:], tick)
     return
+
+def AddOfflinePlayerGMTInfo(orderId, queryType, playerFind, gmCmdDict):
+    # 玩家不在线,先记录,等玩家上线后处理,开关服后无效
+    key = (queryType, playerFind)
+    ctgInfoList = PyGameData.g_gmtOfflinePlayerInfo.get(key, [])
+    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.")
+    return
+
+def OnPlayerLogin(curPlayer):
+    gmtList = []
+    nameKey = (ChConfig.queryType_sqtPlayerByName, curPlayer.GetName())
+    if nameKey in PyGameData.g_gmtOfflinePlayerInfo:
+        gmtList += PyGameData.g_gmtOfflinePlayerInfo.pop(nameKey)
+        
+    accIDKey = (ChConfig.queryType_sqtPlayerByAccID, curPlayer.GetAccID())
+    if accIDKey in PyGameData.g_gmtOfflinePlayerInfo:
+        gmtList += PyGameData.g_gmtOfflinePlayerInfo.pop(accIDKey)
+        
+    if not gmtList:
+        return
+    
+    tagMapID = curPlayer.GetRealMapID()
+    GameWorld.Log("离线玩家上线GMT: tagMapID=%s, %s" % (tagMapID, gmtList), curPlayer.GetPlayerID())
+    if not tagMapID:
+        return
+    
+    for gmCmdDict in gmtList:
+        pack_type = gmCmdDict.get("pack_type")
+        if not pack_type:
+            continue
+        
+        callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(pack_type, "OnOfflineCTGInfo"))
+        if callFunc:
+            GameWorld.Log("玩家上线执行GMT: %s, tagMapID=%s, %s" % (pack_type, tagMapID, gmCmdDict), curPlayer.GetPlayerID())
+            callFunc(curPlayer, tagMapID, gmCmdDict)
+            
+    return
+

--
Gitblit v1.8.0