From c63ffd10aecb12b2e09dae603cf9a0f824f6482c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 10 十二月 2025 15:46:15 +0800
Subject: [PATCH] 16 卡牌服务端(合成目标物品与材料物品不在同一背包时支持合成;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py
index 0b2a0a9..f157b02 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldEvent.py
@@ -17,15 +17,21 @@
 
 import DBDataMgr
 import GameWorld
+import PyMongoMain
+import PlayerFamily
 import IpyGameDataPY
 import IPY_GameWorld
 import PlayerEventCounter
+import PlayerViewCache
 import PlayerControl
 import NetPackCommon
 import PlayerOnline
 import ShareDefine
-import PlayerTeam
 import PyGameData
+import ItemCommon
+import BattleObj
+import ChPlayer
+import ObjPool
 
 import datetime
 import time
@@ -66,7 +72,7 @@
 #调用该函数时,C++已经设置好区服,如果改变区服需重启
 def StartDB(tick):
     #初始化数据库, 恢复备档(按区服记录), 加载静态表
-    from PyMongoDB import PyMongoMain
+    #from PyMongoDB import PyMongoMain
     PyMongoMain.StartDB()
     InitGameWorld(tick)
     return
@@ -78,7 +84,9 @@
     serverID = GameWorld.GetGameWorld().GetServerID()
     GameWorld.Log("服务器启动初始化InitGameWorld: serverID=%s" % serverID)
     DBDataMgr.OnServerStart() # 优先加载公共数据
+    ItemCommon.InitPyItem()
     LoadDBPlayer()
+    PlayerViewCache.LoadRobot()
     PyGameData.g_initGameTime = int(time.time()) # 放到加载数据之后
     
     #初始话开服时间、星期几
@@ -231,13 +239,29 @@
     ## 每秒分钟执行一次
     if not PyGameData.g_initGameTime:
         return
-    if tick - PyGameData.g_highProcessTick < 1000:
+    curTime = int(time.time())
+    if not PyGameData.g_highProcessTime:
+        PyGameData.g_highProcessTime = curTime
+        
+    if curTime < PyGameData.g_highProcessTime:
+        GameWorld.Log("时间回调了: lastProcessTime=%s" % (GameWorld.ChangeTimeNumToStr(PyGameData.g_highProcessTime)))
+        PyGameData.g_highProcessTime = curTime
+        OnFixServerTimeProcess()
+        
+    passSeconds = curTime - PyGameData.g_highProcessTime
+    if passSeconds < 1:
         return
-    PyGameData.g_highProcessTick = tick
+    if passSeconds > 10:
+        GameWorld.Log("时间误差过大: passSeconds=%s,lastProcessTime=%s" % (passSeconds, GameWorld.ChangeTimeNumToStr(PyGameData.g_highProcessTime)))
+        OnFixServerTimeProcess()
+        
+    PyGameData.g_highProcessTime = curTime
     
     if PyGameData.g_serverClosing:
         CheckCloseMapOK()
         return
+    
+    PyMongoMain.GetUserCtrlDB().onSecondProcess()
     
     OnMinute(tick)
     
@@ -247,6 +271,21 @@
     
     return
 
+def OnFixServerTimeProcess():
+    
+    # 补同步一次服务器时间给前端
+    playerManager = GameWorld.GetPlayerManager()
+    for i in xrange(playerManager.GetPlayerCount()):
+        curPlayer = playerManager.GetPlayerByIndex(i)
+        
+        if not GameWorld.IsNormalPlayer(curPlayer):
+            continue
+        
+        ChPlayer.Sync_PyServerDataTimeToClient(curPlayer)
+        ChPlayer.Sync_OpenServerDay(curPlayer)
+        
+    return
+        
 def OnMinute(tick):
     ## 每整分钟执行一次
     curTime = GameWorld.GetCurrentTime()
@@ -264,9 +303,11 @@
     #GameWorldActionControl.Dispose_OperationActionState()
     #GameWorldActionControl.Dispose_DailyActionState()
     #GameWorldActionControl.Dispose_FBStateTime()
+    PlayerFamily.OnMinute()
     PlayerOnline.OnMinute()
+    BattleObj.OnMinute()
+    ObjPool.OnMinute(curTime)
     
-    PlayerTeam.OnCheckTeamPlayerDisconnectTimeout(tick)
     __CheckIpyDataRecycle(curTime)
     return
     

--
Gitblit v1.8.0