Ejemplo n.º 1
0
def main():
    runic_skills = replace_with_runic_font()
    path_directory_new_profiles = Path.cwd() / r'output'
    os.makedirs(path_directory_new_profiles, exist_ok=True)
    for number in range(1, 11, 1):
        unique_skills = random.sample(runic_skills, 3)
        context_profile = create_profile(unique_skills)
        file_operations.render_template('src/template.svg', 'output/charsheet-{}.svg'.format(number), context_profile)
Ejemplo n.º 2
0
def main():
    charsheet_foldername = 'charsheets'
    charsheets_num = 10
    min_skill_value = 8
    max_skill_value = 14
    template_filepath = 'charsheet.svg'
    skills = [
        'Стремительный прыжок', 'Электрический выстрел', 'Ледяной удар',
        'Стремительный удар', 'Кислотный взгляд', 'Тайный побег',
        'Ледяной выстрел', 'Огненный заряд'
    ]
    runic_skills = [make_runic(skill) for skill in skills]
    fake = Faker("ru_RU")
    for num in range(1, charsheets_num + 1):
        skill_1, skill_2, skill_3 = sample(runic_skills, k=3)
        male_char = {
            'first_name': fake.first_name_male(),
            'last_name': fake.last_name_male(),
        }
        female_char = {
            'first_name': fake.first_name_female(),
            'last_name': fake.last_name_female(),
        }
        character = choice(male_char, female_char)
        character.update({
            'town':
            fake.city(),
            'job':
            fake.job(),
            'strength':
            randint(min_skill_value, max_skill_value),
            'agility':
            randint(min_skill_value, max_skill_value),
            'endurance':
            randint(min_skill_value, max_skill_value),
            'intelligence':
            randint(min_skill_value, max_skill_value),
            'luck':
            randint(min_skill_value, max_skill_value),
            'skill_1':
            skill_1,
            'skill_2':
            skill_2,
            'skill_3':
            skill_3
        })
        charsheet_filename = os.path.join(charsheet_foldername,
                                          f'charsheet_{num}.svg')
        render_template(template_filepath, charsheet_filename, character)
Ejemplo n.º 3
0
def generate_questionnaire(skills_list, lower_limit_level, upper_limit_level, skills_names, example_filepath,
                           result_filepath):
    fake = Faker("ru_RU")

    first_name, last_name = random.choice([
        [fake.first_name_male(), fake.last_name_male()],
        [fake.first_name_female(), fake.last_name_female()],
    ])

    context = {
        'first_name': first_name,
        'last_name': last_name,
        'job': fake.job(),
        'town': fake.city()
    }

    for skill in skills_names:
        context[skill] = random.randint(lower_limit_level, upper_limit_level)

    for skill_number, skill in enumerate(skills_list):
        context['skill_{}'.format(skill_number + 1)] = skill

    file_operations.render_template(example_filepath, result_filepath, context)
Ejemplo n.º 4
0
    ]

    makedirs('result', exist_ok=True)

    for counter in range(1, TOTAL_PERSONS + 1):
        fake = Faker("ru_RU")

        skill_1, skill_2, skill_3 = sample(runic_skills, 3)

        person = {
            "first_name": fake.first_name(),
            "last_name": fake.last_name(),
            "job": fake.job(),
            "town": fake.city(),

            "strength": randint(MIN_POINTS, MAX_POINTS),
            "agility": randint(MIN_POINTS, MAX_POINTS),
            "endurance": randint(MIN_POINTS, MAX_POINTS),
            "intelligence": randint(MIN_POINTS, MAX_POINTS),
            "luck": randint(MIN_POINTS, MAX_POINTS),

            "skill_1": skill_1,
            "skill_2": skill_2,
            "skill_3": skill_3,
        }

        render_template(
            "templates/charsheet.svg",
            f"result/person_{counter:04d}.svg", person
        )
