8321 【主干】【后端】GM工具优化(查看玩家信息、物品信息优化)
4个文件已修改
253 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GetPlayerInfo.py 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_PlayerItemInfo.py 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerInfo.py 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_PlayerItemInfo.py 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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'])
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
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
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