hch
2018-08-28 0a93c7c66ea0047c8080d7e21ced94736fe25034
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -104,6 +104,7 @@
    return curNPC.GetLV()
def GetRealmLV(curNPC): return curNPC.GetMAtkMin()      # NPC表中此字段含义改成境界等级
def SetRealmLV(curNPC, realmLV): return curNPC.SetMAtkMin(realmLV)      # NPC表中此字段含义改成境界等级
def GetIsLVSuppress(curNPC): return curNPC.GetWindDef() # 风防代表是否等级压制
def GetSuppressFightPower(curNPC): return curNPC.GetThunderDef() # 雷防代表压制战力
def SetSuppressFightPower(curNPC, value): return curNPC.SetThunderDef(value)
@@ -112,6 +113,7 @@
def GetFaction(curNPC): return curNPC.GetCountry()
def GetSkillAtkRate(curNPC): return curNPC.GetPoisionAtk() # 毒攻代表NPC技能伤害加成万分率
def GetFinalHurt(curNPC): return curNPC.GetFireAtk() # 火攻代表NPC最终固定伤害加成, 普攻也有效果
def SetFinalHurt(curNPC, hurt): return curNPC.SetFireAtk(hurt) # 火攻代表NPC最终固定伤害加成, 普攻也有效果
def GetSkillEnhance(curNPC): return curNPC.GetWindAtk() # 风攻代表NPC 《普攻》 的技能附加伤害固定值
def GetNPCSeries(curNPC): return curNPC.GetPoisionDef() # 毒防字段代表NPC系,按二进制位区分
@@ -822,13 +824,28 @@
    tagPlaceSortList.sort() # 升序排序
    tagPlaceSortList2.sort() # 升序排序
    if isKillCountDropEquipEx:
        GameWorld.DebugLog("都不满足目标装备的优先级信息: npcID=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, tagPlaceSortList), playerID)
        GameWorld.DebugLog("部分满足目标装备的优先级信息: npcID=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, tagPlaceSortList2), playerID)
    tagPlaceSortList += tagPlaceSortList2
    if tagPlaceSortList:
        tagPlace = tagPlaceSortList[0][-2]
        tagJob = tagPlaceSortList[0][-1]
        GameWorld.DebugLog("都不满足目标装备的优先级信息: npcID=%s, 数量=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, len(tagPlaceSortList), tagPlaceSortList), playerID)
        GameWorld.DebugLog("部分满足目标装备的优先级信息: npcID=%s, 数量=%s, 颜色,阶,星,评分,部位,职业=%s" % (npcID, len(tagPlaceSortList2), tagPlaceSortList2), playerID)
    if tagPlaceSortList or tagPlaceSortList2:
        isOptimalPlace = IpyGameDataPY.GetFuncCfg("DropEquipPlaceMode", 1) # 是否取最优解部位
        if isOptimalPlace:
            tagPlaceSortList += tagPlaceSortList2
            if tagPlaceSortList:
                tagPlace = tagPlaceSortList[0][-2]
                tagJob = tagPlaceSortList[0][-1]
                GameWorld.DebugLog("掉落目标部位取最优解: tagPlace=%s,tagJob=%s" % (tagPlace, tagJob), playerID)
        else:
            randPlaceCountLimit = IpyGameDataPY.GetFuncCfg("DropEquipPlaceMode", 2) # 全不满足目标条件部位有几个时才优先随机
            if len(tagPlaceSortList) < randPlaceCountLimit:
                tagPlaceSortList += tagPlaceSortList2
            else:
                GameWorld.DebugLog("优先随机都不满足目标装备的,randPlaceCountLimit=%s" % randPlaceCountLimit, playerID)
            randPlaceIndex = random.randint(0, len(tagPlaceSortList) - 1)
            GameWorld.DebugLog("掉落目标部位随机, randPlaceIndex=%s, 颜色,阶,星,评分,部位,职业=%s" % (randPlaceIndex, tagPlaceSortList), playerID)
            tagPlace = tagPlaceSortList[randPlaceIndex][-2]
            tagJob = tagPlaceSortList[randPlaceIndex][-1]
            GameWorld.DebugLog("掉落目标部位随机不满足条件的: tagPlace=%s,tagJob=%s" % (tagPlace, tagJob), playerID)
    if isKillCountDropEquipEx:
        GameWorld.DebugLog("附加掉落指定目标装备信息: npcID=%s,玩家最少的击杀次数=%s,目标击杀数=%s,tagClassLV=%s,tagColor=%s,tagStar=%s,tagStarMin=%s,tagPlace=%s,tagJob=%s" 
                           % (npcID, dropEquipExKillCount, tagKillCount, tagClassLV, tagColor, tagStar, tagStarMin, tagPlace, tagJob), playerID)
@@ -2497,7 +2514,7 @@
            self.__AddAngryValue(npcAngry, curObjID, curObjType, plusAngryValue, canPile)
        
        #激活呆滞的NPC
        if curNPC.GetHP() > 0 and not curNPC.GetIsNeedProcess() :
        if GameObj.GetHP(curNPC) > 0 and not curNPC.GetIsNeedProcess() :
            curNPC.SetIsNeedProcess(True)
        
@@ -5332,6 +5349,7 @@
#  @param None
#  @param None
def SyncCollectionItemInfo(curPlayer, addExp, addMoney, addZhenQi, syncItemInfoList, collectNPCID=0):
    return #暂不同步
    if addExp <= 0 and addMoney <= 0 and addZhenQi <= 0 and not syncItemInfoList:
        return
    
@@ -5419,15 +5437,15 @@
        collectNPCIDTimeLimit = ReadChConfig.GetEvalChConfig('CollectNPCIDTimeLimit')
        npcIDList = collectNPCIDTimeLimit.keys()
    
    if funcTypeList:
        collection = ChPyNetSendPack.tagMCFuncNPCCollectionCnt()
        for fType in funcTypeList:
            todayCollTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcCollTime % fType)
            collection.Clear()
            collection.FuncType = fType
            collection.CollectionCnt = todayCollTime
            collection.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcBuyTime % fType)
            NetPackCommon.SendFakePack(curPlayer, collection)
#    if funcTypeList:
#        collection = ChPyNetSendPack.tagMCFuncNPCCollectionCnt()
#        for fType in funcTypeList:
#            todayCollTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcCollTime % fType)
#            collection.Clear()
#            collection.FuncType = fType
#            collection.CollectionCnt = todayCollTime
#            collection.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollNpcBuyTime % fType)
#            NetPackCommon.SendFakePack(curPlayer, collection)
        
    if npcIDList:
        npcIDCollInfo = ChPyNetSendPack.tagMCNPCIDCollectionCntInfo()
@@ -5542,6 +5560,59 @@
    NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
    return
## 获取本地图NPC数量
#  @param queryNPCIDList:查询的NPCID列表
#  @param tick
#  @return {NPCID:cnt}
def GetNPCCntInfo(queryNPCIDList, tick):
    npcCntDict = {}
    if not queryNPCIDList:
        return npcCntDict
    gameNPCManager = GameWorld.GetNPCManager()
    GameWorld.DebugLog("GetNPCCntInfo...queryNPCIDList=%s" % (str(queryNPCIDList)))
    for index in xrange(gameNPCManager.GetNPCCount()):
        curNPC = gameNPCManager.GetNPCByIndex(index)
        curID = curNPC.GetID()
        if curID == 0:
            continue
        curNPCID = curNPC.GetNPCID()
        if curNPCID not in queryNPCIDList:
            continue
        if curNPC.GetCurAction() == IPY_GameWorld.laNPCDie or not curNPC.IsAlive():
            continue
        npcCntDict[curNPCID] = npcCntDict.get(curNPCID, 0) + 1
    GameWorld.DebugLog("    npcCntDict=%s" % (str(npcCntDict)))
    return npcCntDict
## 同步地图NPC数量信息
#  @param curPlayer:采集玩家实例
#  @param mapID:
#  @param npcInfoDict:
#  @return None
def SyncNPCCntInfo(curPlayer, mapID, npcCntDict):
    npcInfoPack = ChPyNetSendPack.tagMCNPCCntList()
    npcInfoPack.Clear()
    npcInfoPack.MapID = mapID
    npcInfoPack.NPCInfoList = []
    for npcid, npcCnt in npcCntDict.items():
        npcInfo = ChPyNetSendPack.tagMCNPCCntInfo()
        npcInfo.Clear()
        npcInfo.NPCID = npcid
        npcInfo.Cnt = npcCnt
        npcInfoPack.NPCInfoList.append(npcInfo)
    npcInfoPack.NPCInfoCnt = len(npcInfoPack.NPCInfoList)
    NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
    return
def SendGameServerGoodItemRecord(mapID, npcID, playerName, playerID, itemID, equipInfo=[]):
    # @param equipInfo: [equipPlace, itemClassLV, itemColor, itemQuality, itemUserData]
#    GameWorld.DebugLog("检查物品是否发送GameServer: mapID=%s, npcID=%s, playerName=%s, itemID=%s"