Ejemplo n.º 5
0
    name = names_list[1]
    last_name = names_list[0]

    three_random_skills = random.sample(SKILLS, 3)
    runic_skills = []

    for skill in three_random_skills:
        runic_skill = []
        for letter in skill:
            runic_skill.append(ABC[letter])
        runic_skills.append(''.join(runic_skill))

    context = {
        "first_name": name,
        "last_name": last_name,
        "job": FAKE.job(),
        "town": FAKE.city(),
        "strength": random.randint(MIN_RANDOM, MAX_RANDOM),
        "agility": random.randint(MIN_RANDOM, MAX_RANDOM),
        "endurance": random.randint(MIN_RANDOM, MAX_RANDOM),
        "intelligence": random.randint(MIN_RANDOM, MAX_RANDOM),
        "luck": random.randint(MIN_RANDOM, MAX_RANDOM),
        "skill_1": ''.join(runic_skills[0]),
        "skill_2": ''.join(runic_skills[1]),
        "skill_3": ''.join(runic_skills[2])
    }

    file_operations.render_template("charsheet.svg",
                                    "RESULTS/charsheet-{}.svg".format(person),
                                    context)
Ejemplo n.º 6
0
            "job":
            fake.job(),
            "town":
            fake.city(),
            "strength":
            random.randint(min_characteristics_value,
                           max_characteristics_value),
            "agility":
            random.randint(min_characteristics_value,
                           max_characteristics_value),
            "endurance":
            random.randint(min_characteristics_value,
                           max_characteristics_value),
            "intelligence":
            random.randint(min_characteristics_value,
                           max_characteristics_value),
            "luck":
            random.randint(min_characteristics_value,
                           max_characteristics_value),
            "skill_1":
            first_skill,
            "skill_2":
            second_skill,
            "skill_3":
            third_skill,
        }
        file_operations.render_template(
            "charsheet.svg",
            "questionnaires/questionnaire{}.svg".format(questionnaire_number),
            context)
Ejemplo n.º 7
0
def get_character_form(form_filename, character_data):
    render_template(TEMPLATE_FILE, form_filename, character_data)
Ejemplo n.º 8
0
        first_name, last_name, city, specialization = get_hero_description()

        random_skills = random.sample(skills, number_of_random_skills)

        runic_skills = []

        for skill in random_skills:
            runic_skill = replace_to_old_alfabet(skill)
            runic_skills.append(runic_skill)

        context = {
            "name": first_name,
            "surname": last_name,
            "city": city,
            "specialization": specialization,
            "strength": random.randint(power_from, power_to),
            "dexterity": random.randint(power_from, power_to),
            "precision": random.randint(power_from, power_to),
            "endurance": random.randint(power_from, power_to),
            "mana": random.randint(power_from, power_to),
            "luck": random.randint(power_from, power_to),
            "oratory": random.randint(power_from, power_to),
            "first_skill": runic_skills[0],  # index uses due to random choice
            "second_skill": runic_skills[1],
            "third_skill": runic_skills[2],
        }

        filename = f'charsheet-{profile}.svg'
        filename = os.path.join(abspath, filename)
        file_operations.render_template("template.txt", filename, context)
Ejemplo n.º 9
0
}

fake = Faker("ru_RU")
runic_skills = []

for skill in skills:
    runic_skill = ''
    for char in skill:
        runic_skill += letters_mapping[char]
    runic_skills.append(runic_skill)

for i in range(10):
    three_runic_skills = sample(runic_skills, k=3)
    context = {
        "first_name": fake.first_name_male(),
        "last_name": fake.last_name_male(),
        "job": fake.job(),
        "town": fake.city(),
        "strength": randint(8, 14),
        "agility": randint(8, 14),
        "endurance": randint(8, 14),
        "intelligence": randint(8, 14),
        "luck": randint(8, 14),
        "skill_1": three_runic_skills[0],
        "skill_2": three_runic_skills[1],
        "skill_3": three_runic_skills[2]
    }
    file_operations.render_template("profiles/charsheet-{}.svg",
                                    "profiles/result-{}.svg".format(i),
                                    context)
Ejemplo n.º 10
0
skills = [
    'Стремительный прыжок', 'Электрический выстрел', 'Ледяной удар',
    'Стремительный удар', 'Кислотный взгляд', 'Тайный побег',
    'Ледяной выстрел', 'Огненный заряд'
]

