rough spell data to YAML, turns out LOT OF data issues in json

bradl/monsters-adult-gold-dragon
James Miller 2019-11-14 21:14:07 -06:00
parent 9c94876a06
commit 18ad27e77f
5 changed files with 14400 additions and 370 deletions

File diff suppressed because one or more lines are too long

View File

@ -37,6 +37,13 @@ actioncost:
abbr: reaction abbr: reaction
- name: Varies - name: Varies
abbr: varies abbr: varies
- name: 1 minute
abbr: 1m
- name: 10 minutes
abbr: 10m
- name: 1 hour
abbr: 1h
- name:
alignment: alignment:
- name: Lawful Good - name: Lawful Good
abbr: LG abbr: LG

View File

@ -0,0 +1,160 @@
import json
import yaml
def main():
with open(
'../third_party_json/spells20191115.json',
encoding='utf-8-sig') as f:
data = json.load(f)
# print(data)
for i in data:
if 'manual' in i:
del i['manual']
i['has_been_manually_proofread'] = False
if 'duration' not in i:
i['duration'] = None
# Fix components
if 'components' not in i:
i['components'] = None
else:
if i['components'] == ['1minute(material', 'somatic', 'verbal)']:
i['components'] = ['material', 'somatic', 'verbal']
if i['components'] == ['10minutes(material', 'somatic', 'verbal)']:
i['components'] = ['material', 'somatic', 'verbal']
if i['components'] == ['1hour(material', 'somatic', 'verbal)']:
i['components'] = ['material', 'somatic', 'verbal']
if i['components'] == ['1minute','material', 'somatic', 'verbal)']:
i['components'] = ['material', 'somatic', 'verbal']
if i['components'] == ['10minutes(somatic', 'verbal)']:
i['components'] = ['somatic', 'verbal']
if i['components'] == ['1minute(somatic', 'verbal)']:
i['components'] = ['somatic', 'verbal']
if i['components'] == ['1hour(somatic', 'verbal)']:
i['components'] = ['somatic', 'verbal']
for j, item in enumerate(i['components']):
if i['components'][j] == "somatic":
i['components'][j] = "Somatic"
if i['components'][j] == "material":
i['components'][j] = "Material"
if i['components'][j] == "verbal":
i['components'][j] = "Verbal"
if i['components'][j] == "focus":
i['components'][j] = "Focus"
if 'cast' not in i:
i['cast'] = None
if 'action' not in i:
i['action'] = None
i['action_abbr'] = i['action']
del i['action']
if i['action_abbr'] == "10 minutes":
i['action_abbr'] = "10m"
if i['action_abbr'] == "1 minute":
i['action_abbr'] = "1m"
if i['action_abbr'] == "1 hour":
i['action_abbr'] = "1h"
if 'traditions' not in i:
i['traditions'] = None
if i['traditions'] != None:
for j, item in enumerate(i['traditions']):
i['traditions'][j] = i['traditions'][j].capitalize()
if 'nethysUrl' in i:
del i['nethysUrl']
# print("spell:{}\n\tcast:{}\n\tcomponents:{}\n\taction:{}".format(i['name'], i['cast'], i['components'],i['action']))
# Fix source data
x = i['source']
if "Core Rulebook" in x:
tmp_abbr = "CRB"
elif "Lost Omens" in x:
tmp_abbr = "LOWG"
else:
raise Exception(
'something went wrong on sources in 3pp json data.')
res = [int(i) for i in x.split() if i.isdigit()]
# print("source line:{}\tres:{}".format(i['source'], res))
tmp_page_start = res[0]
tmp_page_stop = res[0]
i['source'] = [{
'abbr': tmp_abbr,
'page_start': tmp_page_start,
'page_stop': tmp_page_stop
}]
# description to descr
i['descr'] = i['description']
del i['description']
# Fix action cost
# fix requirements
if 'requirements' not in i:
i['req'] = None
else:
i['req'] = i['requirements']
del i['requirements']
if 'trigger' not in i:
i['trigger'] = None
if 'traits' not in i:
i['traits'] = None
else:
for idx, item in enumerate(i['traits']):
i['traits'][idx] = i['traits'][idx].capitalize()
# TODO Decide to keep targets or target
if 'targets' not in i:
i['targets'] = None
# for i in data:
# del i['actions_id']
# page = int(i['sources_pages'])
# del i['sources_pages']
# i['source'] = [{'abbr': 'CRB', 'page_start': page, 'page_stop': page }]
# x = i['actioncategories_id']
# if x == 1:
# i['actioncategory'] = "Basic"
# elif x ==2:
# i['actioncategory'] = "Specialty Basic"
# del i['actioncategories_id']
# y = i['actioncosts_id']
# if y == 0:
# i['actioncost_name'] = "Varies"
# elif y == 1:
# i['actioncost_name'] = "Single Action"
# elif y == 2:
# i['actioncost_name'] = "Two Actions"
# elif y == 3:
# i['actioncost_name'] = "Three Actions"
# elif y == 5:
# i['actioncost_name'] = "Free Action"
# elif y == 5:
# i['actioncost_name'] = "Reaction"
# del i['actioncosts_id']
data = {"spell": data}
final = yaml.safe_dump(data, allow_unicode=True, width=100000)
with open('tmp-spells.yaml', 'w') as f:
f.write(final)
if __name__ == "__main__":
main()

