Exemple #1
0
def parse_spell_lists(filename, output, book):
	struct = parse_universal(filename, output, book)
	#entity_pass(struct)
	rules, spell_lists = spell_list_structure_pass(struct, os.path.basename(filename))
	spell_lists = spell_list_name_pass(spell_lists)
	for spell_list in spell_lists:
		sl = spell_pass(spell_list)
		print "%s: %s" %(sl['source'], sl['name'])
		filename = create_spell_list_filename(output, book, sl)
		fp = open(filename, 'w')
		json.dump(sl, fp, indent=4)
		fp.close()
	if rules:
		write_rules(output, rules, book, "spell_lists")
Exemple #2
0
def parse_feats(filename, output, book):
	struct = parse_universal(filename, output, book)
	#struct = entity_pass(struct)
	rules, feats = adjust_feat_structure_pass(struct, os.path.basename(filename))

	for feat in feats:
		feat_pass(feat)
		ability_pass(feat)
		section_naming_pass(feat)
		if rules['name'] == 'Monster Feats':
			monster_feat_pass(feat)

	for feat in feats:
		print "%s: %s" %(feat['source'], feat['name'])
		filename = create_feat_filename(output, book, feat)
		fp = open(filename, 'w')
		json.dump(feat, fp, indent=4)
		fp.close()
	if rules:
		write_rules(output, rules, book, "feats")
Exemple #3
0
def parse_spell(filename, output, book):
	struct = parse_universal(filename, output, book, max_title=4)
	struct = stat_block_pass(struct, book)
	struct = heading_pass(struct)
	#struct = entity_pass(struct)
	struct = ability_pass(struct)
	if struct['type'] == 'section':
		if struct.has_key('name'):
			write_rules(output, struct, book, struct['name'])
		else:
			parent_pass_in_file(struct)
			for spell in struct['sections']:
				misc_fix_pass(spell)
				cap_pass(spell)
				write_spell(output, book, spell)
	else:
		parent_pass_out_of_file(struct)
		misc_fix_pass(struct)
		cap_pass(struct)
		write_spell(output, book, struct)
Exemple #4
0
def parse_feats(filename, output, book):
    struct = parse_universal(filename, output, book)
    struct = quote_pass(struct)
    struct = entity_pass(struct)
    rules, feats = adjust_feat_structure_pass(struct, os.path.basename(filename))

    for feat in feats:
        feat_pass(feat)
        ability_pass(feat)
        section_naming_pass(feat)
        prerequisite_pass(feat)
        if rules["name"] == "Monster Feats":
            monster_feat_pass(feat)

    for feat in feats:
        print "%s: %s" % (feat["source"], feat["name"])
        filename = create_feat_filename(output, book, feat)
        fp = open(filename, "w")
        json.dump(feat, fp, indent=4)
        fp.close()
    if rules:
        write_rules(output, rules, book, "feats")