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/Player/PlayerTJG.py |   65 +++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
index 89d3dbb..65abdbd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -299,7 +299,7 @@
     SetTJGTime(curPlayer, min(GetTJGTime(curPlayer) + addTime, maxTime))
     return
 
-def CalcTJGExp(curPlayer, times, npcData):
+def CalcTJGExp(curPlayer, times, npcData, realmNPCIpyData):
     lvIpyData = PlayerControl.GetPlayerLVIpyData(curPlayer.GetLV())
     if not lvIpyData:
         return 0
@@ -327,9 +327,19 @@
     aReFightPower = lvIpyData.GetReFightPower() # 等级表对应的战力
     aNPCHurtAddPer = PlayerControl.GetNPCHurtAddPer(curPlayer) #PVE 伤害加成万分率
     
-    npcExp = npcData.GetExp()
-    npcMaxHP = GameObj.GetHP(npcData)
-    npcCommendFightPower = NPCCommon.GetCommendFightPower(npcData)
+    npcID = npcData.GetNPCID()
+    if realmNPCIpyData:
+        attrDict = NPCCommon.GetNPCStrengthenAttrDict(npcID, realmNPCIpyData.GetLV())
+        npcExp = realmNPCIpyData.GetExp()
+        npcMaxHP = attrDict.get("MaxHP", GameObj.GetHP(npcData))
+        npcCommendFightPower = realmNPCIpyData.GetFireDef()
+        GameWorld.DebugLog("CalcTJGExp realmNPC npcID=%s,npcExp=%s,npcMaxHP=%s,npcCommendFightPower=%s" % (npcID, npcExp, npcMaxHP, npcCommendFightPower))
+    else:
+        npcExp = npcData.GetExp()
+        npcMaxHP = GameObj.GetHP(npcData)
+        npcCommendFightPower = NPCCommon.GetCommendFightPower(npcData)
+        GameWorld.DebugLog("CalcTJGExp npcID=%s,npcExp=%s,npcMaxHP=%s,npcCommendFightPower=%s" % (npcID, npcExp, npcMaxHP, npcCommendFightPower))
+        
     petSkillLV = 1
     petSkillPer = 10000
     
@@ -365,7 +375,7 @@
         aNPCHurtAddPer:%s, aFinalHurtPer:%s, 
         aIceAtk:%s, aDamagePVE:%s, aSkillAtkRate:%s, petMinAtk:%s, petMaxAtk:%s, petDamPer:%s, atkSpeed:%s,
         aIgnoreDefRate:%s, aLuckyHit:%s, aLuckyHitRate:%s, aBleedDamage:%s, aFinalHurt:%s, npcExp:%s, npcMaxHP:%s, npcCommendFightPower:%s,
