From b31e57a8079f5bf8fae3dc607929d72939e7e7c0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 13 一月 2021 18:25:05 +0800
Subject: [PATCH] 8677 【BT】【后端】跨服冲榜活动; 新增跨服活动时间管理模块、跨服榜单;跨服邮件;跨服广播优化;相关GM命令、后台工具;(冲突补同步)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py                |    2 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py               |   37 ++++++++++++++++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py         |    7 +++
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                    |   37 ++++++++++++++++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py |   14 +++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |    9 ++++
 6 files changed, 97 insertions(+), 9 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
index 8860fd5..fc51542 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
@@ -90,6 +90,7 @@
 import CrossRealmPK
 import CrossRealmMsg
 import CrossRealmPlayer
+import CrossActionControl
 import PlayerFBHelpBattle
 import PlayerFamilyRedPacket
 import PlayerFairyDomain
@@ -1930,6 +1931,7 @@
     PlayerTeam.OnServerClose(tick)
     ChPlayer.SavePlayerLVData()
     PlayerFBHelpBattle.OnServerClose()
+    CrossActionControl.OnServerClose()
     GameWorldArena.OnServerClose()
     GameWorld.Log("通知C++关服!")
     GameWorld.GetGameWorld().OnServerClose()
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 2b0d82a..820ffd7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -146,6 +146,7 @@
 Def_Notify_WorldKey_MapServerScriptReloadVersion = 'MapServerScriptReloadVersion'  # MapServer 脚本重读版本标记
 Def_Notify_WorldKey_InitGameWorldTime = "InitGameWorldTime"  #启动服务器时间
 Def_Notify_WorldKey_OperationActionInfo = "OperationActionInfo_%s" # 运营活动信息,参数为运营活动名
+Def_Notify_WorldKey_CrossActInfo = "CrossActInfo_%s" # 跨服运营活动信息,参数为运营活动名
 Def_Notify_WorldKey_ActionBossRebornSign = "ActBossSign_%s" # 活动boss重生标记,参数为日常活动ID 或 运营活动名
 Def_Notify_WorldKey_DailyActionState = "DailyActionState_%s" # 日常活动状态,参数为日常活动ID
 Def_Notify_WorldKey_CrossDailyActionState = "CrossDailyActionState_%s" # 跨服日常活动状态,参数为日常活动ID
@@ -243,13 +244,24 @@
                                    OperationActionName_CostRebate, OperationActionName_FlashGiftbag,
                                    OperationActionName_SpringSale, OperationActionName_LuckyTreasure]
 
+#跨服运营活动表名定义
+CrossActName_CTGBillboard = "CrossActCTGBillboard" # 充值排行榜
+
+#跨服运营活动列表
+CrossActNameList = [CrossActName_CTGBillboard]
+
 #活动信息字典key定义
 ActKey_ID = "ID" # 活动ID,唯一标识的ID,一般是活动开启的time值
 ActKey_State = "State" # 活动状态 0-未开启, >0开启中,也代表当日的第几个时间段
 ActKey_CfgID = "CfgID" # 活动表配置ID
-ActKey_DayIndex = "DayIndex" # 活动表配置ID
+ActKey_DayIndex = "DayIndex" # 当前活动天索引,0开始,代表第1天
+ActKey_TemplateID = "TemplateID" # 当前活动模板ID
 ActKey_WorldLV = "WorldLV" # 活动开启时世界等级
 ActKey_WorldLVList = "WorldLVList" # 活动每天的世界等级列表
+
+ActKey_ServerIDRangeList = "ServerIDRangeList" # 活动服务器ID范围信息
+ActKey_IpyDataInfo = "IpyDataInfo" # 活动对应 IpyData 信息
+ActKey_DBInfo = "DBInfo" # 保存db的历史活动信息
 
 #答题类型枚举
 Def_Game_ExamTypeList = range(1, 4 + 1)
@@ -667,7 +679,16 @@
     
     Def_BT_Max, #排行榜最大类型
 ) = range(0, 28 + 2) 
