ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py
File was deleted ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py
File was deleted ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py
@@ -1,109 +1,107 @@ #!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- #------------------------------------------------------------------------------- # #--------------------------------------------------------------------- ##@package GMT_GetPlayerInfo.py # GM命令,获得玩家信息 ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_GetPlayerInfo # # @author wdb # @date 2012-6-14 # @version 1.6 # @todo:查看玩家 # @author hxp # @date 2025-12-12 # @version 1.0 # # @note # @change: "2012-06-21 15:30" wdb int修改到GMCommon开接口 # @change: "2012-07-12 18:00" wdb 增加编码属性 # @change: "2012-07-30 11:30" wdb GM回复细化,代码优化 # @change: "2012-08-10 17:00" whx 增加仓库密码 # @change: "2015-01-30 02:00" hxp 增加转生次数、转生等级、绑钻信息 # @change: "2015-05-22 14:30" hxp 增加大师等级、战斗力 #--------------------------------------------------------------------- """Version = 2015-05-22 14:30""" #--------------------------------------------------------------------- #导入 from Collections import DataServerPlayerData from MangoDBCommon import fix_incomingText from Collections.CollectionDefine import * import GMCommon #--------------------------------------------------------------------- #全局变量 # 详细描述: 查看玩家 # #------------------------------------------------------------------------------- #"""Version = 2025-12-12 15:00""" #------------------------------------------------------------------------------- #--------------------------------------------------------------------- import GMCommon from Collections.CollectionDefine import (UCN_DSAccount, UCN_RoleNomalDict) from Collections import (DataServerPlayerData) import PlayerControl import IPY_GameWorld import ShareDefine import PyGameData import ChConfig CurrencyMoneyTypeList = [ShareDefine.TYPE_Price_PayCoin, ShareDefine.TYPE_Price_PayCoinDay, ShareDefine.TYPE_Price_Xiantao, ShareDefine.TYPE_Price_Lingyu] ## 收到gm命令执行 # @param gmCmdDict:gm命令字典 # @return None def OnExec(gmCmdDict): playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') if playerFind == '': return GMCommon.Def_ParamErr, '' from GMToolLogicProcess import ProjSpecialProcess Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False) elif queryType == 'accID': return GMCommon.Def_DoQueryLogDB, '' if Result == GMCommon.Def_PlayerOfLine: dbPlayer = curPlayer playerInfo = __getPlayerInfoByDB(dbPlayer) return GMCommon.Def_DoQueryUserDB, '%s'%GMCommon.Def_GMKey_PlayerName ## 查询logdb返回 # @param logdb:logdb # @param data:传入的信息 # @param gmCmdDict:gm命令字典 # @return None def LogDBResponse(logdb, data, gmCmdDict): playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') if queryType == 'accID' and GMCommon.GetPlayerOnLineByAccID(logdb, playerFind): return GMCommon.Def_SendToGameServer, '' # 转换字符串 if data != '' and GMCommon.GetPlayerOnLineByAccID(logdb, data): return GMCommon.Def_SendToGameServer, '' return GMCommon.Def_DoQueryUserDB, '' ## 查询userdb返回 # @param userdb:userdb # @param data:传入的信息 # @param gmCmdDict:gm命令字典 # @return None def UserDBResponse(userdb, data, gmCmdDict): # 转换字符串 playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') # queryType不是accID,发送的信息是玩家的名字 if queryType != 'accID': playerAccID = GMCommon.GetPlayerAccID(userdb, {'PlayerName':fix_incomingText(playerFind), 'IsDeleted':0}) if playerAccID == '': return GMCommon.Def_NoTag, '' elif Result == GMCommon.Def_Success: playerInfo = __getPlayerInfoByPlayer(curPlayer) else: # queryType为accID,发送的信息就是玩家的AccID playerAccID = playerFind return Result # 返回playerid,判断是否在线 if data == '%s'%GMCommon.Def_GMKey_PlayerName: return GMCommon.Def_DoQueryLogDB, playerAccID return GMCommon.Def_Success, playerInfo def __getPlayerInfoByPlayer(curPlayer): ## 从在线取 if not curPlayer: return {} playerInfo = { 'AccID':curPlayer.GetAccID(), # 账号 'AccState':curPlayer.GetAccState(), # 账号状态 'PlayerID':curPlayer.GetPlayerID(), 'Name':curPlayer.GetPlayerName(), # 玩家名 'GMLV':curPlayer.GetGMLevel(), #gm等级 'Job':curPlayer.GetJob(), # ְҵ 'LV':curPlayer.GetLV(), #玩家等级 'OfficialRank':curPlayer.GetOfficialRank(), #境界 'FightPower':PlayerControl.GetFightPower(curPlayer), #战斗力 #'VIPLV':curPlayer.GetVIPLv(), # vip等级 'MapID':curPlayer.GetMapID(), #当前地图id 'Gold':PlayerControl.GetMoneyReal(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money), # 元宝 #'GoldPaper':PlayerControl.GetMoneyReal(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper), # 绑钻 #'Silver':PlayerControl.GetSilver(curPlayer), # 银两 #'SilverPaper':PlayerControl.GetMoneyReal(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Paper), # 神玉 'FamilyName':curPlayer.GetFamilyName(), # 家族名称 'LogoffTime':curPlayer.GetLogoffTime(), #离线时间 'LoginTime':curPlayer.GetLoginTime(), # 上线时间 'LoginIP':curPlayer.GetIP(), #登入IP 'ClientVersion':curPlayer.GetAccountData().GetClientVersion(), #客户端版本号 'Online':1, 'ExAttr1':curPlayer.GetExAttr1(), #过关进度 'TreeLV':curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV) # 祝福数等级 } # 需要额外同步的自定义货币 CurrencyValueDict = {} for moneyType in CurrencyMoneyTypeList: CurrencyValueDict['PlayerCurrency_%s' % moneyType] = PlayerControl.GetMoneyReal(curPlayer, moneyType) playerInfo.update(CurrencyValueDict) return playerInfo def __getPlayerInfoByDB(dbPlayer): if not dbPlayer: return {} accID = dbPlayer.AccID userdb = PyGameData.g_usrCtrlDB.db accountData = DataServerPlayerData.tagDSAccount() accountData.ACCID = playerAccID accountData.ACCID = accID accountData.adoLoad(userdb[UCN_DSAccount]) collection = userdb[UCN_DBPlayer] dbPlayer = DataServerPlayerData.tagDBPlayer() dbPlayer.IsDeleted = 0 loadOK = dbPlayer.adoLoadCEx(collection, {'AccID':fix_incomingText(playerAccID), 'IsDeleted':dbPlayer.IsDeleted}) if not loadOK: # 回复gm return GMCommon.Def_NoTag, '' roleDict = {} moneyMinusDict = {} @@ -134,13 +132,13 @@ 'LV':dbPlayer.LV, #玩家等级 'OfficialRank':dbPlayer.OfficialRank, #境界 'FightPower':dbPlayer.FightPowerEx * 100000000 + dbPlayer.FightPower, #战斗力 'VIPLV':dbPlayer.VIPLv, # vip等级 #'VIPLV':dbPlayer.VIPLv, # vip等级 'MapID':dbPlayer.MapID, #当前地图id 'Gold':moneyMinusDict[1] if 1 in moneyMinusDict else dbPlayer.Gold, # 元宝 'GoldPaper':moneyMinusDict[2] if 2 in moneyMinusDict else dbPlayer.GoldPaper, # 绑钻 'Silver':dbPlayer.Silver, # 银两 'SilverPaper':moneyMinusDict[4] if 4 in moneyMinusDict else dbPlayer.SilverPaper, # 神玉 #'GoldPaper':moneyMinusDict[2] if 2 in moneyMinusDict else dbPlayer.GoldPaper, # 绑钻 #'Silver':dbPlayer.Silver, # 银两 #'SilverPaper':moneyMinusDict[4] if 4 in moneyMinusDict else dbPlayer.SilverPaper, # 神玉 'FamilyName':dbPlayer.FamilyName, # 家族名称 @@ -150,19 +148,19 @@ 'ClientVersion':accountData.ClientVersion, #客户端版本号 'Online':0, 'ExAttr1':dbPlayer.ExAttr1, #过关进度 'TreeLV':roleDict.get(ChConfig.Def_PDict_TreeLV, 0) # 祝福数等级 } # 需要额外同步的自定义货币 CurrencyValueDict = {} for moneyType in [99, 98]: if moneyType == 99: for moneyType in CurrencyMoneyTypeList: if moneyType == ShareDefine.TYPE_Price_PayCoin: moneyValue = dbPlayer.ExAttr11 else: moneyValue = roleDict.get("PlayerCurrency_%s" % moneyType, 0) CurrencyValueDict['PlayerCurrency_%s' % moneyType] = moneyValue playerInfo.update(CurrencyValueDict) return GMCommon.Def_Success, playerInfo return playerInfo ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py
@@ -1,107 +1,101 @@ #!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- #------------------------------------------------------------------------------- # #--------------------------------------------------------------------- ##@package GMT_PlayerItemInfo.py # GM命令获得玩家物品信息 ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_PlayerItemInfo # # @author wdb # @date 2012-6-14 # @version 1.4 # @todo:查看玩家物品 # @author hxp # @date 2025-12-12 # @version 1.0 # # @note # @change: "2012-06-21 15:30" wdb int修改到GMCommon开接口 # @change: "2012-06-29 21:30" wdb 返回信息是否过长 # @change: "2012-07-12 18:00" wdb 增加编码属性 # @change: "2012-07-30 11:30" wdb GM回复细化,代码优化 #--------------------------------------------------------------------- """Version = 2012-07-30 11:30""" #--------------------------------------------------------------------- #导入 from Collections import DataServerPlayerData from MangoDBCommon import fix_incomingText from Collections.CollectionDefine import * # 详细描述: 查看玩家物品 # #------------------------------------------------------------------------------- #"""Version = 2025-12-12 15:00""" #------------------------------------------------------------------------------- import GMCommon #--------------------------------------------------------------------- #全局变量 # 物品userdata的定义key IudetEquipAddSkillList = 3 IudetEquipAddSkillCnt = 4 IudetWakeUpCnt = 12 from Collections.CollectionDefine import (UCN_RoleItem) #from Collections import (DataServerPlayerData) import IPY_GameWorld import ShareDefine import PyGameData import GameWorld # 显示说有背包类型 # 所有背包 ShowAllPack = -1 #--------------------------------------------------------------------- ## 收到gm命令执行 # @param gmCmdDict:gm命令字典 # @return None def OnExec(gmCmdDict): playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') if playerFind == '': return GMCommon.Def_ParamErr, '' from GMToolLogicProcess import ProjSpecialProcess Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False) elif queryType == 'accID': return GMCommon.Def_DoQueryLogDB, '' packIndex = GameWorld.ToIntDef(gmCmdDict.get(GMCommon.Def_GMKey_PackIndex, '')) if packIndex == ShowAllPack: # 暂不提供查询所有的物品 return GMCommon.Def_ParamErr, "Not allowed to query all package items." return GMCommon.Def_DoQueryUserDB, '%s'%GMCommon.Def_GMKey_PlayerName if packIndex < IPY_GameWorld.rptDeleted or packIndex > ShareDefine.rptMax: return GMCommon.Def_ParamErr, "packType error." if Result == GMCommon.Def_PlayerOfLine: dbPlayer = curPlayer itemList = __getPlayerItemByDB(dbPlayer, packIndex) ## 查询logdb返回 # @param logdb:logdb # @param data:传入的信息 # @param gmCmdDict:gm命令字典 # @return None def LogDBResponse(logdb, data, gmCmdDict): playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') elif Result == GMCommon.Def_Success: itemList = __getPlayerItemByPlayer(curPlayer, packIndex) if queryType == 'accID' and GMCommon.GetPlayerOnLineByAccID(logdb, playerFind): return GMCommon.Def_SendToGameServer, '' # 转换字符串 if data != '' and GMCommon.GetPlayerOnLineByAccID(logdb, data): return GMCommon.Def_SendToGameServer, '' return GMCommon.Def_DoQueryUserDB, '' ## 查询userdb返回 # @param userdb:userdb # @param data:传入的信息 # @param gmCmdDict:gm命令字典 # @return None def UserDBResponse(userdb, data, gmCmdDict): # 转换字符串 playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') # queryType不是accID,发送的信息是玩家的名字 if queryType != 'accID': playerAccID = GMCommon.GetPlayerAccID(userdb, {'PlayerName':fix_incomingText(playerFind), 'IsDeleted':0}) if playerAccID == '': return GMCommon.Def_NoTag, '' else: # queryType为accID,发送的信息就是玩家的AccID playerAccID = playerFind return Result # 返回playerid,判断是否在线 if data == '%s'%GMCommon.Def_GMKey_PlayerName: return GMCommon.Def_DoQueryLogDB, playerAccID totalItemCount = len(itemList) resultMsg = {"PackIndex":packIndex, "TotalItemCount":totalItemCount, "ItemList":itemList} # 不大与word #if len(str(resultMsg)) > 65000: # return GMCommon.Def_MaxLimit, '' return GMCommon.Def_Success, resultMsg collection = userdb[UCN_DBPlayer] dbPlayer = DataServerPlayerData.tagDBPlayer() dbPlayer.IsDeleted = 0 def __getPlayerItemByPlayer(curPlayer, packIndex): ## 从在线取 if not curPlayer: return [] loadOK = dbPlayer.adoLoadCEx(collection, {'AccID':fix_incomingText(playerAccID), 'IsDeleted':dbPlayer.IsDeleted}) # 加入人物信息 if not loadOK: return GMCommon.Def_NoTag, "" itemPack = curPlayer.GetItemManager().GetPack(packIndex) itemList = [] for index in range(itemPack.GetCount()): curItem = itemPack.GetAt(index) if curItem == None or curItem.IsEmpty(): continue curItemInfo = {"ItemGUID":curItem.GetGUID(), "ItemTypeID":curItem.GetItemTypeID(), "CreateTime":curItem.GetCreateTime(), "ItemPlaceIndex":curItem.GetItemPlaceIndex() } if curItem.GetSuiteID(): curItemInfo["IsSuite"] = 1 if curItem.GetCount() > 1: curItemInfo["Count"] = curItem.GetCount() if curItem.GetUserData() not in ["", "{}"]: curItemInfo["UserData"] = curItem.GetUserData() if curItem.GetIsBind(): curItemInfo["IsBind"] = curItem.GetIsBind() if curItem.GetRemainHour(): curItemInfo["RemainHour"] = curItem.GetRemainHour() if curItem.GetGearScore(): curItemInfo["GearScore"] = curItem.GetGearScore() itemList.append(curItemInfo) return itemList def __getPlayerItemByDB(dbPlayer, packIndex): if not dbPlayer: return [] userdb = PyGameData.g_usrCtrlDB.db # 获得玩家物品 itemCollection = userdb[UCN_RoleItem] @@ -109,37 +103,14 @@ itemList = [] # 无物品 if itemFind.count() <= 0: return GMCommon.Def_Success, itemList if itemFind.count() > 0: itemInfo = itemFind[0] packIndex = GMCommon.ToIntDef(gmCmdDict.get(GMCommon.Def_GMKey_PackIndex, '')) if packIndex == ShowAllPack: # 暂不提供查询所有的物品 return GMCommon.Def_ParamErr, "Not allowed to query all package items." # 遍历所有物品 for itemIndex in range(1, itemInfo['Count'] + 1): itemDict = itemInfo.get('%s'%itemIndex, {}) # 有指定背包类型,则根据背包类型过滤物品 if packIndex != ShowAllPack and packIndex != itemDict['ItemPlaceType']: if packIndex != itemDict['ItemPlaceType']: continue itemList.append(_GetItemInfo(itemDict)) totalItemCount = len(itemList) resultMsg = {"PackIndex":packIndex, "TotalItemCount":totalItemCount, "ItemList":itemList} # 不大与word if len(str(resultMsg)) > 65000: return GMCommon.Def_MaxLimit, '' # 回复查询信息 return GMCommon.Def_Success, resultMsg ## 获得物品信息 # @param itemDict: 物品信息字典 # @return curItemInfo:当前物品显示信息 def _GetItemInfo(itemDict): # "ItemGUID" : "096389AD-904F-4DAA-B7ED155B8663CE45", # "ItemTypeID" : NumberLong(3901), # "Count" : 100, @@ -157,7 +128,6 @@ # "IsLocked" : 0, # "SID" : -1135840175, # "VerNO" : NumberLong(1), curItemInfo = {} for k, v in itemDict.items(): if k in ["UserDataLen", "ItemPlaceType", "PlayerID", "IsLocked", "SID", "VerNO"]: @@ -166,5 +136,6 @@ continue curItemInfo[k] = v return curItemInfo itemList.append(curItemInfo) return itemList ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/GMToolPyInterface.py
@@ -9,6 +9,7 @@ from DBCommon import CommonDefine import NetPackCommon from Commands import GMCommon DBConfig = __import__('Config.DBConfig') import json ################################################################## ####### 提供的接口 ###### @@ -16,9 +17,9 @@ #回复给ServersRoute->GM工具 命令执行结果包 def SendToGMToolCommandResult(orderID, resultMsg, UserData = ''): # if isinstance(Result, unicode): # #直接从数据库未进行转化的话是unicode # Result = Result.encode('gbk') if isinstance(resultMsg, unicode): #直接从数据库未进行转化的话是unicode resultMsg = resultMsg.encode(DBConfig.encoding) recvPack = SendPackProtocol.tagGMCommandResult() recvPack.Type = CommonDefine.gstGMToolCommandResult ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/GMToolLogicProcess/ProjSpecialProcess.py
@@ -238,7 +238,8 @@ @param offlineSupport: 离线玩家是否支持该命令,默认支持,当玩家离线时,会在上线后执行该命令 @return: GMCommon.Def_xxx, curPlayer 非 Def_Success 的错误类型 - 代表错误,可直接返回给后台 Def_Success, curPlayer - curPlayer为空时代表玩家离线状态 Def_Success, curPlayer - curPlayer为空时代表玩家离线状态,注:离线状态且需要支持离线处理的才返回 (Def_Success, None) GMCommon.Def_PlayerOfLine, dbPlayer - 不需要支持离线处理时,返回离线跟 dbPlayer ''' queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') @@ -249,24 +250,24 @@ # 玩家姓名 if queryType == GMCommon.Def_GMKey_PlayerName: rec = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind) dbPlayer = PyGameData.g_usrCtrlDB.findDBPlayerByName(playerFind, True) elif queryType == GMCommon.Def_GMKey_PlayerAccID: rec = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind) dbPlayer = PyGameData.g_usrCtrlDB.findDBPlayerByAccID(playerFind, True) else: return GMCommon.Def_ParamErr, None if not rec: if not dbPlayer: # db找不到就是不存在该玩家 return GMCommon.Def_NoTag, None playerID = rec.get(u'PlayerID', 0) playerID = dbPlayer.PlayerID 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_PlayerOfLine, dbPlayer return GMCommon.Def_Success, curPlayer