| #!/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_NPCKillCountDrop % npcID) \  | 
|                 and not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCKillCount % npcID):  | 
|                 continue  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCKillCountDrop % npcID, 0)  | 
|             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  | 
|     killCountDropInfo = ipyData.GetKillCountDrop()  | 
|     if killCountDropInfo:  | 
|         needKillCount = killCountDropInfo[0]  | 
|         killCount = min(msgList[1], needKillCount - 1) if len(msgList) > 1 else (needKillCount - 1)  | 
|         setValue = killCount * 10  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCKillCountDrop % npcID, setValue)  | 
|         GameWorld.DebugAnswer(curPlayer, "»÷ɱµôÂäÖµ(%s)=%s" % (npcID, setValue))  | 
|           | 
|     killCountDropEquipEx = ipyData.GetKillCountDropEquipEx()  | 
|     killCountDropEquipEx2 = ipyData.GetKillCountDropEquipEx2()  | 
|     if killCountDropEquipEx or killCountDropEquipEx2:  | 
|         if killCountDropEquipEx:  | 
|             needKillCount = killCountDropEquipEx[0]  | 
|         if killCountDropEquipEx2:  | 
|             needKillCount = min(needKillCount, killCountDropEquipEx2[0])  | 
|         killCount = min(msgList[1], needKillCount - 1) if len(msgList) > 1 else (needKillCount - 1)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCKillCount % npcID, killCount)  | 
|         GameWorld.DebugAnswer(curPlayer, "»÷ɱ´ÎÊý=%s" % (npcID, killCount))  | 
|           | 
|     if not killCountDropInfo and not killCountDropEquipEx and not killCountDropEquipEx2:  | 
|         GameWorld.DebugAnswer(curPlayer, "²»ÐèÒªÉèÖû÷ɱµôÂä´ÎÊýÐÅÏ¢!%s" % npcID)  | 
|           | 
|     return  | 
|   | 
|   | 
|   |