From c0c4a0880e9a0fc5d1482c1260e02ddd1b554bc9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 12 十月 2022 14:09:02 +0800
Subject: [PATCH] 9719 【越南】【BT7】【主干】跨服全民充值

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py |   42 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
index dc9118e..b857004 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
@@ -21,8 +21,11 @@
 import GameWorld
 import PlayerControl
 import NetPackCommon
+import GameWorldArena
 import ChPyNetSendPack
 import PlayerFBHelpBattle
+import CrossChampionship
+import CrossBattlefield
 import PyGameDataStruct
 import IpyGameDataPY
 import PyDataManager
@@ -31,13 +34,22 @@
 import json
 import time
 
-def DoOnDay():
+def DoOnDayEx():
     DelOutofTimeViewCacheData()
     return
 
 def IsSaveDBViewCache(playerID, playerLV):
     ## 是否保存基本的缓存数据
     if PlayerFBHelpBattle.IsInHelpBattleCheckInList(playerID):
+        return True
+    
+    if GameWorldArena.IsArenaBattlePlayer(playerID):
+        return True
+    
+    if CrossBattlefield.IsBattlefieldCallPlayer(playerID):
+        return True
+    
+    if CrossChampionship.IsChampionshipPlayer(playerID):
         return True
     
     SaveDBLimitLV = IpyGameDataPY.GetFuncCfg("PlayerViewCache", 1)
@@ -49,6 +61,18 @@
 
 def IsSaveAllViewCache(playerID):
     ## 是否保存所有缓存数据
+    
+    if PlayerFBHelpBattle.IsInHelpBattleCheckInList(playerID):
+        return True
+    
+    if GameWorldArena.IsArenaBattlePlayer(playerID):
+        return True
+    
+    if CrossBattlefield.IsBattlefieldCallPlayer(playerID):
+        return True
+    
+    if CrossChampionship.IsChampionshipPlayer(playerID):
+        return True
     
     NeedCheckBillBoardType = IpyGameDataPY.GetFuncEvalCfg("PlayerViewCache", 2)
     #校验玩家是否上排行榜
@@ -66,7 +90,7 @@
     ## 删除过期的查看缓存数据
     
     curTime = int(time.time())
-    MaxTime = 30 * 3600 * 24 # 30天
+    MaxTime = IpyGameDataPY.GetFuncCfg("PlayerViewCache", 3) * 3600 * 24
     
     pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager()
     playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
@@ -89,8 +113,9 @@
     GameWorld.DebugLog("删除查看缓存!", playerID)
     return
 
-def FindViewCache(playerID, isAddNew=False):
+def FindViewCache(playerID, isAddNew=False, newPropData={}):
     ## 查找玩家缓存
+    # @param newPropData: 新数据初始PropData {}, key: LV,RealmLV,Job,VIPLV,Name,FamilyID,FamilyName,FightPower
     curCache = None
     pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager()
     playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
@@ -99,6 +124,9 @@
     elif isAddNew:
         curCache = PyGameDataStruct.tagPlayerViewCachePy()
         curCache.PlayerID = playerID
+        if newPropData:
+            curCache.PropData = json.dumps(newPropData, ensure_ascii=False).replace(" ", "")
+            curCache.PropDataSize = len(curCache.PropData)
         playerViewCachePyDict[playerID] = curCache
     return curCache
 
@@ -106,7 +134,7 @@
     ## 获取缓存基础属性字典信息
     if not hasattr(curCache, "PropDataDict"):
         curCache.PropDataDict = {}
-    if not curCache.PropDataDict:
+    if not curCache.PropDataDict and curCache.PropData:
         curCache.PropDataDict = eval(curCache.PropData)
     return curCache.PropDataDict
 
@@ -263,7 +291,11 @@
             answerPack.LV = cacheDict["LV"]
             answerPack.RealmLV = cacheDict["RealmLV"]
             answerPack.OnlineType = ChConfig.Def_Offline
-            answerPack.ServerGroupID = cacheDict.get("ServerGroupID", 0)
+            
+            if GameWorld.IsCrossServer():
+                answerPack.ServerGroupID = cacheDict.get("ServerGroupID", 0)
+            else:
+                answerPack.ServerGroupID = GameWorld.GetServerGroupID()
     else:
         answerPack.PlayerID = clientPack.PlayerID
         answerPack.PlayerName = tagPlayer.GetName()

--
Gitblit v1.8.0