Skip to content

Latest commit

 

History

History
1112 lines (707 loc) · 22.5 KB

File metadata and controls

1112 lines (707 loc) · 22.5 KB

Table of Contents

text_printer

A module for printing text to the console.

TextPrinter Objects

class TextPrinter()

A class to print text to the console.

__init__

def __init__() -> None

Initialize the TextPrinter.

update_text_to_print

def update_text_to_print(text: str) -> None

Print the text.

split_string

def split_string(string: str) -> str

Split the string.

header

def header(title: str) -> None

Print the header.

subheader

def subheader(title: str) -> None

Print the subheader.

bolded

def bolded(text: str) -> None

Print the text in bold.

list_to_dict

def list_to_dict(list_object: list) -> dict

Convert a list to a dictionary.

sort_dict

def sort_dict(dict_object: dict) -> dict

Sort the dictionary.

print_data

def print_data(data: list | dict, title: str) -> None

Print the dictionary.

print_single_value

def print_single_value(value: int | str, title: str) -> None

Print a single value.

print_dict_with_modifiers

def print_dict_with_modifiers(data: dict, title: str) -> None

Print the dictionary with modifiers.

print_dict_with_data_and_modifiers

def print_dict_with_data_and_modifiers(data: dict, title: str) -> None

Print the dictionary with data and modifiers.

print_modifiers

def print_modifiers(value: int) -> str

Print the modifiers of the value.

print_character

def print_character(character: Character) -> str

Print the character.

print_basic_stats

def print_basic_stats(character: Character) -> str

Print the basic stats.

print_race_info

def print_race_info(race_name: str) -> str

Print the list of races.

print_class_info

def print_class_info(class_name: str) -> str

Print the list of classes.

print_roll

def print_roll(num_dice: int, num_sides: int, modifier: int) -> str

Print the roll of the dice.

db

A module for the database connection.

DB Objects

class DB()

A class to represent a database connection.

__init__

def __init__() -> None

Initialize the database connection.

__del__

def __del__() -> None

Close the database connection when the object is destroyed.

insert_character

def insert_character(name: str, race: str, dnd_class: str, stats: dict) -> int

Insert a character into the database.

insert_into_table

def insert_into_table(sql: str, data: list) -> int

Insert into a table.

read_from_table

def read_from_table(sql: str) -> list[list]

Read data from the db.

load_character_list

def load_character_list() -> list[list]

Load the character list.

load_character

def load_character(char_id: int) -> dict

Load a character from the database.

character_class

A module to represent a class in Dungeons and Dragons.

CharacterClass Objects

class CharacterClass()

A class to represent a class in Dungeons and Dragons.

__init__

def __init__(name: str) -> None

Initialize the class.

get_hit_die

def get_hit_die() -> dict

Get the hit die of the class.

get_primary_stat

def get_primary_stat() -> list

Get the primary stat of the class.

get_worst_stat

def get_worst_stat() -> dict

Get the worst stat of the class.

get_saving_throw_proficiencies

def get_saving_throw_proficiencies() -> dict

Get the saving throws of the class.

get_skill_proficiencies

def get_skill_proficiencies() -> dict

Get the skills of the class.

get_all_classes

@staticmethod
def get_all_classes() -> list

Get all classes.

sheet_generator

A module for generating a character sheet key_pairs.

SheetGenerator Objects

class SheetGenerator()

A class to generate a character sheet.

__init__

def __init__(character: Character) -> None

Initialize the SheetGenerator.

generate_key_pairs

def generate_key_pairs() -> dict

Generate all key pairs for the character sheet.

generate_basic_key_pairs

def generate_basic_key_pairs() -> dict

Generate basic key pairs for the character sheet.

generate_stat_key_pairs

def generate_stat_key_pairs() -> dict

Generate stat key pairs for the character sheet.

generate_saving_throw_key_pairs

def generate_saving_throw_key_pairs() -> dict

Generate saving throw key pairs for the character sheet.

generate_skill_key_pairs

def generate_skill_key_pairs() -> dict

Generate skill key pairs for the character sheet.

generate_skill_prof_key_pairs

def generate_skill_prof_key_pairs() -> dict

Generate key pairs for the character sheet.

generate_saving_throw_prof_key_pairs

def generate_saving_throw_prof_key_pairs() -> dict

Generate key pairs for the character sheet.

get_stat_modifier

def get_stat_modifier(stat: str) -> int

Get the modifier of the stat.

get_skill_modifier

def get_skill_modifier(skill: str) -> int

