| | |
| | | templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex]
|
| | | return templateID
|
| | |
|
| | | def GetOperationActionLoopDate(startDateStr, endDateStr, curDateTime):
|
| | | ## 获取运营活动配置日期循环的具体活动时间
|
| | | # @return: 开始日期, 结束日期, 返回的日期是第x次循环
|
| | | startSplitList = startDateStr.split("_")
|
| | | loopDays = int(startSplitList[0][1:])
|
| | | startLoopDateStr = startSplitList[1]
|
| | | startLoopDateTime = ChangeStrToDatetime(startLoopDateStr, ChConfig.TYPE_Time_YmdFormat)
|
| | | |
| | | endSplitList = endDateStr.split("_") # 可不配Lx_开头,防误配,做兼容
|
| | | endLoopDateStr = endSplitList[0] if len(endSplitList) == 1 else endSplitList[1]
|
| | | endLoopDateTime = ChangeStrToDatetime(endLoopDateStr, ChConfig.TYPE_Time_YmdFormat)
|
| | | |
| | | if curDateTime >= startLoopDateTime:
|
| | | passDays = (curDateTime - startLoopDateTime).days
|
| | | loopTimes = passDays / loopDays + 1 # 第x次循环
|
| | | loopTimeMax = (endLoopDateTime - startLoopDateTime).days / loopDays + 1 # 最大循环次数
|
| | | loopTimes = min(loopTimes, loopTimeMax)
|
| | | else:
|
| | | loopTimes = 1 # 还未开始取第一次
|
| | | |
| | | startDateTime = startLoopDateTime + datetime.timedelta((loopTimes - 1)*loopDays)
|
| | | endDateTime = startDateTime + datetime.timedelta(days=(loopDays - 1))
|
| | | return startDateTime, endDateTime, loopTimes
|
| | |
|
| | | def GetOperationActionDateStr(ipyData):
|
| | | ## 获取运营活动对应日期,存数字代表开服天配置,需要转化为对应的日期
|
| | | curDateTime = datetime.datetime.today()
|
| | |
| | | endDateStr = "%d-%d-%d" % (curDateTime.year, curDateTime.month, curDateTime.day)
|
| | |
|
| | | # 日期直接返回
|
| | | if startDateStr.count("-") == 2 and "W" not in startDateStr:
|
| | | if startDateStr.count("-") == 2 and "W" not in startDateStr and not startDateStr.startswith("L"):
|
| | | return startDateStr, endDateStr
|
| | |
|
| | | # 开服天
|
| | |
| | | # 只配置结束日期的时候可能导致开始日期计算出来比结束日期还大,即当前时间超过结束日期,且 配置还存在的情况
|
| | | if startDateTime > endDateTime:
|
| | | startDateTime = endDateTime # 反正都无法开启,随便给个日期,不超过结束日期即可
|
| | | |
| | | # 按日期循环
|
| | | elif startDateStr.startswith("L"):
|
| | | startDateTime, endDateTime, _ = GetOperationActionLoopDate(startDateStr, endDateStr, curDateTime)
|
| | | |
| | | # 默认
|
| | | else:
|
| | | startDateTime = curDateTime
|
| | |
| | | # if not GetGameWorld().GetDebugLevel():
|
| | | # return
|
| | | #===========================================================================
|
| | | if IsCrossServer():
|
| | | DebugAnswerCross(0, 0, text)
|
| | | return
|
| | | if isLog:
|
| | | DebugLog(text)
|
| | | text = text.decode(ShareDefine.Def_Game_Character_Encoding).encode(GetCharacterEncoding())
|
| | | curPlayer.DebugAnswer(text)
|
| | | if curPlayer:
|
| | | curPlayer.DebugAnswer(text)
|
| | | return
|
| | |
|
| | | def CrossServerMsg_DebugAnswer(msgData):
|
| | | playerID, text = msgData
|
| | | if not playerID:
|
| | | playerManager = GetPlayerManager()
|
| | | for i in xrange(playerManager.GetActivePlayerCount()):
|
| | | player = playerManager.GetActivePlayerAt(i)
|
| | | if player == None:
|
| | | continue
|
| | | player.DebugAnswer(text)
|
| | | return
|
| | | curPlayer = GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not curPlayer:
|
| | | return
|
| | |
| | |
|
| | | import CrossRealmMsg
|
| | | dataMsg = [playerID, text]
|
| | | serverGroupIDList = [serverGroupID]
|
| | | serverGroupIDList = [serverGroupID] if serverGroupID else []
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_DebugAnswer, dataMsg, serverGroupIDList)
|
| | | return
|
| | |
|