-    
+
+''' 跨服排行榜类型, 从 150 开始
+与本服榜单存储的是不一样的数据库表格,理论上类型可以和本服榜单类型重复,为了做下区分防误导,跨服榜单从 150 开始
+跨服榜单表(tagDBCrossBillboard)
+本服榜单表(tagDBBillboard)
+'''
+CrossBillboardTypeList = (
+Def_CBT_ActCTG, # 跨服运营活动 - 充值榜 150
+) = range(150, 150 + 1)
+
 #职业对应战力排行榜类型
 JobFightPowerBillboardDict = {
                               PlayerJob_Warrior:Def_BT_FightPower_Warrior,
@@ -1065,7 +1086,7 @@
                                 Def_UniversalGameRecType_FairyDomain, #缥缈仙域事件次数记录13
                                 Def_UniversalGameRecType_Reward,    # 通用奖励表(TopBar)14
                                 Def_UniversalGameRecType_ArenaBattleRecord, # 竞技场玩家挑战记录 15
-                                Def_UniversalGameRecType_16,
+                                Def_UniversalGameRecType_CrossActInfo, # 跨服运营活动信息记录 16
                                 Def_UniversalGameRecType_17,
                                 Def_UniversalGameRecType_18,
                                 Def_UniversalGameRecType_19,
@@ -1251,6 +1272,7 @@
 CrossServerMsg_PKOverInfo = "PKOverInfo"                # 跨服PK结果
 CrossServerMsg_PKSeasonInfo = "PKSeasonInfo"            # 跨服PK赛季信息
 CrossServerMsg_PKSyncBillboard = "PKSyncBillboard"      # 跨服PK同步排行榜 
+CrossServerMsg_SyncBillboard = "SyncBillboard"          # 跨服同步排行榜 
 CrossServerMsg_CrossBossInfo = "CrossBossInfo"          # 跨服Boss信息
 CrossServerMsg_CrossBossState = "CrossBossState"        # 跨服Boss状态
 CrossServerMsg_PutInItem = "PutInItem"                  # 获得物品
@@ -1262,8 +1284,11 @@
 CrossServerMsg_EnterFBRet = "EnterFBRet"                # 请求进入跨服副本返回信息
 CrossServerMsg_FBEnd = "FBEnd"                          # 完成跨服副本
 CrossServerMsg_NPCAttackCount = "NPCAttackCount"        # 攻击NPC次数记录
-CrossServerMsg_SendMail = "SendMail"                    # 发送邮件
+CrossServerMsg_SendMail = "SendMail"                    # 发送邮件,已知玩家目标服务器,主动发送
 CrossServerMsg_FBPlayerCount = "FBPlayerCount"          # 副本功能线路人数同步
+CrossServerMsg_CrossActInfo = "CrossActInfo"            # 跨服运营活动信息
+CrossServerMsg_MailPlayerIDList = "MailPlayerIDList"    # 跨服邮件玩家ID通知,玩家目标服务器可能无法知道,被动推送
+CrossServerMsg_MailContent = "MailContent"              # 跨服邮件内容通知
 
 # 子服发送跨服信息定义
 ClientServerMsg_ServerInitOK = "ServerInitOK"           # 子服启动成功
@@ -1275,6 +1300,9 @@
 ClientServerMsg_PKCancel = "PKCancel"                   # 跨服PK取消匹配
 ClientServerMsg_PKPrepareOK = "PKPrepareOK"             # 跨服PK准备完毕
 ClientServerMsg_PKBillboard = "PKBillboard"             # 跨服PK排行榜
+ClientServerMsg_QueryBillboard = "QueryBillboard"       # 跨服排行榜 - 查询、同步等
+ClientServerMsg_UpdateBillboard = "UpdateBillboard"     # 跨服排行榜 - 更新
+ClientServerMsg_MailContent = "MailContent"             # 跨服邮件内容同步 - 请求同步、汇报成功等
 ClientServerMsg_Reborn = "Reborn"                       # 复活
 ClientServerMsg_QueryNPCInfo = "QueryNPCInfo"           # 查询跨服地图NPC信息
 ClientServerMsg_SetPlayerAttrValue = "SetPlayerAttrValue" # 玩家属性数值更新
@@ -1283,6 +1311,7 @@
 ClientServerMsg_AddBuff = "AddBuff"                     # 添加BUFF
 
 #跨服广播类型定义
+CrossNotify_CrossAct = "CrossAct"
 CrossNotify_World = "World"
 CrossNotify_Family = "Family"
 CrossNotify_Player = "Player"
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 9d3033f..127debf 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3688,6 +3688,12 @@
 Def_PDict_FreeGoodsOpenTime = "FreeGoodsOpenTime" #极品白拿开启时间
 Def_PDict_FreeGoodsBuyState = "FreeGoodsBuyState_%s" #极品白拿购买状态,参数编号  0-未买 time值-购买时间 1-已返还
 
+#跨服充值排行活动
+Def_PDict_CA_CTGBillboardID = "CA_CTGBillboardID"  # 玩家身上的活动ID,唯一标识,取活动开始日期time值
+Def_PDict_CA_CTGBillboardTemplateID = "CA_CTGBillboardTemplateID"  # 玩家身上活动模板ID
+Def_PDict_CA_CTGBillboardRMB = "CA_CTGBillboardRMB"  # 活动累计充值RMB值
+Def_PDict_CA_CTGBillboardAward = "CA_CTGBillboardAward"  # 活动充值目标领奖状态,按二进制位存储
+
 #消费返利活动
 Def_PDict_CostRebateID = "CostRebateID"  # 玩家身上的消费返利活动ID,唯一标识,取活动开始日期time值
 Def_PDict_CostRebateTemplateID = "CostRebateTemplateID"  # 玩家身上的消费返利模板ID
@@ -5353,7 +5359,8 @@
 Def_RewardType_OnLineTotal, #累计在线奖励33
 Def_RewardType_ShareGame, #每日分享奖励34
 Def_RewardType_GoodGame, #游戏好评奖励35
-)= range(36)
+Def_RewardType_CACTGBillboardDabiao, #跨服充值排行活动达标奖励36
+)= range(37)
 
 
 #boss复活相关活动定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
