From 4bf976c6e6af3c7bb6bcb2798544b7f47cd7844d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 22 三月 2024 15:48:37 +0800
Subject: [PATCH] 10138 内存分析(修复读取活动配置部分属性错误bug)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
index a40bc65..d4ead59 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
@@ -23,7 +23,9 @@
import NetPackCommon
import GameWorldArena
import ChPyNetSendPack
+import ChGameToMapPyPack
import PlayerFBHelpBattle
+import GameWorldSkyTower
import CrossChampionship
import CrossBattlefield
import PyGameDataStruct
@@ -51,6 +53,9 @@
return True
if CrossChampionship.IsChampionshipPlayer(playerID):
+ return True
+
+ if GameWorldSkyTower.IsSkyTowerPassPlayer(playerID):
return True
SaveDBLimitLV = IpyGameDataPY.GetFuncCfg("PlayerViewCache", 1)
@@ -143,6 +148,8 @@
def GetCachePropDataDict(curCache):
## 获取缓存基础属性字典信息
+ if not curCache:
+ return {}
if not hasattr(curCache, "PropDataDict"):
curCache.PropDataDict = {}
if not curCache.PropDataDict and curCache.PropData:
@@ -187,12 +194,7 @@
return
curCache.LV = curPackData.PlayerLV
curCache.OffTime = curPackData.OffTime
- if isLogout:
- curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
- if curPlayer:
- curCache.GeTuiID = curPlayer.GetGeTuiClientID()
- curCache.GeTuiIDSize = len(curCache.GeTuiID)
-
+
curCache.PropDataDict = {} # 每次更新数据时,重置字典缓存,下次获取时重新eval缓存
curCache.PropData = curPackData.PropData
curCache.PropDataSize = curPackData.PropDataSize
@@ -234,16 +236,36 @@
# DWORD PlayerID; //玩家ID
# DWORD FindPlayerID; //要查询的玩家ID
# BYTE EquipClassLV; //大于0为查看指定境界阶装备信息, 0为查看默认信息
+# BYTE CallMap; //是否需要通知地图
#};
def OnMGQueryPlayerCache(routeIndex, mapID, curPackData, tick):
curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(curPackData.PlayerID)
findPlayerID = curPackData.FindPlayerID
equipClassLV = curPackData.EquipClassLV
+ callMap = curPackData.CallMap
curCache = FindViewCache(findPlayerID)
if not curCache:
PlayerControl.NotifyCode(curPlayer, "ViewPlayer_OffLine")
+ if callMap:
+ sendPack = ChGameToMapPyPack.tagGMPlayerCache()
+ sendPack.PlayerID = curPlayer.GetPlayerID()
+ sendPack.FindPlayerID = findPlayerID
+ sendPack.PropData = ""
+ sendPack.PropDataSize = len(sendPack.PropData)
+ sendPack.PlusData = ""
+ sendPack.PlusDataSize = len(sendPack.PlusData)
+ NetPackCommon.SendPyPackToMapServer(routeIndex, mapID, sendPack)
return
Sync_PlayerCache(curPlayer, curCache, equipClassLV)
+ if callMap:
+ sendPack = ChGameToMapPyPack.tagGMPlayerCache()
+ sendPack.PlayerID = curPlayer.GetPlayerID()
+ sendPack.FindPlayerID = findPlayerID
+ sendPack.PropData = curCache.PropData
+ sendPack.PropDataSize = len(sendPack.PropData)
+ sendPack.PlusData = curCache.PlusData
+ sendPack.PlusDataSize = len(sendPack.PlusData)
+ NetPackCommon.SendPyPackToMapServer(routeIndex, mapID, sendPack)
return
def Sync_PlayerCache(curPlayer, curCache, equipClassLV=0):
@@ -294,6 +316,7 @@
answerPack.RealmLV = 1
answerPack.OnlineType = ChConfig.Def_Offline
answerPack.ServerGroupID = 0
+ answerPack.Face = 0
else:
cacheDict = GetCachePropDataDict(curCache)
answerPack.PlayerID = clientPack.PlayerID
@@ -302,6 +325,7 @@
answerPack.LV = cacheDict["LV"]
answerPack.RealmLV = cacheDict["RealmLV"]
answerPack.OnlineType = ChConfig.Def_Offline
+ answerPack.Face = cacheDict.get("Face", 0)
if GameWorld.IsCrossServer():
answerPack.ServerGroupID = cacheDict.get("ServerGroupID", 0)
@@ -316,6 +340,7 @@
answerPack.OnlineType = ChConfig.Def_Online
answerPack.IsInTeam = tagPlayer.GetTeamID() > 0
answerPack.ServerGroupID = PlayerControl.GetPlayerServerGroupID(tagPlayer)
+ answerPack.Face = tagPlayer.GetFace()
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
NetPackCommon.SendFakePack(curPlayer, answerPack)
--
Gitblit v1.8.0