From 40f41d737bb9f7df71c6260b766756ba8a2ea1fc Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 20 六月 2024 21:14:13 +0800 Subject: [PATCH] Merge branch 'hyyngame' of http://192.168.1.20:10010/r/SnxxServerCode into hyyngame --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py | 75 ++++++++++++++++++++++++++++++------- 1 files changed, 60 insertions(+), 15 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py index ae845c1..046d843 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py @@ -34,6 +34,7 @@ import PlayerFairyCeremony import PlayerNewFairyCeremony import PlayerActGarbageSorting +import PlayerActBossTrial import PlayerUniversalGameRec import GameWorldAverageLv import PlayerFamilyBoss @@ -108,10 +109,11 @@ def SendMapServerOperationActionState(): # 地图启动成功时通知本日运行活动相关状态 + CrossActionControl.SendMapServerCrossActionState() + if GameWorld.IsCrossServer(): # 跨服不处理运营活动 return - CrossActionControl.SendMapServerCrossActionState() isReload, OperationActionInfo = __GetOperationActionInfo() mapServerInfoDict = OperationActionInfo[OperationAction_MapServerInfo] @@ -141,7 +143,7 @@ 活动分组编号 = 活动类型 * 10 + 不同界面编号 ''' - if ipyData and hasattr(ipyData, "ActNum"): + if ipyData and hasattr(ipyData, "GetActNum"): return ipyData.GetActNum() # 原节日活动的还是默认节日活动 @@ -245,9 +247,9 @@ for ipyData in curServerActIpyDataList: - platformList = [] if not hasattr(ipyData, "PlatformList") else ipyData.GetPlatformList() - serverGroupIDList = [] if not hasattr(ipyData, "ServerGroupIDList") else ipyData.GetServerGroupIDList() - serverGroupIDListExcept = [] if not hasattr(ipyData, "ServerGroupIDListExcept") else ipyData.GetServerGroupIDListExcept() + platformList = [] if not hasattr(ipyData, "GetPlatformList") else ipyData.GetPlatformList() + serverGroupIDList = [] if not hasattr(ipyData, "GetServerGroupIDList") else ipyData.GetServerGroupIDList() + serverGroupIDListExcept = [] if not hasattr(ipyData, "GetServerGroupIDListExcept") else ipyData.GetServerGroupIDListExcept() cfgID = ipyData.GetCfgID() startDateStr = ipyData.GetStartDate() endDateStr = ipyData.GetEndDate() @@ -373,6 +375,13 @@ 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() @@ -389,6 +398,7 @@ % (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) @@ -496,6 +506,17 @@ GameWorld.Log(" startList=%s" % (startList)) GameWorld.Log(" end List=%s" % (endList)) + joinStartTimeList, joinEndTimeList = [], [] # 可指定活动可参与的时间点,不影响活动状态,只影响活动某些功能的参与时机,如上榜类 + 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] # 广播 - 相对实际开始时间 @@ -541,9 +562,9 @@ if actName in ShareDefine.MultiActNumOperationActNameList: if actName not in operationTodayActionDict: operationTodayActionDict[actName] = {} # 今日有需要处理的才初始化 - operationTodayActionDict[actName][actNum] = [ipyData, startList, endList, notifyDict] + operationTodayActionDict[actName][actNum] = [ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList] else: - operationTodayActionDict[actName] = [ipyData, startList, endList, notifyDict] + operationTodayActionDict[actName] = [ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList] if isActTime: activityInfoDict = {ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ActNum:actNum} @@ -557,7 +578,6 @@ dayIndex = (curDateTime - startDayDate).days actIDDateTime = startDayDate - isDayRest = 0 if not hasattr(ipyData, "GetIsDayReset") else ipyData.GetIsDayReset() # 按时段开的默认每天重置 if isDayRest or (startHMStrList and endHMStrList): actIDDateTime += datetime.timedelta(days=dayIndex) @@ -598,9 +618,9 @@ actCfgCount = getattr(ipyDataMgr, "Get%sCount" % actName)() for cfgIndex in xrange(actCfgCount): ipyData = getattr(ipyDataMgr, "Get%sByIndex" % actName)(cfgIndex) - platformList = [] if not hasattr(ipyData, "PlatformList") else ipyData.GetPlatformList() - serverGroupIDList = [] if not hasattr(ipyData, "ServerGroupIDList") else ipyData.GetServerGroupIDList() - serverGroupIDListExcept = [] if not hasattr(ipyData, "ServerGroupIDListExcept") else ipyData.GetServerGroupIDListExcept() + platformList = [] if not hasattr(ipyData, "GetPlatformList") else ipyData.GetPlatformList() + serverGroupIDList = [] if not hasattr(ipyData, "GetServerGroupIDList") else ipyData.GetServerGroupIDList() + serverGroupIDListExcept = [] if not hasattr(ipyData, "GetServerGroupIDListExcept") else ipyData.GetServerGroupIDListExcept() if platformList and platform not in platformList: continue @@ -721,6 +741,7 @@ for sendMapServerMsgDict in curActMapInfoDictList: state = 0 # 默认关闭 + stateJoin = 0 # 可参与状态 ipyData = None actNum = sendMapServerMsgDict.get(ShareDefine.ActKey_ActNum, 0) @@ -733,12 +754,12 @@ else: todayActInfoList = operationTodayActionDict[actName] - if isinstance(todayActInfoList, list) and len(todayActInfoList) == 4: + if isinstance(todayActInfoList, list) and len(todayActInfoList) == 6: #startList = [] # [startDateTime, ...] #endList = [] # [endDateTime, ...] #notifyDict = {} # {notifyDateTime:[notifyKey, [参数]], ...} #ipyData 可能为 None - ipyData, startList, endList, notifyDict = todayActInfoList + ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList = todayActInfoList # 状态 for dIndex, startDateTime in enumerate(startList): @@ -746,6 +767,15 @@ if startDateTime <= curDateTime < endDateTime: state = dIndex + 1 # 代表第几个时间段 break + + if joinStartTimeList: + for jIndex, joinStartDateTime in enumerate(joinStartTimeList): + endJoinDateTime = joinEndTimeList[jIndex] + if joinStartDateTime <= curDateTime < endJoinDateTime: + stateJoin = state + break + else: + stateJoin = state # 全服广播提示信息 if curDateTime in notifyDict: @@ -756,12 +786,19 @@ if actName in ShareDefine.MultiActNumOperationActNameList: dictName += "_%s" % actNum preState = gameWorld.GetDictByKey(dictName) - if not isReload and preState == state: + + dictNameJoin = ChConfig.Def_WorldKey_OperationActionStateJoin % actName + if actName in ShareDefine.MultiActNumOperationActNameList: + dictNameJoin += "_%s" % actNum + preStateJoin = gameWorld.GetDictByKey(dictNameJoin) + + if not isReload and preState == state and preStateJoin == stateJoin: #已经是这个状态了 continue - GameWorld.Log("运营活动变更: actName=%s,actNum=%s,preState=%s,state=%s,dictName=%s" % (actName, actNum, preState, state, dictName)) + GameWorld.Log("运营活动变更: actName=%s,actNum=%s,preState=%s,state=%s,preStateJoin=%s,stateJoin=%s" % (actName, actNum, preState, state, preStateJoin, stateJoin)) #更新字典值 gameWorld.SetDict(dictName, state) + gameWorld.SetDict(dictNameJoin, stateJoin) dbOperationActIDKey = PlayerDBGSEvent.Def_OperationActID % actName dbOperationActWorldLVKey = PlayerDBGSEvent.Def_OActWorldLV % actName @@ -776,6 +813,11 @@ GameWorld.Log(" dbActID变更: dbActID=%s,curActID=%s" % (dbActID, curActID)) PlayerDBGSEvent.SetDBGSTrig_ByKey(dbOperationActIDKey, curActID) + # 结束旧的 + if dbActID: + if actName == ShareDefine.OperationActionName_BossTrial: + PlayerActBossTrial.OnActEnd(actNum, ipyData, dayIndex) + if curActID: if actName in ShareDefine.NeedWorldLVOperationActNameList: #记录开启时世界等级 @@ -803,6 +845,8 @@ PlayerStore.ResetFlashSaleBuyCnt(ipyData) elif actName == ShareDefine.OperationActionName_GarbageSorting: PlayerActGarbageSorting.OnActStart(actNum) + elif actName == ShareDefine.OperationActionName_BossTrial: + PlayerActBossTrial.OnActStart(actNum) else: if actName == ShareDefine.OperationActionName_GarbageSorting: PlayerActGarbageSorting.OnActEnd(actNum) @@ -851,6 +895,7 @@ #GameWorld.SendMapServerMsgEx(dictName, state) # 运营活动不单独通知活动状态,需与活动信息整合后一起通知 sendMapServerMsgDict[ShareDefine.ActKey_State] = state + sendMapServerMsgDict[ShareDefine.ActKey_StateJoin] = stateJoin GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_OperationActionInfo % actName, sendMapServerMsgDict) GameWorld.Log(" sendMapServerMsgDict: %s" % (sendMapServerMsgDict)) -- Gitblit v1.8.0