From 7cda738936cee0049a343ff13279a94fa7816c16 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 17:00:22 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(同场次提前结算的玩家无法再进入;优化无法进入系统提示;增加开启X分钟后无法进入;优化复活坐标)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
index b10f6c7..92885cf 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
@@ -396,6 +396,7 @@
             
         if openDateTime <= curDateTime < closeDateTime:
             battlefieldState = openHour * 100 + openMinute
+            PyGameData.g_openDateTime = openDateTime
             
     stateKey = ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_CrossBattlefield
     gameWorld = GameWorld.GetGameWorld()
@@ -413,6 +414,8 @@
     if battlefieldState and beforeState != battlefieldState:
         # 移除已经存在的副本线路
         PyGameData.g_crossDynamicLineInfo.pop(ChConfig.Def_FBMapID_CrossBattlefield, None)
+        
+        PyGameData.g_overPlayerIDList = []
         
         crossZoneName = GameWorld.GetCrossZoneName()
         crossZoneList = IpyGameDataPY.GetIpyGameDataByCondition("CrossZonePK", {"CrossZoneName":crossZoneName}, True)
@@ -511,18 +514,27 @@
         
     return
 
-def GetCrossBattlefieldOpenTime(zoneID):
+def GetCrossBattlefieldOpenTime(serverGroupID, zoneID, playerID):
     ## 获取跨服战场副本当前是否开放的时间点
     #  @return: None-当前未开放;
-    #  @return: hour, minute  -  当前开放中的时间时分,可进入
+    #  @return: isCallBattle, openHour, openMinute  -  当前开放中的时间时分,可进入
     
     gameWorld = GameWorld.GetGameWorld()
     hmNum = GetCrossBattlefieldState()
     if not hmNum:
+        GameWorld.Log("当前时间战场未开启!", playerID)
+        PlayerControl.NotifyCodeCross(serverGroupID, playerID, "FBIsNotOpen")
         return
     
     seasonState = gameWorld.GetDictByKey(ChConfig.Def_WorldKey_CrossPKZoneSeasonState % zoneID)
     if seasonState != 1:
+        GameWorld.Log("赛季未开启!", playerID)
+        PlayerControl.NotifyCodeCross(serverGroupID, playerID, "NotifySeasonOver")
+        return
+    
+    if playerID in PyGameData.g_overPlayerIDList:
+        # 您已经参加过该场次,无法再进入!
+        PlayerControl.NotifyCodeCross(serverGroupID, playerID, "CrossBattlefieldAlreadyJoin")
         return
     
     openHour, openMinute = GetHMByNum(hmNum)
@@ -530,12 +542,48 @@
     isCallBattle = [openHour, openMinute] not in sysOpenHMList
     if isCallBattle:
         if zoneID not in PyGameData.g_crossBattlefieldBuyInfo:
-            GameWorld.DebugLog("该分区没有使用召集令! zoneID=%s" % zoneID)
+            GameWorld.Log("该分区没有使用召集令! zoneID=%s" % zoneID, playerID)
+            PlayerControl.NotifyCodeCross(serverGroupID, playerID, "FBIsNotOpen")
             return
         buyHMInfo = PyGameData.g_crossBattlefieldBuyInfo[zoneID]
         if hmNum not in buyHMInfo:
-            GameWorld.DebugLog("该时段还未使用召集令! zoneID=%s,hmNum=%s" % (zoneID, hmNum))
+            GameWorld.Log("该时段还未使用召集令! zoneID=%s,hmNum=%s" % (zoneID, hmNum), playerID)
+            PlayerControl.NotifyCodeCross(serverGroupID, playerID, "FBIsNotOpen")
             return
+        
+        # 召集场只有一条线,如果有人结算则代表已经结束了
+        if PyGameData.g_overPlayerIDList:
+            # 该召集场次已结算,无法进入!
+            PlayerControl.NotifyCodeCross(serverGroupID, playerID, "CrossBattlefieldCallOver")
+            return
+        
+    if PyGameData.g_openDateTime:
+        serverTime = GameWorld.GetServerTime()
+        passSeconds = (serverTime - PyGameData.g_openDateTime).seconds
+        closeEnterMinutes = IpyGameDataPY.GetFuncCfg("CrossBattlefieldOpen", 5) # 开启X分钟后不可进入,不包含已进入玩家及召集队伍中的玩家
+        closeSeconds = closeEnterMinutes * 60
+        if passSeconds > closeSeconds:
+            GameWorld.DebugLog("迟到了! passSeconds=%s > %s" % (passSeconds, closeSeconds), playerID)
+            isBelate = True
+            for _, copyMapObj in PyGameData.g_crossDynamicLineCopyMapInfo.items():
+                if copyMapObj.IsMustCopyMapPlayer(playerID):
+                    isBelate = False
+                    GameWorld.DebugLog("已进入的重复进入不限制时间!  playerID=%s" % playerID)
+                    break
+                
+            if isCallBattle:
+                buyPlayerInfo = buyHMInfo[hmNum]
+                for buyRec in buyPlayerInfo.values():
+                    if playerID in buyRec.callPlayerIDList:
+                        isBelate = False
+                        GameWorld.DebugLog("召集令成员不受人时间限制!  playerID=%s" % playerID)
+                        break
+                    
+            if isBelate:
+                PlayerControl.NotifyCodeCross(serverGroupID, playerID, "CrossBattlefieldBelate", [closeEnterMinutes])
+                return
+        #else:
+        #    GameWorld.DebugLog("没有迟到!passSeconds=%s <= %s" % (passSeconds, closeSeconds), playerID)
         
     return isCallBattle, openHour, openMinute
 
@@ -804,6 +852,8 @@
             factionBuffCollCnt, personBuffCollCnt, crystalCollCnt, wallCollCnt \
                 = playerInfo
             
+        PyGameData.g_overPlayerIDList.append(playerID)
+        
         paramList = [rank]
         if faction == winnerFaction:
             winnerPlayerIDList.append(playerID)

--
Gitblit v1.8.0