#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GM.Commands.ClearItemV  
 | 
#  
 | 
# @todo:Çå¿ÕÐéÄâ±³°üÎïÆ·  
 | 
# @author hxp  
 | 
# @date 2017-05-04  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: Çå¿ÕÐéÄâ±³°üÎïÆ·  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2017-05-04 12:00"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import PlayerControl  
 | 
import ItemControler  
 | 
import ShareDefine  
 | 
import ChConfig  
 | 
import ItemCommon  
 | 
import GameWorld  
 | 
  
 | 
## GMÃüÁîÖ´ÐÐÈë¿Ú  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param paramList ²ÎÊýÁÐ±í  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(curPlayer, paramList):  
 | 
    if not paramList:  
 | 
        #GameWorld.DebugAnswer(curPlayer, 'Çå³ýÈ«²¿±³°ü: ClearItemV')  
 | 
        #GameWorld.DebugAnswer(curPlayer, 'Çå³ýÖ¸¶¨±³°ü: ClearItemV ±³°üÀàÐÍ')  
 | 
        #GameWorld.DebugAnswer(curPlayer, 'Çå³ýÖ¸¶¨±³°ü¸ñ×Ó: ClearItemV ±³°üÀàÐ͠λÖÃË÷Òý')  
 | 
        #GameWorld.DebugAnswer(curPlayer, '±³°üÀàÐÍ: ·ûÓ¡£¨255£©; ')  
 | 
        packIndexList = ChConfig.Def_VPackCnt_Dict.keys()  
 | 
    else:  
 | 
        packIndexList = [paramList[0]]  
 | 
          
 | 
    for packIndex in packIndexList:  
 | 
        if packIndex not in ChConfig.Def_VPackCnt_Dict:  
 | 
            GameWorld.DebugAnswer(curPlayer, '²»´æÔڸñ³°üÀàÐÍ')  
 | 
            continue  
 | 
          
 | 
        clearPlaceList = []  
 | 
        placeList = [paramList[1]] if len(paramList) > 1 else xrange(ItemCommon.GetVPackCnt(packIndex))  
 | 
        for place in placeList:  
 | 
            itemKeyData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_VPackItem % (packIndex, place))  
 | 
            if not itemKeyData:  
 | 
                continue  
 | 
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_VPackItem % (packIndex, place), 0)  
 | 
            clearPlaceList.append(place)  
 | 
        ItemControler.Sync_VPackItem_Clear(curPlayer, packIndex, clearPlaceList)  
 | 
        GameWorld.DebugAnswer(curPlayer, 'Çå¿Õ±³°üÀàÐÍ: %s, ¸ñ×ÓÊý=%s' % (packIndex, len(clearPlaceList)))  
 | 
          
 | 
    return True  
 |