#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GM.Commands.SetNPCKillDrop  
 | 
#  
 | 
# @todo:ÉèÖÃNPC»÷ɱµôÂä¼Ç¼ÐÅÏ¢  
 | 
# @author hxp  
 | 
# @date 2018-02-10  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: ÉèÖÃNPC»÷ɱµôÂä¼Ç¼ÐÅÏ¢  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2018-02-10 10:00"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import PlayerControl  
 | 
import IpyGameDataPY  
 | 
import GameWorld  
 | 
import ChConfig  
 | 
import ShareDefine  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
#Â߼ʵÏÖ  
 | 
  
 | 
## GMÃüÁîÖ´ÐÐÈë¿Ú  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param msgList ²ÎÊýÁÐ±í  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(curPlayer, msgList):  
 | 
    if not msgList:  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÉèÖôÎÊý: SetNPCKillDrop npcID »÷ɱ´ÎÊý")  
 | 
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃËùÓÐ: SetNPCKillDrop 0")  
 | 
        return  
 | 
      
 | 
    if len(msgList) == 1 and not msgList[0]:  
 | 
        resetNPCIDList = []  
 | 
        ipyDataMgr = IpyGameDataPY.IPY_Data()  
 | 
        for i in xrange(ipyDataMgr.GetNPCDropItemCount()):  
 | 
            ipyData = ipyDataMgr.GetNPCDropItemByIndex(i)  
 | 
            npcID = ipyData.GetNPCID()  
 | 
            if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCKillCount % npcID):  
 | 
                continue  
 | 
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCKillCount % npcID, 0)  
 | 
            resetNPCIDList.append(npcID)  
 | 
              
 | 
        gw = GameWorld.GetGameWorld()  
 | 
        globalKillDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2)  
 | 
        for npcID in globalKillDropDict.keys():  
 | 
            killedCount = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID)  
 | 
            if not killedCount:  
 | 
                continue  
 | 
            msgInfo = str([npcID, 0])  
 | 
            GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalKillCount", msgInfo, len(msgInfo))  
 | 
            resetNPCIDList.append(npcID)  
 | 
              
 | 
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃOK: %s" % resetNPCIDList)  
 | 
        return  
 | 
      
 | 
    npcID = msgList[0]  
 | 
    ipyData = IpyGameDataPY.GetIpyGameData("NPCDropItem", npcID)  
 | 
    if not ipyData:  
 | 
        GameWorld.DebugAnswer(curPlayer, "ûÓÐÅäÖõôÂä:%s" % npcID)  
 | 
        return  
 | 
      
 | 
    if not ipyData.GetKillCountDropPri() and not ipyData.GetKillCountDropEquipPub() and not ipyData.GetKillCountDropPub():  
 | 
        GameWorld.DebugAnswer(curPlayer, "²»ÐèÒªÉèÖû÷ɱµôÂä´ÎÊýÐÅÏ¢!%s" % npcID)  
 | 
    else:  
 | 
        killCount = msgList[1] if len(msgList) > 1 else 0  
 | 
        setValue = killCount * 10000 + killCount * 100 + killCount  
 | 
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCKillCount % npcID, setValue)  
 | 
        GameWorld.DebugAnswer(curPlayer, "»÷ɱµôÂäÖµ(%s)=%s" % (npcID, killCount))  
 | 
          
 | 
    return  
 | 
  
 | 
  
 | 
  
 |