From 5d9a338c76eba9fd98f95bdff77b78e4c657382e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 23 五月 2019 21:17:16 +0800
Subject: [PATCH] 6805 【后端】【2.0】副本前端化(增加过滤炼丹等级通用配置)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py |    3 +++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py  |    8 +++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py            |   15 +--------------
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
index 9a19d41..af23b2e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
@@ -1942,9 +1942,15 @@
     return itemDict
 
 def GetWeightItemListByAlchemyDiffLV(curPlayer, weightList, alchemyDiffLV):
-    ## 根据炼丹等级差异等级过滤权重列表中不满足的物品,返回新的权重列表
+    ''' 根据炼丹等级差异等级过滤权重列表中不满足的物品,返回新的权重列表
+    @param weightList: 物品权重信息列表
+    @param alchemyDiffLV: 是否过滤掉大于X级的炼丹等级物品,0-不过滤,1-过滤且读默认配置,>1-特殊功能指定的过滤等级
+    '''
     resultWeightList = []
     if alchemyDiffLV:
+        # 如果有指定大于1的等级则取指定等级,没有的话取默认等级差
+        if alchemyDiffLV == 1:
+            alchemyDiffLV = IpyGameDataPY.GetFuncCfg("AlchemyDiffLV", 1)
         curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
         for itemInfo in weightList:
             itemID = itemInfo[1][0]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py
index 8dcbc23..62be145 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_PriWood.py
@@ -37,6 +37,9 @@
     npcControl.RefreshBuffState(tick)
     
     owner = NPCCommon.GetNpcObjOwnerDetail(curNPC)
+    if not owner:
+        return
+    
     if GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), owner.GetPosX(), owner.GetPosY()) > 3:
         resetPos = GameMap.GetEmptyPlaceInArea(owner.GetPosX(), owner.GetPosY(), 2)
         curNPC.ResetPos(resetPos.GetPosX(), resetPos.GetPosY())
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 a2400c3..1a68119 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -5923,20 +5923,7 @@
         
     if not awardItemList:
         alchemyDiffLV = collectNPCIpyData.GetAlchemyDiffLV()
-        giveItemWeightList = []
-        if alchemyDiffLV:
-            curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
-            for itemInfo in collectAwardCfg:
-                itemID = itemInfo[1][0]
-                itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
-                if not itemData:
-                    continue
-                if ItemCommon.GetItemClassLV(itemData) > curAlchemyLV + alchemyDiffLV:
-                    continue
-                giveItemWeightList.append(itemInfo)
-        else:
-            giveItemWeightList = collectAwardCfg
-            
+        giveItemWeightList = ItemCommon.GetWeightItemListByAlchemyDiffLV(curPlayer, collectAwardCfg, alchemyDiffLV)
         GameWorld.DebugLog("    常规采集物品权重列表: alchemyDiffLV=%s,collectAwardCfg=%s,giveItemWeightList=%s" % (alchemyDiffLV, collectAwardCfg, giveItemWeightList))
         giveItemInfo = GameWorld.GetResultByWeightList(giveItemWeightList)
         if giveItemInfo:

--
Gitblit v1.8.0