From a5b182817a2865bd9b4c78e19065f580d0efc4b2 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 20 十二月 2023 16:04:35 +0800
Subject: [PATCH] 10024 【主干】【港台】【砍树】新增三种战令(增加战令类型4:古宝总星级)
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py | 68 +++++++++++++++++++++++++++++----
1 files changed, 59 insertions(+), 9 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
index be85cb0..534b2d2 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
@@ -24,6 +24,7 @@
import CrossActCTGBillboard
import CrossRealmMsg
import PyGameData
+import PlayerFB
import ChConfig
import datetime
@@ -275,6 +276,11 @@
endDateStr = curDateStr
GameWorld.Log(" 结束日期为空,默认每天,今日为: endDateStr=%s" % endDateStr)
+ actByWeek = (startDateStr.startswith("W") and endDateStr.startswith("W")) # 按周x开
+ if actByWeek:
+ startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
+ GameWorld.Log(" 星期X转化为日期: %s ~ %s" % (startDateStr, endDateStr))
+
if hasattr(ipyData, "GetStartTimeList") and hasattr(ipyData, "GetEndTimeList"):
startHMStrList = ipyData.GetStartTimeList()
endHMStrList = ipyData.GetEndTimeList()
@@ -484,6 +490,7 @@
curDateTime = datetime.datetime.strptime("%d-%d-%d %d:%d:00" % (curDateTime.year, curDateTime.month, curDateTime.day,
curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
actChangeList = []
+ actStateChangeList = []
sysnCrossActInfoDict = {}
for actName in ShareDefine.CrossActNameList:
if actName not in actTimeInfoDict or actName not in crossActInfoDict or actName not in actCfgIDInfoDict:
@@ -498,6 +505,7 @@
continue
ipyData, startList, endList, notifyDict = timeInfoDict[cfgID]
+ isEnd = True
state = 0 # 默认关闭
cfgID = ipyData.GetCfgID()
groupName = ipyData.GetActGroupName()
@@ -514,7 +522,9 @@
if startDateTime <= curDateTime < endDateTime:
state = dIndex + 1 # 也是代表第几个时间段
break
-
+ if endList:
+ isEnd = (curDateTime >= endList[-1])
+
serverIDRangeList = actInfoDict.get(ShareDefine.ActKey_ServerIDRangeList)
# 全服广播提示信息
if curDateTime in notifyDict:
@@ -542,8 +552,8 @@
if not isReload and dbState == state and dbActID == actID and not forceReset:
#已经是这个状态了
continue
- GameWorld.Log("跨服运营活动状态: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s, dbActID=%s -> actID=%s,forceReset=%s"
- % (actName, cfgID, groupName, zoneID, dbState, state, dbActID, actID, forceReset))
+ GameWorld.Log("跨服运营活动状态: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,isEnd=%s, dbActID=%s -> actID=%s,forceReset=%s"
+ % (actName, cfgID, groupName, zoneID, dbState, state, isEnd, dbActID, actID, forceReset))
# 更新状态
actInfoDict[ShareDefine.ActKey_State] = state
@@ -565,12 +575,22 @@
else:
actChangeList.append([actName, ipyData, state, cfgID, groupName, zoneID, dbActID, actID, forceReset, dbTemplateID])
+ # 活动ID变更强制视为状态变更,防止维护前后状态一样,但其实活动ID已经不同的情况会导致无法触发状态变更
+ actIDChange = True
+ actStateChangeList.append([actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID])
+
+ elif dbState != state:
+ actIDChange = False
+ GameWorld.Log(" 活动状态变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,actIDChange=%s,dbTemplateID=%s"
+ % (actName, cfgID, groupName, zoneID, dbState, state, actIDChange, dbTemplateID))
+ actStateChangeList.append([actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID])
+
# 非活动中的处理完关闭后,最后删除
- if not state:
+ if not state and isEnd:
del crossActInfoDict[actName][cfgID]
if not crossActInfoDict[actName]:
del crossActInfoDict[actName]
- #GameWorld.Log(" 移除结束的活动: actName=%s,cfgID=%s,crossActInfoDict=%s" % (actName, cfgID, crossActInfoDict))
+ GameWorld.Log(" 移除结束的活动: actName=%s,cfgID=%s,crossActInfoDict=%s" % (actName, cfgID, crossActInfoDict))
# 同步子服务器
if sysnCrossActInfoDict:
@@ -583,12 +603,18 @@
GameWorld.Log(" 活动ID变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbActID=%s -> actID=%s,forceReset=%s,dbTemplateID=%s"
% (actName, cfgID, groupName, zoneID, dbActID, actID, forceReset, dbTemplateID))
- if actName == ShareDefine.CrossActName_LuckyCloudBuy:
- import CrossLuckyCloudBuy
- CrossLuckyCloudBuy.OnLuckyCloudBuyReset(ipyData, state)
- elif actName == ShareDefine.CrossActName_AllRecharge:
+ if actName == ShareDefine.CrossActName_AllRecharge:
import CrossActAllRecharge
CrossActAllRecharge.OnActIDChange(ipyData, state)
+
+ for changeInfo in actStateChangeList:
+ actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID = changeInfo
+ GameWorld.Log(" 活动状态变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,actIDChange=%s,dbTemplateID=%s"
+ % (actName, cfgID, groupName, zoneID, dbState, state, actIDChange, dbTemplateID))
+
+ if actName == ShareDefine.CrossActName_LuckyCloudBuy:
+ import CrossLuckyCloudBuy
+ CrossLuckyCloudBuy.OnLuckyCloudBuyStateChange(ipyData, actIDChange, state)
return
@@ -813,6 +839,10 @@
continue
if state:
+ if dailyActionID in ChConfig.Def_CrossDailyMap:
+ # 开启对应日常地图分区线路
+ __openCrossDailyMap(ChConfig.Def_CrossDailyMap[dailyActionID])
+
if dailyActionID == ShareDefine.CrossDailyActionID_YaomoBoss:
GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % dailyActionID, int(time.time()))
@@ -830,6 +860,26 @@
return
+def __openCrossDailyMap(mapID):
+ if mapID not in ChConfig.Def_CrossZoneMapTableName:
+ return
+ zoneTypeName = ChConfig.Def_CrossZoneMapTableName[mapID]
+ ipyDataMgr = IpyGameDataPY.IPY_Data()
+ if zoneTypeName and hasattr(ipyDataMgr, "Get%sCount" % zoneTypeName):
+ realMapInfo = {}
+ for index in range(getattr(ipyDataMgr, "Get%sCount" % zoneTypeName)()):
+ ipyData = getattr(ipyDataMgr, "Get%sByIndex" % zoneTypeName)(index)
+ zoneID = ipyData.GetZoneID()
+ realMapID = ipyData.GetMapID()
+ copyMapID = ipyData.GetCopyMapID()
+ if realMapID not in realMapInfo:
+ realMapInfo[realMapID] = []
+ copyPropertyList = realMapInfo[realMapID]
+ copyPropertyList.append([copyMapID, zoneID])
+ for realMapID, copyPropertyList in realMapInfo.items():
+ PlayerFB.SendMapOpenFBEx(realMapID, copyPropertyList)
+ return
+
def SendMapServerCrossDailyActionState():
# 地图启动成功时通知本日进行中的日常活动状态
--
Gitblit v1.8.0