From b8177fa3d4b76b87abddc756e91155e5c69c474d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 25 六月 2024 16:15:49 +0800
Subject: [PATCH] 10185 【越南】【港台】【主干】BOSS凭证修改(修复本服未开放仙盟榜活动时结算报错;)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py |  310 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 287 insertions(+), 23 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
index 775937e..489ae9c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossActionControl.py
@@ -22,9 +22,11 @@
 import PlayerControl
 import IpyGameDataPY
 import CrossActCTGBillboard
+import PlayerActBossTrial
 import CrossRealmMsg
 import PyGameData
 import ChConfig
+import CommFunc
 
 import datetime
 import time
@@ -56,6 +58,7 @@
                 # 非活动中的,已经结算过了,不需要存储
                 continue
             state = actInfo.get(ShareDefine.ActKey_State, 0)
+            stateJoin = actInfo.get(ShareDefine.ActKey_StateJoin, 0)
             actID = actInfo.get(ShareDefine.ActKey_ID, 0)
             templateID = actInfo.get(ShareDefine.ActKey_TemplateID, 0)
             serverIDRangeList = actInfo.get(ShareDefine.ActKey_ServerIDRangeList, "")
@@ -66,8 +69,9 @@
             recData.SetValue2(state)
             recData.SetValue3(actID)
             recData.SetValue4(templateID)
-            GameWorld.Log("    actName=%s,cfgID=%s,state=%s,actID=%s,templateID=%s,serverIDRangeList=%s" 
-                          % (actName, cfgID, state, actID, templateID, serverIDRangeList))
+            recData.SetValue5(stateJoin)
+            GameWorld.Log("    actName=%s,cfgID=%s,state=%s,stateJoin=%s,actID=%s,templateID=%s,serverIDRangeList=%s" 
+                          % (actName, cfgID, state, stateJoin, actID, templateID, serverIDRangeList))
             
     return
 
@@ -111,14 +115,24 @@
     GameWorld.DebugLog("找不到服务器组ID对应跨服活动分区! actName=%s, serverGroupID=%s" % (actName, serverGroupID))
     return
 
-def GetCrossActInfoByCfgID(actName, cfgID):
+def GetCrossActInfoByCfgID(actName, cfgID, zoneID=None):
+    ## 获取cfgID对应的跨服活动状态信息,可选验证zoneID是否匹配
     crossActInfoDict = GetCrossActInfoDict()
     if actName not in crossActInfoDict:
         return
     curActInfoDict = crossActInfoDict[actName]
     if cfgID not in curActInfoDict:
         return
-    return curActInfoDict[cfgID]
+    actInfo = curActInfoDict[cfgID]
+    if zoneID:
+        # 验证分区ID是否正确
+        ipyDataDict = actInfo.get(ShareDefine.ActKey_IpyDataInfo, {})
+        if not ipyDataDict:
+            return
+        ipyZoneID = ipyDataDict.get("ZoneID", 0)
+        if zoneID != ipyZoneID:
+            return
+    return actInfo
 
 def GetCrossActInfoDict():
     if PyGameData.g_crossActInfoDict == None:
@@ -136,6 +150,7 @@
             state = recData.GetValue2()
             actID = recData.GetValue3()
             templateID = recData.GetValue4()
+            stateJoin = recData.GetValue5()
             if not state:
                 continue
             if actName not in PyGameData.g_crossActInfoDict:
@@ -143,7 +158,8 @@
             actInfoDict = PyGameData.g_crossActInfoDict[actName]
             # 活动ID、状态、模板信息单独存储,重置活动判断用
             dbInfo = {ShareDefine.ActKey_ID:actID, ShareDefine.ActKey_State:state, ShareDefine.ActKey_TemplateID:templateID, 
-                      ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ServerIDRangeList:serverIDRangeList}
+                      ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ServerIDRangeList:serverIDRangeList, 
+                      ShareDefine.ActKey_StateJoin:stateJoin}
             actInfo = {}
             actInfo.update(dbInfo)
             actInfo[ShareDefine.ActKey_DBInfo] = dbInfo
@@ -275,6 +291,18 @@
                 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, "GetJoinStartTime") and hasattr(ipyData, "GetJoinEndTime"):
