From 791cffdb8bbd408c3794709e23a31b4f6845a0bd Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 16 三月 2021 16:08:36 +0800
Subject: [PATCH] 8855 【主干】【BT2】【后端】活动通用逻辑,新增字段支持配置按世界等级开启(限时礼包支持)
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py | 68 +++++++++++++++++++++++++++++++++-
ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py | 3 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 2
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 2
PySysDB/PySysDBG.h | 1
5 files changed, 72 insertions(+), 4 deletions(-)
diff --git a/PySysDB/PySysDBG.h b/PySysDB/PySysDBG.h
index 1a64a15..cb8252d 100644
--- a/PySysDB/PySysDBG.h
+++ b/PySysDB/PySysDBG.h
@@ -401,6 +401,7 @@
dict NotifyInfoStart; //全服提示信息 - 相对开始时间
dict NotifyInfoEnd; //全服提示信息 - 相对结束时间
list NotifyInfoLoop; //全服提示信息 - 循环广播[间隔分钟, 广播key]
+ WORD LimitWorldLV; //限制开启的最低世界等级
WORD LVLimit; //限制等级
BYTE IsDayReset; //是否每天重置
};
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index 3b62025..bf74fe8 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -151,6 +151,43 @@
## 运营活动类型
return actNum / 10
+def __SaveActWorldLVLimitInfo(actWorldLVLimitInfo):
+ GameWorld.GetUniversalRecMgr().Delete(ShareDefine.Def_UniversalGameRecType_ActWorldLVLimitInfo)
+ recDataList = GameWorld.GetUniversalRecMgr().GetTypeList(ShareDefine.Def_UniversalGameRecType_ActWorldLVLimitInfo)
+ GameWorld.Log("保存运营活动世界等级限制开启信息: %s" % len(actWorldLVLimitInfo))
+ for actName, cfgLimitInfoDict in actWorldLVLimitInfo.items():
+ for cfgID, limitInfo in cfgLimitInfoDict.items():
+ recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV = limitInfo
+ recData = recDataList.AddRec()
+ recData.SetStrValue1(recStartDateStr)
+ recData.SetStrValue2(recEndDateStr)
+ recData.SetStrValue3(actName)
+ recData.SetValue1(cfgID)
+ recData.SetValue2(recLimitWorldLV)
+ recData.SetValue3(recWorldLV)
+ GameWorld.Log(" actName=%s,cfgID=%s,recStartDateStr=%s,recEndDateStr=%s,recLimitWorldLV=%s,recWorldLV=%s"
+ % (actName, cfgID, recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV))
+ return
+
+def __GetActWorldLVLimitInfo():
+ actWorldLVLimitInfo = {}
+ recDataList = GameWorld.GetUniversalRecMgr().GetTypeList(ShareDefine.Def_UniversalGameRecType_ActWorldLVLimitInfo)
+ GameWorld.Log("加载运营活动世界等级限制开启信息: %s" % recDataList.Count())
+ for index in xrange(recDataList.Count()):
+ recData = recDataList.At(index)
+ recStartDateStr = recData.GetStrValue1()
+ recEndDateStr = recData.GetStrValue2()
+ actName = recData.GetStrValue3()
+ cfgID = recData.GetValue1()
+ recLimitWorldLV = recData.GetValue2()
+ recWorldLV = recData.GetValue3()
+ if actName not in actWorldLVLimitInfo:
+ actWorldLVLimitInfo[actName] = {}
+ actWorldLVLimitInfo[actName][cfgID] = [recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV]
+ GameWorld.Log(" actName=%s,cfgID=%s,recStartDateStr=%s,recEndDateStr=%s,recLimitWorldLV=%s,recWorldLV=%s"
+ % (actName, cfgID, recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV))
+ return actWorldLVLimitInfo
+
def __GetOperationActionInfo(isRefreshState=True):
# @return: isReload, OperationActionInfo
@@ -180,10 +217,13 @@
serverGroupID = GameWorld.GetServerGroupID()
ipyDataMgr = IpyGameDataPY.IPY_Data()
curWeekday = curDateTime.weekday() + 1 # 今天星期几, 1代表星期1
+ curWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
+ actWorldLVLimitInfoOld = __GetActWorldLVLimitInfo()
+ actWorldLVLimitInfoNew = {}
GameWorld.Log("===== 加载本日运营活动信息: %s, serverGroupID=%s,openServerDay=%s,customMaxServerDay=%s,isMixServer=%s,mixServerDay=%s,maxCustomServerDayMix=%s,reloadSign=%s ====="
% (curDateTime, serverGroupID, openServerDay, customMaxServerDay, isMixServer, mixServerDay, maxCustomServerDayMix, reloadSign))
- GameWorld.Log(" 今日周%s" % (curWeekday))
+ GameWorld.Log(" 今日周%s, curWorldLV=%s" % (curWeekday, curWorldLV))
for actName in ShareDefine.OperationActionNameList:
@@ -338,7 +378,7 @@
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 # 用于判断是否需要处理的起始时间,一般是活动开始时间,如果有提前广播或预告则时间会提前
# 提前预告
@@ -363,6 +403,29 @@
% (activityIpyData.GetCfgID(), cfgID, advanceMinutes, minNotifyStartMinute, startDayDateJudge))
continue
+ # 在需要处理的时间内附加世界等级开启限制,未达到最低世界等级要求的不开,活动时间从未达到到达到也不开
+ limitWorldLV = 0 if not hasattr(ipyData, "GetLimitWorldLV") else ipyData.GetLimitWorldLV() # 限制开启世界等级
+ if limitWorldLV:
+ GameWorld.Log(" limitWorldLV=%s,curWorldLV=%s" % (limitWorldLV, curWorldLV))
+ recInfoType = ""
+ worldLVLimitInfo = actWorldLVLimitInfoOld.get(actName, {})
+ # 注: 该逻辑是在活动时间内的额外处理,所以需要判断此逻辑的前提理论上都在活动时间内,故只要有记录则以当时的记录为准
+ if cfgID in worldLVLimitInfo:
+ recInfoType = "Old"
+ recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV = worldLVLimitInfo[cfgID]
+ else:
+ recInfoType = "New"
+ recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV = startDateStr, endDateStr, limitWorldLV, curWorldLV
+
+ if actName not in actWorldLVLimitInfoNew:
+ actWorldLVLimitInfoNew[actName] = {}
+ actWorldLVLimitInfoNew[actName][cfgID] = [recStartDateStr, recEndDateStr, recLimitWorldLV, recWorldLV]
+
+ if recLimitWorldLV > recWorldLV:
+ GameWorld.Log(" 活动时间内,但服务器世界等级未达到开启活动世界等级,不处理!recLimitWorldLV=%s > recWorldLV=%s %s"
+ % (recLimitWorldLV, recWorldLV, recInfoType))
+ continue
+
startList = [] # [startDateTime, ...]
endList = [] # [endDateTime, ...]
startNotifyDict = {} # {notifyDateTime:notifyInfo, ...}
@@ -476,6 +539,7 @@
mapServerOperationActionDict[actName] = activityInfoDict
OperationActionInfo = IpyGameDataPY.SetConfigEx(key, [reloadSign, operationTodayActionDict, mapServerOperationActionDict])
+ __SaveActWorldLVLimitInfo(actWorldLVLimitInfoNew)
GameWorld.Log("本日运营活动信息加载完毕!reloadSign=%s,isRefreshState=%s" % (reloadSign, isRefreshState))
GameWorld.Log(" operationTodayActionDict=%s" % operationTodayActionDict)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
index fb6a050..33e1944 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
@@ -341,6 +341,7 @@
("dict", "NotifyInfoStart", 0),
("dict", "NotifyInfoEnd", 0),
("list", "NotifyInfoLoop", 0),
+ ("WORD", "LimitWorldLV", 0),
("WORD", "LVLimit", 0),
("BYTE", "IsDayReset", 0),
),
@@ -1347,6 +1348,7 @@
self.NotifyInfoStart = {}
self.NotifyInfoEnd = {}
self.NotifyInfoLoop = []
+ self.LimitWorldLV = 0
self.LVLimit = 0
self.IsDayReset = 0
return
@@ -1363,6 +1365,7 @@
def GetNotifyInfoStart(self): return self.NotifyInfoStart # 全服提示信息 - 相对开始时间
def GetNotifyInfoEnd(self): return self.NotifyInfoEnd # 全服提示信息 - 相对结束时间
def GetNotifyInfoLoop(self): return self.NotifyInfoLoop # 全服提示信息 - 循环广播[间隔分钟, 广播key]
+ def GetLimitWorldLV(self): return self.LimitWorldLV # 限制开启的最低世界等级
def GetLVLimit(self): return self.LVLimit # 限制等级
def GetIsDayReset(self): return self.IsDayReset # 是否每天重置
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index bde6cad..703645b 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1117,7 +1117,7 @@
Def_UniversalGameRecType_ArenaBattleRecord, # 竞技场玩家挑战记录 15
Def_UniversalGameRecType_CrossActInfo, # 跨服运营活动信息记录 16
Def_UniversalGameRecType_FeastWish, #节日祝福大奖记录17
- Def_UniversalGameRecType_18,
+ Def_UniversalGameRecType_ActWorldLVLimitInfo, # 运营活动世界等级限制开启信息 18
Def_UniversalGameRecType_19,
Def_UniversalGameRecType_20,
Def_UniversalGameRecType_21,
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index bde6cad..703645b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1117,7 +1117,7 @@
Def_UniversalGameRecType_ArenaBattleRecord, # 竞技场玩家挑战记录 15
Def_UniversalGameRecType_CrossActInfo, # 跨服运营活动信息记录 16
Def_UniversalGameRecType_FeastWish, #节日祝福大奖记录17
- Def_UniversalGameRecType_18,
+ Def_UniversalGameRecType_ActWorldLVLimitInfo, # 运营活动世界等级限制开启信息 18
Def_UniversalGameRecType_19,
Def_UniversalGameRecType_20,
Def_UniversalGameRecType_21,
--
Gitblit v1.8.0