index 2cb259c..65088fb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -49,6 +49,7 @@
 import PlayerGoldGift
 import PlayerActTotalRecharge
 import PlayerActRechargePrize
+import CrossActCTGBillboard
 import PlayerActGrowupBuy
 import OpenServerCampaign
 import PlayerWeekParty
@@ -357,6 +358,12 @@
     DataRecordPack.DR_CTGOK(curPlayer, addDRDict)
     
     #---充值成功后逻辑---
+    orderRMB = orderCoin / 100
+    # 所有真实充值均有效的
+    if coinType in [CoinType_Gold, CoinType_Buy]:
+        #跨服充值排行活动
+        CrossActCTGBillboard.AddCTGRMB(curPlayer, orderRMB)
+        
     #仙界盛典-充值大礼
     PlayerFairyCeremony.OnFCRecharge(curPlayer)
     PlayerNewFairyCeremony.OnFCRecharge(curPlayer)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
index 0165a84..28bddf2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -74,6 +74,7 @@
 import GameLogic_FamilyWar
 import OpenServerCampaign
 import PlayerCostRebate
+import CrossActCTGBillboard
 import PlayerActCollectWords
 import PlayerActTotalRecharge
 import PlayerActRechargePrize
@@ -1398,6 +1399,19 @@
                 
             return
         