+                joinStartTimeStr = ipyData.GetJoinStartTime()
+                joinEndTimeStr = ipyData.GetJoinEndTime()
+            else:
+                joinStartTimeStr = ""
+                joinEndTimeStr = ""
+                
             if hasattr(ipyData, "GetStartTimeList") and hasattr(ipyData, "GetEndTimeList"):
                 startHMStrList = ipyData.GetStartTimeList()
                 endHMStrList = ipyData.GetEndTimeList()
@@ -290,6 +318,7 @@
                 GameWorld.ErrLog("        活动配置开始及结束时间个数不匹配! actName=%s,cfgID=%s,startHMStrList=%s,endHMStrList=%s" 
                                  % (actName, cfgID, startHMStrList, endHMStrList))
                 
+            isDayReset = 0 if not hasattr(ipyData, "GetIsDayReset") else ipyData.GetIsDayReset()    
             resetType = 0 if not hasattr(ipyData, "GetResetType") else ipyData.GetResetType() # 重置类型,0-0点重置;1-5点重置
             if resetType == 1:
                 startDayDate = datetime.datetime.strptime("%s 05:00:00" % (startDateStr), ChConfig.TYPE_Time_Format)
@@ -347,6 +376,17 @@
             GameWorld.Log("        startList=%s" % (startList))
             GameWorld.Log("        end  List=%s" % (endList))
             
