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/PyGameData.py | 1 ServerPython/CoreServerGroup/GameServer/Script/GM/GMShell.py | 42 ++++++++++ ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py | 2 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTMagicWeaponExp.py | 92 +++++++++++++++++++++++ ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_MagicWeaponExp.py | 70 +++++++++++++++++ 5 files changed, 207 insertions(+), 0 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_MagicWeaponExp.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_MagicWeaponExp.py new file mode 100644 index 0000000..e3f7ed4 --- /dev/null +++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_MagicWeaponExp.py @@ -0,0 +1,70 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package GM.Commands.GMT_MagicWeaponExp +# +# @todo:法宝灵魂 +# @author hxp +# @date 2018-09-29 +# @version 1.0 +# +# 详细描述: 法宝灵魂 +# +#------------------------------------------------------------------------------- +#"""Version = 2018-09-29 00:00:00""" +#------------------------------------------------------------------------------- + +#导入 +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, '') + mwID = GameWorld.ToIntDef(gmCmdDict.get('mwID', ''), 0) + mwExp = GameWorld.ToIntDef(gmCmdDict.get('mwExp', ''), 0) + + 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: + # 玩家不在线,先记录,等玩家上线后处理 + GMShell.AddOfflinePlayerGMTInfo(orderId, queryType, playerFind, gmCmdDict) + return + + isOnlineGMT = True # 是否是在线接收的GM工具命令 + GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, "GMTMagicWeaponExp", [orderId, mwID, mwExp, isOnlineGMT], False) + return + +def OnOfflineCTGInfo(curPlayer, tagMapID, gmCmdDict): + orderId = gmCmdDict.get('orderId', '') + mwID = GameWorld.ToIntDef(gmCmdDict.get('mwID', ''), 0) + mwExp = GameWorld.ToIntDef(gmCmdDict.get('mwExp', ''), 0) + isOnlineGMT = False # 是否是在线接收的GM工具命令 + cmdStr = str([orderId, mwID, mwExp, isOnlineGMT]) + GameWorld.GetPlayerManager().MapServer_QueryPlayer(0, 0, curPlayer.GetPlayerID(), tagMapID, 'GMTMagicWeaponExp', + cmdStr, len(cmdStr), curPlayer.GetRouteServerIndex()) + return + + 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 + diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py index e6e8440..4452fb6 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py @@ -66,6 +66,7 @@ import GameWorldActionControl import GMT_CTG import PyGameData +import GMShell #--------------------------------------------------------------------- #--------------------------------------------------------------------- @@ -158,6 +159,7 @@ #玩家等级记录 PyGameData.g_todayPlayerLVDict[curPlayer.GetID()] = curPlayer.GetLV() + GMShell.OnPlayerLogin(curPlayer) GMT_CTG.OnPlayerLogin(curPlayer) #通知地图服务器自己初始化成功 diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py index 07ce69e..8873ab7 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py @@ -70,6 +70,7 @@ g_yesterdayPlayerLVDict = {} #昨日玩家等级字典{playerID:lv,..} g_ctgOfflinePlayerInfo = {} # {playerID:[[ctgInfo], ...], ...} # 离线玩家CTG信息缓存 +g_gmtOfflinePlayerInfo = {} # {(queryType, playerFind):[gmtInfo, ...], ...} # 离线玩家GMT信息缓存 g_questionIDHistory = {}#出过的题记录 {familyid:[出过的题id,..]} g_familyAnswerDict = {} #仙盟答题数量 {familyid:[答题数量,tick],..} diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTMagicWeaponExp.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTMagicWeaponExp.py new file mode 100644 index 0000000..0f6de81 --- /dev/null +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTMagicWeaponExp.py @@ -0,0 +1,92 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package Player.RemoteQuery.GY_Query_GMTMagicWeaponExp +# +# @todo:法宝灵魂 +# @author hxp +# @date 2018-09-29 +# @version 1.0 +# +# 详细描述: 法宝灵魂 +# +#------------------------------------------------------------------------------- +#"""Version = 2018-09-29 00:00:00""" +#------------------------------------------------------------------------------- + +import GameWorld +import DataRecordPack +import PlayerMagicWeapon +import PlayerControl +import ChConfig +import GMCommon +#--------------------------------------------------------------------- +#全局变量 +#--------------------------------------------------------------------- +#--------------------------------------------------------------------- +#逻辑实现 +## 请求逻辑 +# @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, mwID, mwExp, isOnlineGMT = packCMDList + + errorMsg = "" + ipyData = PlayerMagicWeapon.GetWMIpyData(mwID) + if not ipyData: + errorMsg = "Error: magic weapon id(%s) is not exist." % mwID + elif mwExp > ChConfig.Def_UpperLimit_DWord: + errorMsg = "Error: set exp value(%s) is error." % mwExp + + if errorMsg: + GameWorld.Log("GMT_MagicWeaponExp, errorMsg=%s" % errorMsg, curPlayer.GetPlayerID()) + resultMsg = str([orderId, errorMsg, 'GMT_MagicWeaponExp', GMCommon.Def_ParamErr]) + GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg)) + return + + curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID) + if mwExp != curExp: + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, mwExp) + PlayerMagicWeapon.Sycn_MagicWeaponLV(curPlayer, mwID) + + resultDict = {"mwID":mwID, "mwExp":mwExp, "curExp":curExp, "isOnlineGMT":isOnlineGMT} + GameWorld.Log("GMT_MagicWeaponExp, isOnlineGMT=%s,resultDict=%s" % (isOnlineGMT, resultDict), curPlayer.GetPlayerID()) + #流向 记录 + DataRecordPack.DR_ToolGMOperate(query_ID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), 'GMT_MagicWeaponExp', resultDict) + + if isOnlineGMT: + resultMsg = str([orderId, resultDict, 'GMT_MagicWeaponExp', 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