hxp
2020-10-30 873fd2b448fc038733d58779ac7ca12d2e4fdb80
1111 【主干】【长尾】【BT】 GM工具增加直接激活称号命令;
2个文件已添加
158 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py
New file
@@ -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
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py
New file
@@ -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