#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package GameWorldLogic.GameWorldAction # # @todo:»î¶¯Ê±¼ä¿ØÖÆÆ÷ # @author hxp # @date 2026-02-08 # @version 1.0 # # ÏêϸÃèÊö: »î¶¯Ê±¼ä¿ØÖÆÆ÷ # #------------------------------------------------------------------------------- #"""Version = 2026-02-08 16:00""" #------------------------------------------------------------------------------- import GameWorld import DBDataMgr import ShareDefine import PlayerActLunhuidian import IpyGameDataPY import PlayerControl import PyGameData import ChConfig import datetime import time ( OperationAction_ReloadSign, # ÐÅÏ¢ÖØÔØ±ê¼Ç OperationAction_TodayInfo, # µ±ÈյĻÐÅÏ¢ ) = range(2) def GetOperationActType(actNum): ## ÔËÓª»î¶¯ÀàÐÍ return actNum / 10 def OnProcessGameAction(curTime): ## ¶¨Ê±´¦ÀíÓÎÏ·µÄ»î¶¯Ê±¼ä Dispose_OperationActionState() #Dispose_DailyActionState() #Dispose_FBStateTime() return def __GetOperationActionInfo(): # @return: isReload, OperationActionInfo key = "OperationActionInfo" openServerDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_ServerDay) + 1 isMixServer = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_IsMixServer) mixServerDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_MixServerDay) + 1 OperationActionInfo = IpyGameDataPY.GetConfigEx(key) serverTime = GameWorld.GetServerTime() #curHour = serverTime.hour reloadSignHour = 0 #0 if curHour < 5 else 5 ·ÏÆú5µãË¢ÐÂÂß¼­ reloadSign = [openServerDay, isMixServer, mixServerDay, reloadSignHour] if OperationActionInfo and OperationActionInfo[OperationAction_ReloadSign] == reloadSign: #GameWorld.DebugLog("ÒѾ­¼ÓÔØ¹ý±¾ÈÕÔËÓª»î¶¯´¦ÀíÐÅÏ¢£¡openServerDay=%s" % openServerDay) return False, OperationActionInfo # ÒòΪºóÃæµÄʱ¼äÅж϶¼ÊǾ«È·µ½·ÖµÄ£¬¶ø´¦Àí´ËÂß¼­µÄʱºò¿ÉÄܲ»ÊÇ0Ã룬ËùÒÔÕâÀïµÄdatetimeÈ¡µ±Ç°Ê±¼ä¾«È·µ½·ÖµÄ curDateTimeStr = "%d-%d-%d %02d:%02d:00" % (serverTime.year, serverTime.month, serverTime.day, serverTime.hour, serverTime.minute) curDateTime = datetime.datetime.strptime(curDateTimeStr, ChConfig.TYPE_Time_Format) startDateInCustomCanOpenList = IpyGameDataPY.GetFuncEvalCfg("OperationAction", 2) # ¿ªÊ¼ÌìÔÚ¶¨ÖÆÌìÄÚÔÚ¶¨ÖÆÌì½áÊøºó¿É¼ÌÐø¿ªÆôµÄ»î¶¯Áбí customMaxServerDay = IpyGameDataPY.GetFuncCfg("OperationAction", 1) # ¶¨ÖÆÔËÓª»î¶¯×î´ó¿ª·þÌì #maxCustomServerDayMix = IpyGameDataPY.GetFuncCfg("MixServer", 1) # ¶¨ÖÆÔËÓª»î¶¯×î´óºÏ·þÌì operationTodayActionDict = {} PyGameData.g_operationActionDict = {} platform = GameWorld.GetPlatform() serverID = GameWorld.GetGameWorld().GetServerID() ipyDataMgr = IpyGameDataPY.IPY_Data() curWeekday = curDateTime.weekday() + 1 # ½ñÌìÐÇÆÚ¼¸, 1´ú±íÐÇÆÚ1 GameWorld.Log("===== ¼ÓÔØ±¾ÈÕÔËÓª»î¶¯ÐÅÏ¢: %s, serverID=%s,openServerDay=%s,customMaxServerDay=%s,isMixServer=%s,mixServerDay=%s,reloadSign=%s =====" % (curDateTime, serverID, openServerDay, customMaxServerDay, isMixServer, mixServerDay, reloadSign)) GameWorld.Log(" ½ñÈÕÖÜ%s" % (curWeekday)) for actName in ShareDefine.OperationActionNameList: if actName not in PyGameData.g_operationActionDict: PyGameData.g_operationActionDict[actName] = {} # È¡³ö±¾»î¶¯ËùÊô±¾·þIDµÄËùÓÐÅäÖà GameWorld.Log("¼ÓÔØÔËÓª»î¶¯: actName=%s,platform=%s,serverID=%s" % (actName, platform, serverID)) curServerActIpyDataList = __GetOperationActionServerIpyDataList(ipyDataMgr, platform, serverID, actName) GameWorld.Log(" ¿É´¦ÀíÌõÊý=%s" % (len(curServerActIpyDataList))) coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo = \ __GetOperationActionDisableIpyDataInfo(actName, curDateTime, curServerActIpyDataList) GameWorld.Log(" kOpenServerActInfo=%s" % kOpenServerActInfo) for ipyData in curServerActIpyDataList: platformList = [] if not hasattr(ipyData, "GetPlatformList") else ipyData.GetPlatformList() serverIDList = [] if not hasattr(ipyData, "GetServerIDList") else ipyData.GetServerIDList() serverIDListExcept = [] if not hasattr(ipyData, "GetServerIDListExcept") else ipyData.GetServerIDListExcept() cfgID = ipyData.GetCfgID() startDateStr = ipyData.GetStartDate() endDateStr = ipyData.GetEndDate() actNum = ipyData.GetActNum() actType = GetOperationActType(actNum) 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,serverIDList=%s,Except=%s" % (cfgID, actNum, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, isMixServer, mixServerDay, curDateTime, platformList, serverIDList, serverIDListExcept)) actIDDateTimeSpec = None # ÌØÊâÖ¸¶¨µÄ»î¶¯IDÈÕÆÚ startDateSync = None # ÌØÊâͬ²½Ç°¶ËÏÔʾÓõĿªÊ¼ÈÕÆÚ£¬Ò»°ãÓÃÓÚÓ뿪·þǰXÌì½»²æµÄ»î¶¯ # ¶à»î¶¯·Ö×é±àºÅÖ§³Ö if actNum not in PyGameData.g_operationActionDict[actName]: PyGameData.g_operationActionDict[actName][actNum] = {ShareDefine.ActKey_ActNum:actNum} curActTodayInfo = operationTodayActionDict.get(actName, {}).get(actNum) if not startDateStr: startDateStr = "%d-%d-%d" % (serverTime.year, serverTime.month, serverTime.day) GameWorld.Log(" ¿ªÊ¼ÈÕÆÚΪ¿Õ£¬Ä¬ÈÏÿÌ죬½ñÈÕΪ: startDateStr=%s" % startDateStr) if not endDateStr: endDateStr = "%d-%d-%d" % (serverTime.year, serverTime.month, serverTime.day) GameWorld.Log(" ½áÊøÈÕÆÚΪ¿Õ£¬Ä¬ÈÏÿÌ죬½ñÈÕΪ: endDateStr=%s" % endDateStr) actByLoopYmd = startDateStr.startswith("L") # °´ÈÕÆÚÑ­»· # ¸ù¾ÝÈÕÆÚÑ­»·µÄͨÓà if actByLoopYmd: if cfgID in coverDisableLoopIpyDataInfo: loopStartDate, loopEndDate, ymdCfgID, ymdStartDate, ymdEndDate = coverDisableLoopIpyDataInfo[cfgID] GameWorld.Log(" °´ÈÕÆÚÑ­»·µÄÔÚ°´ÈÕÆÚ¿ªÆôµÄʱ¼äÄÚ£¬²»´¦Àí! cfgID=%s,%s(%s) ~ %s(%s) in ymdCfgID=%s,%s ~ %s" % (cfgID, loopStartDate, startDateStr, loopEndDate, endDateStr, ymdCfgID, ymdStartDate, ymdEndDate)) continue if cfgID in disableLoopCfgIDDict: GameWorld.Log(" °´ÈÕÆÚÑ­»·µÄδµ½¿ªÆôÑ­»·ÈÕÆÚ»òÒѽáÊøÑ­»·ÈÕÆÚ£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr)) continue if cfgID in otherLoopCfgIDDict: loopCfgIDList, startDateStr, endDateStr, loopIndex, loopTimes = otherLoopCfgIDDict[cfgID] GameWorld.Log(" °´ÈÕÆÚÑ­»·µÄ»¹Î´Ñ­»·µ½µ±Ç°ÅäÖ㬲»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s,loopCfgIDList=%s,loopIndex=%s,loopTimes=%s" % (cfgID, startDateStr, endDateStr, loopCfgIDList, loopIndex, loopTimes)) continue startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData) # ¿ª·þ³£¹æ£º ¿ª·þÌì > ÈÕÆÚ > ÖÜx=ÈÕÆÚÑ­»· £¨²»ÊܺϷþÌìÓ°Ï죬ºÏ·þ»î¶¯ÐÂÔöÒ»Ì×¶ÀÁ¢µÄ»î¶¯£¬»¹ÊÇ×ßÔËÓª»î¶¯ÅäÖã© if actType == ShareDefine.ActType_OpenComm: actByWeek = (startDateStr.startswith("W") and endDateStr.startswith("W")) # °´ÖÜx¿ª actByDate = (not actByLoopYmd and not actByWeek and startDateStr.count("-") == 2 and endDateStr.count("-") == 2) # °´ÈÕÆÚ¿ª # ¿ª·þÌìµÄ if startDateStr.isdigit() and endDateStr.isdigit(): startServerDay, endServerDay = int(startDateStr), int(endDateStr) #½áÊøÈÕ¿ÉÄÜ»¹ÐèÒª´¦Àí¹ã²¥Ö®À࣬ËùÒÔÕâÀïÐèÒª+1 if openServerDay > endServerDay + 1: GameWorld.Log(" µ±Ç°¿ª·þÌ쳬¹ý»î¶¯½áÊø¿ª·þÌ죬²»´¦Àí! 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(" ¿ª·þÌìת»¯ÎªÈÕÆÚ: %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 <= actCustomServerDayMax: GameWorld.Log(" °´ÈÕÆÚ/ÖÜ¿ªµÄÔÚ¿ª·þ¶¨ÖÆÏÞÖÆÌìÄÚ£¬²»´¦Àí! cfgID=%s,%s ~ %s,openServerDay=%s,actCustomServerDayMax=%s,K¿ª·þÌìÐÅÏ¢=%s" % (cfgID, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, kOpenServerActInfo)) continue if cfgID in coverDisableWeekIpyDataInfo: startWeekDate, endWeekDate, ymdCfgID, ymdStartDate, ymdEndDate = coverDisableWeekIpyDataInfo[cfgID] GameWorld.Log(" ³£¹æ»î¶¯£¬°´ÐÇÆÚ¿ªÆôµÄÔÚ°´ÈÕÆÚ¿ªÆôµÄʱ¼äÄÚ£¬²»´¦Àí! cfgID=%s,%s(%s) ~ %s(%s) in ymdCfgID=%s,%s ~ %s" % (cfgID, startWeekDate, startDateStr, endWeekDate, endDateStr, ymdCfgID, ymdStartDate, ymdEndDate)) continue if cfgID in disableWeekCfgIDDict: GameWorld.Log(" ³£¹æ»î¶¯£¬°´ÐÇÆÚ¿ªÆôµÄδµ½¿ªÆôÑ­»·ÈÕÆÚ»òÒѽáÊøÑ­»·ÈÕÆÚ£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s, %s" % (cfgID, startDateStr, endDateStr, str(disableWeekCfgIDDict[cfgID]))) continue if actByWeek: startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData) GameWorld.Log(" ÐÇÆÚXת»¯ÎªÈÕÆÚ: %s ~ %s" % (startDateStr, endDateStr)) curServerOpenDateTime = curDateTime + datetime.timedelta(days=(1 - 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: # ÿÈÕÖØÖõÄĬÈϽ»²æºó¿É¿ªÆô isDayRest = 0 if not hasattr(ipyData, "GetIsDayReset") else ipyData.GetIsDayReset() if not isDayRest and actName not in startDateInCustomCanOpenList: GameWorld.Log(" °´ÈÕÆÚ/ÖÜ¿ªµÄ¿ªÊ¼ÈÕÆÚÔÚ¿ª·þ¶¨ÖÆÏÞÖÆÌìÄÚ£¬²»´¦Àí! cfgID=%s,curServerOpenDateTime=%s<=curStartDateTime=%s<=customMaxServerDateTime=%s" % (cfgID, curServerOpenDateTime, curStartDateTime, customMaxServerDateTime)) continue # ·ÇÿÈÕÖØÖÃµÄ ÇÒ ¿ªÊ¼ÌìÔÚ¶¨ÖÆÌìÄÚÔÚ¶¨ÖÆÌì½áÊøºó¿É¼ÌÐø¿ªÆôµÄ»î¶¯ # ×¢£º Ϊ·ÀÖ¹¿ªÊ¼ÈÕÆÚÓ뿪·þÌìÄڵĻ¿ªÊ¼Ìì¶ÔÓ¦ÈÕÆÚ¸ÕºÃͬһÌìµ¼Ö»IDÒ»Ñù£¬ËùÒÔÕâÀïĬÈϽ«¿ªÊ¼ÈÕÆÚ¸ÄΪ¶¨ÖÆÌìºóÒ»Ìì if not isDayRest and actName in startDateInCustomCanOpenList: actIDDateTimeSpec = datetime.datetime.strptime("%d-%d-%d 00:00:00" % (customMaxServerDateTime.year, customMaxServerDateTime.month, customMaxServerDateTime.day), ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1) GameWorld.Log(" ¿ª·þÌìºó¿É¿ªÆôµÄ·ÇÿÈÕÖØÖû! »î¶¯IDÈÕÆÚÌØÊâÉèÖÃΪ¿ª·þ¶¨ÖÆÌì½áÊøºóÒ»Ìì! cfgID=%s,actIDDateTimeSpec=%s" % (cfgID, actIDDateTimeSpec)) # ÌØÊâͬ²½µÄ¿ªÊ¼ÈÕÆÚ£¬ÎÞÊÓÊÇ·ñÿÈÕÖØÖà if actName in startDateInCustomCanOpenList: startDateSync = datetime.datetime.strptime("%d-%d-%d 00:00:00" % (customMaxServerDateTime.year, customMaxServerDateTime.month, customMaxServerDateTime.day), ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1) startDateSync = "%d-%d-%d" % (startDateSync.year, startDateSync.month, startDateSync.day) else: GameWorld.Log(" ¿ª·þ³£¹æ»î¶¯£¬ÅäÖÃʱ¼ä¸ñʽ²»Ö§³Ö£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr)) continue # ºÏ·þ»î¶¯: Ö»ÊܺϷþÌìÓ°Ïì elif actType == ShareDefine.ActType_MixServer: if not startDateStr.startswith("Mix") or not endDateStr.startswith("Mix"): GameWorld.Log(" ºÏ·þ»î¶¯£¬ÅäÖ÷ǺϷþÌ죬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr)) continue if not isMixServer: GameWorld.Log(" ·ÇºÏ·þ·þÎñÆ÷£¬²»´¦Àí! cfgID=%s,%s ~ %s" % (cfgID, startDateStr, endDateStr)) continue startMixServerDay, endMixServerDay = int(startDateStr[3:]), int(endDateStr[3:]) #½áÊøÈÕ¿ÉÄÜ»¹ÐèÒª´¦Àí¹ã²¥Ö®À࣬ËùÒÔÕâÀïÐèÒª+1 if mixServerDay > endMixServerDay + 1: GameWorld.Log(" µ±Ç°ºÏ·þÌ쳬¹ý»î¶¯½áÊøºÏ·þÌ죬²»´¦Àí! cfgID=%s,%s ~ %s < mixServerDay(%s)" % (cfgID, startDateStr, endDateStr, mixServerDay)) continue openServerDateTime = curDateTime + datetime.timedelta(days=(startMixServerDay - mixServerDay)) endServerDateTime = curDateTime + datetime.timedelta(days=(endMixServerDay - mixServerDay)) startDateStr = "%d-%d-%d" % (openServerDateTime.year, openServerDateTime.month, openServerDateTime.day) endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day) GameWorld.Log(" ºÏ·þÌìת»¯ÎªÈÕÆÚ: %s ~ %s" % (startDateStr, endDateStr)) # ½ÚÈջ£ºÖ»ÊÜÈÕÆÚÓ°Ïì elif actType == ShareDefine.ActType_Feast: if startDateStr.count("-") != 2 or endDateStr.count("-") != 2: GameWorld.Log(" ½ÚÈջ£¬ÅäÖ÷ÇÈÕÆÚ£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr)) continue else: GameWorld.Log(" ·Ç·¨ÅäÖã¬Î´Öª»î¶¯ÀàÐÍ£¬²»´¦Àí! cfgID=%s,actNum=%s" % (cfgID, actNum)) continue 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() else: startHMStrList = [] endHMStrList = [] notifyInfoDictStart = ipyData.GetNotifyInfoStart() if hasattr(ipyData, "GetNotifyInfoStart") else {} notifyInfoDictEnd = ipyData.GetNotifyInfoEnd() if hasattr(ipyData, "GetNotifyInfoEnd") else {} notifyInfoLoopInfo = ipyData.GetNotifyInfoLoop() if hasattr(ipyData, "GetNotifyInfoLoop") else {} # [Ñ­»··ÖÖÓ, ¹ã²¥key, [¹ã²¥²ÎÊýÁбí¿ÉÑ¡]] if len(startHMStrList) != len(endHMStrList): GameWorld.ErrLog(" »î¶¯ÅäÖÿªÊ¼¼°½áÊøÊ±¼ä¸öÊý²»Æ¥Åä! actName=%s,cfgID=%s,startHMStrList=%s,endHMStrList=%s" % (actName, cfgID, startHMStrList, endHMStrList)) continue isDayRest = 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) endDayDate = datetime.datetime.strptime("%s 05:00:00" % (endDateStr), ChConfig.TYPE_Time_Format) # ½áÊøÈÕÆÚ5µã elif resetType == 2: startDayDate = datetime.datetime.strptime("%s 05:00:00" % (startDateStr), ChConfig.TYPE_Time_Format) endDayDate = datetime.datetime.strptime("%s 00:00:00" % (endDateStr), ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1) # ½áÊøÈÕÆÚ¸ôÌì0µã else: startDayDate = datetime.datetime.strptime("%s 00:00:00" % (startDateStr), ChConfig.TYPE_Time_Format) endDayDate = datetime.datetime.strptime("%s 00:00:00" % (endDateStr), ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1) # ½áÊøÈÕÆÚ¸ôÌì0µã advanceMinutes = 0 if not hasattr(ipyData, "GetAdvanceMinutes") else ipyData.GetAdvanceMinutes() # Ìáǰ֪ͨʱ¼ä£¬·ÖÖÓ£¬ÔÝÖ»Ö§³Ö°´ÌìµÄ GameWorld.Log(" resetType=%s,startDayDate=%s,endDayDate=%s,startHMStrList=%s,endHMStrList=%s,advanceMinutes=%s" % (resetType, startDayDate, endDayDate, startHMStrList, endHMStrList, advanceMinutes)) advanceNoticeDateTime = None startDayDateJudge = startDayDate # ÓÃÓÚÅжÏÊÇ·ñÐèÒª´¦ÀíµÄÆðʼʱ¼ä£¬Ò»°ãÊǻ¿ªÊ¼Ê±¼ä£¬Èç¹ûÓÐÌáǰ¹ã²¥»òÔ¤¸æÔòʱ¼ä»áÌáǰ # ÌáǰԤ¸æ if advanceMinutes: advanceNoticeDateTime = startDayDate + datetime.timedelta(minutes= -advanceMinutes) startDayDateJudge = advanceNoticeDateTime # Ìáǰ¹ã²¥ minNotifyStartMinute = 0 if not notifyInfoDictStart else min(notifyInfoDictStart.keys()) if minNotifyStartMinute < 0: minNotifyStartDateTime = startDayDate + datetime.timedelta(minutes=minNotifyStartMinute) if minNotifyStartDateTime < startDayDateJudge: startDayDateJudge = minNotifyStartDateTime if curDateTime < startDayDateJudge or curDateTime > endDayDate: # ½áÊøÊ±¼äµãµÄʱºò¿ÉÄÜÐèÒª´¦Àí¹ã²¥Ö®ÀàµÄ GameWorld.Log(" ·Ç»î¶¯Ê±¼ä£¡²»´¦Àí£¡") continue #×¢£º ͬ¸ö»î¶¯±àºÅ¿ÉÅäÖöà¸öʱ¼ä²»½»²æµÄ»î¶¯£¬Èç¹û¶à¸öʱ¼äÅäÖÃͬʱÂú×ãÌõ¼þ£¬ÔòÖ»»áÒÔ×îºóÒ»¸öΪ׼£¬ÌáǰԤ¸æ¡¢¹ã²¥³ýÍâ if curActTodayInfo and curDateTime < startDayDate: activityIpyData = curActTodayInfo[0] ## ·ÀÖ¹Î´ÕæÕý¿ªÊ¼µÄ»î¶¯ÐèÒªÌáǰԤ¸æ£¬¶øµ¼Ö¸²¸ÇµôÁËʵ¼ÊÕýÔÚ½øÐÐÖеĻ£¬Ò»°ãÊǻʱ¼äÅäÖÃÁ¬ÐøµÄʱºò¿ÉÄܳöÏÖ¸ÃÇé¿ö GameWorld.Log(" ÒѾ­´æÔÚÐèÒª´¦ÀíµÄÅäÖÃID(%s)£¡ µ±Ç°ÐèÒªÌáǰ֪ͨ»ò¹ã²¥µÄ»î¶¯Î´´ïµ½»î¶¯¿ªÊ¼Ê±¼ä£¬²»´¦Àí£¡cfgID=%s,advanceMinutes=%s,minNotifyStartMinute=%s,startDayDateJudge=%s" % (activityIpyData.GetCfgID(), cfgID, advanceMinutes, minNotifyStartMinute, startDayDateJudge)) continue #×¢£º¸ÕºÃÊǽáÊøµÄʱ¼äµã£¬·À·¶ÒѾ­ÓÐÐèÒª´¦ÀíµÄÅäÖñ»¸²¸Ç if curActTodayInfo and curDateTime == endDayDate: activityIpyData = curActTodayInfo[0] GameWorld.Log(" ÒѾ­´æÔÚÐèÒª´¦ÀíµÄÅäÖÃID(%s)£¡ µ±Ç°¸ÕºÃ½áÊøµÄʱ¼äµã£¬²»´¦Àí£¡cfgID=%s" % (activityIpyData.GetCfgID(), cfgID)) continue startList = [] # [startDateTime, ...] endList = [] # [endDateTime, ...] startNotifyDict = {} # {notifyDateTime:notifyInfo, ...} endNotifyDict = {} # {notifyDateTime:notifyInfo, ...} loopNotifyDict = {} # {notifyDateTime:notifyInfo, ...} notifyDict = {} isActTime = (startDayDate <= curDateTime < endDayDate) isEnd = (curDateTime == endDayDate) isNotify = False isAdvanceNotice = False # ûÅäÖÃʱ·ÖµÄ´ú±íÈ«Ìì, Ö»Òª¿ªÊ¼»ò½áÊøÊ±·ÖûÅä¶¼Ëã if not startHMStrList or not endHMStrList: startDateTime = startDayDate endDateTime = endDayDate startList.append(startDateTime) endList.append(endDateTime) # ÿÌ찴ʱ¶Î¿ªÆôµÄ£¬Ö§³Ö¶àʱ¶Î else: for hmIndex, startHMStr in enumerate(startHMStrList): endHMStr = endHMStrList[hmIndex] # ÿÌ쿪µÄ, ʵ¼Ê¿ª¹ØÊ±¼äֻȡ½ñÌìµÄÈÕÆÚ£» ÕâÀïÓиöÎÊÌ⣬ȫ·þ¹ã²¥µÄʱ¼ä²»ÊǽñÌìµÄ, Ôݲ»×öÖ§³Ö£¬Ö®ºóÕæÓÐÕâÖÖÐèÇóÔÙ˵ startTimeStr = "%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, startHMStr) endTimeStr = "%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, endHMStr) startDateTime = datetime.datetime.strptime(startTimeStr, ChConfig.TYPE_Time_Format) endDateTime = datetime.datetime.strptime(endTimeStr, ChConfig.TYPE_Time_Format) startList.append(startDateTime) endList.append(endDateTime) if advanceNoticeDateTime: if advanceNoticeDateTime.year == curDateTime.year and advanceNoticeDateTime.month == curDateTime.month and advanceNoticeDateTime.day == curDateTime.day: isAdvanceNotice = True GameWorld.Log(" advanceNoticeDateTime=%s,isAdvanceNotice=%s" % (advanceNoticeDateTime, isAdvanceNotice)) GameWorld.Log(" startList=%s" % (startList)) GameWorld.Log(" end List=%s" % (endList)) joinStartTimeList, joinEndTimeList = [], [] # ¿ÉÖ¸¶¨»î¶¯¿É²ÎÓëµÄʱ¼äµã£¬²»Ó°Ïì»î¶¯×´Ì¬£¬Ö»Ó°Ïì»î¶¯Ä³Ð©¹¦ÄܵIJÎÓëʱ»ú£¬ÈçÉϰñÀà if joinStartTimeStr: if isDayRest: 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] # ¹ã²¥ - Ïà¶Ôʵ¼Ê¿ªÊ¼Ê±¼ä for notifyMinute, notifyInfo in notifyInfoDictStart.items(): notifyDateTime = startDateTime + datetime.timedelta(minutes=notifyMinute) if notifyDateTime.year == curDateTime.year and notifyDateTime.month == curDateTime.month and notifyDateTime.day == curDateTime.day: startNotifyDict[notifyDateTime] = notifyInfo isNotify = True # ¹ã²¥ - Ïà¶Ôʵ¼Ê½áÊøÊ±¼ä for notifyMinute, notifyInfo in notifyInfoDictEnd.items(): notifyDateTime = endDateTime + datetime.timedelta(minutes=notifyMinute) if notifyDateTime.year == curDateTime.year and notifyDateTime.month == curDateTime.month and notifyDateTime.day == curDateTime.day: endNotifyDict[notifyDateTime] = notifyInfo isNotify = True # ¹ã²¥ - Ñ­»·¹ã²¥ if notifyInfoLoopInfo and len(notifyInfoLoopInfo) >= 2: loopMinutes, loopNotifyKey = notifyInfoLoopInfo[:2] loopNotifyParamList = notifyInfoLoopInfo[2] if len(notifyInfoLoopInfo) > 2 else [] notifyInfo = [loopNotifyKey, loopNotifyParamList] # Ñ­»·¹ã²¥µÄĬÈÏÎÞ²ÎÊý loopCount, loopMaxCount = 0, 100 while loopMinutes and loopNotifyKey and loopCount < loopMaxCount: loopCount += 1 notifyDateTime = startDateTime + datetime.timedelta(minutes=loopMinutes * loopCount) if notifyDateTime >= endDateTime: break if notifyDateTime.year == curDateTime.year and notifyDateTime.month == curDateTime.month and notifyDateTime.day == curDateTime.day: loopNotifyDict[notifyDateTime] = notifyInfo isNotify = True if startNotifyDict or endNotifyDict or loopNotifyDict: GameWorld.Log(" startNotifyDict: minutes=%s, %s" % (notifyInfoDictStart.keys(), startNotifyDict)) GameWorld.Log(" end NotifyDict: minutes=%s, %s" % (notifyInfoDictEnd.keys(), endNotifyDict)) GameWorld.Log(" loop NotifyDict: lopInfo=%s, %s" % (notifyInfoLoopInfo, loopNotifyDict.keys())) notifyDict.update(startNotifyDict) notifyDict.update(endNotifyDict) notifyDict.update(loopNotifyDict) GameWorld.Log(" ÐèÒª´¦ÀíµÄÔËÓª»î¶¯ÐÅÏ¢: cfgID=%s,isActTime=%s,isEnd=%s,isNotify=%s,isAdvanceNotice=%s" % (cfgID, isActTime, isEnd, isNotify, isAdvanceNotice)) if actName not in operationTodayActionDict: operationTodayActionDict[actName] = {} # ½ñÈÕÓÐÐèÒª´¦ÀíµÄ²Å³õʼ»¯ operationTodayActionDict[actName][actNum] = [ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList] if isActTime: activityInfoDict = {ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ActNum:actNum} #if actName == ShareDefine.OperationActionName_LoginAward: # #»î¶¯Ã¿ÌìµÄÊÀ½çµÈ¼¶ # activityInfoDict[ShareDefine.ActKey_WorldLVList] = GameWorldAverageLv.GetWorldLVListByTime(startDayDate, (endDayDate - startDayDate).days) if startDateSync: activityInfoDict[ShareDefine.ActKey_StartDateSync] = startDateSync GameWorld.Log(" startDateSync=%s" % (startDateSync)) dayIndex = (curDateTime - startDayDate).days 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(" activityInfoDict=%s" % (activityInfoDict)) PyGameData.g_operationActionDict[actName][actNum] = activityInfoDict OperationActionInfo = IpyGameDataPY.SetConfigEx(key, [reloadSign, operationTodayActionDict]) GameWorld.Log("±¾ÈÕÔËÓª»î¶¯ÐÅÏ¢¼ÓÔØÍê±Ï!reloadSign=%s" % (reloadSign)) #GameWorld.Log(" operationTodayActionDict=%s" % operationTodayActionDict) GameWorld.Log(" PyGameData.g_operationActionDict=%s" % PyGameData.g_operationActionDict) GameWorld.Log("=============================================================") return True, OperationActionInfo def __GetOperationActionServerIpyDataList(ipyDataMgr, platform, serverID, actName): ## »ñÈ¡ÔËÓª»î¶¯±¾·þÎñÆ÷¶ÔÓ¦µÄÅäÖÃÊý¾ÝÁбí if not hasattr(ipyDataMgr, "Get%sCount" % actName): GameWorld.ErrLog("ûÓиÃÔËÓª»î¶¯ÀàÐͶÔÓ¦»î¶¯Ê±¼ä±í! actName=%s" % actName) return [] curServerActIpyDataList = [] actCfgCount = getattr(ipyDataMgr, "Get%sCount" % actName)() for cfgIndex in xrange(actCfgCount): ipyData = getattr(ipyDataMgr, "Get%sByIndex" % actName)(cfgIndex) platformList = [] if not hasattr(ipyData, "GetPlatformList") else ipyData.GetPlatformList() serverIDList = [] if not hasattr(ipyData, "GetServerIDList") else ipyData.GetServerIDList() serverIDListExcept = [] if not hasattr(ipyData, "GetServerIDListExcept") else ipyData.GetServerIDListExcept() if platformList and platform not in platformList: continue # ÅųýµÄ·þÎñÆ÷×éIDÁбí if serverIDListExcept: isExcept = False for serverIDInfo in serverIDListExcept: if GameWorld.CheckServerIDInList(serverID, serverIDInfo): isExcept = True break if isExcept: continue if not serverIDList: curServerActIpyDataList.append(ipyData) else: for serverIDInfo in serverIDList: if GameWorld.CheckServerIDInList(serverID, serverIDInfo): curServerActIpyDataList.append(ipyData) break return curServerActIpyDataList def __GetOperationActionDisableIpyDataInfo(actName, curDateTime, curServerActIpyDataList): ## »ñÈ¡²»¿ÉÓõİ´ÐÇÆÚX¿ªÆôµÄÅäÖÃÊý¾ÝÐÅÏ¢£¬°´ÐÇÆÚX¿ªÆôµÄ »î¶¯ÓÅÏȼ¶Ð¡ÓÚ°´Èͮ򵀣¬µ±ÓÐÖØµþʱÒÔÈÕÆÚµÄΪ׼ # ÓÅÏȼ¶ ÈÕÆÚ > °´ÈÕÆÚÑ­»· > °´ÐÇÆÚÑ­»· actNumYMDIpyDataInfo = {} # {actNum:ymdIpyDataList, ...} # ÅäÖÃÈÕÆÚµÄ actNumLoopIpyDataInfo = {} # {actNum:{loopKey:[loopCfgIDList, loopDateInfo]}, ...} # °´ÈÕÆÚÑ­»·µÄ actNumWeekIpyDataInfo = {} # {actNum:weekIpyDataList, ...} # °´ÐÇÆÚÑ­»·µÄ 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_Format_Ymd) for ipyData in curServerActIpyDataList: cfgID = ipyData.GetCfgID() startDateStr = ipyData.GetStartDate() endDateStr = ipyData.GetEndDate() actNum = ipyData.GetActNum() # °´ÐÇÆÚXµÄ if startDateStr.startswith("W"): if actNum not in actNumWeekIpyDataInfo: actNumWeekIpyDataInfo[actNum] = [] weekIpyDataList = actNumWeekIpyDataInfo[actNum] startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData) startWeekDate = GameWorld.ChangeStrToDatetime(startDateStr, ChConfig.TYPE_Time_Format_Ymd) endWeekDate = GameWorld.ChangeStrToDatetime(endDateStr, ChConfig.TYPE_Time_Format_Ymd) if startWeekDate > curDateTimeYmd or curDateTimeYmd > endWeekDate: # »¹Î´¿ªÊ¼µÄÑ­»· or ÒѾ­Ç¿ÖƽáÊøµÄÑ­»· disableWeekCfgIDDict[cfgID] = [startDateStr, endDateStr] 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) if loopStartDate > curDateTimeYmd or curDateTimeYmd > loopEndDate: # »¹Î´¿ªÊ¼µÄÑ­»· or ÒѾ­Ç¿ÖƽáÊøµÄÑ­»· disableLoopCfgIDDict[cfgID] = [startDateStr, endDateStr] else: loopKey = (startDateStr, endDateStr) # ͬ¸öÑ­»·ÖÜÆÚµÄÊÓΪͬһ×é if actNum not in actNumLoopIpyDataInfo: actNumLoopIpyDataInfo[actNum] = {} loopIpyDataDict = actNumLoopIpyDataInfo[actNum] if loopKey not in loopIpyDataDict: loopCfgIDList, loopDateInfo = [], [loopStartDate, loopEndDate, loopTimes] loopIpyDataDict[loopKey] = [loopCfgIDList, loopDateInfo] loopCfgIDList, loopDateInfo = loopIpyDataDict[loopKey] loopCfgIDList.append(cfgID) # °´ÈÕÆÚµÄ elif startDateStr.count("-") == 2: if actNum not in actNumYMDIpyDataInfo: actNumYMDIpyDataInfo[actNum] = [] ymdIpyDataList = actNumYMDIpyDataInfo[actNum] ymdStartDate = GameWorld.ChangeStrToDatetime(startDateStr, ChConfig.TYPE_Time_Format_Ymd) ymdEndDate = GameWorld.ChangeStrToDatetime(endDateStr, ChConfig.TYPE_Time_Format_Ymd) ymdIpyDataList.append([cfgID, ymdStartDate, ymdEndDate]) else: # ÆäËûµÄ²»´¦Àí pass nowLoopYMDIpyDataInfo = {} # {actNum:loopIpyDataList, ...} # # ÈÕÆÚÑ­»·Öе±Ç°ÔÚÑ­»·µÄ otherLoopCfgIDDict = {} # {cfgID:[info], ...} # ÈÕÆÚÑ­»·Öв»Êǵ±Ç°Ñ­»·µÄÆäËûÑ­»· coverDisableLoopIpyDataInfo = {} # {cfgID:[info], ...} # ±»ÈÕÆÚ¸²¸ÇµÄÈÕÆÚÑ­»· for actNum, loopIpyDataDict in actNumLoopIpyDataInfo.items(): ymdIpyDataList = actNumYMDIpyDataInfo.get(actNum, []) if actNum not in nowLoopYMDIpyDataInfo: nowLoopYMDIpyDataInfo[actNum] = [] loopIpyDataList = nowLoopYMDIpyDataInfo[actNum] for loopKey, loopInfo in loopIpyDataDict.items(): startDateStr, endDateStr = loopKey loopCfgIDList, loopDateInfo = loopInfo loopStartDate, loopEndDate, loopTimes = loopDateInfo loopIndex = (loopTimes - 1) % len(loopCfgIDList) # µ±Ç°Ñ­»·´ÎÊý¶ÔÓ¦µÄÑ­»·Ë÷Òý curLoopCfgID = 0 for index, loopCfgID in enumerate(loopCfgIDList): if index == loopIndex: # µ±Ç°Ñ­»·µÄ curLoopCfgID = loopCfgID loopIpyDataList.append([loopCfgID, loopStartDate, loopEndDate]) else: otherLoopCfgIDDict[loopCfgID] = [loopCfgIDList, startDateStr, endDateStr, loopIndex, loopTimes] for ymdCfgID, ymdStartDate, ymdEndDate in ymdIpyDataList: if ymdStartDate <= loopStartDate <= ymdEndDate or ymdStartDate <= loopEndDate <= ymdEndDate: coverDisableLoopIpyDataInfo[curLoopCfgID] = [loopStartDate, loopEndDate, ymdCfgID, ymdStartDate, ymdEndDate] coverDisableWeekIpyDataInfo = {} # {cfgID:[info], ...} # ±»ÈÕÆÚ¸²¸ÇµÄÐÇÆÚÑ­»· for actNum, weekIpyDataList in actNumWeekIpyDataInfo.items(): ymdIpyDataList = actNumYMDIpyDataInfo.get(actNum, []) loopIpyDatList = nowLoopYMDIpyDataInfo.get(actNum, []) for weekCfgID, startWeekDate, endWeekDate in weekIpyDataList: # ±»³£¹æÈÕÆÚ¸²¸ÇµÄ for ymdCfgID, ymdStartDate, ymdEndDate in ymdIpyDataList: if ymdStartDate <= startWeekDate <= ymdEndDate or ymdStartDate <= endWeekDate <= ymdEndDate: coverDisableWeekIpyDataInfo[weekCfgID] = [startWeekDate, endWeekDate, ymdCfgID, ymdStartDate, ymdEndDate] # ±»Ñ­»·ÈÕÆÚ¸²¸ÇµÄ for loopCfgID, loopStartDate, loopEndDate in loopIpyDatList: if loopStartDate <= startWeekDate <= loopEndDate or loopStartDate <= endWeekDate <= loopEndDate: coverDisableWeekIpyDataInfo[weekCfgID] = [startWeekDate, endWeekDate, loopCfgID, loopStartDate, loopEndDate] return coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo def Dispose_OperationActionState(): # ÔËÓª»î¶¯×´Ì¬´¦Àí if GameWorld.IsCrossCenter(): # ¿ç·þ»î¶¯¹ÜÀí£¬´ýÀ©Õ¹£¬ÓÉ¿ç·þÖÐÐÄͳһ¹ÜÀí #CrossActionControl.Dispose_CrossActState(reloadRefresh) return if not GameWorld.IsMainServer(): return isReload, OperationActionInfo = __GetOperationActionInfo() operationTodayActionDict = OperationActionInfo[OperationAction_TodayInfo] mapServerInfoDict = PyGameData.g_operationActionDict #OperationActionInfo[OperationAction_MapServerInfo] gameWorld = GameWorld.GetGameWorld() dbEventMgr = DBDataMgr.GetEventTrigMgr() # ÕâÀïʱ¼äÐ辫ȷµ½·ÖÖÓ£¬²»È»ºóÃæµÄ±È½Ï»áÆ¥Åä²»µ½ curDateTime = GameWorld.GetServerTime() curDateTime = datetime.datetime.strptime("%d-%d-%d %d:%d:00" % (curDateTime.year, curDateTime.month, curDateTime.day, curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format) syncMapList = [] for actName in ShareDefine.OperationActionNameList: if actName not in mapServerInfoDict: continue curActMapInfoDictList = mapServerInfoDict[actName].values() for sendMapServerMsgDict in curActMapInfoDictList: state = 0 # ĬÈÏ¹Ø±Õ stateJoin = ShareDefine.ActStateJoin_None # ¿É²ÎÓë״̬£¬0-²ÎÓëǰ£»1-¿É²ÎÓ룻2-²ÎÓë½áÊø ipyData = None actNum = sendMapServerMsgDict.get(ShareDefine.ActKey_ActNum, 0) if actName in operationTodayActionDict: todayActInfoList = [] if actNum in operationTodayActionDict[actName]: todayActInfoList = operationTodayActionDict[actName][actNum] if isinstance(todayActInfoList, list) and len(todayActInfoList) == 6: #startList = [] # [startDateTime, ...] #endList = [] # [endDateTime, ...] #notifyDict = {} # {notifyDateTime:[notifyKey, [²ÎÊý]], ...} #ipyData ¿ÉÄÜΪ None ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList = todayActInfoList # ״̬ for dIndex, startDateTime in enumerate(startList): endDateTime = endList[dIndex] if startDateTime <= curDateTime < endDateTime: state = dIndex + 1 # ´ú±íµÚ¼¸¸öʱ¼ä¶Î break if joinStartTimeList: for jIndex, joinStartDateTime in enumerate(joinStartTimeList): endJoinDateTime = joinEndTimeList[jIndex] if joinStartDateTime <= curDateTime < endJoinDateTime: stateJoin = ShareDefine.ActStateJoin_Start break elif curDateTime >= endJoinDateTime: stateJoin = ShareDefine.ActStateJoin_End else: stateJoin = ShareDefine.ActStateJoin_Start if state else ShareDefine.ActStateJoin_None # È«·þ¹ã²¥ÌáʾÐÅÏ¢ if curDateTime in notifyDict: notifyKey, paramList = notifyDict[curDateTime] PlayerControl.WorldNotify(0, notifyKey, paramList) dictName = ShareDefine.Def_WorldKey_OperationActionState % (actName, actNum) dictNameJoin = ShareDefine.Def_WorldKey_OperationActionStateJoin % (actName, actNum) preState = gameWorld.GetGameWorldDictByKey(dictName) preStateJoin = gameWorld.GetGameWorldDictByKey(dictNameJoin) if not isReload and preState == state and preStateJoin == stateJoin: #GameWorld.DebugLog("ÔËÓª»î¶¯ÒѾ­ÊÇÕâ¸ö״̬ÁË: actName=%s,actNum=%s,preState=%s,state=%s,preStateJoin=%s,stateJoin=%s" % (actName, actNum, preState, state, preStateJoin, stateJoin)) continue GameWorld.Log("ÔËÓª»î¶¯±ä¸ü: actName=%s,actNum=%s,preState=%s,state=%s,preStateJoin=%s,stateJoin=%s,isReload=%s" % (actName, actNum, preState, state, preStateJoin, stateJoin, isReload)) #¸üÐÂ×ÖµäÖµ gameWorld.SetGameWorldDict(dictName, state) gameWorld.SetGameWorldDict(dictNameJoin, stateJoin) dbOperationActIDKey = ShareDefine.Def_OperationActID % (actName, actNum) dbActID = dbEventMgr.GetValue(dbOperationActIDKey) curActID = sendMapServerMsgDict.get(ShareDefine.ActKey_ID, 0) #dayIndex = sendMapServerMsgDict.get(ShareDefine.ActKey_DayIndex, 0) if dbActID != curActID: GameWorld.Log(" dbActID±ä¸ü: dbActID=%s,curActID=%s" % (dbActID, curActID)) dbEventMgr.SetValue(dbOperationActIDKey, curActID) # ½áÊø¾ÉµÄ if dbActID: pass #if actName == ShareDefine.OperationActionName_Gubao: # PlayerActGubao.OnActEnd(actNum, ipyData, dayIndex) if curActID: pass #´Ë´¦Îª»î¶¯¿ªÆôʱ #if actName == ShareDefine.OperationActionName_Gubao: # PlayerActGubao.OnActStart(actNum, ipyData) #else: # if actName == ShareDefine.OperationActionName_GarbageSorting: # PlayerActGarbageSorting.OnActEnd(actNum) else: GameWorld.Log(" dbActID²»±ä: dbActID=%s,curActID=%s" % (dbActID, curActID)) # »î¶¯ÖÐˢУ¬Ã¿´Î¶¼ÐèҪˢеÄÂß¼­£¬°üº¬ÖضÁÅäÖÃµÈ if state: pass #if actName == ShareDefine.OperationActionName_Gubao: # PlayerActGubao.OnActInStateRefresh(actNum, ipyData) # ½ö»î¶¯ÓÐÅäÖòÎÓëʱ¼ä¶ÎµÄ»á´¥·¢ if curActID and dbActID == curActID and preStateJoin != stateJoin: GameWorld.Log(" ²ÎÓë״̬±ä¸ü: preStateJoin=%s,stateJoin=%s" % (preStateJoin, stateJoin)) # ²ÎÓ뿪ʼ if stateJoin == ShareDefine.ActStateJoin_Start: pass # ²ÎÓë½áÊø elif stateJoin == ShareDefine.ActStateJoin_End: pass #if actName == ShareDefine.OperationActionName_Gubao: # PlayerActGubao.OnActJoinEnd(actNum, ipyData, dayIndex) if ipyData: pass #if actName == ShareDefine.OperationActionName_ExpRate: # if isReload and ipyData: # Sync_OperationAction_ExpRate(ipyData) #֪ͨMapserver,ÉèÖÃ×Öµä #GameWorld.SendMapServerMsgEx(dictName, state) # ÔËÓª»î¶¯²»µ¥¶À֪ͨ»î¶¯×´Ì¬£¬ÐèÓë»î¶¯ÐÅÏ¢ÕûºÏºóÒ»Æð֪ͨ sendMapServerMsgDict[ShareDefine.ActKey_State] = state sendMapServerMsgDict[ShareDefine.ActKey_StateJoin] = stateJoin mapServerInfoDict[actName][actNum] = sendMapServerMsgDict syncMapList.append([actName, actNum, sendMapServerMsgDict]) if syncMapList: GameWorld.Log("=============================================================") for actName, actNum, actInfo in syncMapList: OnMapOperationActionRefresh(actName, actNum, actInfo) # ֪ͨµØÍ¼Íæ¼ÒˢлÏà¹Ø return def OnMapOperationActionRefresh(actName, actNum, actInfo): ## ´¦ÀíÀàËÆÖ®Ç°ÓÉGameServer֪ͨMapServerµÄÔËÓª»î¶¯Ë¢Ð GameWorld.Log("OperationActionRefresh: %s,actNum=%s,%s" % (actName, actNum, actInfo)) if actName == ShareDefine.OperationActionName_Lunhuidian: PlayerActLunhuidian.RefreshActLunhuidianActionInfo(actNum) return