runic_skills = []
for skill in skills:
    for orig, repl in rune_abc.items():
        skill = skill.replace(orig, repl)
    runic_skills.append(skill)

for sheet in range(0, number_of_sheets):
    skill_list = sample(runic_skills, 3)
    context = {
        'first_name': fake.first_name_male(),
        'last_name': fake.last_name_male(),
        'job': fake.job(),
        'town': fake.city(),
        'strength': randint(min_ability, max_ability),
        'agility': randint(min_ability, max_ability),
        'endurance': randint(min_ability, max_ability),
        'intelligence': randint(min_ability, max_ability),
        'luck': randint(min_ability, max_ability),
        'skill_1': skill_list[0],
        'skill_2': skill_list[1],
        'skill_3': skill_list[2]
    }

    file_operations.render_template(
        'charsheet.svg', 'charsheets/charsheet-{}.svg'.format(sheet), context)
Ejemplo n.º 11
0
runic_skills = []

for skill in skills:
    for letter_skill in skill:
        skill = skill.replace(letter_skill, runic_letters[letter_skill])
    runic_skills.append(skill)

for number in range(10):
    three_unique_skills = random.sample(runic_skills, 3)

    context = {
        'first_name': fake.first_name_male(),
        'last_name': fake.last_name_male(),
        'town': fake.city(),
        'job': fake.job(),
        'strength': random.randint(min_characterization, max_characterization),
        'agility': random.randint(min_characterization, max_characterization),
        'endurance': random.randint(min_characterization,
                                    max_characterization),
        'intelligence': random.randint(min_characterization,
                                       max_characterization),
        'luck': random.randint(min_characterization, max_characterization),
        'skill_1': three_unique_skills[0],
        'skill_2': three_unique_skills[1],
        'skill_3': three_unique_skills[2]
    }

    file_operations.render_template(
        "charsheet.svg", "result/charsheet-{}.svg".format(number + 1), context)
Ejemplo n.º 12
0
    "max_lvl": 14
}
count_of_monstres = 10
count_of_skills = 3

skills = []
with open('skills.txt') as file:
  for skill in file:
    for letter in skill:
      if letter in runic_letters:
        skill = skill.replace(letter, runic_letters[letter])
    skills.append(skill)

for number in range(count_of_monstres):
  monstr_skills = random.sample(skills, count_of_skills)
  context = {
    "first_name": fake.first_name_male(),
    "last_name": fake.last_name_male(),
    "town": fake.city(),
    "job": fake.job(),
    "strength": random.randint(ability['min_lvl'], ability['max_lvl']),
    "agility": random.randint(ability['min_lvl'], ability['max_lvl']),
    "endurance": random.randint(ability['min_lvl'], ability['max_lvl']),
    "intelligence": random.randint(ability['min_lvl'], ability['max_lvl']),
    "luck": random.randint(ability['min_lvl'], ability['max_lvl']),
    "skill_1": monstr_skills[0],
    "skill_2": monstr_skills[1],
    "skill_3": monstr_skills[2]
    }
  file_operations.render_template("template/charsheet.svg", f'monstres/charsheet-{number}.svg', context)
Ejemplo n.º 13
0
person_amount = 10
min_ability_value = 8
max_ability_value = 14
for person in range(person_amount):
    random_skills = random.sample(runic_skills, 3)
    male_name = [fake.first_name_male(), fake.last_name_male()]
    female_name = [fake.first_name_female(), fake.last_name_female()]
    names = [male_name, female_name]
    random_name = random.choice(names)
    first_name = random_name[0]
    last_name = random_name[1]
    context = {
        "first_name": first_name,
        "last_name": last_name,
        "job": fake.job(),
        "town": fake.city(),
        "strength": random.randint(min_ability_value, max_ability_value),
        "agility": random.randint(min_ability_value, max_ability_value),
        "endurance": random.randint(min_ability_value, max_ability_value),
        "intelligence": random.randint(min_ability_value, max_ability_value),
        "luck": random.randint(min_ability_value, max_ability_value),
        "skill_1": random_skills[0],
        "skill_2": random_skills[1],
        "skill_3": random_skills[2]
    }

    file_operations.render_template(
        "templates/charsheet.svg",
        "output/svg/charsheet_{}.svg".format(person + 1), context)
