From 2302b1d177f432df31524077a71033e4c4bad4a1 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 06 十一月 2019 17:08:31 +0800 Subject: [PATCH] 8321 【主干】【后端】GM工具优化(查看玩家信息、物品信息优化) --- ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py | 18 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py | 31 ----- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py | 143 +++++++++------------------- ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py | 61 ++++++----- 4 files changed, 85 insertions(+), 168 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py index 9ff7048..c6056ec 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py @@ -16,7 +16,6 @@ #--------------------------------------------------------------------- """Version = 2015-05-22 14:30""" #--------------------------------------------------------------------- -import IPY_GameWorld import GameWorld import PlayerControl #--------------------------------------------------------------------- @@ -42,47 +41,23 @@ 'GMLV':curPlayer.GetGMLevel(), #gm等级 'Job':curPlayer.GetJob(), # 职业 - 'Sex':curPlayer.GetSex(), # 性别 'LV':curPlayer.GetLV(), #玩家等级 - 'LVEx':curPlayer.GetLVEx(), #转生等级 - 'LV2':curPlayer.GetLV2(), #大师等级 - 'ReincarnationLv':curPlayer.GetReincarnationLv(), #转生次数 + 'OfficialRank':curPlayer.GetOfficialRank(), #境界 'FightPower':curPlayer.GetFightPower(), #战斗力 'VIPLV':curPlayer.GetVIPLv(), # vip等级 - 'TotalExp':curPlayer.GetTotalExp(), # 总经验值 'MapID':curPlayer.GetMapID(), #当前地图id - 'PosX':curPlayer.GetPosX(), # 当前坐标 - 'PosY':curPlayer.GetPosY(), 'Gold':curPlayer.GetGold(), # 元宝 'GoldPaper':curPlayer.GetGoldPaper(), # 绑钻 'Silver':PlayerControl.GetSilver(curPlayer), # 银两 - 'ZhenQi':PlayerControl.GetZhenQi(curPlayer), # 真气 'FamilyName':curPlayer.GetFamilyName(), # 家族名称 - - 'STR':curPlayer.GetSTR(), #力量 - 'PNE':curPlayer.GetPNE(), #真元 - 'PHY':curPlayer.GetPHY(), #筋骨 - 'CON':curPlayer.GetCON(), #体魄 - 'FreePoint':curPlayer.GetFreePoint(), # 剩余点数 - - 'PoisionAtk':curPlayer.GetPoisionAtk(), #毒攻 - 'PoisionDef':curPlayer.GetPoisionDef(), #毒抗 - 'FireAtk':curPlayer.GetFireAtk(), #火攻 - 'FireDef':curPlayer.GetFireDef(), #火抗 - 'IceAtk':curPlayer.GetIceAtk(), #冰攻 - - 'IceDef':curPlayer.GetIceDef(), #冰抗 - 'ThunderAtk':curPlayer.GetThunderAtk(), #雷攻 - 'ThunderDef':curPlayer.GetThunderDef(), #雷抗 - 'WindAtk':curPlayer.GetWindAtk(), #风防 - 'WindDef':curPlayer.GetWindDef(), #风防 'LogoffTime':curPlayer.GetLogoffTime(), #离线时间 'LoginTime':curPlayer.GetLoginTime(), # 上线时间 - 'OnlineTime':curPlayer.GetOnlineTime(), # 累计上线时间 'LoginIP':curPlayer.GetIP(), #登入IP + + 'Online':1, } resultMsg = str([packCMDList[0], playerInfo, 'GMT_GetPlayerInfo']) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py index ac632e1..cff8655 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py @@ -16,12 +16,12 @@ # @change: "2012-06-29 21:30" wdb 返回信息是否过长 # @change: "2015-12-29 11:00" hxp 开放其他背包查询 #--------------------------------------------------------------------- -"""Version = 2015-12-29 11:00""" +#"""Version = 2015-12-29 11:00""" #--------------------------------------------------------------------- import IPY_GameWorld import GameWorld -import ItemCommon import ShareDefine +import GMCommon #--------------------------------------------------------------------- # 显示说有背包类型 @@ -43,49 +43,26 @@ packIndex = packCMDList[1] itemList = [] -# # 查看的背包类型 -# packTypes = ( -# IPY_GameWorld.rptEquip, #1 装备 -# IPY_GameWorld.rptItem, #2 物品 -# IPY_GameWorld.rptRecycle, #3 垃圾桶(回收站) -# IPY_GameWorld.rptWarehouse, #5 仓库 -# IPY_GameWorld.rptTitle, #6 称号背包 -# IPY_GameWorld.rptHorse, #12 坐骑背包 -# IPY_GameWorld.rptAnyWhere, #13 万能背包 -# IPY_GameWorld.rptCabinetDressCoat, #16 衣服外套背包 -# IPY_GameWorld.rptCabinetWeaponCoat, #17 武器外套背包 -# IPY_GameWorld.rptCabinetHorse, #18 时装坐骑背包 -# IPY_GameWorld.rptFineSoulSlot, #21 精魄槽 -# ) - # 是否指定显示的背包类型 if IPY_GameWorld.rptDeleted <= packIndex <= ShareDefine.rptMax: packTypes = [packIndex] - elif packIndex != ShowAllPack: - packTypes = [] + elif packIndex == ShowAllPack: + return 'Not allowed to query all package items.' # 要查看的背包 for packIndex in packTypes: # 遍历pack格子,获得物品信息 packItemList = _GetPackItem(curPlayer, packIndex) itemList.extend(packItemList) - - resultDict = { - 'LogoffTime':curPlayer.GetLogoffTime(), #离线时间 - 'LoginTime':curPlayer.GetLoginTime(), # 上线时间 - 'OnlineTime':curPlayer.GetOnlineTime(), # 累计上线时间 - 'LoginIP':curPlayer.GetIP(), #登入IP - 'ItemList':itemList, # 物品装备列表 - } - - - gmResult = 0 - if len(resultDict) > pow(2, 14): - resultDict = '' - gmResult = 8 # 数据过大 - - resultMsg = str([packCMDList[0], resultDict, 'GMT_PlayerItemInfo', gmResult]) + + gmResult = GMCommon.Def_Success + resultMsg = {"PackIndex":packIndex, "ItemList":itemList} + if len(resultMsg) > pow(2, 14): + resultMsg = {} + gmResult = GMCommon.Def_MaxLimit # 数据过大 + + resultMsg = str([packCMDList[0], resultMsg, 'GMT_PlayerItemInfo', gmResult]) GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg)) return '' @@ -114,68 +91,40 @@ if curItem.IsEmpty(): continue - #分为装备和非装备 - if not ItemCommon.CheckItemIsEquip(curItem): - # 获得具体信息 - itemList.append(_GetItemInfo(curItem, packIndex, index)) - else: - itemList.append(_GetEquipInfo(curItem, packIndex, index)) - + itemList.append(_GetItemInfo(curItem)) + return itemList +def _GetItemInfo(curItem): +# "ItemGUID" : "096389AD-904F-4DAA-B7ED155B8663CE45", +# "ItemTypeID" : NumberLong(3901), +# "Count" : 100, +# "IsBind" : 0, +# "UserData" : "{}", +# "IsSuite" : 0, +# "RemainHour" : 0, +# "GearScore" : NumberLong(0), +# "CreateTime" : "2019-10-16 20:12:17" + +# "ItemPlaceIndex" : 1, +# "PlayerID" : NumberLong(268902), +# "ItemPlaceType" : 2, +# "UserDataLen" : NumberLong(2), +# "IsLocked" : 0, +# "SID" : -1135840175, +# "VerNO" : NumberLong(1), + + curItemInfo = {"ItemGUID":curItem.GetGUID(), + "ItemTypeID":curItem.GetItemTypeID(), + "ItemName":curItem.GetName().decode(ShareDefine.Def_Game_Character_Encoding).encode(GameWorld.GetCharacterEncoding()), + "Count":curItem.GetCount(), + "UserData":curItem.GetUserData(), + "IsBind":curItem.GetIsBind(), + "IsSuite":1 if curItem.GetSuiteID() else 0, + "RemainHour":curItem.GetRemainHour(), + "GearScore":curItem.GetGearScore(), + "CreateTime":curItem.GetCreateTime(), + } + + return curItemInfo -## 获取背包字典 -# @param curFindPlayer 当前玩家 -# @param packIndex 背包索引 -# @param index 物品位置 -# @return None -def _GetItemInfo(curItem, packType, index): - - itemInfo = { - 'PackType':packType, # 背包类型 - 'ItemIndex':index, # 索引 - 'GUID':curItem.GetGUID(), # guid - 'Name':curItem.GetName(), # 物品名 - 'ItemID':curItem.GetItemTypeID(), - - 'IsBand':curItem.GetIsBind(), # 是否绑定 - 'ItemCnt':curItem.GetCount(), # 数量 - } - - return itemInfo - - -## 获取背包字典 -# @param curFindPlayer 当前玩家 -# @param packIndex 背包索引 -# @param index 物品位置 -# @return None -def _GetEquipInfo(curItem, packType, index): - itemInfo = { - 'PackType':packType, # 背包类型 - 'ItemIndex':index, # 索引 - 'GUID':curItem.GetGUID(), # guid - 'Name':curItem.GetName(), # 物品名 - 'IsBand':curItem.GetIsBind(), # 是否绑定 - 'ItemID':curItem.GetItemTypeID(), - 'IsSuite':curItem.GetIsSuite(), # 是否套装 - - } - - return itemInfo - - -## 获取装备技能 -# @param curEquip 装备 -# @return addSkillList 技能列表 -def GetEquipSkill(curEquip): - - #该装备当前的灵纹属性列表 - addSkillList = [] - - for i in range(0, curEquip.GetUserAttrCount(IPY_GameWorld.iudetEquipAddSkillList)): - - addSkillID = curEquip.GetUserAttrByIndex(IPY_GameWorld.iudetEquipAddSkillList, i) - addSkillList.append(addSkillID) - - return addSkillList diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py index 9fb2db9..4c7628f 100644 --- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py +++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py @@ -109,37 +109,23 @@ 'GMLV':dbPlayer.GMLevel, #gm等级 'Job':dbPlayer.Job, # 职业 - 'Sex':dbPlayer.Sex, # 性别 'LV':dbPlayer.LV, #玩家等级 - 'LVEx':dbPlayer.LVEx, #转生等级 - 'LV2':dbPlayer.LV2, #大师等级 - 'ReincarnationLv':dbPlayer.ReincarnationLv, #转生次数 + 'OfficialRank':dbPlayer.OfficialRank, #境界 'FightPower':dbPlayer.FightPower, #战斗力 'VIPLV':dbPlayer.VIPLv, # vip等级 - 'TotalExp':dbPlayer.TotalExp, # 总经验值 'MapID':dbPlayer.MapID, #当前地图id - 'PosX':dbPlayer.PosX, # 当前坐标 - 'PosY':dbPlayer.PosY, 'Gold':dbPlayer.Gold, # 元宝 'GoldPaper':dbPlayer.GoldPaper, # 绑钻 'Silver':dbPlayer.Silver, # 银两 - 'ZhenQi':dbPlayer.ExAttr5, # 真气 'FamilyName':dbPlayer.FamilyName, # 家族名称 - 'STR':dbPlayer.STR, #力量 - 'PNE':dbPlayer.PNE, #真元 - 'PHY':dbPlayer.PHY, #筋骨 - 'CON':dbPlayer.CON, #体魄 - 'FreePoint':dbPlayer.FreePoint, # 剩余点数 - 'LogoffTime':dbPlayer.LogoffTime, #离线时间 'LoginTime':dbPlayer.LoginTime, # 上线时间 - 'OnlineTime':dbPlayer.OnlineTime, # 累计上线时间 'LoginIP':dbPlayer.LoginIP, #登入IP - 'WarehousePsw':dbPlayer.WarehousePsw, #仓库密码 + 'Online':0, } return GMCommon.Def_Success, playerInfo diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py index 4e688d3..a70bbbd 100644 --- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py +++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py @@ -100,29 +100,23 @@ loadOK = dbPlayer.adoLoadCEx(collection, {'AccID':fix_incomingText(playerAccID), 'IsDeleted':dbPlayer.IsDeleted}) # 加入人物信息 - resultMsg = {} - if loadOK: - resultMsg = { - 'LogoffTime':dbPlayer.LogoffTime, #离线时间 - 'LoginTime':dbPlayer.LoginTime, # 上线时间 - 'OnlineTime':dbPlayer.OnlineTime, # 累计上线时间 - 'LoginIP':dbPlayer.LoginIP, #登入IP - } - else: - return GMCommon.Def_NoTag, '' + if not loadOK: + return GMCommon.Def_NoTag, "" # 获得玩家物品 itemCollection = userdb[UCN_RoleItem] itemFind = itemCollection.find({'PlayerID':dbPlayer.PlayerID}) + itemList = [] # 无物品 if itemFind.count() <= 0: - return GMCommon.Def_Success, resultMsg + return GMCommon.Def_Success, itemList - itemList = [] 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, {}) @@ -131,9 +125,8 @@ continue itemList.append(_GetItemInfo(itemDict)) - - resultMsg['ItemList'] = itemList - + + resultMsg = {"PackIndex":packIndex, "ItemList":itemList} # 不大与word if len(resultMsg) > pow(2, 14): return GMCommon.Def_MaxLimit, '' @@ -146,17 +139,31 @@ # @param itemDict: 物品信息字典 # @return curItemInfo:当前物品显示信息 def _GetItemInfo(itemDict): +# "ItemGUID" : "096389AD-904F-4DAA-B7ED155B8663CE45", +# "ItemTypeID" : NumberLong(3901), +# "Count" : 100, +# "IsBind" : 0, +# "UserData" : "{}", +# "IsSuite" : 0, +# "RemainHour" : 0, +# "GearScore" : NumberLong(0), +# "CreateTime" : "2019-10-16 20:12:17" - #itemData = eval(itemDict['UserData']) - curItemInfo = { - 'PackType':itemDict['ItemPlaceType'], # 背包类型 - 'ItemIndex':itemDict['ItemPlaceIndex'], # 索引 - 'GUID':itemDict['ItemGUID'], # guid - 'IsBand':itemDict['IsBind'], # 是否绑定 - 'ItemCnt':itemDict['Count'], # 数量 - 'ItemID':itemDict['ItemTypeID'], - - 'IsSuite':itemDict['IsSuite'], # 是否套装 - } +# "ItemPlaceIndex" : 1, +# "PlayerID" : NumberLong(268902), +# "ItemPlaceType" : 2, +# "UserDataLen" : NumberLong(2), +# "IsLocked" : 0, +# "SID" : -1135840175, +# "VerNO" : NumberLong(1), + + curItemInfo = {} + for k, v in itemDict.items(): + if k in ["UserDataLen", "ItemPlaceType", "PlayerID", "IsLocked", "SID", "VerNO", "ItemPlaceIndex"]: + continue + if not v: + continue + curItemInfo[k] = v + return curItemInfo \ No newline at end of file -- Gitblit v1.8.0