| | |
| | | import PlayerSuccess
|
| | | import IpyGameDataPY
|
| | | import PlayerOnline
|
| | | import PlayerPreset
|
| | | import NPCCommon
|
| | | import ShareDefine
|
| | | import PyGameData
|
| | |
| | | % (chapterID, levelNum, nowChapterID, fixNowValue), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | |
|
| | | def GetCacheLineupFightPower(tagViewCache, lineupID):
|
| | | lineupInfo = GetCacheLineupInfo(tagViewCache, lineupID)
|
| | | return lineupInfo.get("FightPower", 0)
|
| | | def GetCacheLineupInfo(tagViewCache, lineupID):
|
| | | def GetCacheLineupFightPower(tagViewCache, batPresetType=ShareDefine.BatPreset_Main):
|
| | | if not tagViewCache:
|
| | | return 0
|
| | | lineupInfo = GetCacheLineupInfo(tagViewCache, batPresetType)
|
| | | return lineupInfo.get("FightPower", tagViewCache.GetFightPowerTotal())
|
| | | def GetCacheLineupInfo(tagViewCache, batPresetType=ShareDefine.BatPreset_Main):
|
| | | ## 根据查看缓存获取阵容信息,一般是 GetPlayerLineupInfo 返回的结果
|
| | | plusDict = tagViewCache.GetPlusDict()
|
| | | batPresetDict = plusDict.get("BatPreset", {})
|
| | | batTypePresetDict = batPresetDict.get("%s" % batPresetType, {})
|
| | | batPresetID = batTypePresetDict.get("%s" % ShareDefine.FuncPreset_Battle, 1)
|
| | | |
| | | lineupDict = plusDict.get("Lineup", {})
|
| | | lineupInfo = lineupDict.get("%s" % lineupID, {})
|
| | | lineupInfo = lineupDict.get("%s" % batPresetID, {})
|
| | | if not lineupInfo:
|
| | | lineupInfo = lineupDict.get("%s" % ShareDefine.Lineup_Main, {})
|
| | | defBatPresetID = 1
|
| | | lineupInfo = lineupDict.get("%s" % defBatPresetID, {})
|
| | | return lineupInfo
|
| | |
|
| | | def GetPlayerLineupFightPower(curPlayer, lineupID=ShareDefine.Lineup_Main):
|
| | | def GetPlayerLineupFightPower(curPlayer, batPresetType=ShareDefine.BatPreset_Main, exclusiveMapID=0):
|
| | | ## 获取玩家阵容战力,一般用于直接获取阵容战力记录用
|
| | | return GetPlayerLineup(curPlayer, lineupID).fightPower
|
| | | def GetPlayerLineup(curPlayer, lineupID=ShareDefine.Lineup_Main, exclusiveMapID=0):
|
| | | return GetPlayerLineupByType(curPlayer, batPresetType, exclusiveMapID).fightPower
|
| | | def GetPlayerLineupByType(curPlayer, batPresetType=ShareDefine.BatPreset_Main, exclusiveMapID=0):
|
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, batPresetType)
|
| | | return GetPlayerLineupByID(curPlayer, batPresetID, exclusiveMapID)
|
| | | def GetPlayerLineupByID(curPlayer, batPresetID=0, exclusiveMapID=0):
|
| | | ## 获取玩家阵容
|
| | | mainBatPresetID = PlayerPreset.GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main)
|
| | | if not batPresetID:
|
| | | batPresetID = mainBatPresetID
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | lineup = olPlayer.GetLineup(lineupID, exclusiveMapID=exclusiveMapID)
|
| | | if lineup.IsEmpty():
|
| | | GameWorld.DebugLogEx("玩家没有目标阵容默认取主阵容! lineupID=%s", lineupID, curPlayer.GetPlayerID())
|
| | | lineup = olPlayer.GetLineup(ShareDefine.Lineup_Main)
|
| | | lineup = olPlayer.GetPresetLineup(batPresetID, exclusiveMapID=exclusiveMapID)
|
| | | if lineup.IsEmpty() and batPresetID != mainBatPresetID:
|
| | | GameWorld.DebugLogEx("玩家没有目标阵容默认取主线阵容! batPresetID=%s,mainBatPresetID=%s", (batPresetID, mainBatPresetID), curPlayer.GetPlayerID())
|
| | | lineup = olPlayer.GetPresetLineup(mainBatPresetID, exclusiveMapID=exclusiveMapID)
|
| | | return lineup
|
| | |
|
| | | def GetPlayerLineupInfo(curPlayer, lineupID, exclusiveMapID=0):
|
| | | def GetPlayerLineupInfo(curPlayer, batPresetType=ShareDefine.BatPreset_Main, exclusiveMapID=0):
|
| | | ## 获取玩家阵容信息,可用于战斗或查看缓存,因为可能取玩家的缓存进行对战,所以统一使用json格式,前端通用
|
| | | # @param lineupID: 阵容ID
|
| | | # @param exclusiveMapID: 专享阵容的地图ID,如定军阁
|
| | | # @return: 阵容全部信息json字典,前端通用格式
|
| | | |
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, batPresetType)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | lineup = GetPlayerLineup(curPlayer, lineupID, exclusiveMapID)
|
| | | lineup = GetPlayerLineupByID(curPlayer, batPresetID, exclusiveMapID)
|
| | | if lineup.IsEmpty():
|
| | | return {}
|
| | |
|
| | |
| | | heroID = hero.heroID
|
| | | itemIndex = hero.itemIndex
|
| | | heroLV = 1
|
| | | star = 0
|
| | | star, breakLV, awakeLV = 0, 0, 0
|
| | | userData = "{}"
|
| | | if itemIndex >= 0 and itemIndex < curPack.GetCount():
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | if heroItem and not heroItem.IsEmpty():
|
| | | heroLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | star = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | #breakLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | #awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
|
| | | breakLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
|
| | | userData = heroItem.GetUserData()
|
| | |
|
| | | skillIDlist = []
|
| | |
| | | "LV":heroLV,
|
| | | "Star":star,
|
| | | "Data":userData,
|
| | | #"BreakLV":breakLV,
|
| | | #"AwakeLV":awakeLV,
|
| | | "BreakLV":breakLV,
|
| | | "AwakeLV":awakeLV,
|
| | | "FightPower":hero.fightPower,
|
| | | "AttrDict":{str(k):v for k, v in hero.heroBatAttrDict.items() if v > 0},
|
| | | "SkillIDList":skillIDlist,
|
| | |
| | | if not heroDict:
|
| | | return {}
|
| | |
|
| | | lineupInfo = {"PlayerID":playerID, "FightPower":lineup.fightPower, "ShapeType":lineup.shapeType, "Hero":heroDict}
|
| | | #shapeType = 0
|
| | | lineupInfo = {"PlayerID":playerID, "FightPower":lineup.fightPower, "BatPresetID":batPresetID, "Hero":heroDict}
|
| | | return lineupInfo
|
| | |
|
| | | def GetNPCLineupInfo(lineupID, strongerLV=0, difficulty=0, isLog=True, viewNPCID=0):
|
| | |
| | | if not tagViewCache:
|
| | | PlayerControl.NotifyCode(curPlayer, "TagNoViewCache")
|
| | | return
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache, ShareDefine.Lineup_Main)
|
| | | lineupDictA = {1:GetPlayerLineupInfo(curPlayer, ShareDefine.Lineup_Main)}
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache)
|
| | | lineupDictA = {1:GetPlayerLineupInfo(curPlayer)}
|
| | | lineupDictB = {1:defLineupInfo}
|
| | | turnFight = DoTurnFightPVP(guid, mapID, funcLineID, lineupDictA, lineupDictB)
|
| | | return turnFight.costTime if turnFight else None
|
| | |
| | | playerServerID = GameWorld.GetPlayerServerID(curPlayer)
|
| | | guid = GameWorld.GetGUID()
|
| | |
|
| | | atkLineupID = ShareDefine.Lineup_Main # 进攻方默认使用主阵容
|
| | | atkLineupInfo = GetPlayerLineupInfo(curPlayer, atkLineupID, mapID)
|
| | | atkBatPresetType = ChConfig.MapAtkBatPresetTypeDict.get(mapID, ShareDefine.BatPreset_Main)
|
| | | atkLineupInfo = GetPlayerLineupInfo(curPlayer, atkBatPresetType, exclusiveMapID=mapID)
|
| | | if not atkLineupInfo:
|
| | | GameWorld.DebugLogEx("玩家没有该阵容数据! atkLineupID=%s,mapID=%s", atkLineupID, mapID, playerID)
|
| | | GameWorld.DebugLogEx("玩家没有主线阵容数据! mapID=%s", mapID, playerID)
|
| | | return
|
| | |
|
| | | # 玩家
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, "TagNoViewCache")
|
| | | return
|
| | |
|
| | | defLineupID = ChConfig.MapLineIDDict.get(mapID, ShareDefine.Lineup_Main)
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache, defLineupID)
|
| | | defBatPresetType = ChConfig.MapDefBatPresetTypeDict.get(mapID, ShareDefine.BatPreset_Main)
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache, defBatPresetType)
|
| | | if not defLineupInfo:
|
| | | GameWorld.DebugLogEx("目标玩家没有该阵容数据! tagPlayerID=%s,defLineupID=%s", tagPlayerID, defLineupID, playerID)
|
| | | GameWorld.DebugLogEx("目标玩家没有该阵容预设数据! tagPlayerID=%s,defBatPresetType=%s", tagPlayerID, defBatPresetType, playerID)
|
| | | PlayerControl.NotifyCode(curPlayer, "TagNoLineup")
|
| | | return
|
| | |
|
| | |
| | | return
|
| | | lineupID = lineupIDList[0] # NPC阵容ID
|
| | |
|
| | | lineupMainInfo = GetPlayerLineupInfo(curPlayer, ShareDefine.Lineup_Main)
|
| | | lineupMainInfo = GetPlayerLineupInfo(curPlayer)
|
| | | if not lineupMainInfo:
|
| | | GameWorld.DebugLogEx("没有设置主阵容!", playerID)
|
| | | return
|
| | |
| | | # char GUID[40]; //战报guid
|
| | | #};
|
| | | def OnTurnFightReportView(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | guid = clientData.GUID
|
| | | |
| | | lastBatBufferInfo = PlayerOnline.GetOnlinePlayer(curPlayer).GetLastBatBuffer()
|
| | | if lastBatBufferInfo and len(lastBatBufferInfo) == 2 and guid == lastBatBufferInfo[0]:
|
| | | guid, reprot = lastBatBufferInfo
|
| | | SyncTurnFightReport(curPlayer, guid, reprot)
|
| | | return
|
| | | |
| | | # 其他战报,一般是入库存储的,待扩展
|
| | | |
| | | # 战报已过期
|
| | | PlayerControl.NotifyCode(curPlayer, "FightReportExpired")
|
| | | ## 改为下载文件
|
| | | return
|
| | |
|
| | | #// B4 16 查看NPC属性 #tagCSViewNPCAttr
|