+        if key.startswith(ShareDefine.Def_Notify_WorldKey_CrossActInfo[:-2]):
+            keyHead = ShareDefine.Def_Notify_WorldKey_CrossActInfo[:-2]
+            actionName = key[len(keyHead):]
+            if actionName not in PyGameData.g_crossActInfoDict:
+                PyGameData.g_crossActInfoDict[actionName] = {}
+            actInfoDict = PyGameData.g_crossActInfoDict[actionName]
+            actInfoDict.update(eval(msgValue))
+            
+            if actionName == ShareDefine.CrossActName_CTGBillboard:
+                CrossActCTGBillboard.RefreshCrossActCTGBillboardInfo()
+            
+            return
+        
         if key == ShareDefine.Def_Notify_WorldKey_CrossZoneName:
             PyGameData.g_crossZoneName = msgValue
             return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 2b0d82a..820ffd7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -146,6 +146,7 @@
 Def_Notify_WorldKey_MapServerScriptReloadVersion = 'MapServerScriptReloadVersion'  # MapServer 脚本重读版本标记
 Def_Notify_WorldKey_InitGameWorldTime = "InitGameWorldTime"  #启动服务器时间
 Def_Notify_WorldKey_OperationActionInfo = "OperationActionInfo_%s" # 运营活动信息,参数为运营活动名
+Def_Notify_WorldKey_CrossActInfo = "CrossActInfo_%s" # 跨服运营活动信息,参数为运营活动名
 Def_Notify_WorldKey_ActionBossRebornSign = "ActBossSign_%s" # 活动boss重生标记,参数为日常活动ID 或 运营活动名
 Def_Notify_WorldKey_DailyActionState = "DailyActionState_%s" # 日常活动状态,参数为日常活动ID
 Def_Notify_WorldKey_CrossDailyActionState = "CrossDailyActionState_%s" # 跨服日常活动状态,参数为日常活动ID
@@ -243,13 +244,24 @@
                                    OperationActionName_CostRebate, OperationActionName_FlashGiftbag,
                                    OperationActionName_SpringSale, OperationActionName_LuckyTreasure]
 
+#跨服运营活动表名定义
+CrossActName_CTGBillboard = "CrossActCTGBillboard" # 充值排行榜
+
+#跨服运营活动列表
+CrossActNameList = [CrossActName_CTGBillboard]
+
 #活动信息字典key定义
 ActKey_ID = "ID" # 活动ID,唯一标识的ID,一般是活动开启的time值
 ActKey_State = "State" # 活动状态 0-未开启, >0开启中,也代表当日的第几个时间段
 ActKey_CfgID = "CfgID" # 活动表配置ID
-ActKey_DayIndex = "DayIndex" # 活动表配置ID
+ActKey_DayIndex = "DayIndex" # 当前活动天索引,0开始,代表第1天
+ActKey_TemplateID = "TemplateID" # 当前活动模板ID
 ActKey_WorldLV = "WorldLV" # 活动开启时世界等级
 ActKey_WorldLVList = "WorldLVList" # 活动每天的世界等级列表
+
+ActKey_ServerIDRangeList = "ServerIDRangeList" # 活动服务器ID范围信息
+ActKey_IpyDataInfo = "IpyDataInfo" # 活动对应 IpyData 信息
+ActKey_DBInfo = "DBInfo" # 保存db的历史活动信息
 
 #答题类型枚举
 Def_Game_ExamTypeList = range(1, 4 + 1)
@@ -667,7 +679,16 @@
     
     Def_BT_Max, #排行榜最大类型
 ) = range(0, 28 + 2) 
