From 0c2f7c40cce8588f55ece592a1dafa22d30d9fb8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 17 一月 2019 02:25:30 +0800
Subject: [PATCH] 5722 【后端】【1.5】跨服BOSS开发(增加PK状态下不可进入跨服及提示)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
index 74ee805..fa29cda 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
@@ -94,6 +94,8 @@
 import EventReport
 #import ReloadModule
 import CrossRealmPK
+import CrossRealmMsg
+import CrossRealmPlayer
 import PlayerFBHelpBattle
 import PlayerFamilyRedPacket
 import IpyGameDataPY
@@ -290,7 +292,8 @@
     PlayerFamilyParty.FamilyParty_Process(tick)
     # 帮主弹劾时钟调用
     PlayerFamily.OnLeaderImpeachTick(tick)
-    
+    #跨服玩家
+    CrossRealmPlayer.OnCrossProcess(tick)
     #跨服PK匹配
     CrossRealmPK.OnPKMatchProcess(tick)
     
@@ -543,22 +546,16 @@
 #  所有服务器人数要回报一次,  每个map也要回报一次
 #  gameWorld.GetTickByType(0 - n) 取间隔
 def DisposeGameActivePlayer(tick):
-#    gameWorld = GameWorld.GetGameWorld()
-#    lastTick = gameWorld.GetTickByType(ChConfig.TYPE_GetActivePlayerCount)
-#    
-#    if lastTick == -1:
-#        #GameWorld.Log("未初始化服务器")
-#        return
-#    
-#    if tick - lastTick < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_GetActivePlayerCount]:
-#        return
-#    
-#    
-#    gameWorld.SetTickByType(ChConfig.TYPE_GetActivePlayerCount , tick)
-        
+    gameWorld = GameWorld.GetGameWorld()    
+    curMinute = datetime.datetime.today().minute 
     #为了每个服的输出时间点统一一个分钟点,便于统计
-    if datetime.datetime.today().minute % 5 != 0:
+    if curMinute % 5 != 0:
         return
+    noteData = gameWorld.GetDictByKey("OnlineCntM")
+    if noteData == curMinute:
+        # 同一分钟不多发送,此处不建议用CD处理,避免两CD冲突
+        return
+    gameWorld.SetDict("OnlineCntM", curMinute)
     
     # 全服在线人数平台明细
     platformOLDict = {} # 平台在线人数 {平台:人数, ...}
@@ -1211,7 +1208,8 @@
     if initOpenServerTime <= 0 or openServerWeekday <= 0:
         #记录首次开发时间(现实时间戳)
         PlayerDBGSEvent.SetInitOpenServerTime(initOpenServerTime if initOpenServerTime else int(time.time()))
-
+        
+    CrossRealmMsg.OnGameServerInitOK()
     #初始化家族数量
     GameWorld.GetFamilyManager().SetFamilyUpperLimitCount(ChConfig.Def_Family_MaxCnt)
     #排序元宝交易平台
@@ -1238,12 +1236,20 @@
     ChPlayer.LoadPlayerLVData()
     #加载助战信息
     PlayerFBHelpBattle.OnServerStart()
+    #跨服PK
+    CrossRealmPK.OnGameServerInitOK()
     #世界boss被杀次数重置
     #GameWorldBoss.CheckResetBossKilledCntOnServerInit()
     #GameWorldActionTeHui.OnGameServerInitOK() # 特惠活动初始化
-    #子服启动成功告知跨服主服
-    serverGroupID = GameWorld.GetServerGroupID()
-    GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID)
+    isCrossServer = GameWorld.IsCrossServer()
+    if isCrossServer:
+        isServerClose = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossServerClose)
+        isServerOpen = 0 if isServerClose else 1
+        GameWorld.GetGameWorld().SetDict(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isServerOpen)
+        GameWorld.Log("跨服服务器启动成功: isServerOpen=%s" % isServerOpen)
+    else:
+        serverGroupID = GameWorld.GetServerGroupID()
+        GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID)
     return
 
 def DoCheckNewServerOpen(tick):
@@ -1403,6 +1409,10 @@
     # 商店信息
     #GameWorldShopItem.OnMapServerInitOK()
     
+    # 跨服服务器状态
+    isCrossServerOpen = GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen)
+    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isCrossServerOpen)
+    
     # 跨服PK
     CrossRealmPK.OnMapServerInitOK()
     
@@ -1432,7 +1442,6 @@
     # 清除指定通用数据
     universalRecMgr = GameWorld.GetUniversalRecMgr()
     delRecTypeList = [ShareDefine.Def_UniversalGameRecType_ManorWarInfo,
-                      #ShareDefine.Def_UniversalGameRecType_MergeRegister,
                       ]
     GameWorld.DebugLog("    清除指定通用数据 delRecTypeList=%s" % str(delRecTypeList))
     for delRecType in delRecTypeList:
@@ -1457,7 +1466,7 @@
     # 删除过期的通用数据
     curTime = int(time.time())
     GameWorld.Log("执行删除过期的通用数据, curTime=%s" % curTime)
-    delOutofdayRecDataDict = {ShareDefine.Def_UniversalGameRecType_MergeRegister:31 * 24 * 3600,
+    delOutofdayRecDataDict = {
                               }
     for otDayRecType, otTime in delOutofdayRecDataDict.items():
         otRecDataList = universalRecMgr.GetTypeList(otDayRecType)

--
Gitblit v1.8.0