10
editsMore actions
User:Sairon/Python example for working with .lsx (edit)
Revision as of 22:50, 7 September 2023
, 7 September 2023no edit summary
mNo edit summary |
mNo edit summary |
||
Line 42: | Line 42: | ||
xp = '//node[@id="Progression" and attribute[@id="ProgressionType" and @value="0"] and attribute[@id="Name" and ( @value="MulticlassSpellSlots" or '+' or '.join( '@value="'+x+'"' for x in (x.xpath('attribute[@id="Name"]')[0].attrib['value'] for x in base_classes) )+ ' ) ] ]' | xp = '//node[@id="Progression" and attribute[@id="ProgressionType" and @value="0"] and attribute[@id="Name" and ( @value="MulticlassSpellSlots" or '+' or '.join( '@value="'+x+'"' for x in (x.xpath('attribute[@id="Name"]')[0].attrib['value'] for x in base_classes) )+ ' ) ] ]' | ||
nodes_base_classes = [ copy.deepcopy(x) for x in run_xpath_group( xp, progressions ) ] | nodes_base_classes = [ copy.deepcopy(x) for x in run_xpath_group( xp, progressions ) ] | ||
# Copy the last levels & change their level to 13, this | # Copy the last levels & change their level to 13, this acts a sort of sentinel to make sure that it's possible to level up even if you're already level 12 in a class & have increased the max level | ||
level_13s = [ copy.deepcopy(x) for x in filter( lambda x: x.xpath('attribute[@id="Level" and @value="12"]'), nodes_base_classes) ] | level_13s = [ copy.deepcopy(x) for x in filter( lambda x: x.xpath('attribute[@id="Level" and @value="12"]'), nodes_base_classes) ] | ||
for node in level_13s: | for node in level_13s: |