From 937e159f80f02bff02b218afa6c88438b0343f5f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 15 三月 2019 10:58:13 +0800
Subject: [PATCH] 1111 修改任务接口对bind的判断

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
index bffd6cb..959c0e7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
@@ -55,11 +55,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 +108,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
 
 ## 根据规则判定是否需要继续保存离线玩家数据
@@ -179,12 +183,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
 
@@ -311,8 +314,8 @@
     playerLV = PropData["LV"]
     
     PropData = json.dumps(PropData, ensure_ascii=False)
-    ItemData = curCache.GetItemData()
-    PlusData = curCache.GetPlusData()
+    ItemData = GetItemData(curCache)
+    PlusData = GetPlusData(curCache)
     UpdatePlayerCache(playerID, PropData, ItemData, PlusData, True if playerLV > 150 else False)  
     return
 

--
Gitblit v1.8.0