Ejemplo n.º 14
0
        'П': 'П̋͠',
        'Р': 'Р̋͠',
        'С': 'С͒',
        'Т': 'Т͒',
        'У': 'У͒͠',
        'Ф': 'Ф̋̋͠',
        'Х': 'Х͒͠',
        'Ц': 'Ц̋',
        'Ч': 'Ч̋͠',
        'Ш': 'Ш͒͠',
        'Щ': 'Щ̋',
        'Ъ': 'Ъ̋͠',
        'Ы': 'Ы̋͠',
        'Ь': 'Ь̋',
        'Э': 'Э͒͠͠',
        'Ю': 'Ю̋͠',
        'Я': 'Я̋',
        ' ': ' '
    }

    for letter in phrase:
        phrase = phrase.replace(letter, runic_letters[letter])

    return phrase


for card in range(number_of_cards):
    file_operations.render_template("charsheet.svg",
                                    "charsheets/charsheet-{}.svg".format(card),
                                    generate_template())
Ejemplo n.º 15
0
max_grade = 14
runic_skills = []
forms_total_nunber = 10

for skill in skills:
    for letter in skill:
        skill = skill.replace(letter, runic_alphabet[letter])
    runic_skills.append(skill)

for number in range(1, forms_total_nunber, +1):
    skills_for_hero = random.sample(runic_skills, number_of_skills_in_form)
    skill_1, skill_2, skill_3 = skills_for_hero

    context = {
        'first_name': fake.first_name(),
        'last_name': fake.last_name(),
        'job': fake.job(),
        'town': fake.city(),
        'strength': random.randint(min_grade, max_grade),
        'agility': random.randint(min_grade, max_grade),
        'endurance': random.randint(min_grade, max_grade),
        'intelligence': random.randint(min_grade, max_grade),
        'luck': random.randint(min_grade, max_grade),
        'skill_1': skill_1,
        'skill_2': skill_2,
        'skill_3': skill_3
    }
    file_operations.render_template('src/charsheet.svg',
                                    f'output/monsters_form_{number}.svg',
                                    context)
Ejemplo n.º 16
0
def rand_abilities(dictionary, *abilities):
    for ability in abilities:
        dictionary[ability] = random.randint(8, 14)


for charsheet in range(10):
    runic_skills = []
    context = {
        "first_name": fake.first_name(),
        "last_name": fake.last_name(),
        "job": fake.job(),
        "town": fake.city()
    }

    rand_abilities(context, "strength", "agility", "endurance", "intelligence",
                   "luck")

    npc_skills = random.sample(skills, 3)

    for skill_number, skill in enumerate(npc_skills):
        skill_word = []
        for letter in npc_skills[skill_number]:
            skill_word.append(runic_letters[letter])
        runic_skills.append(''.join(skill_word))
        context['skill_{}'.format(skill_number +
                                  1)] = runic_skills[skill_number]

    file_operations.render_template(
        "charsheet.svg", "charsheet/charsheet-{}.svg".format(charsheet),
        context)
Ejemplo n.º 17
0
        "agility": get_random_number(),
        "endurance": get_random_number(),
        "intelligence": get_random_number(),
        "luck": get_random_number(),
        "skill_1": skill_1,
        "skill_2": skill_2,
        "skill_3": skill_3
    }
    return hero_data


def get_output_directory():
    parser = argparse.ArgumentParser()
    parser.add_argument("output", help="output directory path for generated files")
    return parser.parse_args().output


if __name__ == '__main__':
    output_dir = get_output_directory()
    if not os.path.exists(output_dir):
        os.makedirs(output_dir)
    fake = Faker("ru_RU")
    runic_skills = get_runic_skills(SKILLS, LETTERS_MAPPING)
    for num in range(10):
        hero = generate_hero(runic_skills, fake)
        output_file_name = os.path.join(output_dir, f"hero{num}.svg")
        file_operations.render_template("src/template.svg", output_file_name, hero)