Difference between revisions of "Monster stats/Script"

From Wildermyth Wiki
(Created page with "This is a [https://www.python.org/downloads/ Python] script to generate the monster stat tables. Copy the code in the box below into a text file named '''<nowiki>tables.py...")
 
m
Line 69: Line 69:
   for faction in list(type_paths):
   for faction in list(type_paths):
     string += '{| role="presentation" class="wikitable sortable mw-collapsible mw-collapsed" style="text-align: center"\n'
     string += '{| role="presentation" class="wikitable sortable mw-collapsible mw-collapsed" style="text-align: center"\n'
     string += '| style="width:880px" | ' + "'''%s'''\n"%faction
     string += '| style="width:880px" | ' + ("'''%s'''\n"%faction if faction=='Miscellaneous' else "'''[[%s]]'''\n"%faction)
     string += '|-\n'
     string += '|-\n'
     string += '|\n\n'
     string += '|\n\n'
     string += '{| class="wikitable sortable" style="text-align: center"\n'
     string += '{| class="wikitable sortable" style="text-align: center"\n'
     string += '! ID !! Name !! Health !! Armor !! Warding !! Block + Dodge !! Speed !! Melee Accuracy !! Ranged Accuracy\n'
     string += '! ID !! Name !! [[Health]] !! [[Armor]] !! [[Warding]] !! [[Block]] + [[Dodge]] !! [[Speed]] !! [[Melee Accuracy]] !! [[Ranged Accuracy]]\n'
     for l in type_paths[faction]:
     for l in type_paths[faction]:
       for m in glob(l + '/*.json'):
       for m in glob(l + '/*.json'):
Line 91: Line 91:
           avoid = str(int(block)+int(dodge))
           avoid = str(int(block)+int(dodge))
           string += '|-\n'
           string += '|-\n'
           string += '| <small>' + id + '</small> || ' + name + ' || ' + health + ' || ' + armor + ' || ' + warding + ' || ' + avoid + ' || ' + speed + ' || ' + macc + ' || ' + racc + '\n'
           string += '| <small>' + id + '</small> || [[' + name + ']] || ' + health + ' || ' + armor + ' || ' + warding + ' || ' + avoid + ' || ' + speed + ' || ' + macc + ' || ' + racc + '\n'
        
        
     string += '|}\n\n'
     string += '|}\n\n'

Revision as of 13:23, 16 February 2022

This is a Python script to generate the monster stat tables. Copy the code in the box below into a text file named tables.py (or whatever you want) inside the Wildermyth directory. Then run it by calling python tables.py from the command line. It will create a text file for each difficulty named tables_<difficulty>.txt, full of wiki-formatted tables that can be pasted into the appropriate wiki pages.