This commit is contained in:
2026-03-06 17:10:02 +08:00
parent 195b48b36b
commit e611911738
+8 -4
View File
@@ -419,7 +419,7 @@ def get_skill_tree_info(encoded: str) -> dict:
className = advInfo['class'] className = advInfo['class']
character = createCharacter(className) character = createCharacter(className)
skillMap = {} skillMap = {}
for i in r['skills']: for index, i in enumerate(r['skills']):
skillIndex = i['skill_index'] skillIndex = i['skill_index']
skillUuids = skill_map.get(str(skillIndex), [None]) skillUuids = skill_map.get(str(skillIndex), [None])
skills = [] skills = []
@@ -428,12 +428,16 @@ def get_skill_tree_info(encoded: str) -> dict:
if skill is not None: if skill is not None:
skills.append(skill) skills.append(skill)
skillMap[skillIndex] = skills skillMap[skillIndex] = skills
if len(skills) == 0:
r['skills'][index] = None
for k, v in skillMap.items(): for k, v in skillMap.items():
if len(v) > 1: if len(v) > 1:
skillMap[k] = [s for s in v if s.learnLv not in [50, 85]] skillMap[k] = [s for s in v if s.learnLv not in [50, 85]]
skillLearn = {} skillLearn = {}
# 处理技能等级 # 处理技能等级
for skill in r['skills']: for skill in r['skills']:
if skill is None:
continue
skillIndex = skill['skill_index'] skillIndex = skill['skill_index']
candidates = skillMap.get(skillIndex, []) candidates = skillMap.get(skillIndex, [])
chosen = None chosen = None
@@ -441,14 +445,13 @@ def get_skill_tree_info(encoded: str) -> dict:
chosen = candidates[0] chosen = candidates[0]
elif len(candidates) > 1: elif len(candidates) > 1:
chosen = next((x for x in candidates if x.type == ('active' if skill['skill_type'] == 1 else 'passive')), None) chosen = next((x for x in candidates if x.type == ('active' if skill['skill_type'] == 1 else 'passive')), None)
if chosen: if chosen and skillLearn.get(str(chosen.id), {'lv': 0})['lv'] < skill['level']:
skillLearn[str(chosen.id)] = { skillLearn[str(chosen.id)] = {
'lv': skill['level'], 'lv': skill['level'],
'up': 0, 'up': 0,
'vp': 0, 'vp': 0,
# 'name': chosen.name, 'name': chosen.name,
} }
# 处理进化 # 处理进化
for evo in r['evolutions']: for evo in r['evolutions']:
for s in skillMap.get(evo['skill_index'], []): for s in skillMap.get(evo['skill_index'], []):
@@ -466,6 +469,7 @@ def get_skill_tree_info(encoded: str) -> dict:
'lv': i.calculate_lv() if (i.learnLv in [50,85] or i.name == '基础精通') and str(i.id) else 0, 'lv': i.calculate_lv() if (i.learnLv in [50,85] or i.name == '基础精通') and str(i.id) else 0,
'up': 0, 'up': 0,
'vp': 0, 'vp': 0,
'name': i.name,
} }
return { return {
"name": header['name'], "name": header['name'],