From 07404bf456b40111afa9f46e67236b4ef1b76e5d Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 20 五月 2024 15:54:50 +0800
Subject: [PATCH] 0312 封包同步

---
 ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py |   90 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 76 insertions(+), 14 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py b/ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py
index 5e225a8..d69ec33 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py
@@ -14,7 +14,9 @@
 
 import GameWorld
 import PlayerSocial
+import CrossBillboard
 import PlayerFamilyStore
+import PlayerCompensation
 import PlayerBourse
 import GameWorldBoss
 import PlayerSealDemon
@@ -25,12 +27,16 @@
 import AuctionHouse
 import PlayerAssist
 import PyGameDataStruct
+import IpyGameDataPY
+import PlayerCharm
+import PlayerLove
 import CommFunc
+import time
 
 def GetSavePyData():
     pyGameDataMgr = GetPyGameDataManager()
     result = pyGameDataMgr.GetSaveData()
-    GameWorld.DebugLog("GetSavePyData!! id = %s-%s"%(id(pyGameDataMgr), len(result)))
+    GameWorld.Log("GetSavePyData!! id = %s-%s"%(id(pyGameDataMgr), len(result)))
     result = binascii.b2a_hex(result)
     #GameWorld.DebugLog("GetSavePyData!! result = %s-%s"%(result, len(result)))
     # 字节码在C++转化会发生错误must be string without null bytes, not str,但是可以正常保存,错误会在下次调用便宜接口才会触发
@@ -54,6 +60,7 @@
     
     # 保存数据 存数据库和realtimebackup
     def GetSaveData(self):
+        PlayerAssist.RemoveOutofdateAssistThanks()
         savaData = ""
         cntData = ""
         cnt = 0
@@ -63,7 +70,7 @@
             PlayerAssist.OnSaveAssistThanksData(dbData)
             savaData += dbData.getBuffer()
             
