make cleanyaml.py get all yaml files in the directory and then run it

bradl/monsters-adult-gold-dragon
James Miller 2020-04-21 17:54:30 -05:00
parent a9765b85b7
commit de1765445e
3 changed files with 35 additions and 26 deletions

View File

@ -236,7 +236,10 @@ ancestries:
to add your level to the Hit Points you regain from their treatment. to add your level to the Hit Points you regain from their treatment.
feat: null feat: null
name: Hillock Halfling name: Hillock Halfling
- descr: Your ancestors have traveled from place to place for generations, never content to settle down. You gain two additional languages of your choice, chosen from among the common and uncommon languages available to you, and every time you take the Multilingual feat, you gain another new language. - descr: Your ancestors have traveled from place to place for generations, never
content to settle down. You gain two additional languages of your choice, chosen
from among the common and uncommon languages available to you, and every time
you take the Multilingual feat, you gain another new language.
feat: null feat: null
name: Nomadic Halfling name: Nomadic Halfling
- descr: Your ancestors performed many secret acts under the concealing cover of - descr: Your ancestors performed many secret acts under the concealing cover of
@ -268,16 +271,16 @@ ancestries:
flavor_text: TODO flavor_text: TODO
flaws: null flaws: null
heritages: heritages:
- descr: Either one of your parents was an elf, or one or both were half-elves. You - descr: Either one of your parents was an elf, or one or both were half-elves.
have pointed ears and other telltale signs of elf heritage. You gain the elf trait You have pointed ears and other telltale signs of elf heritage. You gain the
and low-light vision. In addition, you can select elf, half-elf, and human feats elf trait and low-light vision. In addition, you can select elf, half-elf, and
whenever you gain an ancestry feat. human feats whenever you gain an ancestry feat.
feat: null feat: null
name: Half-Elf name: Half-Elf
- descr: One of your parents was an orc, or one or both were half-orcs. You have a - descr: One of your parents was an orc, or one or both were half-orcs. You have
green tinge to your skin and other indicators of orc heritage. You gain the orc a green tinge to your skin and other indicators of orc heritage. You gain the
trait and low-light vision. In addition, you can select orc, half-orc, and human orc trait and low-light vision. In addition, you can select orc, half-orc, and
feats whenever you gain an ancestry feat. human feats whenever you gain an ancestry feat.
feat: null feat: null
name: Half-Orc name: Half-Orc
- descr: Your ingenuity allows you to train in a wide variety of skills. You become - descr: Your ingenuity allows you to train in a wide variety of skills. You become
@ -286,9 +289,9 @@ ancestries:
feat: null feat: null
name: Skilled Heritage name: Skilled Heritage
- descr: Humanitys versatility and ambition have fueled its ascendance to be the - descr: Humanitys versatility and ambition have fueled its ascendance to be the
most common ancestry in most nations throughout the world. Select a general feat most common ancestry in most nations throughout the world. Select a general
of your choice for which you meet the prerequisites (as with your ancestry feat, feat of your choice for which you meet the prerequisites (as with your ancestry
you can select this general feat at any point during character creation). feat, you can select this general feat at any point during character creation).
feat: null feat: null
name: Versatile Heritage name: Versatile Heritage
hp: 8 hp: 8

View File

@ -2,27 +2,33 @@
# TO CLEAN UP AND ORDER ALL THE YAML # TO CLEAN UP AND ORDER ALL THE YAML
import yaml import yaml
import glob
import os
yfiles = [
"actions.yaml", "ancestries.yaml", "armor.yaml", "backgrounds.yaml",
"basics.yaml", "bulks.yaml", "conditions.yaml", "damage.yaml",
"feats-levels-false-matches.yaml", "feats.yaml", "langs.yaml",
"monsters.yaml", "requirements.yaml", "senses.yaml", "skills.yaml",
"sources.yaml", "spells.yaml", "traits.yaml", "triggers.yaml"
]
def main(): def main():
# gets all files with a yaml extension in the directory
yfiles = []
for file in glob.glob("*.yaml"):
yfiles.append(file)
yfiles.sort()
print(yfiles)
for x in yfiles: for x in yfiles:
print("Doing: {}".format(x)) print("Doing: {}".format(x))
with open(x, 'r') as r: with open(x, 'r') as r:
data = yaml.full_load(r) data = yaml.full_load(r)
if x == "feats.yaml": if x == "feats.yaml":
for i in data['feat']: for i in data['feat']:
# This is to clean out smart quotes that made it into the
# yaml file so it matches the requirements.yaml
if i['requirement'] != None: if i['requirement'] != None:
print("Before: {}".format(i['requirement'])) # print("Before: {}".format(i['requirement']))
i['requirement'] = i['requirement'].replace('', "'") i['requirement'] = i['requirement'].replace('', "'")
print("After: {}".format(i['requirement'])) # print("After: {}".format(i['requirement']))
final = yaml.safe_dump(data, allow_unicode=True) final = yaml.safe_dump(data, allow_unicode=True)
with open(x, 'w') as f: with open(x, 'w') as f:
f.write(final) f.write(final)

View File

@ -1073,7 +1073,7 @@ gear:
page_start: 291 page_start: 291
page_stop: 291 page_stop: 291
traits: traits:
- Uncommon - Uncommon
- bulk: 0.1 - bulk: 0.1
descr: Maps are uncommon. Most maps you can find are simple and functional. A survey descr: Maps are uncommon. Most maps you can find are simple and functional. A survey
map details a single location in excellent detail. One of these maps gives you map details a single location in excellent detail. One of these maps gives you
@ -1088,7 +1088,7 @@ gear:
page_start: 291 page_start: 291
page_stop: 291 page_stop: 291
traits: traits:
- Uncommon - Uncommon
- bulk: 0.0 - bulk: 0.0
descr: Picking an average lock requires four successes at DC 25. descr: Picking an average lock requires four successes at DC 25.
hands: 2 hands: 2
@ -1193,7 +1193,7 @@ gear:
page_start: 291 page_start: 291
page_stop: 291 page_stop: 291
traits: traits:
- Uncommon - Uncommon
- bulk: 0.1 - bulk: 0.1
descr: This small wooden box contains cosmetics, false facial hair, spirit gum, descr: This small wooden box contains cosmetics, false facial hair, spirit gum,
and a few simple wigs. You usually need a disguise kit to set up a disguise in and a few simple wigs. You usually need a disguise kit to set up a disguise in
@ -1271,7 +1271,7 @@ gear:
page_start: 291 page_start: 291
page_stop: 291 page_stop: 291
traits: traits:
- Uncommon - Uncommon
- bulk: 0.1 - bulk: 0.1
descr: You need thieves' tools to Pick Locks or Disable Devices (of some types) descr: You need thieves' tools to Pick Locks or Disable Devices (of some types)
using the Thievery skill. Infiltrator thieves' tools add a +1 item bonus to checks using the Thievery skill. Infiltrator thieves' tools add a +1 item bonus to checks