Merge branch 'begin-yaml-transition'

bradl/monsters-adult-gold-dragon
James Miller 2019-11-14 21:57:04 -06:00
commit 1ff08baa6d
11 changed files with 22602 additions and 36 deletions

View File

@ -3,8 +3,9 @@
## Spells (Tim Schneider) ## Spells (Tim Schneider)
Our initial spell data was taken from Our initial spell data was taken from
https://github.com/fyjham-ts/Pathfinder-2E-Spell-DB via their spells.json file. https://github.com/fyjham-ts/Pathfinder-2E-Spell-DB via their spells.json file
The MIT license information for the software is as follows: as of their commit: `73be926a415901e28e00d418fc4120ac41897e6c`. The MIT license
information for the software is as follows:
MIT License MIT License

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
# NOTE: actioncategory assumes a single source entry # NOTE: actioncategory assumes a single source entry
# TODO Requirements and triggers can be normalized in gendb.py and schema
actioncategory: actioncategory:
- name: Basic - name: Basic
descr: Basic actions represent common tasks like moving around, attacking, and helping others. As such, every creature can use basic actions except in some extreme circumstances, and many of those actions are used very frequently. Most notably, youll use Interact, Step, Stride, and Strike a great deal. Many feats and other actions call upon you to use one of these basic actions or modify them to produce different effects. For example, a more complex action might let you Stride up to double your Speed instead of just up to your Speed, and a large number of activities include a Strike. descr: Basic actions represent common tasks like moving around, attacking, and helping others. As such, every creature can use basic actions except in some extreme circumstances, and many of those actions are used very frequently. Most notably, youll use Interact, Step, Stride, and Strike a great deal. Many feats and other actions call upon you to use one of these basic actions or modify them to produce different effects. For example, a more complex action might let you Stride up to double your Speed instead of just up to your Speed, and a large number of activities include a Strike.

View File

@ -32,11 +32,17 @@ actioncost:
- name: Three Actions - name: Three Actions
abbr: 3 abbr: 3
- name: Free Action - name: Free Action
abbr: free abbr: F
- name: Reaction - name: Reaction
abbr: reaction abbr: R
- name: Varies - name: Varies
abbr: varies abbr: V
- name: 1 minute
abbr: 1m
- name: 10 minutes
abbr: 10m
- name: 1 hour
abbr: 1h
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

@ -71,6 +71,146 @@ def main():
data = yaml.full_load(yl) data = yaml.full_load(yl)
do_actions(data, conn) do_actions(data, conn)
# move on to spells
with open('spells.yaml') as yl:
data = yaml.full_load(yl)
do_spells(data, conn)
def do_spells(data, conn):
# load the helper info
do_spelltype(data, conn)
do_spellcomponent(data, conn)
do_spelltradition(data, conn)
do_spellschool(data, conn)
def do_spelltype(data, conn):
table = """
CREATE TABLE spelltype (
spelltype_id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE
);
"""
c = conn.cursor()
c.execute(table)
inp_data = []
for i in data['spelltype']:
inp_data.append((i, ))
stmt = "INSERT INTO spelltype (name) VALUES (?)"
try:
conn.executemany(stmt, inp_data)
except Exception as e:
print("Error creating spelltype: {}".format(e))
else:
conn.commit()
def do_spellcomponent(data, conn):
table = """
CREATE TABLE spellcomponent (
spellcomponent_id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE
);
"""
c = conn.cursor()
c.execute(table)
inp_data = []
for i in data['spellcomponent']:
inp_data.append((i, ))
stmt = "INSERT INTO spellcomponent (name) VALUES (?)"
try:
conn.executemany(stmt, inp_data)
except Exception as e:
print("Error creating spellcomponent: {}".format(e))
else:
conn.commit()
def do_spelltradition(data, conn):
table = """
CREATE TABLE spelltradition (
spelltradition_id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE
);
"""
c = conn.cursor()
c.execute(table)
inp_data = []
for i in data['spelltradition']:
inp_data.append((i, ))
stmt = "INSERT INTO spelltradition (name) VALUES (?)"
try:
conn.executemany(stmt, inp_data)
except Exception as e:
print("Error creating spelltradition: {}".format(e))
else:
conn.commit()
def do_spellschool(data, conn):
table = """
CREATE TABLE spellschool (
spellschool_id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
descr TEXT NOT NULL UNIQUE,
sourceentry_id INTEGER,
FOREIGN KEY (sourceentry_id) REFERENCES sourceentry(sourceentry_id)
);
"""
c = conn.cursor()
c.execute(table)
# print(data)
for i in data['spellschool']:
# print(i)
srcentrydata = []
for j in i['source']:
abbr = j['abbr']
page_start = j['page_start']
# Not all YAML entries have page_stop data
if 'page_stop' in j:
page_stop = j['page_stop']
else:
page_stop = page_start
srcentrydata.append((abbr, page_start, page_stop))
# need to insert sourceentry data first but check and make sure the
# length is only one
if len(srcentrydata) != 1:
raise AssertionError(
'length of srcentrydata should only be 1, no more no less, on spellschool'
)
# print("length of srcentrydata:{}\tsrcentrydata:{}".format(len(srcentrydata),srcentrydata))
util_insert_into_sourceentry(srcentrydata, conn)
stmt = """
INSERT INTO spellschool(name, descr, sourceentry_id)
VALUES (?,?,
(SELECT sourceentry_id FROM sourceentry
WHERE source_id=(SELECT source_id FROM source WHERE abbr=?)
AND page_start=?
AND page_stop=?
)
);
"""
# print('executing on name:{}'.format(i['name']))
try:
conn.execute(
stmt,
(i['name'], i['descr'], srcentrydata[0][0],
srcentrydata[0][1], srcentrydata[0][2]))
except Exception as e:
print("Error creating spellschool: {}".format(e))
else:
conn.commit()
def do_actions(data, conn): def do_actions(data, conn):
do_action_categories(data, conn) do_action_categories(data, conn)

View File

@ -1,3 +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
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
@ -8,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
@ -16,7 +24,8 @@ source:
descr: Volume containing monster stat blocks and rules primarily for Game Masters descr: Volume containing monster stat blocks and rules primarily for Game Masters
release_date: 2019-08-01 release_date: 2019-08-01
is_first_party: true is_first_party: true
ogl_copyright_block: "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
@ -26,7 +35,8 @@ source:
descr: TODO descr: TODO
release_date: 2019-08-01 release_date: 2019-08-01
is_first_party: true is_first_party: true
ogl_copyright_block: "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
@ -36,4 +46,25 @@ source:
descr: "Player's Guide for the Age of Ashes Adventure Path" descr: "Player's Guide for the Age of Ashes Adventure Path"
release_date: 2019 release_date: 2019
is_first_party: true is_first_party: true
ogl_copyright_block: "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"
isbn: 978-1-64078-173-3
pzocode: PZO90145
short_name: "Hellknight Hill"
abbr: APHH
descr: "Book 1 in the Age of Ashes Adventure Path."
release_date: 2019
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 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)"
isbn: 978-1-64078-172-6
pzocode: PZO9301
short_name: "Lost Omens World Guide"
abbr: LOWG
descr: "A gazeteer of Golarion detailing 10 diverse regions."
release_date: 2019-08-28
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."
publisher_name: Paizo, Inc.

13925
data/yaml/spells.yaml 100644

File diff suppressed because one or more lines are too long