-        GameWorld.Log("Save DBAssistThanks count :%s" % cnt)
+        GameWorld.Log("Save DBAssistThanks count :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -84,9 +91,8 @@
     
     def __init__(self):
         self.allAssistDict = {} # 所有协助 {GUID:tagDBAssist, ...}
-        self.familyAssistDict = {} # 仙盟协助缓存 {familyID:[tagDBAssist, ...], ...}
         
-        self.playerNoSaveDBAssistDict = {} # 玩家发布的不存库协助 {playerID:[tagDBAssist, ...], ...}
+        self.playerAssistDict = {} # 玩家发布的协助 {playerID:[tagDBAssist, ...], ...}
         self.playerAssistingDict = {} # 玩家正在协助中的协助,只能存在一条 {playerID:tagDBAssist, ...}
         return
     
@@ -102,7 +108,7 @@
             cnt += 1
             savaData += dbData.getBuffer()
             
-        GameWorld.Log("Save DBAssist count :%s" % cnt)
+        GameWorld.Log("Save DBAssist count :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -118,11 +124,11 @@
             PlayerAssist.OnInitAssistData(dbData, 1)
             
             self.allAssistDict[dbData.GUID] = dbData
-            familyID = dbData.FamilyID
-            if familyID not in self.familyAssistDict:
-                self.familyAssistDict[familyID] = []
-            familyAssistList = self.familyAssistDict[familyID]
-            familyAssistList.append(dbData)
+            PlayerID = dbData.PlayerID
+            if PlayerID not in self.playerAssistDict:
+                self.playerAssistDict[PlayerID] = []
+            playerAssistList = self.playerAssistDict[PlayerID]
+            playerAssistList.append(dbData)
             
         return pos
     
@@ -143,7 +149,7 @@
             cnt += 1
             savaData += dbData.getBuffer()
             
-        GameWorld.Log("Save PlayerViewCachePy count :%s" % cnt)
+        GameWorld.Log("Save PlayerViewCachePy count :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -175,13 +181,21 @@
         cntData = ""
         cnt = 0
         
+        unSaveCnt = 0
+        curTime = int(time.time())
+        vaildSeconds = IpyGameDataPY.GetFuncCfg("AuctionHouse", 1) * 3600 * 24
         for recordDict in [self.myAuctionItemRecordDict, self.myBidItemRecordDict, self.familyAuctionItemRecordDict]:
             for recordList in recordDict.values():
                 for dbData in recordList:
+                    if vaildSeconds:
+                        recordTime = GameWorld.ChangeTimeStrToNum(dbData.RecordTime)
+                        if curTime - recordTime > vaildSeconds:
+                            unSaveCnt += 1
+                            continue
                     cnt += 1
                     savaData += dbData.getBuffer()
                     
-        GameWorld.Log("Save AuctionRecord count :%s" % cnt)
+        GameWorld.Log("Save AuctionRecord count :%s len=%s unSaveCnt=%s" % (cnt, len(savaData), unSaveCnt))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -215,7 +229,7 @@
             cnt += 1
             savaData += dbData.getBuffer()
             
-        GameWorld.Log("Save AuctionAttention count :%s" % cnt)
+        GameWorld.Log("Save AuctionAttention count :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -271,7 +285,7 @@
             cnt += 1
             savaData += dbData.getBuffer()
             
-        GameWorld.Log("Save AuctionItem count :%s" % cnt)
+        GameWorld.Log("Save AuctionItem count :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -295,6 +309,12 @@
 
 class PyGameDataManager(object):
     def __init__(self):
+        self.DBPyCoupleManager = PlayerLove.DBPyCoupleManager()
+        self.DBPyUnNotifyLoveGiftRecManager = PlayerLove.DBPyUnNotifyLoveGiftRecManager()
+        self.DBPyCharmValueRecManager = PlayerCharm.DBPyCharmValueRecManager()
+        self.IntimacyManager = PlayerSocial.IntimacyManager()
+        self.CrossPersonalCompensationManager = PlayerCompensation.CrossPersonalCompensationManager()
+        self.CrossBillboardManager = CrossBillboard.CrossBillboardManager()
         self.PlayerAssistThanksPyManager = PlayerAssistThanksPyManager()
         self.PlayerAssistPyManager = PlayerAssistPyManager()
         self.PlayerViewCachePyManager = PlayerViewCachePyManager()
@@ -318,6 +338,12 @@
 
     def GetSaveData(self):
         buff = ""
+        buff += self.DBPyCoupleManager.GetSaveData()
+        buff += self.DBPyUnNotifyLoveGiftRecManager.GetSaveData()
+        buff += self.DBPyCharmValueRecManager.GetSaveData()
+        buff += self.IntimacyManager.GetSaveData()
+        buff += self.CrossPersonalCompensationManager.GetSaveData()
+        buff += self.CrossBillboardManager.GetSaveData()
         buff += self.PlayerAssistThanksPyManager.GetSaveData()
         buff += self.PlayerAssistPyManager.GetSaveData()
         buff += self.PlayerViewCachePyManager.GetSaveData()
@@ -340,6 +366,12 @@
         return buff
     
     def LoadGameData(self, gameBuffer, pos):
+        pos = self.DBPyCoupleManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
+        pos = self.DBPyUnNotifyLoveGiftRecManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
+        pos = self.DBPyCharmValueRecManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
+        pos = self.IntimacyManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
+        pos = self.CrossPersonalCompensationManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
+        pos = self.CrossBillboardManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
         pos = self.PlayerAssistThanksPyManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
         pos = self.PlayerAssistPyManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
         pos = self.PlayerViewCachePyManager.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
@@ -368,6 +400,16 @@
         pyGameDataMgr = PyGameDataManager()
         PyGameData.g_pyGameDataManager = pyGameDataMgr
     return pyGameDataMgr
+
+def GetCrossPersonalCompensationManager():
+    # 跨服个人补偿邮件管理
+    pyGameDataMgr = GetPyGameDataManager()
+    return pyGameDataMgr.CrossPersonalCompensationManager
+
+def GetCrossBillboardManager():
+    # 跨服排行榜管理
+    pyGameDataMgr = GetPyGameDataManager()
+    return pyGameDataMgr.CrossBillboardManager
 
 def GetPlayerAssistThanksPyManager():
     # 协助感谢表
@@ -439,6 +481,26 @@
     pyGameDataMgr = GetPyGameDataManager()
     return pyGameDataMgr.familyStoreItemManager
 
+def GetDBPyCoupleManager():
+    # 伴侣管理
+    pyGameDataMgr = GetPyGameDataManager()
+    return pyGameDataMgr.DBPyCoupleManager
+
+def GetDBPyUnNotifyLoveGiftRecManager():
+    # 未通知的赠送礼物记录
+    pyGameDataMgr = GetPyGameDataManager()
+    return pyGameDataMgr.DBPyUnNotifyLoveGiftRecManager
+
+def GetDBPyCharmValueRecManager():
+    # 魅力管理
+    pyGameDataMgr = GetPyGameDataManager()
+    return pyGameDataMgr.DBPyCharmValueRecManager
+
+def GetIntimacyManager():
+    # 亲密管理
+    pyGameDataMgr = GetPyGameDataManager()
+    return pyGameDataMgr.IntimacyManager
+
 # 好友系统
 def GetFriendManager():
     pyGameDataMgr = GetPyGameDataManager()

--
Gitblit v1.8.0