From 8991be83970f03f8f4baad83767f27586da0eafd Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 20 四月 2019 10:13:44 +0800
Subject: [PATCH] 6459 【后端】【2.0】缥缈仙域开发单(按时间掉血的NPC扣血公式调整)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py |  126 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 104 insertions(+), 22 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 0b2d18e..0aad972 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
@@ -14,13 +14,49 @@
 #-------------------------------------------------------------------------------
 #"""Version = 2019-04-15 16:30"""
 #-------------------------------------------------------------------------------
+
 import GameWorld
 import GameWorldProcess
+import PlayerFairyDomain
 import NPCCustomRefresh
+import IpyGameDataPY
 import PyGameData
+import NPCCommon
+import PlayerControl
+import ChConfig
+
+def DoResetCrossGrassland(curPlayer, eventType, fdeventID):
+    ## 草园重置
+    
+    resetCollectType = 10 + eventType
+    NPCCommon.DoResetCollectNPCTimeByType(curPlayer, [resetCollectType])
+    
+    # 宝箱怪次数重置
+    if eventType == PlayerFairyDomain.FDEventType_GrasslandXian:
+        npcID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+        if npcID:
+            NPCCommon.UpdateNPCAttackCount(curPlayer, npcID, 0)
+            
+    return
+    
+def __SetGrasslandVisitState(curPlayer, mapID, lineID, state):
+    ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
+    if not ipyData:
+        return False
+    eventID = ipyData.GetID()
+    if not PlayerFairyDomain.SetFairyDomainEventState(curPlayer, eventID, state):
+        return False
+    return True
 
 def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
+    if not __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting):
+        return False
     return True
+
+## 跨服功能线路数据缓存,下次开启同样功能线路时会用该数据进行还原之前的副本状态
+def OnGetCrossFuncLineDataCache():
+    refreshNPCInfo = NPCCustomRefresh.GetCopyMapRandomRefreshNPCInfo()
+    return refreshNPCInfo
 
 ## 开启副本
 def OnOpenFB(tick):
@@ -28,7 +64,7 @@
     realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
     key = (realMapID, copyMapID)
     if key in PyGameData.g_crossFuncLineDataCache:
-        refreshNPCInfo = PyGameData.g_crossFuncLineDataCache[key]
+        refreshNPCInfo = PyGameData.g_crossFuncLineDataCache.pop(key)
         GameWorld.DebugLog("副本开启根据保存的虚拟线路标试点刷怪信息刷怪: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo))
         NPCCustomRefresh.OnFBOpenSetRandomRefreshNPCInfo(refreshNPCInfo, tick)
         
@@ -50,27 +86,17 @@
     GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s" % (zoneID, funcLineID), playerID)
     return
 
-## 副本总逻辑计时器
-def OnProcess(tick):
-    #gameFB = GameWorld.GetGameFB()
-    return
-
-## 关闭副本
-def OnCloseFB(tick):
-    gameWorld = GameWorld.GetGameWorld()
-    refreshNPCInfo = NPCCustomRefresh.GetCopyMapRandomRefreshNPCInfo()
-    if refreshNPCInfo:
-        realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
-        key = (realMapID, copyMapID)
-        PyGameData.g_crossFuncLineDataCache[key] = refreshNPCInfo
-        GameWorld.DebugLog("缓存虚拟线路标试点刷怪信息: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo))
-        
-    GameWorld.GetGameWorld().SetPropertyID(0)
-    return
-
-## 玩家退出副本
-def DoExitFB(curPlayer, tick):
-    return
+### 副本总逻辑计时器
+#def OnProcess(tick):
+#    return
+#
+### 关闭副本
+#def OnCloseFB(tick):
+#    return
+#
+### 玩家退出副本
+#def DoExitFB(curPlayer, tick):
+#    return
 
 ##玩家主动离开副本.
 def DoPlayerLeaveFB(curPlayer, tick):
@@ -82,4 +108,60 @@
         
     return
 
+## 客户端进入自定义场景
+def OnEnterCustomScene(curPlayer, mapID, lineID):
+    __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
+    return
+
+def DoCheckUpdateGrasslandEnd(curPlayer):
+    ## 检查更新草园已拜访完成
+    
+    grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian]
+    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
+    clientCustomSceneMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
+    if crossMapID in grasslandMapIDList:
+        mapID = crossMapID
+        lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine)
+    elif clientCustomSceneMapID in grasslandMapIDList:
+        mapID = clientCustomSceneMapID
+        lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
+    else:
+        return
+    
+    # 采集次数是否已用完
+    collNPCIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
+    if not collNPCIpyDataList:
+        return
+    
+    for collIpyData in collNPCIpyDataList:
+        npcIDList = collIpyData.GetNPCIDList()
+        for npcID in npcIDList:
+            collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
+            if not collectNPCIpyData:
+                return
+            limitMaxTime = collectNPCIpyData.GetMaxCollectCount()
+            totalCollTime = NPCCommon.GetTodayCollectCount(curPlayer, npcID)
+            if totalCollTime < limitMaxTime:
+                GameWorld.DebugLog("草园NPC采集次数未用完! npcID=%s,totalCollTime=%s < limitMaxTime=%s" % (npcID, totalCollTime, limitMaxTime))
+                return
+            
+    # 宝箱怪攻击次数是否已用完
+    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
+        boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+        boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID)
+        if not boxNPCIpyData:
+            return
+        attackCountDropWeightInfo = boxNPCIpyData.GetAttackCountDropWeightInfo()
+        if not attackCountDropWeightInfo:
+            return
+        maxAttackCount = max(attackCountDropWeightInfo)
+        attackCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCAttackCount % boxNPCID)
+        if attackCount < maxAttackCount:
+            GameWorld.DebugLog("草园宝箱怪攻击次数未用完! boxNPCID=%s,attackCount=%s < maxAttackCount=%s" % (boxNPCID, attackCount, maxAttackCount))
+            return
+        
+    __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
+    GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
+    return
+
 

--
Gitblit v1.8.0