#!/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  
 | 
  
 |