|  |  |  | 
|---|
|  |  |  | import CrossBattlefield | 
|---|
|  |  |  | import CrossRealmPlayer | 
|---|
|  |  |  | import PyGameDataStruct | 
|---|
|  |  |  | import PlayerPackData | 
|---|
|  |  |  | import IpyGameDataPY | 
|---|
|  |  |  | import PyDataManager | 
|---|
|  |  |  | import CrossRealmPK | 
|---|
|  |  |  | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if GameWorldSkyTower.IsSkyTowerPassPlayer(playerID): | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if PlayerPackData.IsPackDataPlayer(playerID): | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #跨服榜单上的默认保留 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DelOutofTimeViewCacheData(): | 
|---|
|  |  |  | ## 删除过期的查看缓存数据 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerPackData.DelOutofTimePackData() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager() | 
|---|
|  |  |  | playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict | 
|---|
|  |  |  | 
|---|
|  |  |  | "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): | 
|---|
|  |  |  | 
|---|
|  |  |  | "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), | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 {} | 
|---|
|  |  |  | 
|---|
|  |  |  | #    ...         ... | 
|---|
|  |  |  | #    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 | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) | 
|---|