#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#---------------------------------------------------------------------
|
#
|
#---------------------------------------------------------------------
|
##@package GY_Query_PlayerItemInfo
|
# @todo: GM²éÑ¯Íæ¼ÒÎïÆ· ÐÅÏ¢
|
#
|
# @author: wdb
|
# @date 2012-06-06 12:00
|
# @version 1.4
|
#
|
# @note
|
# @change: "2012-06-14 18:00" wdb gm¹¤¾ßµ÷Õû£¬Ôö¼ÓÃüÁîid
|
# @change: "2012-06-28 16:30" wdb ɾ³ý´íÎólog£¬Ôö¼Ó±³°üÀàÐÍ
|
# @change: "2012-06-29 21:30" wdb ·µ»ØÐÅÏ¢ÊÇ·ñ¹ý³¤
|
# @change: "2015-12-29 11:00" hxp ¿ª·ÅÆäËû±³°ü²éѯ
|
#---------------------------------------------------------------------
|
"""Version = 2015-12-29 11:00"""
|
#---------------------------------------------------------------------
|
import IPY_GameWorld
|
import GameWorld
|
import ItemCommon
|
import ShareDefine
|
#---------------------------------------------------------------------
|
|
# ÏÔʾ˵Óб³°üÀàÐÍ
|
ShowAllPack = -1
|
|
## ÇëÇóÂß¼
|
# @param query_Type ÇëÇóÀàÐÍ
|
# @param query_ID ÇëÇóµÄÍæ¼ÒID
|
# @param packCMDList ·¢°üÃüÁî [ ]
|
# @param tick µ±Ç°Ê±¼ä
|
# @return resultDisc
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def DoLogic(query_Type, query_ID, packCMDList, tick):
|
curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)
|
|
if not curPlayer or curPlayer.IsEmpty():
|
return ''
|
|
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 = []
|
|
# Òª²é¿´µÄ±³°ü
|
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])
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult',
|
resultMsg, len(resultMsg))
|
return ''
|
|
|
## »ñÈ¡±³°ü×Öµä
|
# @param curFindPlayer µ±Ç°Íæ¼Ò
|
# @param packIndex ±³°üË÷Òý
|
# @param discKey ×Öµäkey
|
# @return None
|
def _GetPackItem(curFindPlayer, packIndex):
|
|
itemPack = curFindPlayer.GetItemManager().GetPack(packIndex)
|
|
itemList = []
|
|
if not itemPack:
|
return itemList
|
|
for index in range(itemPack.GetCount()):
|
curItem = itemPack.GetAt(index)
|
|
if curItem == None:
|
continue
|
|
if curItem.IsEmpty():
|
continue
|
|
#·ÖΪװ±¸ºÍ·Ç×°±¸
|
if not ItemCommon.CheckItemIsEquip(curItem):
|
# »ñµÃ¾ßÌåÐÅÏ¢
|
itemList.append(_GetItemInfo(curItem, packIndex, index))
|
else:
|
itemList.append(_GetEquipInfo(curItem, packIndex, index))
|
|
return itemList
|
|
|
## »ñÈ¡±³°ü×Öµä
|
# @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
|