#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.SetChestsUseCount
|
#
|
# @todo:ÉèÖñ¦Ï俪Æô´ÎÊý
|
# @author hxp
|
# @date 2018-09-27
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÉèÖñ¦Ï俪Æô´ÎÊý
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2018-09-27 19:00"""
|
#-------------------------------------------------------------------------------
|
|
import PlayerControl
|
import IpyGameDataPY
|
import GameWorld
|
import ChConfig
|
|
#---------------------------------------------------------------------
|
#Â߼ʵÏÖ
|
|
## GMÃüÁîÖ´ÐÐÈë¿Ú
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param msgList ²ÎÊýÁбí
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnExec(curPlayer, msgList):
|
if not msgList:
|
GameWorld.DebugAnswer(curPlayer, "SetChestsUseCount ±¦ÏäID ´ÎÊý")
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖÃËùÓÐ: SetChestsUseCount 0")
|
return
|
|
if len(msgList) == 1 and not msgList[0]:
|
resetIDList = []
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
for i in xrange(ipyDataMgr.GetChestsAwardCount()):
|
ipyData = ipyDataMgr.GetChestsAwardByIndex(i)
|
chestsItemID = ipyData.GetChestsItemID()
|
if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChestsOpenCount % chestsItemID):
|
continue
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChestsOpenCount % chestsItemID, 0)
|
resetIDList.append(chestsItemID)
|
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖÃOK: %s" % resetIDList)
|
return
|
|
isNeedRecord = False
|
chestsItemID = msgList[0]
|
awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ChestsAward", chestsItemID)
|
if not awardIpyDataList:
|
GameWorld.DebugAnswer(curPlayer, "ûÓиñ¦Ïä²ú³öÅäÖÃ:%s" % chestsItemID)
|
return
|
|
for ipyData in awardIpyDataList:
|
if ipyData.GetRandItemByUseCount():
|
isNeedRecord = True
|
break
|
|
if not isNeedRecord:
|
GameWorld.DebugAnswer(curPlayer, "ûÓÐÅäÖÿªÆô´ÎÊýÌØÊâ²ú³ö:%s" % chestsItemID)
|
return
|
|
useCount = msgList[1] if len(msgList) > 1 else 0
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ChestsOpenCount % chestsItemID, useCount)
|
GameWorld.DebugAnswer(curPlayer, "ÉèÖñ¦Ï俪Æô´ÎÊý(%s)=%s" % (chestsItemID, useCount))
|
return
|
|
|
|