From a98e28b6487ea5634459d3e425124de6df143b2d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 19 三月 2025 14:21:01 +0800
Subject: [PATCH] 10263 【英文】【BT】【GM】后端支持NPC仿真实玩家战斗和快速战斗(触发被动死循环防范修改;)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py |   93 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 67 insertions(+), 26 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index bf08925..2907045 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -247,8 +247,9 @@
         GameWorld.Log("加载运营活动: actName=%s,platform=%s,serverGroupID=%s" % (actName, platform, serverGroupID))
         curServerActIpyDataList = __GetOperationActionServerIpyDataList(ipyDataMgr, platform, serverGroupID, actName)
         GameWorld.Log("    可处理条数=%s" % (len(curServerActIpyDataList)))
-        coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict = \
+        coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo = \
             __GetOperationActionDisableIpyDataInfo(actName, curDateTime, curServerActIpyDataList)
+        GameWorld.Log("    kOpenServerActInfo=%s" % kOpenServerActInfo)
             
         for ipyData in curServerActIpyDataList:
             
@@ -260,8 +261,13 @@
             endDateStr = ipyData.GetEndDate()
             actNum = GetOperationActNum(actName, ipyData)
             actType = GetOperationActType(actNum)
-            GameWorld.Log("    cfgID=%s,actNum=%s,startDateStr=%s,endDateStr=%s,openServerDay=%s,isMixServer=%s,mixServerDay=%s,curDateTime=%s,platformList=%s,serverGroupIDList=%s,Except=%s" 
-                          % (cfgID, actNum, startDateStr, endDateStr, openServerDay, isMixServer, mixServerDay, curDateTime, platformList, serverGroupIDList, serverGroupIDListExcept))
+            if kOpenServerActInfo and actNum in kOpenServerActInfo:
+                kOpenServerCfgIDInfo = kOpenServerActInfo[actNum]
+                actCustomServerDayMax = max(max(kOpenServerCfgIDInfo.values()), customMaxServerDay)
+            else:
+                actCustomServerDayMax = customMaxServerDay
+            GameWorld.Log("    cfgID=%s,actNum=%s,startDateStr=%s,endDateStr=%s,openServerDay=%s,actCustomServerDayMax=%s,isMixServer=%s,mixServerDay=%s,curDateTime=%s,platformList=%s,serverGroupIDList=%s,Except=%s" 
+                          % (cfgID, actNum, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, isMixServer, mixServerDay, curDateTime, platformList, serverGroupIDList, serverGroupIDListExcept))
             
             actIDDateTimeSpec = None # 特殊指定的活动ID日期
             startDateSync = None # 特殊同步前端显示用的开始日期,一般用于与开服前X天交叉的活动
@@ -319,10 +325,24 @@
                     endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day)
                     GameWorld.Log("        开服天转化为日期: %s ~ %s" % (startDateStr, endDateStr))
                     
+                # K开头的
+                elif startDateStr.startswith("K"):
+                    startServerDay, endServerDay = GameWorld.ToIntDef(startDateStr[1:]), GameWorld.ToIntDef(endDateStr[1:])
+                    #结束日可能还需要处理广播之类,所以这里需要+1
+                    if openServerDay > endServerDay + 1:
+                        GameWorld.Log("        当前开服天超过活动结束K开服天,不处理! cfgID=%s,%s ~ %s < openServerDay(%s)" % (cfgID, startDateStr, endDateStr, openServerDay))
+                        continue
+                    openServerDateTime = curDateTime + datetime.timedelta(days=(startServerDay - openServerDay))
+                    endServerDateTime = curDateTime + datetime.timedelta(days=(endServerDay - openServerDay))
+                    startDateStr = "%d-%d-%d" % (openServerDateTime.year, openServerDateTime.month, openServerDateTime.day)
+                    endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day)
+                    GameWorld.Log("        K开服天转化为日期: %s ~ %s" % (startDateStr, endDateStr))
+                    
                 # 常规配置: 开服前X天不开,不受合服影响,功能配置表可配置 开服前X天后交叉可开,每日重置的活动默认可开
                 elif actByWeek or actByDate or actByLoopYmd:
