| | |
| | | import CrossActCTGBillboard
|
| | | import CrossRealmMsg
|
| | | import PyGameData
|
| | | import PlayerFB
|
| | | import ChConfig
|
| | | import CommFunc
|
| | |
|
| | | import datetime
|
| | | import time
|
| | |
| | | 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()
|
| | |
| | |
|
| | | # 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)
|
| | |
|
| | |
| | | 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]
|
| | |
|
| | |
| | | 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:
|
| | |
| | | continue
|
| | | ipyData, startList, endList, notifyDict = timeInfoDict[cfgID]
|
| | |
|
| | | isEnd = True
|
| | | state = 0 # 默认关闭
|
| | | cfgID = ipyData.GetCfgID()
|
| | | groupName = ipyData.GetActGroupName()
|
| | |
| | | if startDateTime <= curDateTime < endDateTime:
|
| | | state = dIndex + 1 # 也是代表第几个时间段
|
| | | break
|
| | | |
| | | if endList:
|
| | | isEnd = (curDateTime >= endList[-1])
|
| | | |
| | | serverIDRangeList = actInfoDict.get(ShareDefine.ActKey_ServerIDRangeList)
|
| | | # 全服广播提示信息
|
| | | if curDateTime in notifyDict:
|
| | |
| | | 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
|
| | |
| | | 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:
|
| | |
| | | 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
|
| | |
|
| | |
| | | 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()))
|
| | |
|
| | |
| | |
|
| | | 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():
|
| | | # 地图启动成功时通知本日进行中的日常活动状态
|
| | |
|