hxp
2018-08-30 71639a932d820939f39feee51711e0bf04f19498
Add: 3089 【后端】新增全服首杀掉落规则
6个文件已修改
75 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetNPCKillDrop.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
@@ -1662,7 +1662,8 @@
def SendAllMapGlobalDropInfo():
    # 同步所有地图所有全服掉落控制信息
    globalDropCDDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD") # {物品ID:分钟, ...}
    globalDropCDDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 1) # {物品ID:分钟, ...}
    globalKilledCountDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2) # 全服击杀次数必掉
    globalDropRateDict = IpyGameDataPY.GetFuncEvalCfg("NPCGlobalDropRate") # {物品ID:[[npcID列表], "概率公式"], ...}
    
    for itemID in globalDropCDDict.keys():
@@ -1675,6 +1676,10 @@
        killedCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(key)
        GameWorld.SendMapServerMsgEx(key, killedCnt)
        
    for npcID in globalKilledCountDropDict.keys():
        key = ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID
        killedCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(key)
        GameWorld.SendMapServerMsgEx(key, killedCnt)
    return
def UpdGlobalDropCD(msgList):
@@ -1693,6 +1698,14 @@
    GameWorld.SendMapServerMsgEx(key, updKilledCnt)
    return
def UpdGlobalKillCount(msgList):
    ## 更新全局击杀次数
    npcID, updKilledCnt = msgList
    key = ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID
    PlayerDBGSEvent.SetDBGSTrig_ByKey(key, updKilledCnt)
    GameWorld.SendMapServerMsgEx(key, updKilledCnt)
    return
#---------------------------------------------------------------------
#//////////////////////////////////////////////////////////////
#//01 05 注册副本信息#tagGRegisterFBInfo
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
@@ -634,6 +634,10 @@
    if callName =="GlobalDropRate":
        GameWorldProcess.UpdGlobalDropRate(eval(resultName))
        return
    # 全局击杀数统计
    if callName =="GlobalKillCount":
        GameWorldProcess.UpdGlobalKillCount(eval(resultName))
        return
    
    # 自定义商店全服限购次数清空
    if callName =="ShopItemClearBuyCnt":
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -152,6 +152,7 @@
Def_Notify_WorldKey_LastDropTime = "LastDropTime_%s"  # 全局物品上次掉落时间, 参数(itemID)
Def_Notify_WorldKey_DropNPCKilledCnt = "DropNPCKilledCnt_%s"  # 全局物品绑定的NPC击杀次数, 参数(itemID)
Def_Notify_WorldKey_NPCKilledCount = "NPCKilledCount_%s"  # 全局NPC被击杀次数, 参数(npcID)
Def_Notify_WorldKey_WorldAverageLv = "WorldAverageLv"  #世界等级
Def_Notify_WorldKey_YdayLoginCnt= 'YdayLoginCnt'  # 昨天总在线人数
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetNPCKillDrop.py
@@ -19,6 +19,7 @@
import IpyGameDataPY
import GameWorld
import ChConfig
import ShareDefine
#---------------------------------------------------------------------
#逻辑实现
@@ -46,6 +47,17 @@
            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
    
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -1205,6 +1205,48 @@
        msgInfo = str([itemID, updKilledCnt])
        GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalDropRate", msgInfo, len(msgInfo))
         
    # 4. 指定全服击杀次数必掉,算额外掉落
    globalKillDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2) # {NPCID:{击杀次数:[是否本职业, [物品ID, ...], [随机物品ID, ...]]}, ...}
    if npcID in globalKillDropDict:
        killCountDropDict = globalKillDropDict[npcID]
        updNPCKilledCount = min(gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID) + 1, ShareDefine.Def_UpperLimit_DWord)
        GameWorld.DebugLog("更新全服击杀次数: %s" % updNPCKilledCount)
        # 通知GameServer记录
        msgInfo = str([npcID, updNPCKilledCount])
        GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalKillCount", msgInfo, len(msgInfo))
        if updNPCKilledCount in killCountDropDict:
            isJobLimit, itemIDList, randItemIDList = killCountDropDict[updNPCKilledCount]
            for itemID in itemIDList:
                if isJobLimit:
                    itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
                    if not itemData:
                        continue
                    itemJob = itemData.GetJobLimit() / 100
                    if itemJob and itemJob != curPlayer.GetJob():
                        # 非本职业可用,不掉落
                        GameWorld.DebugLog("全服击杀次数必掉,非本职业可用,不掉落! itemID=%s" % itemID)
                        continue
                dropItemIDList.append(itemID)
                GameWorld.DebugLog("全服击杀次数必掉物品: itemID=%s" % itemID)
            if randItemIDList:
                if isJobLimit:
                    randJobItemList = []
                    for rItemID in randItemIDList:
                        itemData = GameWorld.GetGameData().GetItemByTypeID(rItemID)
                        if not itemData:
                            continue
                        itemJob = itemData.GetJobLimit() / 100
                        if itemJob and itemJob != curPlayer.GetJob():
                            # 非本职业可用,不掉落
                            GameWorld.DebugLog("全服击杀次数必掉随机,非本职业可用,不掉落! rItemID=%s" % rItemID)
                            continue
                        randJobItemList.append(rItemID)
                    randItemID = random.choice(randJobItemList)
                else:
                    randItemID = random.choice(randItemIDList)
                dropItemIDList.append(randItemID)
                GameWorld.DebugLog("全服击杀次数必掉随机物品: randItemID=%s" % randItemID)
    return dropItemIDList
def __GetEquipIDList(npcID, classLV, color, placeList, star, itemJobList, tagPlace=None):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -152,6 +152,7 @@
Def_Notify_WorldKey_LastDropTime = "LastDropTime_%s"  # 全局物品上次掉落时间, 参数(itemID)
Def_Notify_WorldKey_DropNPCKilledCnt = "DropNPCKilledCnt_%s"  # 全局物品绑定的NPC击杀次数, 参数(itemID)
Def_Notify_WorldKey_NPCKilledCount = "NPCKilledCount_%s"  # 全局NPC被击杀次数, 参数(npcID)
Def_Notify_WorldKey_WorldAverageLv = "WorldAverageLv"  #世界等级
Def_Notify_WorldKey_YdayLoginCnt= 'YdayLoginCnt'  # 昨天总在线人数