mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-06-06 04:38:28 +02:00
Merge pull request #96 from Tim-Jackins/master
Adding the second page of the standard character sheet to the generation (WIP)
This commit is contained in:
@@ -144,6 +144,20 @@ class Character(Entity):
|
|||||||
# Character-specific
|
# Character-specific
|
||||||
player_name = ""
|
player_name = ""
|
||||||
xp = 0
|
xp = 0
|
||||||
|
# Hit points
|
||||||
|
hp_max = None
|
||||||
|
hp_current = None
|
||||||
|
hp_temp = None
|
||||||
|
# Base stats (ability scores)
|
||||||
|
strength = Ability()
|
||||||
|
dexterity = Ability()
|
||||||
|
constitution = Ability()
|
||||||
|
intelligence = Ability()
|
||||||
|
wisdom = Ability()
|
||||||
|
charisma = Ability()
|
||||||
|
armor_class = ArmorClass()
|
||||||
|
initiative = Initiative()
|
||||||
|
speed = Speed()
|
||||||
inspiration = False
|
inspiration = False
|
||||||
attacks_and_spellcasting = ""
|
attacks_and_spellcasting = ""
|
||||||
class_list = list()
|
class_list = list()
|
||||||
@@ -159,6 +173,30 @@ class Character(Entity):
|
|||||||
features_and_traits = "Describe any other features and abilities."
|
features_and_traits = "Describe any other features and abilities."
|
||||||
|
|
||||||
_proficiencies_text = list()
|
_proficiencies_text = list()
|
||||||
|
# Magic
|
||||||
|
spellcasting_ability = None
|
||||||
|
_spells = list()
|
||||||
|
_spells_prepared = list()
|
||||||
|
infusions = list()
|
||||||
|
# Features IN MAJOR DEVELOPMENT
|
||||||
|
custom_features = list()
|
||||||
|
feature_choices = list()
|
||||||
|
|
||||||
|
# Appearance
|
||||||
|
# portrait = placeholder not sure how to implement
|
||||||
|
age = 0
|
||||||
|
height = ''
|
||||||
|
weight = ''
|
||||||
|
eyes = ''
|
||||||
|
skin = ''
|
||||||
|
hair = ''
|
||||||
|
# Background
|
||||||
|
allies = ''
|
||||||
|
faction_name = ''
|
||||||
|
# faction_symbol = placeholder not sure how to implement
|
||||||
|
backstory = ''
|
||||||
|
other_feats_traits = ''
|
||||||
|
treasure = ''
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ def create_character_pdf_template(character, basename, flatten=False):
|
|||||||
# Hit points
|
# Hit points
|
||||||
"HDTotal": character.hit_dice,
|
"HDTotal": character.hit_dice,
|
||||||
"HPMax": str(character.hp_max),
|
"HPMax": str(character.hp_max),
|
||||||
|
"HPCurrent": str(character.hp_current),
|
||||||
|
"HPTemp": str(character.hp_temp),
|
||||||
# Personality traits and other features
|
# Personality traits and other features
|
||||||
"PersonalityTraits ": text_box(character.personality_traits),
|
"PersonalityTraits ": text_box(character.personality_traits),
|
||||||
"Ideals": text_box(character.ideals),
|
"Ideals": text_box(character.ideals),
|
||||||
@@ -172,6 +174,30 @@ def create_character_pdf_template(character, basename, flatten=False):
|
|||||||
return make_pdf(fields, src_pdf=src_pdf, basename=basename, flatten=flatten)
|
return make_pdf(fields, src_pdf=src_pdf, basename=basename, flatten=flatten)
|
||||||
|
|
||||||
|
|
||||||
|
def create_personality_pdf_template(character, basename, flatten=False):
|
||||||
|
# Prepare the list of fields
|
||||||
|
fields = {
|
||||||
|
"CharacterName 2": character.name,
|
||||||
|
"Age": str(character.age),
|
||||||
|
"Height": character.height,
|
||||||
|
"Weight": character.weight,
|
||||||
|
"Eyes": character.eyes,
|
||||||
|
"Skin": character.skin,
|
||||||
|
"Hair": character.hair,
|
||||||
|
# "CHARACTER IMAGE": None
|
||||||
|
# "Faction Symbol Image": None
|
||||||
|
"Allies": text_box(character.allies),
|
||||||
|
"FactionName": character.faction_name,
|
||||||
|
"Backstory": text_box(character.backstory),
|
||||||
|
"Feat+Traits": text_box(character.other_feats_traits),
|
||||||
|
"Treasure": text_box(character.treasure)
|
||||||
|
}
|
||||||
|
# Prepare the actual PDF
|
||||||
|
dirname = os.path.join(os.path.dirname(os.path.abspath(__file__)), "forms/")
|
||||||
|
src_pdf = os.path.join(dirname, "blank-personality-sheet-default.pdf")
|
||||||
|
return make_pdf(fields, src_pdf=src_pdf, basename=basename, flatten=flatten)
|
||||||
|
|
||||||
|
|
||||||
def create_spells_pdf_template(character, basename, flatten=False):
|
def create_spells_pdf_template(character, basename, flatten=False):
|
||||||
classes_and_levels = " / ".join(
|
classes_and_levels = " / ".join(
|
||||||
[c.name + " " + str(c.level) for c in character.spellcasting_classes]
|
[c.name + " " + str(c.level) for c in character.spellcasting_classes]
|
||||||
|
|||||||
Binary file not shown.
@@ -17,6 +17,7 @@ from dungeonsheets import character as _char, exceptions, readers, latex, monste
|
|||||||
from dungeonsheets.stats import mod_str, findattr
|
from dungeonsheets.stats import mod_str, findattr
|
||||||
from dungeonsheets.fill_pdf_template import (
|
from dungeonsheets.fill_pdf_template import (
|
||||||
create_character_pdf_template,
|
create_character_pdf_template,
|
||||||
|
create_personality_pdf_template,
|
||||||
create_spells_pdf_template,
|
create_spells_pdf_template,
|
||||||
)
|
)
|
||||||
from dungeonsheets.character import Character
|
from dungeonsheets.character import Character
|
||||||
@@ -283,9 +284,9 @@ def make_character_sheet(
|
|||||||
character_props = readers.read_sheet_file(char_file)
|
character_props = readers.read_sheet_file(char_file)
|
||||||
character = _char.Character.load(character_props)
|
character = _char.Character.load(character_props)
|
||||||
# Set the fields in the FDF
|
# Set the fields in the FDF
|
||||||
basename = char_file.stem
|
char_base = os.path.splitext(character_file)[0] + "_char"
|
||||||
char_base = basename + "_char"
|
person_base = os.path.splitext(character_file)[0] + "_person"
|
||||||
sheets = [char_base + ".pdf"]
|
sheets = [char_base + ".pdf", person_base + ".pdf"]
|
||||||
pages = []
|
pages = []
|
||||||
tex = [
|
tex = [
|
||||||
jinja_env.get_template("preamble.tex").render(
|
jinja_env.get_template("preamble.tex").render(
|
||||||
@@ -299,6 +300,10 @@ def make_character_sheet(
|
|||||||
character=character, basename=char_base, flatten=flatten
|
character=character, basename=char_base, flatten=flatten
|
||||||
)
|
)
|
||||||
pages.append(char_pdf)
|
pages.append(char_pdf)
|
||||||
|
person_pdf = create_personality_pdf_template(
|
||||||
|
character=character, basename=person_base, flatten=flatten
|
||||||
|
)
|
||||||
|
pages.append(person_pdf)
|
||||||
if character.is_spellcaster:
|
if character.is_spellcaster:
|
||||||
# Create spell sheet
|
# Create spell sheet
|
||||||
spell_base = "{:s}_spells".format(basename)
|
spell_base = "{:s}_spells".format(basename)
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ alignment = "Lawful good"
|
|||||||
|
|
||||||
xp = 0
|
xp = 0
|
||||||
hp_max = 105
|
hp_max = 105
|
||||||
|
hp_current = 92
|
||||||
|
hp_temp = 0
|
||||||
inspiration = 0 # integer inspiration value
|
inspiration = 0 # integer inspiration value
|
||||||
|
|
||||||
# Ability Scores
|
# Ability Scores
|
||||||
@@ -107,3 +109,17 @@ flaws = """TODO: Describe your characters interesting flaws.
|
|||||||
|
|
||||||
features_and_traits = """TODO: Describe other features and abilities your
|
features_and_traits = """TODO: Describe other features and abilities your
|
||||||
character has."""
|
character has."""
|
||||||
|
|
||||||
|
age = 22
|
||||||
|
height = "3'11\""
|
||||||
|
weight = "47lb"
|
||||||
|
eyes = "Brown"
|
||||||
|
skin = "White tan"
|
||||||
|
hair = "Short and brown"
|
||||||
|
# Background
|
||||||
|
allies = """TODO: List what allies your character has."""
|
||||||
|
faction_name = "TODO: Name of your faction"
|
||||||
|
# faction_symbol = placeholder not sure how to implement
|
||||||
|
backstory = """TODO: Describe your character's backstory"""
|
||||||
|
other_feats_traits = """TODO: Describe your character's other feats and traits"""
|
||||||
|
treasure = """TODO: Describe what treasures you character owns."""
|
||||||
|
|||||||
Reference in New Issue
Block a user