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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package UseItem.Item_ClothesCoatSkin
#
# @todo:¼¤»îʱװ
# @author hxp
# @date 2015-6-17
# @version 1.0
#
# ÏêϸÃèÊö: ¼¤»îʱװ
#
#---------------------------------------------------------------------
"""Version = 2015-6-17 15:00"""
#---------------------------------------------------------------------
 
#µ¼Èë
import GameWorld
import PlayerCoat
import ItemCommon
import ChConfig
 
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
##ʹÓÃÎïÆ·,´¥·¢ÎïÆ·¸½¼Ó¼¼ÄÜ
# @param curPlayer Íæ¼ÒʵÀý
# @param curRoleItem ÎïÆ·ÊµÀý
# @param tick Ê±¼ä´Á
# @return ÊÇ·ñʹÓÃÎïÆ·³É¹¦
def UseItem(curPlayer, curRoleItem, tick):
    itemTypeID = curRoleItem.GetItemTypeID()
    jobType = ChConfig.JOB_TYPE_DICT[curPlayer.GetJob()]
    
    clothesCoatSkinID = 0
    for i in range(curRoleItem.GetEffectCount()):
        curEffect = curRoleItem.GetEffectByIndex(i)
        if not curEffect:
            continue
        
        effectID = curEffect.GetEffectID()
        # Ê±×°Ð§¹ûID
        if effectID != ChConfig.Def_Effect_ClothesCoatSkin:
            continue
        
        itemJobType = curEffect.GetEffectValue(0)
        if itemJobType == jobType:
            clothesCoatSkinID = curEffect.GetEffectValue(1)
            break
                
    if clothesCoatSkinID <= 0:
        GameWorld.ErrLog('²ß»®Ìî±í´íÎó£¬ÎïÆ· = %s,¼¤»îʱװƤ·ôЧ¹ûÖµ´íÎó = %s' % (itemTypeID, clothesCoatSkinID))
        return False
    
    isOK = PlayerCoat.ActivateClothesCoatSkinItem(curPlayer, clothesCoatSkinID)
    
    if isOK:
        #ÎïÆ·¼õÉÙ
        saveDataDict = {"ClothesCoatSkinID":clothesCoatSkinID}
        ItemCommon.DelItem(curPlayer, curRoleItem, 1, True, ChConfig.ItemDel_ClothesCoatSkin, saveDataDict)
        
    return isOK