From 61f8b79f9ba9ae47d8930bd7aead8d6a39a74745 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 26 十一月 2024 18:48:57 +0800
Subject: [PATCH] 10318 【英文】【越南】【BT】【砍树】统一增加奖励获得封包

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py |   54 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
index 5d32d76..9257609 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
@@ -31,6 +31,7 @@
 import CrossBattlefield
 import CrossRealmPlayer
 import PyGameDataStruct
+import PlayerPackData
 import IpyGameDataPY
 import PyDataManager
 import CrossRealmPK
@@ -74,6 +75,9 @@
         return True
     
     if GameWorldSkyTower.IsSkyTowerPassPlayer(playerID):
+        return True
+    
+    if PlayerPackData.IsPackDataPlayer(playerID):
         return True
     
     #跨服榜单上的默认保留
@@ -123,6 +127,8 @@
 
 def DelOutofTimeViewCacheData():
     ## 删除过期的查看缓存数据
+    
+    PlayerPackData.DelOutofTimePackData()
     
     pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager()
     playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
@@ -204,22 +210,23 @@
                      "LV":cacheDict["LV"], 
                      "RealmLV":cacheDict["RealmLV"], 
                      }
-    if "PlayerID" in exAttrs:
-        shotCacheDict["PlayerID"] = playerID
-    if "FightPower" in exAttrs:
-        shotCacheDict["FightPower"] = cacheDict["FightPower"]
-    if "ServerID" in exAttrs:
-        shotCacheDict["ServerID"] = GameWorld.GetAccIDServerID(cacheDict["AccID"])
-    if "OfflineValue" in exAttrs:
-        olMgr = ChPlayer.GetOnlinePlayerMgr()
-        shotCacheDict["OfflineValue"] = olMgr.GetOfflineValue(playerID, viewCache)
-    # 附带外观模型展示相关
-    if "Model" in exAttrs:
-        shotCacheDict.update({
-                              "TitleID":cacheDict.get("TitleID", 0),
-                              "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
-                              "EquipShowID":cacheDict.get("EquipShowID", []),
-                              })
+    for attrName in exAttrs:
+        if attrName == "PlayerID":
+            shotCacheDict["PlayerID"] = playerID
+        elif attrName == "ServerID":
+            shotCacheDict["ServerID"] = GameWorld.GetAccIDServerID(cacheDict["AccID"])
+        elif attrName == "OfflineValue":
+            olMgr = ChPlayer.GetOnlinePlayerMgr()
+            shotCacheDict["OfflineValue"] = olMgr.GetOfflineValue(playerID, viewCache)
+        # 附带外观模型展示相关
+        elif attrName == "Model":
+            shotCacheDict.update({
+                                  "TitleID":cacheDict.get("TitleID", 0),
+                                  "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
+                                  "EquipShowID":cacheDict.get("EquipShowID", []),
+                                  })
+        elif attrName in cacheDict:
+            shotCacheDict[attrName] = cacheDict[attrName]
     return shotCacheDict
 
 def GetSyncCrossCacheBase(curPlayer):
@@ -233,6 +240,8 @@
                  "Job":curPlayer.GetJob(),
                  "VIPLV":curPlayer.GetVIPLv(),
                  "Name":CrossRealmPlayer.GetCrossPlayerName(curPlayer),
+                 "Face":curPlayer.GetFace(),
+                 "FacePic":curPlayer.GetFacePic(),
                  "FamilyID":curPlayer.GetFamilyID(),
                  "FamilyName":cacheDict.get("FamilyName", ""),
                  "TitleID":cacheDict.get("TitleID", 0),
@@ -245,9 +254,6 @@
 
 def UpdCrossCacheBase(playerID, cacheBase, isLogout=False):
     ## 更新同步跨服基础查看缓存
-    #更新跨服在线状态,只要有同步即视为在线,除了指定是Logout的
-    olMgr = ChPlayer.GetOnlinePlayerMgr()
-    olMgr.SetOnlineState(playerID, not isLogout, cacheBase.get("ServerGroupID", 0))
     curCache = FindViewCache(playerID, True)
     if not curCache:
         return {}
@@ -282,6 +288,11 @@
 #    ...         ...
 #    WORD        ItemDataSize20;
 #    char        ItemData20[ItemDataSize20];
+#    BYTE        PackDataSyncState;    // 打包数据同步状态: 0-不同步;个位-是否同步本服;十位-是否同步跨服
+#    DWORD       PackDataLen;
+#    char        PackData[PackDataLen];
+#    WORD        PackMsgLen;
+#    char        PackMsg[PackMsgLen];
 #};
 def OnMGUpdatePlayerCache(routeIndex, mapID, curPackData, tick):
     playerID = curPackData.PlayerID
@@ -318,12 +329,15 @@
         setattr(curCache, "ItemDataSize%s" % classLV, itemDataSize)
         #GameWorld.DebugLog("    更新Item数据: classLV=%s,size=%s, %s" % (classLV, itemDataSize, itemData), playerID)
         
+    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
+    # 在可能删除之前执行打包数据相关逻辑
+    PlayerPackData.OnMGUpdatePlayerPackData(curPlayer, curPackData)
+    
     if isLogout:
         #不需要保存离线数据的,直接删除缓存数据
         if not IsSaveDBViewCache(curCache):
             DeleteViewCache(playerID)
             return
-        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
         if curPlayer:
             curCache.GeTuiID = curPlayer.GetGeTuiClientID()
             curCache.GeTuiIDSize = len(curCache.GeTuiID)

--
Gitblit v1.8.0