10413 【英文】【BT】【砍树】活动开服天新方案(支持以格式:K+开服天的配置方案,如K15代表开服第15天)
2个文件已修改
77 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -247,8 +247,9 @@
        GameWorld.Log("加载运营活动: actName=%s,platform=%s,serverGroupID=%s" % (actName, platform, serverGroupID))
        curServerActIpyDataList = __GetOperationActionServerIpyDataList(ipyDataMgr, platform, serverGroupID, actName)
        GameWorld.Log("    可处理条数=%s" % (len(curServerActIpyDataList)))
        coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict = \
        coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo = \
            __GetOperationActionDisableIpyDataInfo(actName, curDateTime, curServerActIpyDataList)
        GameWorld.Log("    kOpenServerActInfo=%s" % kOpenServerActInfo)
            
        for ipyData in curServerActIpyDataList:
            
@@ -260,8 +261,13 @@
            endDateStr = ipyData.GetEndDate()
            actNum = GetOperationActNum(actName, ipyData)
            actType = GetOperationActType(actNum)
            GameWorld.Log("    cfgID=%s,actNum=%s,startDateStr=%s,endDateStr=%s,openServerDay=%s,isMixServer=%s,mixServerDay=%s,curDateTime=%s,platformList=%s,serverGroupIDList=%s,Except=%s"
                          % (cfgID, actNum, startDateStr, endDateStr, openServerDay, isMixServer, mixServerDay, curDateTime, platformList, serverGroupIDList, serverGroupIDListExcept))
            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,serverGroupIDList=%s,Except=%s"
                          % (cfgID, actNum, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, isMixServer, mixServerDay, curDateTime, platformList, serverGroupIDList, serverGroupIDListExcept))
            
            actIDDateTimeSpec = None # 特殊指定的活动ID日期
            startDateSync = None # 特殊同步前端显示用的开始日期,一般用于与开服前X天交叉的活动
@@ -319,10 +325,24 @@
                    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 <= customMaxServerDay:
                        GameWorld.Log("        按日期/周开的在开服定制限制天内,不处理! cfgID=%s,%s ~ %s,openServerDay=%s" % (cfgID, startDateStr, endDateStr, openServerDay))
                    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:
@@ -341,7 +361,7 @@
                        GameWorld.Log("        星期X转化为日期: %s ~ %s" % (startDateStr, endDateStr))
                        
                    curServerOpenDateTime = curDateTime + datetime.timedelta(days=(1 - openServerDay)) # 开服第一天的日期
                    customMaxServerDateTime = curDateTime + datetime.timedelta(days=(customMaxServerDay - 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:
@@ -601,16 +621,26 @@
                    GameWorld.Log("        startDateSync=%s" % (startDateSync))
                    
                dayIndex = (curDateTime - startDayDate).days
                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
                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("        isDayRest=%s,actIDDateTime=%s,actID=%s" % (isDayRest, actIDDateTime, actID))
                GameWorld.Log("        activityInfoDict=%s" % (activityInfoDict))
                
                # 兼容新旧运营活动逻辑处理数据
@@ -684,6 +714,8 @@
    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_YmdFormat)
    
@@ -706,6 +738,15 @@
            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)
@@ -775,7 +816,7 @@
                if loopStartDate <= startWeekDate <= loopEndDate or loopStartDate <= endWeekDate <= loopEndDate:
                    coverDisableWeekIpyDataInfo[weekCfgID] = [startWeekDate, endWeekDate, loopCfgID, loopStartDate, loopEndDate]
                    
    return coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict
    return coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo
def Dispose_OperationActionState(reloadRefresh=False):
    # 运营活动状态处理, 每天0点会强制同步当天的运营活动详情到地图服务器
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -698,6 +698,12 @@
        startDateTime = curDateTime + datetime.timedelta(days=(int(startDateStr)-diffDay))
        endDateTime = curDateTime + datetime.timedelta(days=(int(endDateStr)-diffDay))
        
    # K开服天
    elif startDateStr.startswith("K"):
        diffDay = GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
        startDateTime = curDateTime + datetime.timedelta(days=(ToIntDef(startDateStr[1:])-diffDay))
        endDateTime = curDateTime + datetime.timedelta(days=(ToIntDef(endDateStr[1:])-diffDay))
    # 合服天
    elif startDateStr.startswith("Mix"):
        diffDay = GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_MixServerDay) + 1