def parse_class(cl, book): cl = stat_block_pass(cl, book) cl = class_pass(cl) cl = domain_pass(cl) cl = bloodline_pass(cl) cl = arcane_school_pass(cl) cl = ability_pass(cl) cl = ranger_pass(cl) cl = quote_pass(cl) cl = mark_subtype_pass(cl, "Discovery", "ability", "alchemist_discovery") cl = mark_subtype_pass(cl, "Rage Powers", "ability", "barbarian_rage_power") cl = mark_subtype_pass(cl, "Bardic Performance", "section", "bardic_performance") cl = mark_subtype_pass(cl, "Deeds", "section", "gunslinger_deed") cl = mark_subtype_pass(cl, "Magus Arcana", "section", "magus_arcana") cl = mark_subtype_pass(cl, "Ninja Tricks", "section", "ninja_trick") cl = mark_subtype_pass(cl, "Oracle's Curse", "section", "oracle_curse") cl = mark_subtype_pass(cl, "Mysteries", "section", "oracle_mystery") cl = mark_subtype_pass(cl, "Rogue Talents", "section", "rogue_talent") cl = mark_subtype_pass(cl, "Advanced Talents", "section", "rogue_advanced_talent") cl = mark_subtype_pass(cl, "1-Point Evolutions", "section", "summoner_evolution_1") cl = mark_subtype_pass(cl, "2-Point Evolutions", "section", "summoner_evolution_2") cl = mark_subtype_pass(cl, "3-Point Evolutions", "section", "summoner_evolution_3") cl = mark_subtype_pass(cl, "4-Point Evolutions", "section", "summoner_evolution_4") cl = mark_subtype_pass(cl, "Cavalier Orders", "section", "warrior_order") cl = mark_subtype_pass(cl, "Samurai Orders", "section", "warrior_order") cl = mark_subtype_pass(cl, "Hex", "section", "witch_hex") cl = mark_subtype_pass(cl, "Major Hex", "section", "witch_major_hex") cl = mark_subtype_pass(cl, "Grand Hex", "section", "witch_grand_hex") cl = mark_subtype_pass(cl, "Patron Spells", "section", "witch_patron") cl = spell_list_pass(cl) cl = entity_pass(cl) return cl
def parse_arg_uncommon_race(filename, output, book): struct = parse_universal(filename, output, book) struct = stat_block_pass(struct, book) struct = quote_pass(struct) struct = entity_pass(struct) struct = arg_restructure(struct, book) race = arg_race_pass(struct, 'uncommon_race') write_race(output, book, race)
def parse_races(filename, output, book): struct = parse_universal(filename, output, book) struct = quote_pass(struct) struct = entity_pass(struct) for race in struct['sections']: race_pass(race) racial_trait_pass(race) for race in struct['sections']: write_race(output, book, race)
def parse_races(filename, output, book): struct = parse_universal(filename, output, book) struct = stat_block_pass(struct, book) struct = quote_pass(struct) struct = entity_pass(struct) for race in struct['sections']: race_pass(race) racial_trait_pass(race) for race in struct['sections']: write_race(output, book, race)
def parse_skills(filename, output, book): skill = parse_universal(filename, output, book) skill = quote_pass(skill) skill = entity_pass(skill) skill_pass(skill) print "%s: %s" %(skill['source'], skill['name']) filename = create_skill_filename(output, book, skill) fp = open(filename, 'w') json.dump(skill, fp, indent=4) fp.close()
def parse_rules(filename, output, book, title): basename = os.path.basename(filename) rules = parse_universal(filename, output, book) rules = stat_block_pass(rules, book) rules = structure_pass(rules, basename, book) if not basename in ['glossary.html']: rules = ability_pass(rules) rules = title_pass(rules, book, title) rules = quote_pass(rules) rules = entity_pass(rules) if not basename in ['ranger.html', 'universalMonsterRules.html', 'buildingAndModifyingConstructs.html', 'spellbooks.html']: rules = abbrev_pass(rules) print_struct(rules) print "%s: %s" %(rules['source'], rules['name']) write_rules(output, rules, book, title)
def parse_spell_lists(filename, output, book): struct = parse_universal(filename, output, book) struct = quote_pass(struct) struct = 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")
def parse_rules(filename, output, book, title, no_sb=False): basename = os.path.basename(filename) rules = parse_universal(filename, output, book) rules = stat_block_pass(rules, book, no_sb=no_sb) rules = structure_pass(rules, basename, book) if not basename in ['glossary.html']: rules = ability_pass(rules) rules = title_pass(rules, book, title) rules = quote_pass(rules) rules = entity_pass(rules) if not basename in [ 'ranger.html', 'universalMonsterRules.html', 'buildingAndModifyingConstructs.html', 'spellbooks.html' ]: rules = abbrev_pass(rules) print_struct(rules) print "%s: %s" % (rules['source'], rules['name']) write_rules(output, rules, book, title)
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 = quote_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)
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) 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")
def parse_creature(filename, output, book): basename = os.path.basename(filename) struct = parse_universal(filename, output, book, max_title=4) struct = stat_block_pass(struct, book) struct = animal_companion_pass(struct) struct = rule_pass(struct) struct = ability_pass(struct) struct = familiar_pass(struct, basename) struct = monster_race_pass(struct) struct = collapse_pass(struct) struct = quote_pass(struct) struct = entity_pass(struct) currrules = [] if struct['type'] == 'section': struct['name'] = struct['sections'][0]['name'] struct['name'] = struct['name'].split(",")[0] write_creature(output, book, struct) elif struct['type'] == 'creature': write_creature(output, book, struct) else: raise Exception("Uh Oh")
def parse_creature(filename, output, book): basename = os.path.basename(filename) struct = parse_universal(filename, output, book, max_title=4) struct = stat_block_pass(struct, book) struct = animal_companion_pass(struct) struct = rule_pass(struct) struct = ability_pass(struct) struct = familiar_pass(struct, basename) struct = monster_race_pass(struct) struct = collapse_pass(struct) struct = quote_pass(struct) struct = entity_pass(struct) currrules = [] if struct['type'] == 'section': if not struct.has_key('name'): struct['name'] = struct['sections'][0]['name'] struct['name'] = struct['name'].split(",")[0] write_creature(output, book, struct) elif struct['type'] == 'creature': write_creature(output, book, struct) else: raise Exception("Uh Oh")
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) 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")