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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.SetPetInfo
#
# @todo:ÉèÖóèÎïÊôÐÔ
# @author hxp
# @date 2017-03-09
# @version 1.0
#
# ÏêϸÃèÊö: ÉèÖóèÎïÊôÐÔ
#
#-------------------------------------------------------------------------------
#"""Version = 2017-03-09 12:00"""
#-------------------------------------------------------------------------------
 
import ShareDefine
import PlayerPet
import GameWorld
#---------------------------------------------------------------------
##ÉèÖóèÎï״̬.
# @param curPlayer Íæ¼ÒʵÀý
# @param cmdList ²ÎÊýÁбí
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ÉèÖóèÎï״̬
def OnExec(curPlayer, cmdList):
    
    if len(cmdList) != 3:
        GameWorld.DebugAnswer(curPlayer, 'ÉèÖóèÎï½×¼¶: SetPetInfo %s ³èÎïID ½×¼¶' % ShareDefine.Def_IudetPet_ClassLV)
        return
    
    petDataPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptPet)
    petCnt = petDataPack.GetCount()
    if petCnt <= 0:
        GameWorld.DebugAnswer(curPlayer, 'Íæ¼ÒÎÞ³èÎï')
        return
    
    infoType, petNPCID, value = cmdList
    for petIndex in range(petDataPack.GetCount()):
        petItem = petDataPack.GetAt(petIndex)
        if petItem.IsEmpty():
            continue
        
        if petNPCID != petItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID):
            continue
        
        if infoType == ShareDefine.Def_IudetPet_ClassLV:
            petItem.SetUserAttr(ShareDefine.Def_IudetPet_ClassLV, value)
            
        PlayerPet.RefreshPetItemAddAttr(curPlayer, True)
        GameWorld.DebugAnswer(curPlayer, 'ÉèÖóèÎïÊôÐÔOK!')
        return
    
    GameWorld.DebugAnswer(curPlayer, 'Íæ¼Òδ¼¤»î¸Ã³èÎïID: %s' % petNPCID)
    return