Get the modifier of the skill.

get_saving_throw_modifier

def get_saving_throw_modifier(save: str) -> int

Get the modifier of the saving throw.

check_skill_proficiency

def check_skill_proficiency(skill: str) -> bool

Check if the character is proficient in the skill.

check_save_proficiency

def check_save_proficiency(save: str) -> bool

Check if the character is proficient in the save.

list_to_textarea_string

def list_to_textarea_string(data: list) -> str

Convert a list to a string.

race

A module for representing a race in Dungeons and Dragons.

Race Objects

class Race()

A class to represent a race in Dungeons and Dragons.

__init__

def __init__(name: str) -> None

Initialize the race.

get_race_bonus_stat

def get_race_bonus_stat() -> dict

Get the bonus stats of the Race.

get_race_speed

def get_race_speed() -> int

Get the speed of the Race.

get_race_languages

def get_race_languages() -> list

Get the languages of the Race.

get_race_traits

def get_race_traits() -> list

Get the traits of the Race.

get_all_races

@staticmethod
def get_all_races() -> list

Get a list of all the Dungeons and Dragons races.

__init__

A module to initialize the application.

dice

A module to represent a dice roll.

Dice Objects

class Dice()

A class to represent a dice roll.

__init__

def __init__(num_dice: int, num_sides: int, modifier: int) -> None

Initialize the dice roll.

roll

def roll() -> None

Roll the dice and return the total.

roll_stat

def roll_stat() -> int

Roll a single stat.

roll_stats

def roll_stats() -> list

Roll the stats for the character.

page_loader

A module to load html pages.

PageLoader Objects

class PageLoader()

A class to load html pages.

__init__

def __init__() -> None

Initialize the page loader.

load_left_right_page

def load_left_right_page(left_content: str = "",
                         right_content: str = "",
                         subtitle: str = "") -> str

Load the page.

load_left_only_page

def load_left_only_page(left_content: str = "",
                        subtitle: str = "",
                        styles: list | None = None,
                        scripts: list | None = None) -> str

Load the page.

display_char

def display_char(char: Character) -> str

Display the character sheet.

load_roll

def load_roll(args: dict) -> str

Load the roll page.

load_races

def load_races(args: dict) -> str

Load the races page.

load_classes

def load_classes(args: dict) -> str

Load the classes page.

load_table

def load_table() -> str

Load the table page.

left_right_dance

def left_right_dance(submit: str | None, left_content: str, right_content: str,
                     subtitle: str) -> str

Load the left right page.

load_create_character

def load_create_character(args: dict) -> str

Load the sheet page.

load_old_character

def load_old_character(char_id: int) -> Character

Load the sheet page.

load_old_character_sheet

def load_old_character_sheet(args: dict) -> str

Load the sheet page.

build_script_string

def build_script_string(script_list: list) -> str

Build a string of script tags.

build_styles_string

def build_styles_string(styles_list: list) -> str

Build a string of style tags.

character

A module to represent a character in Dungeons and Dragons.

Character Objects

class Character()

A class to represent a character in Dungeons and Dragons.

__init__

def __init__() -> None

Initialize the character.

new_character

def new_character(name: str,
                  race: str,
                  dnd_class: str,
                  stats: dict[str, int] | None = None) -> None

Create a new character.

store_character_in_db

def store_character_in_db() -> None

Create the character in the database.

find_modifier_stat

def find_modifier_stat(stat: str) -> int

Find the modifier for a given stat.

find_modifier_value

@staticmethod
def find_modifier_value(value: int) -> int

Find the modifier for a given value.

update_race_details

def update_race_details() -> None

Update the character based on the race.

update_class_details

def update_class_details() -> None

Update the character based on the class.

update_skills

def update_skills() -> None

Update the skills based on the stats.

update_ac

def update_ac() -> None

Update the AC based on the stats.

update_initiative

def update_initiative() -> None

Update the initiative based on the stats.

update_hp

def update_hp() -> None

Update the HP based on the stats.

update_passive_perception

def update_passive_perception() -> None

Update the passive perception based on the stats.

roll_stats

def roll_stats(primary_stat: list, worst_stat: list) -> None

Roll the stats for the character.

update_skill_for_stat

def update_skill_for_stat(stat: str, skill_list: list) -> None

Update the skill based on the stat.

load_character_from_db

def load_character_from_db(char_id: int) -> None

Load the character from the database.

roll_check

def roll_check(check_type: str, check: str = "") -> int

Roll a check based on type.