From f1a6b8c880d4d10af12b76bf6962880946cafdb3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 26 十一月 2020 21:07:12 +0800
Subject: [PATCH] 4869 【主干】【长尾】【BT】运营活动按周开没有判断时间;(优化开始时间交叉时可开启的活动状态判断逻辑)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index b2e6970..e464bee 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -503,6 +503,8 @@
     curDateTime = datetime.datetime.strptime("%d-%d-%d %d:%d:00" % (curDateTime.year, curDateTime.month, curDateTime.day,
                                                                     curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
     
+    startDateInCustomCanOpenList = IpyGameDataPY.GetFuncEvalCfg("OperationAction", 2) # 开始天在定制天内在定制天结束后可继续开启的活动列表
+    
     for actName in ShareDefine.OperationActionNameList:
         
         state = 0 # 默认关闭
@@ -515,20 +517,41 @@
             #notifyDict = {} # {notifyDateTime:[notifyKey, [参数]], ...}
             #ipyData 可能为 None
             ipyData, startList, endList, notifyDict = operationActionDict[actName]
-            # 精确匹配开启
-            if curDateTime in startList:
-                state = startList.index(curDateTime) + 1 # 也是代表第几个时间段
-            # 精确匹配关闭
-            elif curDateTime in endList:
-                state = 0
-            # goon 状态
-            else:
+            
+            if actName in startDateInCustomCanOpenList:
+                # 由于某些活动的开始天允许和前定制X天有交叉的情况出现(实际不开,会等定制结束后才接下去开)
+                # 所以会有时间交叉的情况出现,这种活动goon单独判断
+                # 为防止动到其他活动,允许交叉的活动另外处理,理论上可以统一逻辑,为保险起见分开处理
+                
+                # 精确匹配开启
+                if curDateTime in startList:
+                    state = startList.index(curDateTime) + 1 # 也是代表第几个时间段
+                # 精确匹配关闭
+                elif curDateTime in endList:
+                    state = 0
+                    
+                # goon 状态
                 for dIndex, startDateTime in enumerate(startList):
                     endDateTime = endList[dIndex]
                     if startDateTime < curDateTime < endDateTime:
                         state = dIndex + 1
                         break
                     
+            else:
+                # 精确匹配开启
+                if curDateTime in startList:
+                    state = startList.index(curDateTime) + 1 # 也是代表第几个时间段
+                # 精确匹配关闭
+                elif curDateTime in endList:
+                    state = 0
+                # goon 状态
+                else:
+                    for dIndex, startDateTime in enumerate(startList):
+                        endDateTime = endList[dIndex]
+                        if startDateTime < curDateTime < endDateTime:
+                            state = dIndex + 1
+                            break
+                    
             # 全服广播提示信息
             if curDateTime in notifyDict:
                 notifyKey, paramList = notifyDict[curDateTime]

--
Gitblit v1.8.0