All prerequisites finished

merge-requests/29/head
Wesley Webb 2019-08-12 06:03:15 -04:00
commit 440c2557a8
9 changed files with 1717 additions and 120 deletions

View File

@ -54,6 +54,10 @@ The action symbols can be represented by the following characters:
| Reaction | 🄡 | U+1F121 | | Reaction | 🄡 | U+1F121 |
| Free action | 🄕 | U+1F115 | | Free action | 🄕 | U+1F115 |
## Text Formatting
Text formatting will be according to github-flavored markdown.
## Ability Scores in Integer Representation ## Ability Scores in Integer Representation
| Ability Type | Value | | Ability Type | Value |
@ -70,4 +74,4 @@ The action symbols can be represented by the following characters:
If I wanted to say STR and DEX, I would use a `3`. If I wanted STR, WIS, and If I wanted to say STR and DEX, I would use a `3`. If I wanted STR, WIS, and
CHA, that would be 1 + 16 + 32 = `49`. This is to give a program-focused data CHA, that would be 1 + 16 + 32 = `49`. This is to give a program-focused data
return in addition to the textual representation. return in addition to the textual representation.

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ VALUES
(201, 'Fey-Touched Gnome', 'The blood of the fey is so strong within you that youre truly one of them. You gain the fey trait, in addition to the gnome and humanoid traits. Choose one cantrip from the <%SPELL.LIST%Primal%%>primal spell list. You can cast this spell as a primal innate spell at will. A cantrip is heightened to a spell level equal to half your level rounded up. You can change this cantrip to a different one from the same list once per day by meditating to realign yourself with the First World; this is a 10-minute activity that has the concentrate trait.', 0, 0), (201, 'Fey-Touched Gnome', 'The blood of the fey is so strong within you that youre truly one of them. You gain the fey trait, in addition to the gnome and humanoid traits. Choose one cantrip from the <%SPELL.LIST%Primal%%>primal spell list. You can cast this spell as a primal innate spell at will. A cantrip is heightened to a spell level equal to half your level rounded up. You can change this cantrip to a different one from the same list once per day by meditating to realign yourself with the First World; this is a 10-minute activity that has the concentrate trait.', 0, 0),
(202, 'Sensate Gnome', 'You see all colors as brighter, hear all sounds as richer, and especially smell all scents with incredible detail. You gain a special sense: imprecise scent with a range of 30 feet. This means you can use your sense of smell to determine the exact location of a creature (as explained on page 465). The GM will usually double the range if youre downwind from the creature or halve the range if youre upwind.', 0, 0), (202, 'Sensate Gnome', 'You see all colors as brighter, hear all sounds as richer, and especially smell all scents with incredible detail. You gain a special sense: imprecise scent with a range of 30 feet. This means you can use your sense of smell to determine the exact location of a creature (as explained on page 465). The GM will usually double the range if youre downwind from the creature or halve the range if youre upwind.', 0, 0),
(204, 'Umbral Gnome', 'Whether from a connection to dark or shadowy fey, from the underground deep gnomes also known as svirfneblin, or another source, you can see in complete darkness. You gain darkvision.', 0, 0), (204, 'Umbral Gnome', 'Whether from a connection to dark or shadowy fey, from the underground deep gnomes also known as svirfneblin, or another source, you can see in complete darkness. You gain darkvision.', 0, 0),
(204, 'Wellspring Gnome', 'Some other source of magic has a greater hold on you than the primal magic of your fey lineage does. This connection might come from an occult plane or an ancient occult song; a deity, celestial, or fiend; magical effluent left behind by a mage war; or ancient rune magic.', 0, 0), (205, 'Wellspring Gnome', 'Some other source of magic has a greater hold on you than the primal magic of your fey lineage does. This connection might come from an occult plane or an ancient occult song; a deity, celestial, or fiend; magical effluent left behind by a mage war; or ancient rune magic.', 0, 0), -- TODO there was an error with wellspring gnome being ID 204; need to double check other data to make sure it has been accounted for elsewhere
-- Start of Goblin Heritages -- Start of Goblin Heritages
(300, 'Charhide Goblin', 'Your ancestors have always had a connection to fire and a thicker skin, which allows you to resist burning. You gain fire resistance equal to half your level (minimum 1). You can also recover from being on fire more easily. Your flat check to remove persistent fire damage is DC 10 instead of DC 15, which is reduced to DC 5 if another creature uses a particularly appropriate action to help.', 0, 0), (300, 'Charhide Goblin', 'Your ancestors have always had a connection to fire and a thicker skin, which allows you to resist burning. You gain fire resistance equal to half your level (minimum 1). You can also recover from being on fire more easily. Your flat check to remove persistent fire damage is DC 10 instead of DC 15, which is reduced to DC 5 if another creature uses a particularly appropriate action to help.', 0, 0),

