1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/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