-                    if openServerDay <= customMaxServerDay:
-                        GameWorld.Log("        按日期/周开的在开服定制限制天内,不处理! cfgID=%s,%s ~ %s,openServerDay=%s" % (cfgID, startDateStr, endDateStr, openServerDay))
+                    if openServerDay <= actCustomServerDayMax:
+                        GameWorld.Log("        按日期/周开的在开服定制限制天内,不处理! cfgID=%s,%s ~ %s,openServerDay=%s,actCustomServerDayMax=%s,K开服天信息=%s" 
+                                      % (cfgID, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, kOpenServerActInfo))
                         continue
                     
                     if cfgID in coverDisableWeekIpyDataInfo:
@@ -341,7 +361,7 @@
                         GameWorld.Log("        星期X转化为日期: %s ~ %s" % (startDateStr, endDateStr))
                         
                     curServerOpenDateTime = curDateTime + datetime.timedelta(days=(1 - openServerDay)) # 开服第一天的日期
-                    customMaxServerDateTime = curDateTime + datetime.timedelta(days=(customMaxServerDay - openServerDay))
+                    customMaxServerDateTime = curDateTime + datetime.timedelta(days=(actCustomServerDayMax - openServerDay))
                     curStartDateTime = datetime.datetime.strptime("%s %02d:%02d:%02d" % (startDateStr, customMaxServerDateTime.hour, customMaxServerDateTime.minute,
                                                                                          customMaxServerDateTime.second), ChConfig.TYPE_Time_Format)
                     if curServerOpenDateTime <= curStartDateTime <= customMaxServerDateTime:
@@ -601,16 +621,26 @@
                     GameWorld.Log("        startDateSync=%s" % (startDateSync))
                     
                 dayIndex = (curDateTime - startDayDate).days
-                actIDDateTime = startDayDate
-                # 按时段开的默认每天重置
-                if isDayRest or (startHMStrList and endHMStrList):
-                    actIDDateTime += datetime.timedelta(days=dayIndex)
-                if actIDDateTimeSpec:
-                    actIDDateTime = actIDDateTimeSpec
-                actID = int(time.mktime(actIDDateTime.timetuple())) # 默认取开始时间点的time值作为活动ID
+                    
+                if ipyData.GetStartDate().startswith("K"):
+                    startServerDay = GameWorld.ToIntDef(ipyData.GetStartDate()[1:])
+                    # 按时段开的默认每天重置
+                    if isDayRest or (startHMStrList and endHMStrList):
+                        actID = startServerDay + dayIndex
+                    else:
+                        actID = startServerDay
+                    GameWorld.Log("        isDayRest=%s,startServerDay=%s,actID=%s" % (isDayRest, startServerDay, actID))
+                else:
+                    actIDDateTime = startDayDate
+                    # 按时段开的默认每天重置
+                    if isDayRest or (startHMStrList and endHMStrList):
+                        actIDDateTime += datetime.timedelta(days=dayIndex)
+                    if actIDDateTimeSpec:
+                        actIDDateTime = actIDDateTimeSpec
+                    actID = int(time.mktime(actIDDateTime.timetuple())) # 默认取开始时间点的time值作为活动ID
+                    GameWorld.Log("        isDayRest=%s,actIDDateTime=%s,actID=%s" % (isDayRest, actIDDateTime, actID))
                 activityInfoDict[ShareDefine.ActKey_DayIndex] = dayIndex
                 activityInfoDict[ShareDefine.ActKey_ID] = actID
-                GameWorld.Log("        isDayRest=%s,actIDDateTime=%s,actID=%s" % (isDayRest, actIDDateTime, actID))
                 GameWorld.Log("        activityInfoDict=%s" % (activityInfoDict))
                 
                 # 兼容新旧运营活动逻辑处理数据
