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/Player/PlayerRecover.py              |   20 ++++++++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py   |   22 ++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                          |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py |   21 ++++++++--
 4 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index d9bac28..0a6a433 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -916,17 +916,9 @@
         if not GameFuncComm.GetFuncCanUse(atkPlayer, funcID):
             PlayerControl.NotifyCode(atkPlayer, funcSysMark)
             return
-
-    hasKillCnt = atkPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt%index, 0)
-    itemAddKillCnt = atkPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntItemAddCnt%index, 0)
-    killLimitPrivilege = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 4, {}).get(index, 0)
-    if killLimitPrivilege:
-        limitCnt = PlayerVip.GetPrivilegeValue(atkPlayer, killLimitPrivilege)
-    else:
-        limitCnt = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 2, {}).get(index, 0)
+    canKillCnt, limitCnt = GetBossCanKillRemainCnt(atkPlayer, index)
     
-    
-    if hasKillCnt >= limitCnt + itemAddKillCnt:
+    if canKillCnt <= 0:
         #if BossHurtMng.GetPlayerBossHurt(atkPlayer, defender):
         #    GameWorld.DebugLog("攻击过该boss可继续攻击")
         #    return True
@@ -939,6 +931,16 @@
         return False
     return True
 
+def GetBossCanKillRemainCnt(curPlayer, funcIndex):
+    #获取BOSS剩余可击杀数量与最大数量
+    hasKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt%funcIndex, 0)
+    itemAddKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntItemAddCnt%funcIndex, 0)
+    killLimitPrivilege = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 4, {}).get(funcIndex, 0)
+    if killLimitPrivilege:
+        limitCnt = PlayerVip.GetPrivilegeValue(curPlayer, killLimitPrivilege)
+    else:
+        limitCnt = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 2, {}).get(funcIndex, 0)
+    return max(0, limitCnt + itemAddKillCnt - hasKillCnt), limitCnt
 
 def CheckAttackNPCByCnt(attacker, defender, isNotify=True):
     ''' 判断当日攻击该NPC次数是否已满 '''
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index fcbb6db..b001fd5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3385,6 +3385,7 @@
 Def_Player_Dict_EnterFbCntWeek = "EnterFbCntWeek_%s"  # 本周进入副本次数, 参数为副本ID
 Def_Player_Dict_FbCntRegainStartTime = "FbCntRegainStartTime_%s" # 副本次数恢复开始时间, 参数为副本ID
 Def_Player_Dict_FbCntRegainTotalTime = "FbCntRegainTotalTime_%s" # 副本次数恢复还需时间, 参数为副本ID
+Def_Player_Dict_FbCntRegainOverTime = "FbCntRegainOverTime_%s" # 副本次数恢复超出的次数, 参数为副本ID
 Def_Player_Dict_FBHistoryMaxLine = "FBHistoryMaxLine_%s"  # 副本历史最高通关, 参数为副本ID
 Def_Player_Dict_IceLoadLineID = "IceLoadLineID_%s"  # 副本星级星级信息, 参数为[key编号], 按位存储每个lineID是否选中
 Def_Player_Dict_RefurbishGoodBookPlayerLv = "RefurbishGoodBookPlayerLv_97"  # 刷新天书任务时的玩家等级
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):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRecover.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRecover.py
index 2c96581..102dde6c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRecover.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRecover.py
@@ -34,6 +34,7 @@
 import PlayerActivity
 import PlayerSuccess
 import PyGameData
+import AttackCommon
 
 import copy
 import datetime
@@ -151,15 +152,26 @@
             recoverNumList.append(index)
         elif dailyQuestData.GetRelatedType() == 1:#每日活动
             dailyID = dailyQuestData.GetRelatedID()
+            lostOnDay = lostOnDayNum
             curDayTimes, dayTimesLimit = PlayerActivity.GetDailyActionFinishCnt(curPlayer, dailyID)
             if dailyID in [ShareDefine.DailyActionID_Dice, ShareDefine.DailyActionID_IceLode]:#我要太极只分是否参加过,没参加过才能找回,次数算1次
                 dayTimesLimit = 1
                 if curDayTimes:
                     curDayTimes = dayTimesLimit
-                
-            if curDayTimes >= dayTimesLimit and not lostOnDayNum:
+            elif dailyID is ShareDefine.DailyActionID_WorldBOSS:
+                canKillCnt, dayTimesLimit = AttackCommon.GetBossCanKillRemainCnt(curPlayer, 0)
+                curDayTimes = dayTimesLimit - canKillCnt
+            elif dailyID is ShareDefine.DailyActionID_SealDemon:
+                #找回前先立即刷新一次
+                FBCommon.RegainFBCntProcess(curPlayer)
+                beyondTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainOverTime % ChConfig.Def_FBMapID_SealDemon)
+                recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
+                dayTimesLimit = 24*3600/recoverInterval
+                curDayTimes = dayTimesLimit - beyondTimes
+                lostOnDay = 0
+            if curDayTimes >= dayTimesLimit and not lostOnDay:
                 continue
-            addCommonCnt = (dayTimesLimit - curDayTimes) + lostOnDayNum * dayTimesLimit
+            addCommonCnt = (dayTimesLimit - curDayTimes) + lostOnDay * dayTimesLimit
             if addCommonCnt <=0:
                 continue
             curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
@@ -400,7 +412,7 @@
     expRate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Recover)
     extraData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainData % index, 0)
     dataEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainDataEx % index, 0)
-    
+    realmLV = curPlayer.GetOfficialRank()
     tjgExp = 0 #脱机挂找回经验
     exp = 0
     sp = 0

--
Gitblit v1.8.0