View File

@ -1,4 +1,10 @@
# TODO Normalize the ogl_copyright_block to make future lookups based on what's
# in the ogl copyright block easier
# TODO Add publisher data to each of these and modify schema and gendb.py # TODO Add publisher data to each of these and modify schema and gendb.py
publisher:
- name: Paizo, Inc.
website: https://paizo.com
source: source:
- full_name: Pathfinder Core Rulebook (Second Edition) - full_name: Pathfinder Core Rulebook (Second Edition)
isbn: 978-1-64078-168-9 isbn: 978-1-64078-168-9
@ -9,6 +15,7 @@ source:
release_date: 2019-08-01 release_date: 2019-08-01
is_first_party: true is_first_party: true
ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Pathfinder Core Rulebook (Second Edition) (c) 2019, Paizo, Inc.; Designers: Logan Bonner, Jason Bulmahn, Stephen Radney-MacFarland, and Mark Seifter." ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Pathfinder Core Rulebook (Second Edition) (c) 2019, Paizo, Inc.; Designers: Logan Bonner, Jason Bulmahn, Stephen Radney-MacFarland, and Mark Seifter."
publisher_name: Paizo, Inc.
- full_name: Pathfinder Bestiary (Second Edition) - full_name: Pathfinder Bestiary (Second Edition)
isbn: 978-1-64078-170-2 isbn: 978-1-64078-170-2
pzocode: PZO2102 pzocode: PZO2102
@ -18,6 +25,7 @@ source:
release_date: 2019-08-01 release_date: 2019-08-01
is_first_party: true is_first_party: true
ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Daemon, Guardian from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Ian McDowall. Dark Creeper from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Rik Shepard. Dark Stalker from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Simon Muth. Dragon, Faerie from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Brian Jaeger and Gary Gygax. Genie, Marid from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Gary Gygax. Mite from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Ian Livingstone and Mark Barnes. Pathfinder Bestiary (Second Edition) © 2019, Paizo Inc.; Authors: Alexander Augunas, Logan Bonner, Jason Bulmahn, John Compton, Paris Crenshaw, Adam Daigle, Eleanor Ferron, Leo Glass, Thurston Hillman, James Jacobs, Jason Keeley, Lyz Liddell, Ron Lundeen, Robert G. McCreary, Tim Nightengale, Stephen Radney-MacFarland, Alex Riggs, David N. Ross, Michael Sayre, Mark Seifter, Chris S. Sims, Jeffrey Swank, Jason Tondro, Tonya Woldridge, and Linda Zayas-Palmer." ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Daemon, Guardian from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Ian McDowall. Dark Creeper from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Rik Shepard. Dark Stalker from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Simon Muth. Dragon, Faerie from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Brian Jaeger and Gary Gygax. Genie, Marid from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Gary Gygax. Mite from the Tome of Horrors Complete © 2011, Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Ian Livingstone and Mark Barnes. Pathfinder Bestiary (Second Edition) © 2019, Paizo Inc.; Authors: Alexander Augunas, Logan Bonner, Jason Bulmahn, John Compton, Paris Crenshaw, Adam Daigle, Eleanor Ferron, Leo Glass, Thurston Hillman, James Jacobs, Jason Keeley, Lyz Liddell, Ron Lundeen, Robert G. McCreary, Tim Nightengale, Stephen Radney-MacFarland, Alex Riggs, David N. Ross, Michael Sayre, Mark Seifter, Chris S. Sims, Jeffrey Swank, Jason Tondro, Tonya Woldridge, and Linda Zayas-Palmer."
publisher_name: Paizo, Inc.
- full_name: "Pathfinder Adventure: The Fall of Plaguestone" - full_name: "Pathfinder Adventure: The Fall of Plaguestone"
isbn: 978-1-64078-174-0 isbn: 978-1-64078-174-0
pzocode: PZO9555 pzocode: PZO9555
@ -28,6 +36,7 @@ source:
release_date: 2019-08-01 release_date: 2019-08-01
is_first_party: true is_first_party: true
ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Pathfinder Adventure: The Fall of Plaguestone © 2019, Paizo Inc.; Author: Jason Bulmahn." ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Pathfinder Adventure: The Fall of Plaguestone © 2019, Paizo Inc.; Author: Jason Bulmahn."
publisher_name: Paizo, Inc.
- full_name: "Age of Ashes Player's Guide" - full_name: "Age of Ashes Player's Guide"
isbn: null isbn: null
pzocode: PZO9000-25E pzocode: PZO9000-25E
@ -38,6 +47,7 @@ source:
release_date: 2019 release_date: 2019
is_first_party: true is_first_party: true
ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Age of Ashes Player''s Guide © 2019, Paizo Inc.; Authors: James Jacobs with Amanda Hamon." ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Age of Ashes Player''s Guide © 2019, Paizo Inc.; Authors: James Jacobs with Amanda Hamon."
publisher_name: Paizo, Inc.
- full_name: "Pathfinder Adventure Path #145: Hellknight Hill" - full_name: "Pathfinder Adventure Path #145: Hellknight Hill"
isbn: 978-1-64078-173-3 isbn: 978-1-64078-173-3
pzocode: PZO90145 pzocode: PZO90145
@ -46,7 +56,8 @@ source:
descr: "Book 1 in the Age of Ashes Adventure Path." descr: "Book 1 in the Age of Ashes Adventure Path."
release_date: 2019 release_date: 2019
is_first_party: true is_first_party: true
ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Pathfind Advetnrue Path #145: Hellknight Hill (c) 2019, Paizo, Inc.; Authors: Amanda Hamon, with Logan Bonner, James Jacobs, and Jason Tondro." ogl_copyright_block: "Open Game License v.1.0a (c) 2000, Wizards of the Coast, Inc.; System Reference Document (c) 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Pathfinder Adventure Path #145: Hellknight Hill (c) 2019, Paizo, Inc.; Authors: Amanda Hamon, with Logan Bonner, James Jacobs, and Jason Tondro."
publisher_name: Paizo, Inc.
- full_name: "Pathfinder Lost Omens World Guide (Second Edition)" - full_name: "Pathfinder Lost Omens World Guide (Second Edition)"
isbn: 978-1-64078-172-6 isbn: 978-1-64078-172-6
pzocode: PZO9301 pzocode: PZO9301
@ -56,3 +67,4 @@ source:
release_date: 2019-08-28 release_date: 2019-08-28
is_first_party: true is_first_party: true
ogl_copyright_block: "Open Game License v 1.0a © Wizards of the Coast, Inc.; System Reference Document © 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Genie, Marid from the Tome of Horrors Complete © 2011 Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Gary Gygax. Pathfinder Lost Omens World Guide (Second Edition) © 2019, Paizo, Inc.; Authors: Tanya DePass, James Jacobs, Lyz Liddell, Ron Lundeen, Liane Merciel, Erik Mona, Mark Seifter, James L Sutter." ogl_copyright_block: "Open Game License v 1.0a © Wizards of the Coast, Inc.; System Reference Document © 2000, Wizards of the Coast, Inc.; Authors: Jonathan Tweet, Monte Cook, and Skip Williams, based on material by E. Gary Gygax and Dave Arneson. Genie, Marid from the Tome of Horrors Complete © 2011 Necromancer Games, Inc., published and distributed by Frog God Games; Author: Scott Greene, based on original material by Gary Gygax. Pathfinder Lost Omens World Guide (Second Edition) © 2019, Paizo, Inc.; Authors: Tanya DePass, James Jacobs, Lyz Liddell, Ron Lundeen, Liane Merciel, Erik Mona, Mark Seifter, James L Sutter."
publisher_name: Paizo, Inc.

File diff suppressed because one or more lines are too long