From 8b6a875df683ea3728da7b0411743f67e75760b2 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 27 五月 2019 20:48:35 +0800
Subject: [PATCH] 6970 【2.0】【后端】缥缈仙域仙草园(刷怪个数修改,采集个数支持星级修改)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py                                     |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py |   56 +++++++++++++++++++++-----------------------------------
 2 files changed, 23 insertions(+), 35 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
index c5c510a..2614330 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
@@ -131,35 +131,16 @@
     curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
     PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
     
-    boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
-    refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
-    refreshCount, npcIDRateList = refreshMapNPCDict.get(mapID, [0, []])
-    npcIDList = [rate[1] for rate in npcIDRateList]
     if curState == PlayerFairyDomain.FDEventState_CanVisit:
-        # 随机采集物数量
-        for npcID in npcIDList:
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, 0)
-        npcCountDict = {}
-        #  {寻访次数:{mapID:{npcID:个数, ...}, ...}, ...}
-        refreshMapNPCDictAppoint = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 3)
-        fairyDomainVisitCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
-        if fairyDomainVisitCnt in refreshMapNPCDictAppoint:
-            appointRefreshMapNPCDict = refreshMapNPCDictAppoint[fairyDomainVisitCnt]
-            npcCountDict = appointRefreshMapNPCDict.get(mapID, {})
-        if not npcCountDict:
-            for _ in xrange(refreshCount):
-                npcID = GameWorld.GetResultByRandomList(npcIDRateList)
-                if npcID:
-                    npcCount = npcCountDict.get(npcID, 0) + 1
-                    npcCountDict[npcID] = npcCount
-            
+        refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
+        npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
         for npcID, npcCount in npcCountDict.items():
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, npcCount)
             
         if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
             FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID)
             
-    SyncCustomSceneNPCCount(curPlayer, mapID)
+    SyncCustomSceneNPCCount(curPlayer, mapID, lineID)
     if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
         boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
         if boxNPCID:
@@ -170,31 +151,36 @@
 ## 自定义场景采集OK,需自带是否允许采集的判断
 def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
     curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
-    return curState == PlayerFairyDomain.FDEventState_Visiting
+    if curState != PlayerFairyDomain.FDEventState_Visiting:
+        return False
+    curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
+    if not curCount:
+        return False
+    return True
 
 def DecCustomSceneNPCCount(curPlayer, npcID):
     ## 减少草园自定义场景NPC,默认减少一个
-    mapID = GetGrasslandMapID(curPlayer)[0]
+    mapID, lineID = GetGrasslandMapID(curPlayer)
     if not mapID:
         return
     curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
     updCount = max(0, curCount - 1)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, updCount)
-    SyncCustomSceneNPCCount(curPlayer, mapID)
+    SyncCustomSceneNPCCount(curPlayer, mapID, lineID)
     return
 
-def SyncCustomSceneNPCCount(curPlayer, mapID):
+def SyncCustomSceneNPCCount(curPlayer, mapID, lineID):
     ## 通知自定义场景NPC数
     refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
-    npcIDRateList = refreshMapNPCDict.get(mapID, [0, []])[1]
-    npcCountDict = {}
-    for npcRate in npcIDRateList:
-        npcID = npcRate[1]
-        npcCountDict[npcID] = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
+    npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
+    npcNowCountDict = {}
+    for npcID in npcCountDict.keys():
+        npcNowCountDict[npcID] = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
     if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
         boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
-        npcCountDict[boxNPCID] = 1
-    NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCountDict)
+        if boxNPCID:
+            npcNowCountDict[boxNPCID] = 1
+    NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcNowCountDict)
     return
 
 def RecordGrasslandAward(curPlayer, addItemList):
@@ -274,8 +260,8 @@
                 return
             
     # 宝箱怪攻击次数是否已用完
-    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
-        boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+    boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian and boxNPCID:
         boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID)
         if not boxNPCIpyData:
             return
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 2b9d7b3..e6883cb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -6297,6 +6297,8 @@
 
 def UpdateNPCAttackCount(curPlayer, npcID, attackCount, maxCount=0):
     ## 更新玩家攻击NPC次数
+    if not npcID:
+        return
     GameWorld.DebugLog("更新玩家攻击NPC次数: npcID=%s,attackCount=%s,maxCount=%s" % (npcID, attackCount, maxCount))
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCAttackCount % npcID, attackCount)
     

--
Gitblit v1.8.0