View File

@ -1,9 +1,13 @@
INSERT INTO spelltypes ( INSERT INTO spelltypes (
spelltypes_id,
name
)
VALUES
(1, 'Spell'), (1, 'Spell'),
(2, 'Cantrip'), (2, 'Cantrip'),
(3, 'Focus'), (3, 'Focus'),
(3, 'Ritual') (4, 'Ritual');
);
INSERT INTO spellcomponents ( INSERT INTO spellcomponents (
spellcomponents_id, spellcomponents_id,
@ -34,11 +38,11 @@ INSERT INTO spellschools (
descr descr
) )
VALUES VALUES
(1, 1, '297','Abjuration', 'TODO'), (1, 1, '297','Abjuration', 'Abjurations protect and ward. They create barriers that keep out attacks, effects, or even certain types of creatures. They also create effects that harm trespassers or banish interlopers.'),
(2, 1, '297','Conjuration', 'TODO'), (2, 1, '297','Conjuration', 'Conjuration spells transport creatures via teleportation, create an object, or bring a creature or object from somewhere else (typically from another plane) to follow your commands.\n\nConjuration spells often have the teleportation trait, and the creatures summoned by conjuration spells have the summoned trait.'),
(3, 1, '297','Divination', 'TODO'), (3, 1, '297','Divination', 'Divinations allow you to learn the secrets of the present, past, and future. They bestow good fortune, grant you the ability to perceive remote locations, and reveal secret knowledge.\n\nDivinations often have the detection trait if they find something, the prediction trait if they grant you insight about what might happen in the future, the revelation trait if they show things as they truly are, or the scrying trait if they let you perceive another location.'),
(4, 1, '297','Enchantment', 'TODO'), (4, 1, '297','Enchantment', 'Enchantments affect the minds and emotions of other creatures—sometimes to influence and control them, and other times to bolster them to greater heights of courage. Enchantment spells almost always have the mental trait, and many have the emotion trait or the fear trait.'),
(5, 1, '298','Evocation', 'TODO'), (5, 1, '298','Evocation', 'Evocations capture magical energy and then shape it to harm your foes or protect your allies. Evocation spells often have a trait that comes from the type of damage they deal, such as acid, cold, fire, force, or sonic.'),
(6, 1, '298','Illusion', 'TODO'), (6, 1, '298','Illusion', 'Illusions create the semblance of something real, fooling the eyes, ears, and other senses. They almost always have the mental trait, and depending on how the illusion is perceived, they might also have the auditory or visual trait.'),
(7, 1, '298','Necromancy', 'TODO'), (7, 1, '298','Necromancy', 'Necromancy spells harness the power of life and death. They can sap life essence or sustain creatures with life-saving healing. Necromancy spells often have the curse, death, healing, negative, or positive traits.'),
(8, 1, '298','Transmutation', 'Transmutation spells make alterations to or transform the physical form of a creature or object. The morph and polymorph traits appear primarily in transmutation spells.'), (8, 1, '298','Transmutation', 'Transmutation spells make alterations to or transform the physical form of a creature or object. The morph and polymorph traits appear primarily in transmutation spells.');

View File

@ -1,4 +1,5 @@
import json import json
import sqlite3
def main(): def main():
# load json into python # load json into python
@ -25,12 +26,271 @@ def main():
sorted_dicts.append(x) sorted_dicts.append(x)
# NOW we can go alphabetically spell by spell # NOW we can go alphabetically spell by spell
for i in sorted_dicts:
do_sql(i)
# TODO write this function after sql schema drafted ## Get database connection
def do_sql(): conn = sqlite3.connect('../../pf2.db')
pass
# load in ids for traits from traits table so we only call this once
# instead of every spell
stmt = "SELECT trait_id, short_name FROM traits"
c = conn.cursor()
c.execute(stmt)
traits = c.fetchall()
# print(traits)
# load in ids for spelltypes from spelltypes table so we only call this once
# instead of every spell
stmt = "SELECT spelltypes_id, name FROM spelltypes"
c = conn.cursor()
c.execute(stmt)
stypes = c.fetchall()
# TODO FIX THIS FOR SPELL COMPONENTS
# CREATE TABLE spellcomponents (
# spellcomponents_id INTEGER PRIMARY KEY,
# name TEXT NOT NULL UNIQUE
# );
# load in ids for spelltypes from spelltypes table so we only call this once
# instead of every spell
stmt = "SELECT spellcomponents_id, name FROM spellcomponents"
c = conn.cursor()
c.execute(stmt)
ctypes = c.fetchall()
# List the various triggers and see if there are any duplicates
# THERE ARE NOT IN THE CRB SO NOT BOTHERING WITH SEPARATE TRIGGERS TABLE YET
### trigs = []
### for i in sorted_dicts:
### if 'trigger' in i:
### trigs.append(i['trigger'])
### print(sorted(trigs))
### print(len(trigs))
### print(len(set(trigs)))
# List the various targets and see if there are any duplicates
## YES, there are MANY duplicates, so we need a separate targets table
targs = []
for i in sorted_dicts:
if 'targets' in i:
targs.append(i['targets'])
dedup_targs = set(targs)
sorted_targs = sorted(dedup_targs)
inp_targs = []
id = 0
for i in sorted_targs:
id += 1
inp_targs.append((id,i))
stmt = "INSERT INTO spelltargets (spelltargets_id, name) VALUES (?,?)"
try:
conn.executemany(stmt,inp_targs)
except:
print("Error creating targets")
else:
conn.commit()
# load in ids for targets so just doing this once
stmt = "SELECT spelltargets_id, name FROM spelltargets"
c = conn.cursor()
c.execute(stmt)
ttypes = c.fetchall()
# print(sorted(targs))
# print(len(targs))
# print(len(set(targs)))
id = 0
for i in sorted_dicts:
id += 1
do_basic_sql(i, id, conn)
do_range_numbers(i,id,conn)
do_sources_pages(i,id,conn)
do_spell_traits(i,id,conn,traits)
do_spell_types(i,id,conn,stypes)
do_spell_components(i,id,conn,ctypes)
do_spell_targets(i,id,conn,ttypes)
def do_spell_components(i,id,conn,ctypes):
res = None
for j in ctypes:
for k in i['components']:
if k.capitalize() == j[1]:
res = j[0]
inp = (res, id)
stmt = "INSERT INTO spells_spellcomponents (spells_id, spellcomponents_id) VALUES (?,?)"
try:
conn.execute(stmt, inp)
except:
print("Error inserting spell components")
else:
conn.commit()
def do_spell_targets(i,id,conn,ttypes):
if 'targets' not in i:
return
res = 0
for j in ttypes:
if i['targets'] == j[1]:
res = j[0]
# print(id , res)
inp = (res, id)
stmt = "UPDATE spells SET spelltargets_id=? WHERE spells_id=?"
try:
conn.execute(stmt, inp)
except:
print("Error updating spelltargets_id")
else:
conn.commit()
def do_spell_types(i,id,conn,stypes):
res = 0
for j in stypes:
if i['type'] == j[1]:
res = j[0]
# print(id , res)
inp = (res, id)
stmt = "UPDATE spells SET spelltypes_id=? WHERE spells_id=?"
try:
conn.execute(stmt, inp)
except:
print("Error updating spell types")
else:
conn.commit()
def do_spell_traits(i, id, conn, traits):
# get list of traits from the json and capitalize first letter
traits_json = []
for item in i['traits']:
traits_json.append(item.capitalize())
trait_ids =[]
for j in traits_json:
for k in traits:
if j == k[1]:
trait_ids.append(k[0])
# print(trait_ids)
inp = []
for j in trait_ids:
inp.append((id,j))
# print(inp)
# insert into sql
stmt = "INSERT OR REPLACE INTO spells_traits (spells_id, traits_id) VALUES (?,?)"
try:
conn.executemany(stmt, inp)
except:
print("Error updating traits")
else:
conn.commit()
def do_sources_pages(i, id, conn):
if 'source' not in i:
return
res = ''
source_id = 0
# Do Core Rulebook branch
if "Core Rulebook" in i['source']:
res = i['source'].replace('Core Rulebook pg.','').strip()
source_id = 1
stmt = "UPDATE spells SET sources_id=?, sources_pages=? WHERE spells_id=?"
inp = (source_id, res, id)
try:
conn.execute(stmt, inp)
except:
print("Error updating sources")
else:
conn.commit()
def do_range_numbers(i, id, conn):
# no need to do range
if 'range' not in i:
return
rg = -1
# convert range_text to an integer representation
if i['range'] == 'touch':
rg = 0
elif i['range'] == 'planetary':
rg = 999999999
# is the only one in CRB with emanation 40' from current scraping
elif i['name'] == 'Repulsion':
rg = 40
else:
# DO SPLITS
splits = i['range'].split(' ')
# print(splits)
rg = splits[0]
inp = (rg, id)
stmt = "UPDATE spells SET range_ft=? WHERE spells_id=?"
try:
conn.execute(stmt, inp)
except:
print("Error updating range_ft")
else:
conn.commit()
# print("Successfully updated range_ft")
def do_basic_sql(i, id, conn):
print("Doing spell id #{}: {}".format(id, i['name']))
stmt = """INSERT INTO spells (
spells_id,
sources_id,
sources_pages,
nethysurl,
name,
level,
descr,
range_text,
trigger,
area_text)
VALUES (?,?,?,?,?,?,?,?,?,?)"""
rge = None
if 'range' in i:
rge = i['range']
dscr = None
if 'description' in i:
dscr = i['description']
trg = None
if 'trigger' in i:
trg = i['trigger']
area = None
if 'area' in i:
area = i['area']
inp = (id, 1, i['source'], i['nethysUrl'], i['name'], i['level'], dscr, rge, trg, area)
try:
conn.execute(stmt, inp)
except:
print("Error inserting row")
else:
conn.commit()
# print("Successfully inserted row")
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,5 +1,12 @@
-- -*- mode:sql sql-product:sqlite -*- -- -*- mode:sql sql-product:sqlite -*-
-- #########################################################
-- This space is where we say the latest ID for incrementing
--
-- 269 is top ID right now so start with 270 for anything new
--
-- #########################################################
INSERT INTO traittypes (traittype_id, name) INSERT INTO traittypes (traittype_id, name)
VALUES VALUES
(1, 'None'), (1, 'None'),
@ -133,6 +140,9 @@ INSERT INTO traits (trait_id, traittype, short_name,description)
(100, 5, "Rogue", "This indicates abilities from the rogue class."), (100, 5, "Rogue", "This indicates abilities from the rogue class."),
(101, 5, "Sorcerer", "This indicates abilities from the sorcerer class."), (101, 5, "Sorcerer", "This indicates abilities from the sorcerer class."),
(102, 5, "Wizard", "This indicates abilities from the wizard class."), (102, 5, "Wizard", "This indicates abilities from the wizard class."),
(252, 1, "Additive 1", "Feats with the additive trait allow you to spend actions to add special substances to bombs or elixirs. You can add only one additive to a single alchemical item, and attempting to add another spoils the item. You can typically use actions with the additive trait only when youre creating an infused alchemical item, and some can be used only with the Quick Alchemy action. The additive trait is always followed by a level, such as additive 2. An additive adds its level to the level of the alchemical item youre modifying; the result is the new level of the mixture. The mixtures item level must be no higher than your advanced alchemy level."),
(253, 1, "Additive 2", "Feats with the additive trait allow you to spend actions to add special substances to bombs or elixirs. You can add only one additive to a single alchemical item, and attempting to add another spoils the item. You can typically use actions with the additive trait only when youre creating an infused alchemical item, and some can be used only with the Quick Alchemy action. The additive trait is always followed by a level, such as additive 2. An additive adds its level to the level of the alchemical item youre modifying; the result is the new level of the mixture. The mixtures item level must be no higher than your advanced alchemy level."),
(254, 1, "Additive 3", "Feats with the additive trait allow you to spend actions to add special substances to bombs or elixirs. You can add only one additive to a single alchemical item, and attempting to add another spoils the item. You can typically use actions with the additive trait only when youre creating an infused alchemical item, and some can be used only with the Quick Alchemy action. The additive trait is always followed by a level, such as additive 2. An additive adds its level to the level of the alchemical item youre modifying; the result is the new level of the mixture. The mixtures item level must be no higher than your advanced alchemy level."),
-- "Creature type" type traits -- "Creature type" type traits
(103, 6, "Aberration", "Aberrations are creatures from beyond the planes or corruptions of the natural order."), (103, 6, "Aberration", "Aberrations are creatures from beyond the planes or corruptions of the natural order."),
@ -301,4 +311,19 @@ INSERT INTO traits (trait_id, traittype, short_name,description)
(248, 15, "Two-Hand", "This weapon can be wielded with two hands. Doing so changes its weapon damage die to the indicated value. This change applies to all the weapons damage dice, such as those from "), (248, 15, "Two-Hand", "This weapon can be wielded with two hands. Doing so changes its weapon damage die to the indicated value. This change applies to all the weapons damage dice, such as those from "),
(249, 15, "Unarmed", "An unarmed attack uses your body rather than a manufactured weapon. An unarmed attack isnt a weapon, though its categorized with weapons for weapon groups, and it might have weapon traits. Since its part of your body, an unarmed attack cant be Disarmed. It also doesnt take up a hand, though a fist or other grasping appendage follows the same rules as a free-hand weapon."), (249, 15, "Unarmed", "An unarmed attack uses your body rather than a manufactured weapon. An unarmed attack isnt a weapon, though its categorized with weapons for weapon groups, and it might have weapon traits. Since its part of your body, an unarmed attack cant be Disarmed. It also doesnt take up a hand, though a fist or other grasping appendage follows the same rules as a free-hand weapon."),
(250, 15, "Versatile", "A versatile weapon can be used to deal a different type of damage than that listed in the Damage entry. This trait indicates the alternate damage type. For instance, a piercing weapon that is versatile S can be used to deal piercing or slashing damage. You choose the damage type each time you make an attack."), (250, 15, "Versatile", "A versatile weapon can be used to deal a different type of damage than that listed in the Damage entry. This trait indicates the alternate damage type. For instance, a piercing weapon that is versatile S can be used to deal piercing or slashing damage. You choose the damage type each time you make an attack."),
(251, 15, "Volley", "This ranged weapon is less effective at close distances. Your attacks against targets that are at a distance within the range listed take a 2 penalty."); (251, 15, "Volley", "This ranged weapon is less effective at close distances. Your attacks against targets that are at a distance within the range listed take a 2 penalty."),
(255, 15, "Thrown 10ft.", "You can throw this weapon as a ranged attack. A thrown weapon adds your Strength modifier to damage just like a melee weapon does. When this trait appears on a melee weapon, it also includes the range increment. Ranged weapons with this trait use the range increment specified in the weapons Range entry."),
(256, 15, "Thrown 20ft.", "You can throw this weapon as a ranged attack. A thrown weapon adds your Strength modifier to damage just like a melee weapon does. When this trait appears on a melee weapon, it also includes the range increment. Ranged weapons with this trait use the range increment specified in the weapons Range entry."),
(257, 15, "Deadly d8", "On a critical hit, the weapon adds a weapon damage die of the listed size. Roll this after doubling the weapons damage. This increases to two dice if the weapon has a "),
(258, 15, "Deadly d10", "On a critical hit, the weapon adds a weapon damage die of the listed size. Roll this after doubling the weapons damage. This increases to two dice if the weapon has a "),
(259, 15, "Versatile S", "A versatile weapon can be used to deal a different type of damage than that listed in the Damage entry. This trait indicates the alternate damage type. For instance, a piercing weapon that is versatile S can be used to deal piercing or slashing damage. You choose the damage type each time you make an attack."),
(260, 15, "Versatile P", "A versatile weapon can be used to deal a different type of damage than that listed in the Damage entry. This trait indicates the alternate damage type. For instance, a piercing weapon that is versatile S can be used to deal piercing or slashing damage. You choose the damage type each time you make an attack."),
(261, 15, "Versatile B", "A versatile weapon can be used to deal a different type of damage than that listed in the Damage entry. This trait indicates the alternate damage type. For instance, a piercing weapon that is versatile S can be used to deal piercing or slashing damage. You choose the damage type each time you make an attack."),
(262, 15, "Two-Hand d8", "This weapon can be wielded with two hands. Doing so changes its weapon damage die to the indicated value. This change applies to all the weapons damage dice, such as those from "),
(263, 15, "Two-Hand d10", "This weapon can be wielded with two hands. Doing so changes its weapon damage die to the indicated value. This change applies to all the weapons damage dice, such as those from "),
(264, 15, "Two-Hand d12", "This weapon can be wielded with two hands. Doing so changes its weapon damage die to the indicated value. This change applies to all the weapons damage dice, such as those from "),
(265, 15, "Fatal d8", "The fatal trait includes a die size. On a critical hit, the weapons damage die increases to that die size instead of the normal die size, and the weapon adds one additional damage die of the listed size."),
(266, 15, "Fatal d10", "The fatal trait includes a die size. On a critical hit, the weapons damage die increases to that die size instead of the normal die size, and the weapon adds one additional damage die of the listed size."),
(267, 15, "Fatal d12", "The fatal trait includes a die size. On a critical hit, the weapons damage die increases to that die size instead of the normal die size, and the weapon adds one additional damage die of the listed size."),
(268, 15, "Jousting d6", "The weapon is suited for mounted combat with a harness or similar means. When mounted, if you moved at least 10 feet on the action before your attack, add a circumstance bonus to damage for that attack equal to the number of damage dice for the weapon. In addition, while mounted, you can wield the weapon in one hand, changing the damage die to the listed value."),
(269, 15, "Volley 30 ft.", "This ranged weapon is less effective at close distances. Your attacks against targets that are at a distance within the range listed take a 2 penalty.");

View File

@ -8,6 +8,7 @@ sqlite3 pf2.db < schema/bulk.sql
sqlite3 pf2.db < schema/sizes.sql sqlite3 pf2.db < schema/sizes.sql
sqlite3 pf2.db < schema/langs.sql sqlite3 pf2.db < schema/langs.sql
sqlite3 pf2.db < schema/traits.sql sqlite3 pf2.db < schema/traits.sql
sqlite3 pf2.db < schema/spells.sql
sqlite3 pf2.db < schema/feats.sql sqlite3 pf2.db < schema/feats.sql
sqlite3 pf2.db < schema/senses.sql sqlite3 pf2.db < schema/senses.sql
sqlite3 pf2.db < schema/ancestries.sql sqlite3 pf2.db < schema/ancestries.sql
@ -22,9 +23,20 @@ sqlite3 pf2.db < data/senses.sql
sqlite3 pf2.db < data/sizes.sql sqlite3 pf2.db < data/sizes.sql
sqlite3 pf2.db < data/langs.sql sqlite3 pf2.db < data/langs.sql
sqlite3 pf2.db < data/traits.sql sqlite3 pf2.db < data/traits.sql
sqlite3 pf2.db < data/spells.sql
sqlite3 pf2.db < data/feats.sql sqlite3 pf2.db < data/feats.sql
sqlite3 pf2.db < data/ancestries.sql sqlite3 pf2.db < data/ancestries.sql
sqlite3 pf2.db < data/armor.sql sqlite3 pf2.db < data/armor.sql
sqlite3 pf2.db < data/heritages.sql sqlite3 pf2.db < data/heritages.sql
# Comment out the following three lines if you don't want to generate the spell data.
cd data/third_party_json
python3 spells.py
cd ../..
# TODO Eventually we will stop relying on the spells.py script and I will have
# the actual .sql files for the spell data; I am waiting to see if the
# third-party source improves the data in the next few weeks. If not, we'll
# "divorce" from that data, dump to .sql, and manually manipulate going
# forward.

View File

@ -46,7 +46,9 @@ etc.. */
CREATE TABLE heritages ( CREATE TABLE heritages (
heritage_id INTEGER PRIMARY KEY, heritage_id INTEGER PRIMARY KEY,
short_name TEXT NOT NULL UNIQUE, short_name TEXT NOT NULL UNIQUE,
description TEXT NOT NULL description TEXT NOT NULL,
bonus_type TEXT, -- TODO Should this be text, or should this have its own table and FK?
bonus_id INTEGER -- TODO What is this referencing from data/heritages.sql ???
); );
CREATE TABLE ancestries_heritages ( CREATE TABLE ancestries_heritages (

View File

@ -15,6 +15,11 @@ CREATE TABLE spelltraditions (
name TEXT NOT NULL UNIQUE name TEXT NOT NULL UNIQUE
); );
CREATE TABLE spelltargets (
spelltargets_id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE
);
CREATE TABLE spellschools ( CREATE TABLE spellschools (
spellschools_id INTEGER PRIMARY KEY, spellschools_id INTEGER PRIMARY KEY,
sources_id INTEGER NOT NULL, sources_id INTEGER NOT NULL,
@ -24,27 +29,32 @@ CREATE TABLE spellschools (
FOREIGN KEY (sources_id) REFERENCES sources(sources_id) FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
); );
-- TODO eventually once data is finalized, lock down variables as NOT NULL /
-- UNIQUE as sanity requires :)
-- TODO Area eventually needs its own table
CREATE TABLE spells ( CREATE TABLE spells (
spells_id INTEGER PRIMARY KEY, spells_id INTEGER PRIMARY KEY,
sources_id INTEGER NOT NULL, sources_id INTEGER NOT NULL, -- generated in spells.py from scraped data
sources_pages TEXT, sources_pages TEXT, -- generated in spells.py from scraped data
nethysurl TEXT, name TEXT NOT NULL UNIQUE, -- scraped from github repo
name TEXT NOT NULL UNIQUE, level INTEGER, -- scraped from github repo
source TEXT, trigger TEXT, -- scraped from spells.py NOTE, there are no duplicate triggers
level INTEGER NOT NULL, -- as of CRB, so not bothering with a separate spell triggers
has_trigger BOOLEAN NOT NULL, -- table at this time
trigger TEXT, descr TEXT, -- scraped from github repo
descr TEXT NOT NULL, spelltypes_id INTEGER, -- generated from spells.py
spelltypes_id INTEGER NOT NULL, range_text TEXT, -- scraped from github repo
range_text TEXT, range_ft INTEGER, -- generated from text in spells.py
range_ft INTEGER, area_text TEXT, -- TODO need to figure out some sort of programmatic representation for this too
targets TEXT, spelltargets_id INTEGER,
nethysurl TEXT, -- scraped from github repo
FOREIGN KEY (sources_id) REFERENCES sources(sources_id), FOREIGN KEY (sources_id) REFERENCES sources(sources_id),
FOREIGN KEY (spelltypes_id) REFERENCES spelltypes(spelltypes_id) FOREIGN KEY (spelltypes_id) REFERENCES spelltypes(spelltypes_id),
FOREIGN KEY (spelltargets_id) REFERENCES spelltargets(spelltargets_id)
); );
CREATE TABLE spells_spellcomponents( CREATE TABLE spells_spellcomponents(
id INTEGER PRIMARY KEY,
spells_id INTEGER NOT NULL, spells_id INTEGER NOT NULL,
spellcomponents_id INTEGER NOT NULL, spellcomponents_id INTEGER NOT NULL,
FOREIGN KEY (spells_id) REFERENCES spells(spells_id), FOREIGN KEY (spells_id) REFERENCES spells(spells_id),
@ -56,6 +66,7 @@ CREATE TABLE spells_traits (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
spells_id INTEGER NOT NULL, spells_id INTEGER NOT NULL,
traits_id INTEGER NOT NULL, traits_id INTEGER NOT NULL,
UNIQUE(spells_id, traits_id),
FOREIGN KEY (spells_id) REFERENCES spells(spells_id), FOREIGN KEY (spells_id) REFERENCES spells(spells_id),
FOREIGN KEY (traits_id) REFERENCES traits(traits_id) FOREIGN KEY (traits_id) REFERENCES traits(traits_id)
); );