| | |
| | | import PyGameData
|
| | | import PlayerTJG
|
| | | import SkillShell
|
| | | import PlayerPet
|
| | | import GameObj
|
| | |
|
| | | import time
|
| | |
| | | return json.dumps(classItemDataDict, ensure_ascii=False).replace(" ", "")
|
| | |
|
| | | def UpdPlayerPropPlusCache(curPlayer):
|
| | | if not curPlayer:
|
| | | return
|
| | | curPlayerPropDict = {}
|
| | | curPlayerPropDict["AccID"] = curPlayer.GetAccID()
|
| | | curPlayerPropDict["LV"] = curPlayer.GetLV()
|
| | |
| | | curPlayerPlusDict["TotalStoneLV"] = Operate_EquipStone.GetTotalStoneLV(curPlayer)
|
| | | curPlayerPlusDict["TotalEquipWashLV"] = Operate_EquipWash.GetTotalEquipWashLV(curPlayer)
|
| | | #主动技能总等级
|
| | | curPlayerPlusDict["TotalSkillLV"] = SkillShell.GetAllSkillLV(curPlayer, ChConfig.Def_SkillFuncType_FbSkill)
|
| | | skillInfo = SkillShell.GetAllSkillInfo(curPlayer, [ChConfig.Def_SkillFuncType_FbSkill, ChConfig.Def_SkillFuncType_NormalAttack])
|
| | | curPlayerPlusDict["SkillInfo"] = skillInfo
|
| | | curPlayerPlusDict["TotalSkillLV"] = sum(skillInfo.get(ChConfig.Def_SkillFuncType_FbSkill, {}).values())
|
| | | |
| | | #灵宠数据
|
| | | curPlayerPlusDict["Pet"] = __GetPetInfo(curPlayer)
|
| | | curPlayerPlusDict["Pet"] = PlayerPet.GetPetCacheInfo(curPlayer)
|
| | |
|
| | | #坐骑数据
|
| | | curPlayerPlusDict["Horse"] = __GetHorseInfo(curPlayer)
|
| | |
| | | def GetPlayerPropPlusCache(curPlayer):
|
| | | #玩家属性缓存
|
| | | UpdPlayerPropPlusCache(curPlayer)
|
| | | return GetPlayerPropPlusCacheByID(curPlayer.GetPlayerID())
|
| | | return GetPlayerPropPlusCacheByID(curPlayer.GetPlayerID(), False)
|
| | |
|
| | | def GetPlayerPropPlusCacheByID(playerID):
|
| | | def GetPlayerPropPlusCacheByID(playerID, checkUpd=False):
|
| | | #玩家属性缓存
|
| | | viewCache = PyGameData.g_playerViewCache.get(playerID, {})
|
| | | curPlayerPropDict = viewCache.get("PropData", {})
|
| | | curPlayerPlusDict = viewCache.get("PlusData", {})
|
| | | PropData = json.dumps(curPlayerPropDict, ensure_ascii=False).replace(" ", "")
|
| | | PlusData = json.dumps(curPlayerPlusDict, ensure_ascii=False).replace(" ", "")
|
| | | PropDict, PlusDict = GetPlayerPropPlusDictByID(playerID, checkUpd)
|
| | | PropData = json.dumps(PropDict, ensure_ascii=False).replace(" ", "")
|
| | | PlusData = json.dumps(PlusDict, ensure_ascii=False).replace(" ", "")
|
| | | return PropData, PlusData
|
| | |
|
| | | def GetPlayerPropPlusDictByID(playerID, checkUpd=False):
|
| | | #玩家属性字典
|
| | | if checkUpd:
|
| | | UpdPlayerPropPlusCache(GameWorld.GetPlayerManager().FindPlayerByID(playerID))
|
| | | viewCache = PyGameData.g_playerViewCache.get(playerID, {})
|
| | | PropDict = viewCache.get("PropData", {})
|
| | | PlusDict = viewCache.get("PlusData", {})
|
| | | return PropDict, PlusDict
|
| | |
|
| | | def __GetEquipShowIDList(curPlayer):
|
| | | ## 获取外观装备ID列表
|
| | |
| | | continue
|
| | | equipShowIDList.append(curEquip.GetItemTypeID())
|
| | | return equipShowIDList
|
| | |
|
| | | ## 灵宠信息
|
| | | def __GetPetInfo(curPlayer):
|
| | | petInfo = {}
|
| | | petClassLVList = []
|
| | | equipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptPet)
|
| | | for index in xrange(equipPack.GetCount()):
|
| | | packItem = equipPack.GetAt(index)
|
| | | if not packItem or packItem.IsEmpty():
|
| | | continue
|
| | | petNPCID = packItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID)
|
| | | classLV = packItem.GetUserAttr(ShareDefine.Def_IudetPet_ClassLV)
|
| | | petClassLVList.append({"id":petNPCID, 'lv':classLV})
|
| | | |
| | | petInfo["PetLV"] = petClassLVList
|
| | | petInfo["AtkSpeed"] = GameObj.GetAtkSpeed(curPlayer)
|
| | | return petInfo
|
| | |
|
| | | ## 坐骑信息
|
| | | def __GetHorseInfo(curPlayer):
|
| | |
| | | NetPackCommon.SendPyPackToGameServer(sendPack)
|
| | | return
|
| | |
|
| | | def GetPlayerPropData(findPlayerID):
|
| | | ## 获取玩家战斗属性数据 UpdPlayerPropPlusCache
|
| | | viewCache = PyGameData.g_playerViewCache.get(findPlayerID, {})
|
| | | return viewCache.get("PropData", {})
|
| | |
|
| | | def GetPlayerPropDataCall(curPlayer, findPlayerID, callFunc, callData=None, syncClient=True):
|
| | | def GetPlayerPropDataCall(curPlayer, findPlayerID, callFunc, callData=None, syncClient=False):
|
| | | ## 获取玩家战斗属性数据 - 支持callback,因为地图可能暂时没有离线玩家缓存数据
|
| | | # @param callFunc: 获取到玩家数据后回调函数,可能地图没有数据,会等向GameServer同步过后再回调
|
| | | # @param callData: 回调函数扩展参数,透传参数
|
| | | # @param syncClient: 是否附带通知前端该玩家数据,一般如果有需要前端配合展示的,需要直接传给前端,如镜像PK类功能
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | dataDict = GetPlayerPropData(findPlayerID)
|
| | | dataDict = GetPlayerPropPlusDictByID(findPlayerID, True)[0]
|
| | | if dataDict:
|
| | | if syncClient:
|
| | | Sync_PlayerCache(curPlayer, findPlayerID)
|