From 9899bc2038b600b0943e97cac12f7d2722eb614f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 29 九月 2018 00:00:30 +0800
Subject: [PATCH] 3942 【开发】GM后台工具支持发放法宝灵魂

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

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
index d5b2bdf..943407b 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py
@@ -20,6 +20,7 @@
 import Commands
 import IPY_GameServer
 import MergeChildMsg
+import PyGameData
 import traceback
 import GMCommon
 import os
@@ -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