hxp
2025-06-12 edc3910a9d090e5df4deb2dbc37709a740375938
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
#!/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