From 3118adeb72c93f559944ee7425409e0a125b23dd Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 10 一月 2019 11:59:01 +0800
Subject: [PATCH] 860312 修复在线数据同一分钟发送两次问题;客户端和服务端tick不对应再次同步一次

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py     |    1 +
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py           |   22 ++++++++--------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py |    1 +
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
index c0472d1..794177d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
@@ -544,22 +544,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 = {} # 平台在线人数 {平台:人数, ...}
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 6ffbb43..0556fbc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -118,6 +118,7 @@
     Def_Max_Move_Tick = 5000
  
     if abs(gameWorldTick - clientWorldTick) >= Def_Max_Move_Tick:
+        curPlayer.Sync_ClientTick()
         #时间相差过大,可能因网络引起,拉回
         GameWorld.DebugLog("PlayerMoveCheckClientWorldTick -- 服务器tick %s-客户端%s时间相差过大,可能因网络引起,拉回" % (
                             gameWorldTick, clientWorldTick), curPlayer.GetID())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
index bd403bc..af21d9c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -888,6 +888,7 @@
     Def_Attack_DelayTick = 5000
     # tick 误差过大则过滤
     if abs(clientTick - tick) > Def_Attack_DelayTick:
+        curPlayer.Sync_ClientTick()
         GameWorld.DebugLog("tick 误差过大则过滤 > 5000")
         return False
     

--
Gitblit v1.8.0