Auto-detect .py characters and added class ability proficiencies.

This commit is contained in:
Mark Wolfman
2018-03-27 13:27:32 -05:00
parent b1dedaddb2
commit 2790296a7c
3 changed files with 22 additions and 3 deletions
+11
View File
@@ -110,36 +110,43 @@ class Barbarian(Character):
class Bard(Character):
class_name = 'Bard'
hit_dice_faces = 8
saving_throw_proficiencies = ['dexterity', 'charisma']
class Cleric(Character):
class_name = 'Cleric'
hit_dice_faces = 8
saving_throw_proficiencies = ['wisdom', 'charisma']
class Druid(Character):
class_name = 'Druid'
hit_dice_faces = 8
saving_throw_proficiencies = ['intelligence', 'wisdom']
class Fighter(Character):
class_name = 'Fighter'
hit_dice_faces = 10
saving_throw_proficiencies = ['strength', 'constitution']
class Monk(Character):
class_name = 'Monk'
hit_dice_faces = 8
saving_throw_proficiencies = ['strength', 'dexterity']
class Paladin(Character):
class_name = 'Paladin'
hit_dice_faces = 10
saving_throw_proficiencies = ['wisdom', 'charisma']
class Ranger(Character):
class_name = 'Ranger'
hit_dice_faces = 10
saving_throw_proficiencies = ['strength', 'dexterity']
class Rogue(Character):
@@ -151,12 +158,16 @@ class Rogue(Character):
class Sorceror(Character):
class_name = 'Sorceror'
hit_dice_faces = 6
saving_throw_proficiencies = ['constitution', 'charisma']
class Warlock(Character):
class_name = 'Warlock'
hit_dice_faces = 8
saving_throw_proficiencies = ['wisdom', 'charisma']
class Wizard(Character):
class_name = 'Wizard'
hit_dice_faces = 6
saving_throw_proficiencies = ['intelligence', 'wisdom']
+11 -3
View File
@@ -21,6 +21,7 @@ def text_box(string):
new_string = ' '.join(new_string.split())
return new_string
def load_character_file(filename):
"""Create a character object from the given definition file.
@@ -196,11 +197,18 @@ def main():
# Prepare an argument parser
parser = argparse.ArgumentParser(
description='Prepare Dungeons and Dragons character sheets as PDFs')
parser.add_argument('filename', type=str, help="Python file with character definition")
parser.add_argument('filename', type=str, nargs="?", help="Python file with character definition")
parser.add_argument('--flatten', '-F', action="store_true", help="Remove the PDF fields once processed.")
args = parser.parse_args()
# Process the requested file
make_sheet(character_file=args.filename, flatten=args.flatten)
# Process the requested files
if args.filename is None:
filenames = [f for f in os.listdir('.') if os.path.splitext(f)[1] == '.py']
else:
filenames = [args.filename]
for filename in filenames:
print(f"Processing {os.path.splitext(filename)[0]}...", end='')
make_sheet(character_file=filename, flatten=args.flatten)
print("done")
if __name__ == '__main__':
Binary file not shown.