| | |
| | | lineupInfo = {"PlayerID":playerID, "FightPower":lineup.fightPower, "ShapeType":lineup.shapeType, "Hero":heroDict}
|
| | | return lineupInfo
|
| | |
|
| | | def GetNPCLineupInfo(lineupID, strongerLV=0, difficulty=0, isLog=True):
|
| | | def GetNPCLineupInfo(lineupID, strongerLV=0, difficulty=0, isLog=True, viewNPCID=0):
|
| | | ## 获取NPC阵容信息
|
| | | # @param lineupID: 阵容ID
|
| | | # @param npcLV: 成长NPC等级
|
| | | # @param difficulty: 成长NPC难度系数
|
| | | # @param viewNPCID: 查看指定的NPCID,供前端查询NPC属性用
|
| | | # @return: 阵容全部信息json字典,前端通用格式
|
| | | lineupInfo = GetGMTestNPCLineupInfo(lineupID, strongerLV, difficulty)
|
| | | if lineupInfo:
|
| | |
| | | npcID = getattr(ipyData, "GetPosNPCID%s" % posNum)()
|
| | | if not npcID:
|
| | | continue
|
| | | if viewNPCID and viewNPCID != npcID:
|
| | | continue
|
| | | battleDict = GetNPCBattleDict(ipyData, npcID, strongerLV, difficulty, isLog)
|
| | | if not battleDict:
|
| | | continue
|
| | | heroDict[str(posNum)] = battleDict
|
| | | if viewNPCID:
|
| | | break
|
| | |
|
| | | lineupInfo = {"NPCLineupID":lineupID, "Hero":heroDict, "BossID":bossID, "BossPosView":bossPosView}
|
| | | return lineupInfo
|
| | |
| | | "SkinID":skinID,
|
| | | "LV":npcLV,
|
| | | "Star":star,
|
| | | #"BreakLV":breakLV,
|
| | | #"AwakeLV":awakeLV,
|
| | | "BreakLV":breakLV,
|
| | | "AwakeLV":awakeLV,
|
| | | "AttrDict":{str(k):v for k, v in batAttrDict.items() if v > 0},
|
| | | "SkillIDList":skillIDList,
|
| | | }
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, "FightReportExpired")
|
| | | return
|
| | |
|
| | | #// B4 16 查看NPC属性 #tagCSViewNPCAttr
|
| | | #
|
| | | #struct tagCSViewNPCAttr
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD MapID; // 自定义地图ID,可用于绑定战斗地图场景功能(如主线boss、爬塔、竞技场等)
|
| | | # DWORD FuncLineID; // MapID对应的扩展值,如具体某个关卡等
|
| | | # DWORD ViewNPCID; // 指定查看某个NPCID,发0则查看该关卡阵容所有NPC
|
| | | #};
|
| | | def OnViewNPCAttr(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | mapID = clientData.MapID
|
| | | funcLineID = clientData.FuncLineID
|
| | | viewNPCID = clientData.ViewNPCID |
| | | SyncLineupNPCAttr(curPlayer, mapID, funcLineID, viewNPCID)
|
| | | return
|
| | |
|
| | | def SyncLineupNPCAttr(curPlayer, mapID, funcLineID, viewNPCID=0):
|
| | | lineupIDList = []
|
| | | strongerLV, difficulty = 0, 0
|
| | | |
| | | if mapID == ChConfig.Def_FBMapID_MainBoss:
|
| | | chapterID = funcLineID / 100
|
| | | levelNum = funcLineID % 100
|
| | | levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
|
| | | if not levelIpyData:
|
| | | return
|
| | | lineupIDList = levelIpyData.GetBossLineupIDList() # Boss波阵容ID列表,小队1阵容ID|小队2阵容ID|...
|
| | | strongerLV = levelIpyData.GetNPCLV()
|
| | | difficulty = levelIpyData.GetDifficulty()
|
| | | |
| | | else:
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, funcLineID)
|
| | | if fbLineIpyData:
|
| | | lineupIDList = fbLineIpyData.GetLineupIDList()
|
| | | strongerLV = fbLineIpyData.GetNPCLV()
|
| | | difficulty = fbLineIpyData.GetDifficulty()
|
| | | else:
|
| | | ret = FBLogic.GetFBNPCLineupInfo(curPlayer, mapID, funcLineID)
|
| | | if not ret:
|
| | | return
|
| | | lineupIDList, strongerLV, difficulty = ret
|
| | | |
| | | if not lineupIDList:
|
| | | return
|
| | | |
| | | npcAttrList = []
|
| | | for lineupID in lineupIDList:
|
| | | lineupInfo = GetNPCLineupInfo(lineupID, strongerLV, difficulty, False, viewNPCID=viewNPCID)
|
| | | if not lineupInfo:
|
| | | continue
|
| | | heroDict = lineupInfo["Hero"]
|
| | | for posNum, attrInfo in heroDict.items():
|
| | | posNum = int(posNum)
|
| | | npcAttr = ChPyNetSendPack.tagSCViewNPCAttr()
|
| | | npcAttr.PosNum = posNum
|
| | | npcAttr.NPCID = attrInfo["NPCID"]
|
| | | npcAttr.HeroID = attrInfo["HeroID"]
|
| | | npcAttr.LV = attrInfo["LV"]
|
| | | npcAttr.Star = attrInfo["Star"]
|
| | | npcAttr.BreakLV = attrInfo["BreakLV"]
|
| | | npcAttr.AwakeLV = attrInfo["AwakeLV"]
|
| | | npcAttr.AttrMsg = json.dumps(attrInfo["AttrDict"], ensure_ascii=False).replace(" ", "")
|
| | | npcAttr.AttrLen = len(npcAttr.AttrMsg)
|
| | | npcAttrList.append(npcAttr)
|
| | | if not npcAttrList:
|
| | | return
|
| | | clientPack = ChPyNetSendPack.tagSCViewNPCAttrRet()
|
| | | clientPack.MapID = mapID
|
| | | clientPack.FuncLineID = funcLineID
|
| | | clientPack.ViewNPCID = viewNPCID
|
| | | clientPack.NPCAttrList = npcAttrList
|
| | | clientPack.NPCCnt = len(clientPack.NPCAttrList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def SyncTurnFightReport(curPlayer, guid, reprot):
|
| | | ## 通知完整战报
|
| | | clientPack = ChPyNetSendPack.tagSCTurnFightReport()
|