Files
aoe2-flashcard-creator/decks/research-costs.py
Nate Bowman 82ce8590b1 Add more data
Also renamed some of the files and had to change some code to account
for the new names.
2026-10-14 19:07:16 -04:00

39 lines
1.1 KiB
Python

from flashcards.decks import create_deck
from flashcards.maps import create_maps, read_name_data_to_dict
# your choice of deck name and filename
deck_name = 'Research Costs'
deck_fname = 'research-costs'
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'research-standard.txt'
# key into json file specifying which data you want
# uncomment either 'units_buildings' or 'techs'
#name_json_key = 'units_buildings'
name_json_key = 'techs'
# --- create list of notes ---
# read in data
data = read_name_data_to_dict(name_json_key)
# create maps between names and numbers based on namelist
names, _ = create_maps(namelist, name_json_key)
# create cards based on data and maps
notes = []
for num, name in names.items():
cost = data[num]['cost']
back = '\n'.join([f'{res}: {val}' for res, val in cost.items()
if val != 0])
notes.append((name, back))
#print(f'front: {name}\tback: {back}')
# write deck to .apkg file
deck = create_deck(notes, deck_name, deck_fname)