#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.PrintPet
|
#
|
# @todo:ÏÔÊ¾Íæ¼ÒËùÓгèÎï
|
# @author hxp
|
# @date 2016-4-29
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÏÔÊ¾Íæ¼ÒËùÓгèÎï
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2016-4-29 18:00"""
|
#-------------------------------------------------------------------------------
|
|
import ShareDefine
|
import GameWorld
|
|
|
## GMÃüÁîÖ´ÐÐÈë¿Ú
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param list ²ÎÊýÁбí [tagID£¬ExpValue]
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnExec(curPlayer, list):
|
|
petDataPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptPet)
|
petCnt = petDataPack.GetCount()
|
if petCnt <= 0:
|
GameWorld.DebugAnswer(curPlayer, 'Íæ¼ÒÎÞ³èÎï')
|
return
|
|
showDataInfo = [
|
[ShareDefine.Def_IudetPet_ClassLV, "½×¼¶"],
|
[ShareDefine.Def_IudetPet_State, "״̬"],
|
[ShareDefine.Def_IudetPet_Skill, "¼¼ÄÜ"],
|
]
|
|
showPetCnt = 0
|
for petIndex in range(petDataPack.GetCount()):
|
petItem = petDataPack.GetAt(petIndex)
|
if petItem.IsEmpty():
|
continue
|
|
showPetCnt += 1
|
petNPCID = petItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID)
|
petNPCData = GameWorld.GetGameData().FindNPCDataByID(petNPCID)
|
petName = petNPCData.GetName()
|
GameWorld.DebugAnswer(curPlayer, '--µÚ%sÖ»: Ë÷Òý=%s,npcID=%s,name=%s' % (showPetCnt, petIndex, petNPCID, petName))
|
|
infoStr = ""
|
for dataNum, dataName in showDataInfo:
|
if dataNum % 2 == 0:
|
value = petItem.GetUserAttr(dataNum)
|
infoStr += " %s:%s" % (dataName, value)
|
else:
|
dataCnt = petItem.GetUserAttrCount(dataNum)
|
valueList = []
|
for i in xrange(dataCnt):
|
value = petItem.GetUserAttrByIndex(dataNum, i)
|
valueList.append(value)
|
infoStr += " %s:%s" % (dataName, str(valueList))
|
|
GameWorld.DebugAnswer(curPlayer, "%s" % infoStr)
|
|
GameWorld.DebugAnswer(curPlayer, '------×ܳèÎïÊý: %s -------' % showPetCnt)
|
return
|
|
|
|