| | |
| | |
|
| | | import GameWorld
|
| | | import GameWorship
|
| | | import GameXiangong
|
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import GameWorldArena
|
| | |
| | | import CrossBattlefield
|
| | | import CrossRealmPlayer
|
| | | import PyGameDataStruct
|
| | | import PlayerPackData
|
| | | import IpyGameDataPY
|
| | | import PyDataManager
|
| | | import CrossRealmPK
|
| | |
| | | if PyDataManager.GetDBPyFuncTeamManager().IsTeamPlayer(playerID):
|
| | | return True
|
| | |
|
| | | if GameXiangong.IsXiangongPlayer(playerID):
|
| | | return True
|
| | | |
| | | if GameWorldSkyTower.IsSkyTowerPassPlayer(playerID):
|
| | | return True
|
| | | |
| | | if PlayerPackData.IsPackDataPlayer(playerID):
|
| | | return True
|
| | |
|
| | | #跨服榜单上的默认保留
|
| | |
| | |
|
| | | def DelOutofTimeViewCacheData():
|
| | | ## 删除过期的查看缓存数据
|
| | | |
| | | PlayerPackData.DelOutofTimePackData()
|
| | |
|
| | | pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager()
|
| | | playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
|
| | |
| | | curCache.PropDataDict = eval(curCache.PropData)
|
| | | return curCache.PropDataDict
|
| | |
|
| | | def GetShotCahceDict(playerID, withEquip=False):
|
| | | def GetShotCacheDict(playerID, *exAttrs):
|
| | | ## 获取玩家简短的缓存信息字典
|
| | | viewCache = FindViewCache(playerID)
|
| | | cacheDict = GetCachePropDataDict(viewCache)
|
| | | if not cacheDict:
|
| | | return {}
|
| | | olMgr = ChPlayer.GetOnlinePlayerMgr()
|
| | | shotCacheDict = {
|
| | | "PlayerID":playerID, |
| | | "Name":cacheDict["Name"],
|
| | | "Job":cacheDict["Job"],
|
| | | "LV":cacheDict["LV"],
|
| | | "RealmLV":cacheDict["RealmLV"],
|
| | | "FightPower":cacheDict["FightPower"],
|
| | | "ServerID":GameWorld.GetAccIDServerID(cacheDict["AccID"]),
|
| | | "OfflineValue":olMgr.GetOfflineValue(playerID, viewCache)
|
| | | }
|
| | | if withEquip:
|
| | | shotCacheDict.update({
|
| | | "TitleID":cacheDict.get("TitleID", 0),
|
| | | "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", 0),
|
| | | })
|
| | | 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),
|
| | | "FightPower":PlayerControl.GetFightPower(curPlayer),
|
| | | "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", []),
|
| | | "ServerGroupID":PlayerControl.GetPlayerServerGroupID(curPlayer),
|
| | | }
|
| | | return cacheBase
|
| | |
|
| | | 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)
|
| | |
| | | answerPack.RealmLV = 1
|
| | | answerPack.OnlineType = ChConfig.Def_Offline
|
| | | answerPack.ServerGroupID = 0
|
| | | answerPack.Face = 0
|
| | | answerPack.FacePic = 0
|
| | | else:
|
| | | cacheDict = GetCachePropDataDict(curCache)
|
| | | answerPack.PlayerID = clientPack.PlayerID
|
| | |
| | | answerPack.LV = cacheDict["LV"]
|
| | | answerPack.RealmLV = cacheDict["RealmLV"]
|
| | | answerPack.OnlineType = ChConfig.Def_Offline
|
| | | answerPack.Face = cacheDict.get("Face", 0)
|
| | | answerPack.FacePic = cacheDict.get("FacePic", 0)
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | answerPack.ServerGroupID = cacheDict.get("ServerGroupID", 0)
|
| | |
| | | answerPack.OnlineType = ChConfig.Def_Online
|
| | | answerPack.IsInTeam = tagPlayer.GetTeamID() > 0
|
| | | answerPack.ServerGroupID = PlayerControl.GetPlayerServerGroupID(tagPlayer)
|
| | | answerPack.Face = tagPlayer.GetFace()
|
| | | answerPack.FacePic = tagPlayer.GetFacePic()
|
| | |
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | NetPackCommon.SendFakePack(curPlayer, answerPack)
|