hch
2019-04-16 b0e88ac9edef42aa6fcc529bb31905ab76ff86a2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetNPCKillDrop.py
@@ -19,6 +19,7 @@
import IpyGameDataPY
import GameWorld
import ChConfig
import ShareDefine
#---------------------------------------------------------------------
#逻辑实现
@@ -30,7 +31,7 @@
#  @remarks 函数详细说明.
def OnExec(curPlayer, msgList):
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "SetNPCKillDrop npcID 击杀次数")
        GameWorld.DebugAnswer(curPlayer, "设置次数: SetNPCKillDrop npcID 击杀次数")
        GameWorld.DebugAnswer(curPlayer, "重置所有: SetNPCKillDrop 0")
        return
    
@@ -40,12 +41,21 @@
        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):
            if 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
    
@@ -54,27 +64,14 @@
    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:
    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