@@ -684,6 +714,8 @@
     disableWeekCfgIDDict = {} # {cfgID:[startDateStr, endDateStr], ...} # 未开始循环的星期
     disableLoopCfgIDDict = {} # {cfgID:[startDateStr, endDateStr], ...} # 未开始循环的日期
     
+    kOpenServerActInfo = {} # 以K为开头的开服天活动中信息 {actNum:{cftID:endOpenServerDay, ...}, ...}
+    
     curDateTimeYmdStr = "%d-%d-%d" % (curDateTime.year, curDateTime.month, curDateTime.day)
     curDateTimeYmd = GameWorld.ChangeStrToDatetime(curDateTimeYmdStr, ChConfig.TYPE_Time_YmdFormat)
     
@@ -706,6 +738,15 @@
             else:
                 weekIpyDataList.append([cfgID, startWeekDate, endWeekDate])
             
+        # 指定开服天的,不受开服前7天配置影响
+        elif endDateStr.startswith("K"):
+            endKOpenServerDay = GameWorld.ToIntDef(endDateStr[1:])
+            if endKOpenServerDay:
+                if actNum not in kOpenServerActInfo:
+                    kOpenServerActInfo[actNum] = {}
+                kOpenServerCfgIDInfo = kOpenServerActInfo[actNum]
+                kOpenServerCfgIDInfo[cfgID] = endKOpenServerDay
+                
         # 按日期循环
         elif startDateStr.startswith("L"):
             loopStartDate, loopEndDate, loopTimes = GameWorld.GetOperationActionLoopDate(startDateStr, endDateStr, curDateTime)
@@ -775,7 +816,7 @@
                 if loopStartDate <= startWeekDate <= loopEndDate or loopStartDate <= endWeekDate <= loopEndDate:
                     coverDisableWeekIpyDataInfo[weekCfgID] = [startWeekDate, endWeekDate, loopCfgID, loopStartDate, loopEndDate]
                     
-    return coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict
+    return coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo
 
 def Dispose_OperationActionState(reloadRefresh=False):
     # 运营活动状态处理, 每天0点会强制同步当天的运营活动详情到地图服务器
@@ -1100,7 +1141,7 @@
     curDateStr = GameWorld.ChangeTimeNumToStr(curTime, ChConfig.TYPE_Time_YmdFormat) # 当天日期
     
     openServerWeekday = GameWorldProcess.GetOpenServerWeekday() # 服务器开服时是星期几
-    curMaxCustomServerDay = IpyGameDataPY.GetFuncCfg("OperationAction", 1) - openServerWeekday + 1 # 最大有效定制开服天
+    curMaxCustomServerDay = IpyGameDataPY.GetFuncCfg("OperationAction", 1) # 最大有效定制开服天
     maxCustomServerDayMix = IpyGameDataPY.GetFuncCfg("MixServer", 1)
     GameWorld.Log("===== 加载今天日常活动信息 =====")
     GameWorld.Log("开服是星期%s, 开服第%s天, 当前星期%s" % (openServerWeekday, openServerDay, weekDay))
@@ -1114,7 +1155,7 @@
         customIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("DailyActionCustom", openServerWeekday)
         if not customIpyDataList:
             customIpyDataList = []
-        GameWorld.Log("    本周定制的开服日常活动条数: %s" % len(customIpyDataList))
+        GameWorld.Log("    定制的开服日常活动条数: %s" % len(customIpyDataList))
         customIDList = []
         todayCustomIDList = []
         for customIpyData in customIpyDataList:
@@ -1128,8 +1169,8 @@
                 customType = 1
                 dailyTimeInfoList.append([customType, customIpyData.GetOpenTimeList(), customIpyData])
                 GameWorld.Log("    增加本日开服日常活动信息: customType=%s,dailyID=%s,dataID=%s" % (customType, dailyID, dataID))
