| | |
| | | import GameWorldSkyTower
|
| | | import CrossChampionship
|
| | | import CrossBattlefield
|
| | | import CrossRealmPlayer
|
| | | import PyGameDataStruct
|
| | | import IpyGameDataPY
|
| | | import PyDataManager
|
| | |
| | |
|
| | | import json
|
| | | import time
|
| | | import random
|
| | |
|
| | | def DoOnDayEx():
|
| | | DelOutofTimeViewCacheData()
|
| | |
| | | return True
|
| | |
|
| | | if GameWorship.IsWorshipPlayer(playerID):
|
| | | return True
|
| | | |
| | | if PyDataManager.GetDBPyFuncTeamManager().IsTeamPlayer(playerID):
|
| | | return True
|
| | |
|
| | | if GameWorldSkyTower.IsSkyTowerPassPlayer(playerID):
|
| | |
| | | playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict
|
| | | if playerID in playerViewCachePyDict:
|
| | | curCache = playerViewCachePyDict[playerID]
|
| | | elif isAddNew:
|
| | | elif isAddNew or playerID < 10000:
|
| | | # 内网测试假玩家
|
| | | if playerID < 10000 and not newPropData:
|
| | | openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1)
|
| | | fakeName = "匿名玩家".decode(ShareDefine.Def_Game_Character_Encoding).encode(GameWorld.GetCharacterEncoding())
|
| | | fakeName = "%s%s" % (fakeName, playerID)
|
| | | serverID = random.randint(9900, 9950)
|
| | | accID = "fake%s@test@s%s" % (playerID, serverID)
|
| | | newPropData = {
|
| | | "AccID":accID, |
| | | "PlayerID":playerID, |
| | | "Name":fakeName, |
| | | "Job":random.choice(openJobList) if openJobList else 1, |
| | | "LV":random.randint(100, 200), |
| | | "RealmLV":random.randint(5, 15),
|
| | | "FightPower":random.randint(1000000, 100000000), |
| | | "ServerGroupID":serverID,
|
| | | }
|
| | | curCache = PyGameDataStruct.tagPlayerViewCachePy()
|
| | | curCache.PlayerID = playerID
|
| | | if newPropData:
|
| | |
| | | curCache.PropDataDict = eval(curCache.PropData)
|
| | | return curCache.PropDataDict
|
| | |
|
| | | def GetShotCahceDict(playerID, withEquip=False):
|
| | | ## 获取玩家简短的缓存信息字典
|
| | | cacheDict = GetCachePropDataDict(FindViewCache(playerID))
|
| | | if not cacheDict:
|
| | | return {}
|
| | | shotCacheDict = {
|
| | | "PlayerID":playerID, |
| | | "Name":cacheDict["Name"], |
| | | "Job":cacheDict["Job"], |
| | | "LV":cacheDict["LV"], |
| | | "RealmLV":cacheDict["RealmLV"], |
| | | "FightPower":cacheDict["FightPower"],
|
| | | "ServerID":GameWorld.GetAccIDServerID(cacheDict["AccID"]),
|
| | | }
|
| | | if withEquip:
|
| | | shotCacheDict.update({
|
| | | "TitleID":cacheDict.get("TitleID", 0),
|
| | | "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", 0),
|
| | | })
|
| | | return shotCacheDict
|
| | |
|
| | | def GetSyncCrossCacheBase(curPlayer):
|
| | | ## 获取同步跨服基础查看缓存,主要用于个别功能需要提前先同步玩家基础缓存到跨服,因为跨服不一定有玩家缓存,需要提前同步
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | cacheDict = GetCachePropDataDict(FindViewCache(playerID))
|
| | | cacheBase = {
|
| | | "AccID":curPlayer.GetAccID(),
|
| | | "LV":curPlayer.GetLV(),
|
| | | "RealmLV":curPlayer.GetOfficialRank(),
|
| | | "Job":curPlayer.GetJob(),
|
| | | "VIPLV":curPlayer.GetVIPLv(),
|
| | | "Name":CrossRealmPlayer.GetCrossPlayerName(curPlayer),
|
| | | "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),
|
| | | "ServerGroupID":PlayerControl.GetPlayerServerGroupID(curPlayer),
|
| | | }
|
| | | return cacheBase
|
| | |
|
| | | def UpdCrossCacheBase(playerID, cacheBase):
|
| | | ## 更新同步跨服基础查看缓存
|
| | | cacheDict = GetCachePropDataDict(FindViewCache(playerID, True))
|
| | | if not cacheBase:
|
| | | return cacheDict
|
| | | for k, v in cacheBase.items():
|
| | | cacheDict[k] = v
|
| | | return cacheDict
|
| | |
|
| | | #//04 01 地图同步玩家缓存数据到GameServer#tagMGUpdatePlayerCache
|
| | | #
|
| | | #struct tagMGUpdatePlayerCache
|