-        petSkillLV:%s, petSkillPer:%s, skill:%s, petSkill:%s"""%(curPlayer.GetID(), curPlayer.GetLV(), times, npcData.GetNPCID(),
+        petSkillLV:%s, petSkillPer:%s, skill:%s, petSkill:%s"""%(curPlayer.GetID(), curPlayer.GetLV(), times, npcID,
             reExp, attackEff, aMinAtk, aMaxAtk, aSuperHitRate, aSuperHit, aNPCHurtAddPer, aFinalHurtPer,
             aIceAtk, aDamagePVE, aSkillAtkRate, petMinAtk, petMaxAtk, petDamPer,
             atkSpeed, aIgnoreDefRate, aLuckyHit, aLuckyHitRate, aBleedDamage, aFinalHurt, npcExp, npcMaxHP, npcCommendFightPower, petSkillLV,
@@ -418,8 +428,21 @@
     if not npcData:
         return finalAddExp
     
+    realmLV = PlayerControl.GetDifficultyRealmLV(PlayerControl.GetRealmDifficulty(curPlayer))
+    realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
+    if realmNPCIpyData:
+        mDef = realmNPCIpyData.GetMDef()
+        npcLV = realmNPCIpyData.GetLV()
+        sp = realmNPCIpyData.GetSP()
+        GameWorld.DebugLog("OnTJGKillNPCByTimes npcID=%s,npcLV=%s,mDef=%s,sp=%s,realmLV=%s" % (npcID, npcLV, mDef, sp, realmLV))
+    else:
+        mDef = npcData.GetMDef()
+        npcLV = npcData.GetLV()
+        sp = npcData.GetSP()
+        GameWorld.DebugLog("OnTJGKillNPCByTimes npcID=%s,npcLV=%s,mDef=%s,sp=%s" % (npcID, npcLV, mDef, sp))
+        
     # 1. 经验
-    exp = CalcTJGExp(curPlayer, times, npcData)
+    exp = CalcTJGExp(curPlayer, times, npcData, realmNPCIpyData)
     playerControl = PlayerControl.PlayerControl(curPlayer)
     if exp > 0:
         finalAddExp = playerControl.AddExp(exp, ShareDefine.Def_ViewExpType_KillNPC)
@@ -430,10 +453,10 @@
 
     
     # GetMDef 用于 NPC被击杀时间效率 毫秒
-    if npcData.GetMDef() == 0:
+    if mDef == 0:
         return finalAddExp
     
-    killCnt = times*1000/npcData.GetMDef()
+    killCnt = times*1000/mDef
     if not killCnt:
         return finalAddExp
     
@@ -442,18 +465,18 @@
     # 2.物品
     OnTJGDropItems(curPlayer, npcID, killCnt)
     #任务道具
-    OnTJGDropTaskItems(curPlayer, npcData.GetLV(), killCnt)
+    OnTJGDropTaskItems(curPlayer, npcLV, killCnt)
     # VIP杀怪加攻
-    PlayerVip.DoAddVIPKillLVExp(curPlayer, npcData, killCnt)
+    PlayerVip.DoAddVIPKillLVExp(curPlayer, npcLV, killCnt)
     
     # SP值
-    PlayerControl.AddZhenQiByKillNPC(curPlayer, npcData.GetSP(), killCnt)
+    PlayerControl.AddZhenQiByKillNPC(curPlayer, sp, killCnt)
     
     # 击杀特定NPC成就
     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillSpecificNPC, killCnt, [npcID])
     # 日常活动
     if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGOnDayEx):
-        if npcData.GetLV()>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):
+        if npcLV>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):
             PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_KillNPC, killCnt)
     # 击杀任务怪, 杀怪日常已经没有了,暂时屏蔽
     #for _ in xrange(killCnt):
@@ -775,8 +798,11 @@
     if not npcData:
         return
     
+    realmLV = PlayerControl.GetDifficultyRealmLV(PlayerControl.GetRealmDifficulty(curPlayer))
+    realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
+    
     # 1. 经验 
-    exp = CalcTJGExp(curPlayer, times, npcData)
+    exp = CalcTJGExp(curPlayer, times, npcData, realmNPCIpyData)
     expRate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Recover)
     exp = int(exp * expRate / float(ChConfig.Def_MaxRateValue))
     # 通知脱机挂被杀是的时间 和 被杀后的脱机挂时间可获得的经验
@@ -984,14 +1010,23 @@
 
         maxMapID = mapID
         
+    GameWorld.DebugLog("FindTJGNPC maxMapID=%s" % maxMapID)
     if not maxMapID:
         return 0
     
     # ---找到挂机等级点---
     lv = curPlayer.GetLV()
     myPoint = None
-    mapList = IpyGameDataPY.GetIpyGameDataByCondition("MapEventPoint", {"MapID":maxMapID}, True)
-
+    
+    # 注: NPCRealmStrengthen MapEventPoint 这两张配置表需要确保相关共用字段命名一样
+    realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)
+    realmDifficulty = PlayerControl.GetRealmDifficulty(curPlayer)
+    if maxMapID in realmMapIDList and realmDifficulty:
+        realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty)
+        mapList = IpyGameDataPY.GetIpyGameDataByCondition("NPCRealmStrengthen", {"MapID":maxMapID, "RealmDifficulty":realmLV}, True)
+    else:
+        mapList = IpyGameDataPY.GetIpyGameDataByCondition("MapEventPoint", {"MapID":maxMapID}, True)
+        
     mapEffList = []  # 有效挂机点,同地图中存在不需要挂机的NPC点
     for mapInfo in mapList:
         if mapInfo.GetLowLV() == 0:

--
Gitblit v1.8.0