-    
+
+''' 跨服排行榜类型, 从 150 开始
+与本服榜单存储的是不一样的数据库表格,理论上类型可以和本服榜单类型重复,为了做下区分防误导,跨服榜单从 150 开始
+跨服榜单表(tagDBCrossBillboard)
+本服榜单表(tagDBBillboard)
+'''
+CrossBillboardTypeList = (
+Def_CBT_ActCTG, # 跨服运营活动 - 充值榜 150
+) = range(150, 150 + 1)
+
 #职业对应战力排行榜类型
 JobFightPowerBillboardDict = {
                               PlayerJob_Warrior:Def_BT_FightPower_Warrior,
@@ -1065,7 +1086,7 @@
                                 Def_UniversalGameRecType_FairyDomain, #缥缈仙域事件次数记录13
                                 Def_UniversalGameRecType_Reward,    # 通用奖励表(TopBar)14
                                 Def_UniversalGameRecType_ArenaBattleRecord, # 竞技场玩家挑战记录 15
-                                Def_UniversalGameRecType_16,
+                                Def_UniversalGameRecType_CrossActInfo, # 跨服运营活动信息记录 16
                                 Def_UniversalGameRecType_17,
                                 Def_UniversalGameRecType_18,
                                 Def_UniversalGameRecType_19,
@@ -1251,6 +1272,7 @@
 CrossServerMsg_PKOverInfo = "PKOverInfo"                # 跨服PK结果
 CrossServerMsg_PKSeasonInfo = "PKSeasonInfo"            # 跨服PK赛季信息
 CrossServerMsg_PKSyncBillboard = "PKSyncBillboard"      # 跨服PK同步排行榜 
+CrossServerMsg_SyncBillboard = "SyncBillboard"          # 跨服同步排行榜 
 CrossServerMsg_CrossBossInfo = "CrossBossInfo"          # 跨服Boss信息
 CrossServerMsg_CrossBossState = "CrossBossState"        # 跨服Boss状态
 CrossServerMsg_PutInItem = "PutInItem"                  # 获得物品
@@ -1262,8 +1284,11 @@
 CrossServerMsg_EnterFBRet = "EnterFBRet"                # 请求进入跨服副本返回信息
 CrossServerMsg_FBEnd = "FBEnd"                          # 完成跨服副本
 CrossServerMsg_NPCAttackCount = "NPCAttackCount"        # 攻击NPC次数记录
-CrossServerMsg_SendMail = "SendMail"                    # 发送邮件
+CrossServerMsg_SendMail = "SendMail"                    # 发送邮件,已知玩家目标服务器,主动发送
 CrossServerMsg_FBPlayerCount = "FBPlayerCount"          # 副本功能线路人数同步
+CrossServerMsg_CrossActInfo = "CrossActInfo"            # 跨服运营活动信息
+CrossServerMsg_MailPlayerIDList = "MailPlayerIDList"    # 跨服邮件玩家ID通知,玩家目标服务器可能无法知道,被动推送
+CrossServerMsg_MailContent = "MailContent"              # 跨服邮件内容通知
 
 # 子服发送跨服信息定义
 ClientServerMsg_ServerInitOK = "ServerInitOK"           # 子服启动成功
@@ -1275,6 +1300,9 @@
 ClientServerMsg_PKCancel = "PKCancel"                   # 跨服PK取消匹配
 ClientServerMsg_PKPrepareOK = "PKPrepareOK"             # 跨服PK准备完毕
 ClientServerMsg_PKBillboard = "PKBillboard"             # 跨服PK排行榜
+ClientServerMsg_QueryBillboard = "QueryBillboard"       # 跨服排行榜 - 查询、同步等
+ClientServerMsg_UpdateBillboard = "UpdateBillboard"     # 跨服排行榜 - 更新
+ClientServerMsg_MailContent = "MailContent"             # 跨服邮件内容同步 - 请求同步、汇报成功等
 ClientServerMsg_Reborn = "Reborn"                       # 复活
 ClientServerMsg_QueryNPCInfo = "QueryNPCInfo"           # 查询跨服地图NPC信息
 ClientServerMsg_SetPlayerAttrValue = "SetPlayerAttrValue" # 玩家属性数值更新
@@ -1283,6 +1311,7 @@
 ClientServerMsg_AddBuff = "AddBuff"                     # 添加BUFF
 
 #跨服广播类型定义
+CrossNotify_CrossAct = "CrossAct"
 CrossNotify_World = "World"
 CrossNotify_Family = "Family"
 CrossNotify_Player = "Player"

--
Gitblit v1.8.0