From 873fd2b448fc038733d58779ac7ca12d2e4fdb80 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 30 十月 2020 16:35:58 +0800
Subject: [PATCH] 1111 【主干】【长尾】【BT】 GM工具增加直接激活称号命令;

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py |   82 +++++++++++++++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py                                     |   76 +++++++++++++++++++++++++
 2 files changed, 158 insertions(+), 0 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py
new file mode 100644
index 0000000..9454e82
--- /dev/null
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.GMT_AddTitle
+#
+# @todo:激活称号
+# @author hxp
+# @date 2020-10-30
+# @version 1.0
+#
+# 详细描述: 激活称号
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2020-10-30 17:30"""
+#-------------------------------------------------------------------------------
+
+
+#导入
+import GMCommon
+import ChConfig
+import GameWorld
+#import GMShell
+
+
+## 执行逻辑
+#  @param curPlayer 当前玩家
+#  @param gmCmdDict: 命令字典
+#  @return None
+#  @remarks 函数详细说明.
+def OnExec(orderId, gmCmdDict):
+    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
+    playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
+    titleID = GameWorld.ToIntDef(gmCmdDict.get('titleID', ''), 0)
+    expireTime = GameWorld.ToIntDef(gmCmdDict.get('expireTime', ''), 0)
+    
+    if titleID <= 0:
+        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
+        return
+    
+    tagPlayer = None
+    playerManager = GameWorld.GetPlayerManager()
+    
+    if queryType == GMCommon.Def_GMKey_PlayerAccID:
+        queryType = ChConfig.queryType_sqtPlayerByAccID
+        tagPlayer = playerManager.FindPlayerByAccID(str(playerFind))
+    
+    elif queryType == GMCommon.Def_GMKey_PlayerName:
+        queryType = ChConfig.queryType_sqtPlayerByName
+        tagPlayer = playerManager.FindPlayerByName(str(playerFind))
+    
+    else:
+        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
+        return
+    
+    if not tagPlayer:
+        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_PlayerOfLine)
+#        # 玩家不在线,先记录,等玩家上线后处理
+#        GMShell.AddOfflinePlayerGMTInfo(orderId, queryType, playerFind, gmCmdDict)
+        return
+    
+    isOnlineGMT = True # 是否是在线接收的GM工具命令
+    GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, "GMTAddTitle", [orderId, isOnlineGMT, titleID, expireTime], False)
+    return
+
+#def OnOfflineGMTInfo(curPlayer, tagMapID, gmCmdDict):
+#    orderId = gmCmdDict.get('orderId', '')
+#    titleID = GameWorld.ToIntDef(gmCmdDict.get('titleID', ''), 0)
+#    expireTime = GameWorld.ToIntDef(gmCmdDict.get('expireTime', ''), 0)
+#    isOnlineGMT = False # 是否是在线接收的GM工具命令
+#    cmdStr = str([orderId, isOnlineGMT, titleID, expireTime])
+#    GameWorld.GetPlayerManager().MapServer_QueryPlayer(0, 0, curPlayer.GetPlayerID(), tagMapID, 'GMTAddTitle',
+#                                                       cmdStr, len(cmdStr), curPlayer.GetRouteServerIndex())
+#    return
+
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py
new file mode 100644
index 0000000..7d8b132
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py
@@ -0,0 +1,82 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package Player.RemoteQuery.GY_Query_GMTAddTitle
+#
+# @todo:激活称号
+# @author hxp
+# @date 2020-10-30
+# @version 1.0
+#
+# 详细描述: 激活称号
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2020-10-30 17:00"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import DataRecordPack
+import GMCommon
+import PlayerDienstgrad
+
+#---------------------------------------------------------------------
+#全局变量
+#---------------------------------------------------------------------
+#---------------------------------------------------------------------
+#逻辑实现 
+## 请求逻辑  
+#  @param query_Type 请求类型
+#  @param query_ID 玩家ID
+#  @param packCMDList 发包命令 
+#  @param tick 当前时间
+#  @return "True" or "False" or ""
+#  @remarks 函数详细说明.
+def DoLogic(query_Type, query_ID, packCMDList, tick):
+    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)
+    
+    if not curPlayer or curPlayer.IsEmpty():
+        return
+    
+    Result = GMCommon.Def_Success
+    orderId, isOnlineGMT, titleID, expireTime = packCMDList
+    
+    isOK = PlayerDienstgrad.PlayerAddDienstgrad(curPlayer, titleID, expireTime=expireTime)
+    if not isOK:
+        errorMsg = "Add fail! Please check that the ID(%s) is correct." % titleID
+        GameWorld.Log("GMT_AddTitle, errorMsg=%s" % errorMsg, curPlayer.GetPlayerID())
+        resultMsg = str([orderId, errorMsg, 'GMT_AddTitle', GMCommon.Def_Unknow])
+        GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
+        return
+    
+    resultDict = {"titleID":titleID, "expireTime":expireTime, "isOnlineGMT":isOnlineGMT}
+    GameWorld.Log("GMT_AddTitle, isOnlineGMT=%s,resultDict=%s" % (isOnlineGMT, resultDict), curPlayer.GetPlayerID())
+    #流向 记录
+    DataRecordPack.DR_ToolGMOperate(query_ID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), 'GMT_AddTitle', resultDict)
+    
+    if isOnlineGMT:
+        resultMsg = str([orderId, resultDict, 'GMT_AddTitle', Result])
+        GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
+        
+    return
+
+#---------------------------------------------------------------------
+#执行结果
+## 执行结果
+#  @param curPlayer 发出请求的玩家
+#  @param callFunName 功能名称
+#  @param funResult 查询的结果
+#  @param tick 当前时间
+#  @return None
+#  @remarks 函数详细说明.
+def DoResult(curPlayer, callFunName, funResult, tick):
+    return
+
+
+
+
+
+
+
+
+

--
Gitblit v1.8.0