From 5fa02b1adbf1900358ab44a915cd9e841dcdf45f Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期日, 09 十月 2022 16:20:47 +0800 Subject: [PATCH] 9687 【后端】【越南】【主干】【BT7】野外根据境界动态刷怪 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 125 +++++++++++++++++++++++++++++++++-------- 1 files changed, 100 insertions(+), 25 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py index a1c5c46..f2320ef 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py @@ -59,6 +59,7 @@ import PlayerFeastTravel import PlayerGoldInvest import PlayerWeekParty +import NPCRealmRefresh import NPCHurtManager import PlayerActLogin import FamilyRobBoss @@ -187,7 +188,15 @@ randMinLV = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenMinLV) randMaxLV = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenMaxLV) strengthenLV = random.randint(randMinLV, randMaxLV) - + # 根据境界难度 + elif lvStrengthenType == 5: + realmLV = PlayerControl.GetDifficultyRealmLV(curNPC.GetSightLevel()) + realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV) + if realmNPCIpyData: + strengthenLV = realmNPCIpyData.GetLV() + else: + lvStrengthenType = 0 + # 木桩怪最大、平均成长等级处理,直接取归属玩家等级 if lvStrengthenType in [1, 2] and curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]: owner = None @@ -599,6 +608,7 @@ index = 0 playerID = curPlayer.GetPlayerID() gameMap = GameWorld.GetMap() + sightLevel = PlayerControl.GetMapRealmDifficulty(curPlayer) for posX, posY in ChConfig.Def_DropItemAreaMatrix: resultX = dropPosX + posX resultY = dropPosY + posY @@ -620,7 +630,7 @@ continue ChItem.AddMapDropItem(resultX, resultY, curItem, ownerInfo=[ChConfig.Def_NPCHurtTypePlayer, playerID], - dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee) + dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel) return def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp", extraVirtualItemList=[]): @@ -749,6 +759,15 @@ if not ipyDrop: return + realmNPCIpyData = None + realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1) + realmDifficulty = PlayerControl.GetRealmDifficulty(dropPlayer) + if mapID in realmMapIDList and realmDifficulty: + realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty) + realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV) + #if realmNPCIpyData: + # maxDropLV = realmNPCIpyData.GetMaxDrapLV() + #脱机暂不限制最大等级掉落 #playerLV = dropPlayer.GetLV() #maxDropLV = ipyDrop.GetMaxDropLV() @@ -820,6 +839,9 @@ colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...} dropEquipIDDict = {} for classLV, color, dropCount in dropEquipInfoList: + if realmNPCIpyData: + classLV = realmNPCIpyData.GetEquipClassLV() + GameWorld.DebugLog(" 脱机掉落对应难度境界装备: classLV=%s" % classLV, playerID) suitCountDict = {} # {套装:件数, ...} if color in colorSuitRateDict: suitRate = colorSuitRateDict[color] @@ -882,7 +904,7 @@ dropMoneyCnt += 1 dropMoney = 0 if dropMoneyCnt: - dropMoney = __GetDropMoneyValue(dropPlayer, ipyDrop) * dropMoneyCnt + dropMoney = __GetDropMoneyValue(dropPlayer, ipyDrop, realmNPCIpyData) * dropMoneyCnt GameWorld.DebugLog(" 金币掉率: dropMoneyRate=%s,moneyTotalRate=%s,dropMoneyCnt=%s,dropMoney=%s" % (dropMoneyRate, moneyTotalRate, dropMoneyCnt, dropMoney), playerID) dropIDCountDict = {} @@ -937,6 +959,16 @@ playerID = dropPlayer.GetPlayerID() playerLV = dropPlayer.GetLV() maxDropLV = ipyDrop.GetMaxDropLV() + + realmNPCIpyData = None + realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1) + realmDifficulty = PlayerControl.GetRealmDifficulty(dropPlayer) + if mapID in realmMapIDList and realmDifficulty: + realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty) + realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV) + if realmNPCIpyData: + maxDropLV = realmNPCIpyData.GetMaxDrapLV() + if maxDropLV and playerLV > maxDropLV: GameWorld.DebugLog("超过最大可掉落等级,不掉落物品!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV)) return @@ -1066,6 +1098,10 @@ for dropEquipInfo in dropEquipInfoList: classLV, color = dropEquipInfo[:2] + if realmNPCIpyData: + classLV = realmNPCIpyData.GetEquipClassLV() + GameWorld.DebugLog("掉落对应难度境界装备: classLV=%s" % classLV, playerID) + if color in colorMaxDropCntDict: maxCount = colorMaxDropCntDict[color] dropCount = colorDropCntDict.get(color, 0) @@ -1179,7 +1215,7 @@ #GameWorld.DebugLog("NPCID=%s,金币掉率: %s, 执行次数=%s, 掉落金币数=%s" % (npcID, dropMoneyRate, dropMoneyDoCnt, dropMoneyCnt)) if dropMoneyCnt: - moneyValue = __GetDropMoneyValue(dropPlayer, ipyDrop) + moneyValue = __GetDropMoneyValue(dropPlayer, ipyDrop, realmNPCIpyData) #GameWorld.DebugLog(" 掉落金币value=%s" % (moneyValue)) if dropIDList: @@ -1597,12 +1633,15 @@ #GameWorld.DebugLog("独立概率装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList)) return dropEquipInfoList -def __GetDropMoneyValue(curPlayer, ipyDrop): +def __GetDropMoneyValue(curPlayer, ipyDrop, realmNPCIpyData): baseMoney = FBLogic.OnGetNPCDropMoney(curPlayer) if baseMoney <= 0: # 获得掉落数量 - baseMoney = random.randint(ipyDrop.GetDropMoneyMin(), ipyDrop.GetDropMoneyMax()) - + if realmNPCIpyData: + baseMoney = random.randint(realmNPCIpyData.GetDropMoneyMin(), realmNPCIpyData.GetDropMoneyMax()) + else: + baseMoney = random.randint(ipyDrop.GetDropMoneyMin(), ipyDrop.GetDropMoneyMax()) + if baseMoney <= 0: return 0 @@ -2140,7 +2179,7 @@ # @param aiType: AI类型 # @return 如果召唤失败返回None 否则返回召唤的NPC的实例 # @remarks 在地图里召唤NPC 根据NPCID 出生点 AI类型 和TICK -def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0): +def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0): curSummon = GameWorld.GetNPCManager().AddPlayerSummonNPC() if not curSummon: return @@ -2159,9 +2198,17 @@ if playerID > 0: curSummon.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, playerID) + if sightLevel > 0: + curSummon.SetSightLevel(sightLevel) + + if refreshID > 0: + curSummon.SetDict(ChConfig.Def_NPC_Dict_SummonRefreshID, refreshID) + if curSummon.GetType() == ChConfig.ntRobot: __OnFBRobotReborn(curSummon, curSummon.GetLV()) - curSummon.Reborn(rebornX, rebornY) + + curSummon.Reborn(rebornX, rebornY, False) + NPCControl(curSummon).DoNPCRebornCommLogic(tick) FBLogic.DoFBRebornSummonNPC(curSummon, tick) #__NotifyMapPlayerSummonMapNPC(npcId, rebornX, rebornY) @@ -2318,7 +2365,11 @@ summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID) if summonPlayerID > 0: curNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, 0) - + + refreshObj = NPCRealmRefresh.GetTagNPCRefresh(curNPC) + if refreshObj: + refreshObj.SetDead(GameWorld.GetGameWorld().GetTick()) + # 暗金boss if ChConfig.IsGameBoss(curNPC): # 通知GameServer boss状态 封魔坛在副本里单独处理 @@ -3516,7 +3567,7 @@ def __Func_GetRandPosInRefreshArea(self): curNPC = self.__Instance #得到地图刷新点 - posMap = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex()) + posMap = self.GetRefreshPoint() #范围校验 if not posMap: GameWorld.ErrLog("__Func_GetRandPosInRefreshArea GetRefreshPosAt error: return None! npcID=%s" % curNPC.GetNPCID()) @@ -3538,6 +3589,15 @@ return posX, poxY #--------------------------------------------------------------------- + def GetRefreshPoint(self): + curNPC = self.__Instance + refreshObj = NPCRealmRefresh.GetTagNPCRefresh(curNPC) + if refreshObj: + refreshPoint = refreshObj.GetRefreshPoint() + else: + refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex()) + return refreshPoint + ## 是否在移动范围内 # @param self 类实例 # @return 返回值真, 在移动范围内 @@ -3545,7 +3605,7 @@ def IsInRefreshArea(self): #这个NPC是否在移动范围内 curNPC = self.__Instance - refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex()) + refreshPoint = self.GetRefreshPoint() #GameWorld.Log("posX = %d posY = %d, dist = %d"%(refreshPoint.GetPosX(), refreshPoint.GetPosY(), refreshPoint.GetMoveDist())) if self.GetIsInRefreshPoint(curNPC.GetPosX() , curNPC.GetPosY() , refreshPoint): return True @@ -4170,11 +4230,11 @@ npcID = curNPC.GetNPCID() specDropItemList = [] - playerLV = dropPlayer.GetLV() - maxDropLV = ipyDrop.GetMaxDropLV() - if maxDropLV and playerLV > maxDropLV: - GameWorld.DebugLog("超过最大可掉落等级,不掉落物品,特殊掉落!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV)) - return specDropItemList + #playerLV = dropPlayer.GetLV() + #maxDropLV = ipyDrop.GetMaxDropLV() + #if maxDropLV and playerLV > maxDropLV: + # GameWorld.DebugLog("超过最大可掉落等级,不掉落物品,特殊掉落!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV)) + # return specDropItemList auctionItemCanSell = ipyDrop.GetAucionItemCanSell() # 击杀次数掉落算摸怪 @@ -4250,8 +4310,10 @@ dropIDList += [moneyID] * dropMoneyCnt specItemSign = "SpecItem" - playerSpecDropList = self.__NPCSpecialDropItem(dropPlayer, ownerPlayerList, ipyDrop) # 特殊掉落 [[ownerPlayer, itemID, isAuctionItem, isDropInItemPack], ...] 私有特殊掉落 + 击杀次数特殊掉落 - dropIDList += [specItemSign] * len(playerSpecDropList) + playerSpecDropList = [] + if dropInfo: + playerSpecDropList = self.__NPCSpecialDropItem(dropPlayer, ownerPlayerList, ipyDrop) # 特殊掉落 [[ownerPlayer, itemID, isAuctionItem, isDropInItemPack], ...] 私有特殊掉落 + 击杀次数特殊掉落 + dropIDList += [specItemSign] * len(playerSpecDropList) if len(dropIDList) > 5: #打乱物品顺序 @@ -4262,6 +4324,7 @@ GameWorld.ErrLog("Boss没有掉落: dropPlayerLV=%s,ipyWorldLV=%s,maxDropLV=%s" % (dropPlayer.GetLV(), ipyDrop.GetMaxWorldLV(), ipyDrop.GetMaxDropLV()), dropPlayer.GetPlayerID()) + sightLevel = PlayerControl.GetMapRealmDifficulty(dropPlayer) gameMap = GameWorld.GetMap() dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY() # 以NPC为中心点开始掉落 index = 0 @@ -4312,7 +4375,7 @@ SendVirtualItemDrop(ownerPlayer, itemID, resultX, resultY, dropItemDataStr) else: - self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID, isOnlySelfSee=isOnlySelfSee) + self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel) return #--------------------------------------------------------------------- ## NPC被杀死逻辑处理 @@ -4568,7 +4631,7 @@ curNPC = self.__Instance # VIP杀怪加攻 - PlayerVip.DoAddVIPKillLVExp(lastHurtPlayer, curNPC) + PlayerVip.DoAddVIPKillLVExp(lastHurtPlayer, GetNPCLV(curNPC)) # SP值 PlayerControl.AddZhenQiByKillNPC(lastHurtPlayer, curNPC.GetSP()) @@ -5109,7 +5172,14 @@ if baseExp > 0: return baseExp - baseExp = curNPC.GetExp() + npcID = curNPC.GetNPCID() + realmLV = PlayerControl.GetDifficultyRealmLV(curNPC.GetSightLevel()) + realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV) + if realmNPCIpyData: + baseExp = realmNPCIpyData.GetExp() + else: + baseExp = curNPC.GetExp() + if baseExp == 0: #GameWorld.Log("杀怪经验异常,该NPC = %s,无经验"%(curNPC.GetID())) return 0 @@ -5143,7 +5213,7 @@ # @param dropType: 掉落类型 # @param ownerID: 归属者 # @return: None - def __MapCreateItem(self, curItem, posX, posY, dropType, ownerID, isOnlySelfSee=False): + def __MapCreateItem(self, curItem, posX, posY, dropType, ownerID, isOnlySelfSee=False, sightLevel=0): if not curItem: return @@ -5162,7 +5232,7 @@ # 在地上添加物品(统一接口) dropNPCID = 0 if not ChConfig.IsGameBoss(curNPC) else curNPCID specOwnerIDList = [player.GetPlayerID() for player in self.__ownerPlayerList] if dropType == ChConfig.Def_NPCHurtTypeSpecial else [] - curMapItem = ChItem.AddMapDropItem(posX, posY, curItem, ownerInfo=[dropType, ownerID, specOwnerIDList], dropNPCID=dropNPCID, isOnlySelfSee=isOnlySelfSee) + curMapItem = ChItem.AddMapDropItem(posX, posY, curItem, ownerInfo=[dropType, ownerID, specOwnerIDList], dropNPCID=dropNPCID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel) #设置该物品生前拥有者(那个NPC掉落的) if curMapItem == None: @@ -5555,7 +5625,12 @@ npcData = GameWorld.GetGameData().FindNPCDataByID(npcID) if not npcData: return 0 - baseExp = npcData.GetExp() + needRealmLV = PlayerControl.GetDifficultyRealmLV(PlayerControl.GetRealmDifficulty(curPlayer)) + realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, needRealmLV) + if realmNPCIpyData: + baseExp = realmNPCIpyData.GetExp() + else: + baseExp = npcData.GetExp() if not baseExp: return 0 npcLV = npcData.GetLV() -- Gitblit v1.8.0