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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/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