+            joinStartTimeList, joinEndTimeList = [], [] # 可指定活动可参与的时间点,不影响活动状态,只影响活动某些功能的参与时机,如上榜类
+            if joinStartTimeStr:
+                if isDayReset:
+                    joinStartTimeList.append(datetime.datetime.strptime("%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, joinStartTimeStr), ChConfig.TYPE_Time_Format))
+                    joinEndTimeList.append(datetime.datetime.strptime("%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, joinEndTimeStr), ChConfig.TYPE_Time_Format))
+                else:
+                    joinStartTimeList.append(datetime.datetime.strptime("%s %s:00" % (startDateStr, joinStartTimeStr), ChConfig.TYPE_Time_Format))
+                    joinEndTimeList.append(datetime.datetime.strptime("%s %s:00" % (endDateStr, joinEndTimeStr), ChConfig.TYPE_Time_Format))                    
+            GameWorld.Log("        joinStartTimeList=%s" % (joinStartTimeList))
+            GameWorld.Log("        joinEndTime  List=%s" % (joinEndTimeList))
+            
             for dtIndex, startDateTime in enumerate(startList):
                 endDateTime = endList[dtIndex]
                 # 广播 - 相对实际开始时间
@@ -385,7 +425,7 @@
                 
             if actName not in actTimeInfoDict:
                 actTimeInfoDict[actName] = {}
-            actTimeInfoDict[actName][cfgID] = [ipyData, startList, endList, notifyDict]
+            actTimeInfoDict[actName][cfgID] = [ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList]
             if actName not in actCfgIDInfoDict:
                 actCfgIDInfoDict[actName] = [[], []]
             endCfgIDList, actCfgIDList = actCfgIDInfoDict[actName]
@@ -399,10 +439,11 @@
             
             # ipyData 活动时间表信息由跨服服务器同步子服,活动内容取子服自己的
             ipyDataDict = {}
-            for k, v in ipyData.__dict__.items():
-                if k in ["NotifyInfoStart", "NotifyInfoEnd", "NotifyInfoLoop", "ServerIDRangeList"]:
+            methods = CommFunc.get_class_method(ipyData, "Get") # 获取所有Get开头的方法
+            for method_name in methods:
+                if method_name in ["GetNotifyInfoStart", "GetNotifyInfoEnd", "GetNotifyInfoLoop", "GetServerIDRangeList"]:
                     continue
-                ipyDataDict[k] = v
+                ipyDataDict[method_name[3:]] = getattr(ipyData, method_name)()
             ipyDataDict.update({"StartDate":startDateStr, "EndDate":endDateStr})
             GameWorld.Log("        ipyDataDict=%s" % ipyDataDict)
             
@@ -438,7 +479,6 @@
                     
                 dayIndex = (curDateTime - startDayDate).days
                 actIDDateTime = startDayDate
-                isDayReset = 0 if not hasattr(ipyData, "GetIsDayReset") else ipyData.GetIsDayReset()
                 # 按时段开的默认每天重置
                 if isDayReset or (startHMStrList and endHMStrList):
                     actIDDateTime += datetime.timedelta(days=dayIndex)
@@ -446,7 +486,7 @@
                 GameWorld.Log("        isDayReset=%s,actIDDateTime=%s,actID=%s" % (isDayReset, actIDDateTime, actID))
                 
                 # 模板ID
-                if hasattr(ipyData, "TemplateIDList"):
+                if hasattr(ipyData, "GetTemplateIDList"):
                     templateIDList = ipyData.GetTemplateIDList()
                     templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex]
                     
@@ -484,6 +524,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:
@@ -496,9 +537,11 @@
         for cfgID in cfgIDList:
             if cfgID not in timeInfoDict:
                 continue
-            ipyData, startList, endList, notifyDict = timeInfoDict[cfgID]
+            ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList = timeInfoDict[cfgID]
             
+            isEnd = True
             state = 0 # 默认关闭
+            stateJoin = 0 # 可参与状态
             cfgID = ipyData.GetCfgID()
             groupName = ipyData.GetActGroupName()
             zoneID = ipyData.GetZoneID()
@@ -514,7 +557,18 @@
                     if startDateTime <= curDateTime < endDateTime:
                         state = dIndex + 1 # 也是代表第几个时间段
                         break
-                
+                if endList:
+                    isEnd = (curDateTime >= endList[-1])
+                    
+                if joinStartTimeList:
+                    for jIndex, joinStartDateTime in enumerate(joinStartTimeList):
+                        endJoinDateTime = joinEndTimeList[jIndex]
+                        if joinStartDateTime <= curDateTime < endJoinDateTime:
+                            stateJoin = state
+                            break
+                else:
+                    stateJoin = state
+                    
             serverIDRangeList = actInfoDict.get(ShareDefine.ActKey_ServerIDRangeList)
             # 全服广播提示信息
             if curDateTime in notifyDict:
@@ -528,6 +582,7 @@
                 
             dbInfo = actInfoDict.get(ShareDefine.ActKey_DBInfo, {})
             dbState = dbInfo.get(ShareDefine.ActKey_State, 0)
+            dbStateJoin = dbInfo.get(ShareDefine.ActKey_StateJoin, 0)
             dbCfgID = dbInfo.get(ShareDefine.ActKey_CfgID, 0)
             dbActID = dbInfo.get(ShareDefine.ActKey_ID, 0)
             dbTemplateID = dbInfo.get(ShareDefine.ActKey_TemplateID, 0)
@@ -539,16 +594,18 @@
                 
             actID = actInfoDict.get(ShareDefine.ActKey_ID, 0)
             templateID = actInfoDict.get(ShareDefine.ActKey_TemplateID, 0)
-            if not isReload and dbState == state and dbActID == actID and not forceReset:
+            if not isReload and dbState == state and dbStateJoin == stateJoin 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
+            actInfoDict[ShareDefine.ActKey_StateJoin] = stateJoin
             dbInfo = {ShareDefine.ActKey_ID:actID, ShareDefine.ActKey_State:state, ShareDefine.ActKey_TemplateID:templateID, 
-                      ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ServerIDRangeList:serverIDRangeList}
+                      ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ServerIDRangeList:serverIDRangeList, 
+                      ShareDefine.ActKey_StateJoin:stateJoin}
             actInfoDict[ShareDefine.ActKey_DBInfo] = dbInfo
             #GameWorld.Log("    活动状态同步信息: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,actInfoDict=%s" % (actName, cfgID, groupName, zoneID, actInfoDict))
             if actName not in sysnCrossActInfoDict:
@@ -562,15 +619,29 @@
                 if actName == ShareDefine.CrossActName_CTGBillboard:
                     CrossActCTGBillboard.OnActIDChange(cfgID, dbTemplateID, state)
                     
+                if actName == ShareDefine.CrossActName_BossTrial:
+                    PlayerActBossTrial.OnCrossActIDChange(cfgID, state)
+                    
                 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])
+                
+            GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossActInfo % actName, crossActInfoDict[actName])
             # 非活动中的处理完关闭后,最后删除
-            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 +654,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
 
@@ -673,3 +750,190 @@
         
     return
 
