#!/usr/bin/python 
 | 
# -*- coding: GBK -*- 
 | 
#------------------------------------------------------------------------------- 
 | 
# 
 | 
##@package GM.Commands.CustomAward 
 | 
# 
 | 
# @todo:×Ô¶¨Òå½±Àø 
 | 
# @author hxp 
 | 
# @date 2023-09-22 
 | 
# @version 1.0 
 | 
# 
 | 
# ÏêϸÃèÊö: ×Ô¶¨Òå½±Àø 
 | 
# 
 | 
#------------------------------------------------------------------------------- 
 | 
#"""Version = 2023-09-22 13:30""" 
 | 
#------------------------------------------------------------------------------- 
 | 
  
 | 
import GameWorld 
 | 
import PlayerCustomAward 
 | 
import IpyGameDataPY 
 | 
import PlayerControl 
 | 
import ChConfig 
 | 
  
 | 
## GMÃüÁîÖ´ÐÐÈë¿Ú 
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò 
 | 
#  @param msgList ²ÎÊýÁбí [] 
 | 
#  @return None 
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷. 
 | 
def OnExec(curPlayer, msgList): 
 | 
    if not msgList: 
 | 
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃËùÓÐ: CustomAward 0") 
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖý±Àø: CustomAward ID ÊÇ·ñ¿ÉÁì  ÊÇ·ñÒÑÁì") 
 | 
        return 
 | 
     
 | 
    cmdType = msgList[0] 
 | 
    if cmdType == 0: 
 | 
        awardIDMax = 0 
 | 
        ipyDataMgr = IpyGameDataPY.IPY_Data() 
 | 
        for index in range(ipyDataMgr.GetCustomAwardCount()): 
 | 
            ipyData = ipyDataMgr.GetCustomAwardByIndex(index) 
 | 
            if awardIDMax < ipyData.GetAwardID(): 
 | 
                awardIDMax = ipyData.GetAwardID() 
 | 
                 
 | 
        keyNumMax = GameWorld.GetDictKeyNumByBit(awardIDMax) 
 | 
        for keyNum in range(keyNumMax + 1): 
 | 
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet % keyNum, 0) 
 | 
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CustomAwardGetState % keyNum, 0) 
 | 
             
 | 
        PlayerCustomAward.Sync_CustomAwardInfo(curPlayer, None, True) 
 | 
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃOK") 
 | 
    else: 
 | 
        awardID = cmdType 
 | 
        canGet = msgList[1] if len(msgList) > 1 else 0 
 | 
        getState = msgList[2] if len(msgList) > 2 else 0 
 | 
        ipyData = IpyGameDataPY.GetIpyGameData("CustomAward", awardID) 
 | 
        if not ipyData: 
 | 
            GameWorld.DebugAnswer(curPlayer, "²»´æÔڸý±ÀøID:%s" % awardID) 
 | 
            return 
 | 
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet, awardID, canGet) 
 | 
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardGetState, awardID, getState) 
 | 
        PlayerCustomAward.Sync_CustomAwardInfo(curPlayer, awardID, True) 
 | 
        GameWorld.DebugAnswer(curPlayer, "½±ÀøID:%s,¿ÉÁì:%s,ÒÑÁì:%s" % (awardID, canGet, getState)) 
 | 
         
 | 
    return 
 |