From e2539a2e16790732960eb13c4b1b575cee3de446 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 20 六月 2019 15:17:56 +0800
Subject: [PATCH] 7429 【后端】【2.0】资源找回(封魔坛 世界boss)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
index 4ff972f..b616315 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -1574,8 +1574,7 @@
     maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
     maxCanAdd = max(0, maxDayTimes - (maxCnt-enterCnt))
     #GameWorld.DebugLog('封魔坛最大可恢复次数 %s'%maxCanAdd)
-    if not maxCanAdd:
-        return
+
     curTime = int(time.time())
     recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
     lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
@@ -1585,13 +1584,26 @@
     passTime = curTime - lastRegainTime
     if passTime < needTime:
         return
-    recoverCnt = min(maxCanAdd, 1 + (passTime-needTime) / recoverInterval) # 恢复次数
+    recoverCnt = 1 + (passTime-needTime) / recoverInterval # 恢复次数
+    if recoverCnt > maxCanAdd:
+        #记录超出的次数,用于资源找回
+        beyondTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID)
+        updBeyondTimes = recoverCnt - maxCanAdd + beyondTimes
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, updBeyondTimes)
+        if not maxCanAdd:
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
+        GameWorld.DebugLog('    封魔坛恢复次数 记录超出的次数addOverCnt=%s, updBeyondTimes=%s'%(recoverCnt-maxCanAdd, updBeyondTimes))
+    
+    if not maxCanAdd:
+        return
+    recoverCnt = min(maxCanAdd, recoverCnt)
+    
     enterCntKey = ChConfig.Def_Player_Dict_EnterFbCntDay % mapID
     newEnterCnt = max(0, enterCnt-recoverCnt)
     PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
     if recoverCnt == maxCanAdd:
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
     else:
         startTime = curTime- (passTime-needTime)%recoverInterval
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, startTime)
@@ -1729,6 +1741,7 @@
         if mapID in [ChConfig.Def_FBMapID_SealDemon]:
             newEnterCnt = max(0, dayTimes - (maxCnt - enterCnt))
             PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, 0)
             GameWorld.DebugLog("        特殊副本已进入次数更新: newEnterCnt=%s" % newEnterCnt)
         elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
             if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):

--
Gitblit v1.8.0