+## ================================================================================================
+
+def __GetTodayCrossDailyActionInfo():
+    # 获取本日待处理的日常活动信息
+    key = "TodayCrossDailyActionInfo"
+    curTime = int(time.time())
+    curDateStr = GameWorld.ChangeTimeNumToStr(curTime, ChConfig.TYPE_Time_YmdFormat) # 当天日期
+    loadSign = curDateStr
+    TodayDailyActionInfo = IpyGameDataPY.GetConfigEx(key)
+    if TodayDailyActionInfo and TodayDailyActionInfo[0] == loadSign:
+        GameWorld.DebugLog("已经加载过本日跨服日常活动处理信息!loadSign=%s" % loadSign)
+        return TodayDailyActionInfo[1]
+    
+    todayActionInfo = []
+    
+    dayTime = GameWorld.GetServerTime()
+    weekDay = str(dayTime.weekday() + 1) # 格式为json, 当前星期几, 1代表星期1
+    
+    GameWorld.Log("===== 加载今天跨服日常活动信息 =====")
+    GameWorld.Log("当前星期%s" % weekDay)
+    
+    dailyTimeInfoList = []
+    
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetCrossDailyActionCount()):
+        dailyIpyData = ipyDataMgr.GetCrossDailyActionByIndex(i)
+        dailyID = dailyIpyData.GetDailyID()
+        
+        openTimeDict = dailyIpyData.GetOpenTimeDict()
+        # 没有时间控制的,代表永久开放
+        if not openTimeDict:
+            todayActionInfo.append([dailyID])
+            GameWorld.Log("    增加本日常开跨服日常活动信息: dailyID=%s" % dailyID)
+            continue
+        
+        #如果星期key中存在 "0" 代表每日都开启
+        if "0" not in openTimeDict and weekDay not in openTimeDict:
+            GameWorld.Log("    不是跨服日常活动开启星期: dailyID=%s,openWeekLimit=%s" % (dailyID, openTimeDict.keys()))
+            continue
+        openTimeList = openTimeDict["0"] if "0" in openTimeDict else openTimeDict[weekDay]
+        dailyTimeInfoList.append([openTimeList, dailyIpyData])
+        
+    GameWorld.Log("    -----------------------")
+    for openTimeList, ipyData in dailyTimeInfoList:
+        dailyID = ipyData.GetDailyID()
+        notifyInfoDict = ipyData.GetNotifyInfo()
+        
+        openList = [] # [(时,分), ...]
+        overList = [] # [(时,分), ...]
+        goonStateDict = {} # {状态:[(aDateTime, bDateTime)], ...}
+        notifyDict = {} # {(时,分):[notifyKey, [参数]], ...}
+        OpenState = 1 # 定义开启状态为1
+        
+        for hour, minute in openTimeList:  
+            openTimeStr = "%s %02d:%02d:%02d" % (curDateStr, hour, minute, 0)
+            
+            # 精确开启时间
+            openDateTime = datetime.datetime.strptime(openTimeStr, ChConfig.TYPE_Time_Format)
+            openList.append((openDateTime.hour, openDateTime.minute))
+            
+            # 精确关闭时间
+            overDateTime = openDateTime + datetime.timedelta(minutes=ipyData.GetDuration())
+            overList.append((overDateTime.hour, overDateTime.minute))
+            
+            # goon 开启状态
+            openStateTimeList = goonStateDict.get(OpenState, [])
+            openStateTimeList.append((openDateTime, overDateTime))
+            goonStateDict[OpenState] = openStateTimeList
+            
+            # goon 其他状态,待扩展
+            # ...
+            
+            # 广播
+            for notifyMinute, notifyInfo in notifyInfoDict.items():
+                notifyDateTime = openDateTime + datetime.timedelta(minutes=notifyMinute)
+                notifyDict[(notifyDateTime.hour, notifyDateTime.minute)] = notifyInfo
+                
+        todayActionInfo.append([dailyID, openList, overList, goonStateDict, notifyDict])
+        GameWorld.Log("    增加本日跨服日常活动信息: dailyID=%s,openList=%s,overList=%s,goonStateDict=%s,notifyDict=%s" 
+                      % (dailyID, openList, overList, goonStateDict, notifyDict))
+        
+    TodayDailyActionInfo = IpyGameDataPY.SetConfigEx(key, [loadSign, todayActionInfo])
+    GameWorld.Log("本日跨服日常活动信息加载完毕! loadSign=%s" % loadSign)
+    GameWorld.Log("=============================================================")
+    return TodayDailyActionInfo[1]
+
+def Dispose_CrossDailyActionState():
+    # 跨服日常活动状态变更检查处理
+    
+    todayDailyActionInfo = __GetTodayCrossDailyActionInfo()
+    if not todayDailyActionInfo:
+        return
+    
+    gameWorld = GameWorld.GetGameWorld()
+    dayTime = GameWorld.GetServerTime()
+    curHourMinute = (dayTime.hour, dayTime.minute)
+    
+    sysnCrossDailyActionStateDict = {}
+    
+    for actionInfo in todayDailyActionInfo:
+        dailyActionID = actionInfo[0]
+        state = 0 # 默认关闭
+        
+        # 长度为1的代表常开的活动
+        if len(actionInfo) == 1:
+            state = 1
+        else:
+            #openList = [] # [(时,分), ...]
+            #overList = [] # [(时,分), ...]
+            #goonStateDict = {} # {状态:[(aDateTime, bDateTime)], ...}
+            #notifyDict = {} # {(时,分):[notifyKey, [参数]], ...}
+            openList, overList, goonStateDict, notifyDict = actionInfo[1:]
+            
+            # 精确匹配开启
+            if curHourMinute in openList:
+                state = 1
+            # 精确匹配关闭
+            elif curHourMinute in overList:
+                state = 0
+            # goon 状态
+            else:
+                for goonState, openStateTimeList in goonStateDict.items():
+                    for dateTimeInfo in openStateTimeList:
+                        if dateTimeInfo[0] < dayTime < dateTimeInfo[1]:
+                            state = goonState
+                            break
+                        
+            # 全服广播提示信息
+            if curHourMinute in notifyDict:
+                notifyKey, paramList = notifyDict[curHourMinute]
+                serverGroupIDList = []
+                PlayerControl.WorldNotifyCross(serverGroupIDList, 0, notifyKey, paramList)
+                
+        dictName = ShareDefine.Def_Notify_WorldKey_CrossDailyActionState % dailyActionID
+        beforeState = gameWorld.GetDictByKey(dictName)
+        if beforeState == state:
+            #已经是这个状态了
+            continue
+        
+        if state:
+            if dailyActionID == ShareDefine.CrossDailyActionID_YaomoBoss:
+                GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % dailyActionID, int(time.time()))
+                
+        sysnCrossDailyActionStateDict[dailyActionID] = state
+        #通知Mapserver,设置字典
+        GameWorld.SendMapServerMsgEx(dictName, state)
+        #更新字典值
+        gameWorld.SetDict(dictName, state)
+        GameWorld.Log("跨服日常活动状态变更: dailyActionID=%s,state=%s,dictName=%s" % (dailyActionID, state, dictName))
+        
+    # 同步子服务器
+    if sysnCrossDailyActionStateDict:
+        serverGroupIDList = []
+        CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossDailyActionState, sysnCrossDailyActionStateDict, serverGroupIDList)
+        
+    return
+
+def SendMapServerCrossDailyActionState():
+    # 地图启动成功时通知本日进行中的日常活动状态
+    
+    todayDailyActionInfo = __GetTodayCrossDailyActionInfo()
+    if not todayDailyActionInfo:
+        return
+    
+    gameWorld = GameWorld.GetGameWorld()
+    for actionInfo in todayDailyActionInfo:
+        dailyActionID = actionInfo[0]
+        dictName = ShareDefine.Def_Notify_WorldKey_CrossDailyActionState % dailyActionID 
+        state = gameWorld.GetDictByKey(dictName)
+        if state:
+            GameWorld.SendMapServerMsgEx(dictName, state)
+            
+    return
+
+def CrossServerMsg_CrossDailyActionState(msgData):
+    
+    gameWorld = GameWorld.GetGameWorld()
+    for dailyActionID, state in msgData.items():
+        dictName = ShareDefine.Def_Notify_WorldKey_CrossDailyActionState % dailyActionID
+        #通知Mapserver,设置字典
+        GameWorld.SendMapServerMsgEx(dictName, state)
+        #更新字典值
+        gameWorld.SetDict(dictName, state)
+        GameWorld.Log("收到跨服日常活动状态变更: dailyActionID=%s,state=%s,dictName=%s" % (dailyActionID, state, dictName))
+        
+    return
+

--
Gitblit v1.8.0