-        GameWorld.Log("    本周定制的开服日常配置表ID列表: %s" % (customIDList))
-        GameWorld.Log("    本周定制的开服日常活动ID列表: %s" % (customDailyIDList))
+        GameWorld.Log("    定制的开服日常配置表ID列表: %s" % (customIDList))
+        GameWorld.Log("    定制的开服日常活动ID列表: %s" % (customDailyIDList))
         GameWorld.Log("    今天定制的开服日常表ID列表=%s" % (todayCustomIDList))
     elif isMixServer and mixServerDay <= maxCustomServerDayMix:
         todayCustomIDList = [] # 今天定制的数据表ID
@@ -1418,7 +1459,7 @@
         GameWorld.ErrLog("获取开服是星期几数据错误!openServerWeekday=%s" % openServerWeekday)
         return []
     
-    curMaxCustomServerDay = IpyGameDataPY.GetFuncCfg("OperationAction", 1) - openServerWeekday + 1 # 最大有效定制开服天
+    curMaxCustomServerDay = IpyGameDataPY.GetFuncCfg("OperationAction", 1) # 最大有效定制开服天
     maxCustomServerDayMix = IpyGameDataPY.GetFuncCfg("MixServer", 1)
     GameWorld.Log("===== 加载今天副本状态时间表 =====")
     GameWorld.Log("开服是星期%s, 开服第%s天, 当前星期%s,%s点%s分 !" % (openServerWeekday, openServerDay, curWeekDay, curHour, curMinute))
@@ -1427,15 +1468,15 @@
     
     ipyDataMgr = IpyGameDataPY.IPY_Data()
     
-    customMapIDList = [] # 本周有定制的副本数据地图ID列表
+    customMapIDList = [] # 有定制的副本数据地图ID列表
     fbStateTimeInfoList = []
     # 暂固定前2周定制有效, 为方便GM命令测试,这里用开服天做判断,不用开服周
     if openServerDay <= curMaxCustomServerDay:
         customIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("FBStateTimeCustom", openServerWeekday)
         if not customIpyDataList:
             customIpyDataList = []
-        GameWorld.Log("    本周定制的开服副本活动条数: %s" % len(customIpyDataList))
-        customIDList = [] # 本周定制的数据表ID
+        GameWorld.Log("    定制的开服副本活动条数: %s" % len(customIpyDataList))
+        customIDList = [] # 定制的数据表ID
         todayCustomIDList = [] # 今天定制的数据表ID
         for customIpyData in customIpyDataList:
             dataID = customIpyData.GetID()
@@ -1448,8 +1489,8 @@
                 customType, startWeekDay, endWeekDay = 1, curWeekDay, curWeekDay
                 fbStateTimeInfoList.append([customType, startWeekDay, endWeekDay, customIpyData])
                 GameWorld.Log("    今天要处理的开服副本状态配置: customType=%s,dataID=%s" % (customType, dataID))
-        GameWorld.Log("    本周定制的开服副本表ID列表: %s" % (customIDList))
-        GameWorld.Log("    本周定制的开服副本地图列表: %s" % (customMapIDList))
+        GameWorld.Log("    定制的开服副本表ID列表: %s" % (customIDList))
+        GameWorld.Log("    定制的开服副本地图列表: %s" % (customMapIDList))
         GameWorld.Log("    今天定制的开服副本表ID列表=%s" % (todayCustomIDList))
     elif isMixServer and mixServerDay <= maxCustomServerDayMix:
         todayCustomIDList = [] # 今天定制的数据表ID
@@ -1477,7 +1518,7 @@
         dataMapID = fbStateTimeIpyData.GetDataMapID()
         # 是当天开服天定制活动的不处理常规活动
         if dataMapID in customMapIDList:
-            GameWorld.Log("    dataID=%s,dataMapID=%s, 在本周定制的副本地图列表里,不处理!" % (dataID, dataMapID))
+            GameWorld.Log("    dataID=%s,dataMapID=%s, 在定制的副本地图列表里,不处理!" % (dataID, dataMapID))
             continue
         # 暂不支持跨天的活动
         customType, startWeekDay, endWeekDay = 0, fbStateTimeIpyData.GetStartWeekday(), fbStateTimeIpyData.GetStartWeekday()

--
Gitblit v1.8.0