From 4b4e5f3f7ea1e59f70d53fd11efe1ecb366cd3f8 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期五, 19 四月 2019 17:16:00 +0800 Subject: [PATCH] 6457 【后端】【2.0】缥缈仙域开发单(宝藏流程调整) --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py | 29 ++++++++++------------------- 1 files changed, 10 insertions(+), 19 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py index ae14d3b..72ccc54 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py @@ -19,13 +19,8 @@ #------------------------------------------------------------------------------ import GameWorld import ChPyNetSendPack -import IPY_PlayerDefine -import PlayerFamilyAction import PlayerControl import NetPackCommon -import ReadChConfig -import PlayerFamily -import IPY_GameServer import PlayerFBHelpBattle import IpyGameDataPY import ShareDefine @@ -55,11 +50,13 @@ ##更新缓存数据 # @param PlayerID, PropData, ItemData, PlusData, isSaveDB # @return None -def UpdatePlayerCache(PlayerID, PropData, ItemData, PlusData, isSaveDB=False): +def UpdatePlayerCache(PlayerID, PropData, ItemData, PlusData, isSaveDB=False, packData=None): curCache = ViewCacheMgr.FindCache(PlayerID) if not curCache: curCache = ViewCacheMgr.AddNewCache(PlayerID) - curCache.SetUpdateTime(GameWorld.GetCurrentDataTimeStr()) + if packData: + curCache.SetPlayerLV(packData.PlayerLV) + curCache.SetOffTime(packData.OffTime) GameWorld.DebugLog('ViewCache### UpdatePlayerCache PlayerID %s, \ @@ -106,13 +103,15 @@ ##玩家下线缓存数据 # @param PlayerID, PlayerLV, PropData, ItemData, PlusData # @return None -def OnPlayerLogout(PlayerID, PlayerLV, PropData, ItemData, PlusData): +def OnPlayerLogout(curPackData): + PlayerID = curPackData.PlayerID + PlayerLV = curPackData.PlayerLV #不需要保存离线数据的,直接删除缓存数据 if not IsNeedSaveLogoutPlayer(PlayerID, PlayerLV): ViewCacheMgr.DeleteCache(PlayerID) return #更新数据,并设置需要保存数据库 - UpdatePlayerCache(PlayerID, PropData, ItemData, PlusData, True) + UpdatePlayerCache(PlayerID, curPackData.PropData, curPackData.ItemData, curPackData.PlusData, True, packData=curPackData) return ## 根据规则判定是否需要继续保存离线玩家数据 @@ -155,13 +154,6 @@ # if curBillboard.FindByID(PlayerID): # return True # -# #校验玩家竞技场是否进入排名 -# hightLadderMgr = GameWorld.GetHightLadderMgr() -# hightLadderData = hightLadderMgr.FindPlayerData(PlayerID) -# if hightLadderData: -# if hightLadderData.GetOrder() < HighLadderLimitOrder: -# return True -# # curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(PlayerID) # if curPlayer: # # 非普通成员需保存 @@ -179,12 +171,11 @@ PlayerID = curPackData.PlayerID PlayerLV = curPackData.PlayerLV if curPackData.IsLogouting: - OnPlayerLogout(PlayerID, PlayerLV, \ - curPackData.PropData, curPackData.ItemData, curPackData.PlusData) + OnPlayerLogout(curPackData) else: # 此处保存设置为True是为安全防范,比如突然断电,宕机等情况 导致误以为不保存,故等级可设置高一点 UpdatePlayerCache(PlayerID, curPackData.PropData, \ - curPackData.ItemData, curPackData.PlusData, True if PlayerLV > 150 else False) + curPackData.ItemData, curPackData.PlusData, True if PlayerLV > 150 else False, packData=curPackData) GameWorld.DebugLog('ViewCache### OnMGUpdatePlayerCache out') return -- Gitblit v1.8.0