From e4c2a1b331ef0133a010bce5ccdcf3d19db12726 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 07 十一月 2025 14:46:31 +0800
Subject: [PATCH] 237 【福利内容】每日任务/每周任务/章节奖励-服务端(增加物品效果281-给活跃度;每日任务奖励改为配置物品;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/ProjSpecialProcess.py | 145 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 142 insertions(+), 3 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/ProjSpecialProcess.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/ProjSpecialProcess.py
index 24c9bd3..bfa759a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/ProjSpecialProcess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/ProjSpecialProcess.py
@@ -41,6 +41,10 @@
from Common import (CommFuncEx, mylog)
from Protocol import (MMORPGPack, RecvPackProtocol, SendPackProtocol, MergeServerRecvProtocol, MergeServerSendProtocol)
+import PlayerOfflineSupport
+import PyGameData
+import GameWorld
+import DBDataMgr
##################################################################
####### python逻辑入口 #######
@@ -152,6 +156,134 @@
##################################################################
+def GMCmdPlayerListValidationID(gmCmdDict):
+ '''后台GM工具玩家列表命令通用验证
+ @param gmCmdDict: 命令参数字典
+ @return: GMCommon.Def_xxx, idList or errorInfo
+ 非 Def_Success 的错误类型 - 代表错误,可直接返回给后台
+ Def_Success, playerIDList - 待处理的玩家ID列表
+ '''
+ playerList = gmCmdDict.get("playerList", '')
+ playerList = playerList.split(",")
+ if not playerList:
+ return GMCommon.Def_ParamErr, ""
+
+ playerIDList = []
+ queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
+ if queryType in [GMCommon.Def_GMKey_PlayerName, GMCommon.Def_GMKey_PlayerAccID]:
+ for playerFind in playerList:
+ if queryType == GMCommon.Def_GMKey_PlayerName:
+ rec = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind)
+ elif queryType == GMCommon.Def_GMKey_PlayerAccID:
+ rec = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind)
+ else:
+ continue
+
+ if not rec:
+ # db找不到就是不存在该玩家
+ return GMCommon.Def_NoTag, "%s can not found!" % str(playerFind)
+
+ playerID = rec.get(u'PlayerID', 0)
+ playerIDList.append(playerID)
+
+ elif queryType == GMCommon.Def_GMKey_FamilyID:
+ # 根据家族ID的直接返回
+ familyMgr = DBDataMgr.GetFamilyMgr()
+ for familyID in eval(playerList):
+ familyID = GameWorld.ToIntDef(familyID)
+ family = familyMgr.FindFamily(familyID)
+ if not family:
+ GameWorld.DebugLog(" not family %s" % familyID)
+ continue
+ memberIDList = family.GetMemberIDList()
+ playerIDList += memberIDList
+
+ if not playerIDList:
+ return GMCommon.Def_ParamErr, ""
+
+ return GMCommon.Def_Success, playerIDList
+
+def GMCmdPlayerValidationID(gmCmdDict):
+ '''后台GM工具玩家命令通用验证
+ @param gmCmdDict: 命令参数字典
+ @return: GMCommon.Def_xxx, playerID
+ 非 Def_Success 的错误类型 - 代表错误,可直接返回给后台
+ Def_Success, playerID - 本服玩家ID
+ '''
+
+ queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
+ playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
+
+ if len(playerFind) <= 0:
+ return GMCommon.Def_ParamErr, None
+
+ # 玩家姓名
+ if queryType == GMCommon.Def_GMKey_PlayerName:
+ rec = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind)
+ elif queryType == GMCommon.Def_GMKey_PlayerAccID:
+ rec = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind)
+ else:
+ return GMCommon.Def_ParamErr, None
+
+ if not rec:
+ # db找不到就是不存在该玩家
+ return GMCommon.Def_NoTag, None
+
+ playerID = rec.get(u'PlayerID', 0)
+ return GMCommon.Def_Success, playerID
+
+def GMCmdPlayerValidation(gmCmdDict, offlineSupport=True):
+ '''后台GM工具玩家命令通用验证
+ @param gmCmdDict: 命令参数字典
+ @param offlineSupport: 离线玩家是否支持该命令,默认支持,当玩家离线时,会在上线后执行该命令
+ @return: GMCommon.Def_xxx, curPlayer
+ 非 Def_Success 的错误类型 - 代表错误,可直接返回给后台
+ Def_Success, curPlayer - curPlayer为空时代表玩家离线状态
+ '''
+
+ queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
+ playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
+
+ if len(playerFind) <= 0:
+ return GMCommon.Def_ParamErr, None
+
+ # 玩家姓名
+ if queryType == GMCommon.Def_GMKey_PlayerName:
+ rec = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind)
+ elif queryType == GMCommon.Def_GMKey_PlayerAccID:
+ rec = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind)
+ else:
+ return GMCommon.Def_ParamErr, None
+
+ if not rec:
+ # db找不到就是不存在该玩家
+ return GMCommon.Def_NoTag, None
+
+ playerID = rec.get(u'PlayerID', 0)
+ curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
+ if not curPlayer or curPlayer.IsEmpty():
+ # 离线处理
+ if offlineSupport:
+ PlayerOfflineSupport.AddOfflineUnprocessed(playerID, "GMToolCMD", gmCmdDict)
+ return GMCommon.Def_Success, None
+ return GMCommon.Def_PlayerOfLine, None
+
+ return GMCommon.Def_Success, curPlayer
+
+def GMCmdPlayerLogin(curPlayer):
+ PlayerOfflineSupport.DoOfflineUnprocessed(curPlayer, "GMToolCMD", __doOfflineGMToolCMD)
+ return
+
+def __doOfflineGMToolCMD(curPlayer, recData, eventName, eventData):
+ gmCmdDict = eventData
+ if not gmCmdDict or not isinstance(gmCmdDict, dict):
+ return
+ funcName = gmCmdDict.get(GMCommon.Def_GMKey_Type, '')
+ callFunc = GetExecFunc(Commands, "%s.%s" % (funcName, "OnExec"))
+ if callFunc != None:
+ callFunc(gmCmdDict)
+ return
+
## gm命令执行
#
@@ -184,11 +316,18 @@
def GMToolCommand(self):
callFunc = GetExecFunc(Commands, "%s.%s"%(self.funcName, "OnExec"))
- execType = GMCommon.Def_SendToGameServer
+ execType = GMCommon.Def_Unknow
execInfo = ''
if callFunc != None:
- execType, execInfo = callFunc(self.gmCmdDict)
-
+ ret = callFunc(self.gmCmdDict)
+ if isinstance(ret, int):
+ execType = ret
+ elif isinstance(ret, tuple):
+ execType = ret[0]
+ execInfo = ret[1]
+ else:
+ execType = GMCommon.Def_GMCmdNone
+
GetGMOrderMgr().PopCmd(self.orderId)
GMCommandResult(self.orderId, self.funcName, execType, execInfo)
--
Gitblit v1.8.0