spells now have triggers working in them

merge-requests/29/head
James Miller 2019-08-10 15:13:24 -05:00
parent b0b6a20b83
commit 83f140d3a6
2 changed files with 19 additions and 6 deletions

View File

@ -46,17 +46,25 @@ def main():
stypes = c.fetchall()
# print(traits)
# 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)))
id = 0
for i in sorted_dicts:
id += 1
# insert basics of a spell
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)
# TODO do all the traits, FK stuff etc...
def do_spell_types(i,id,conn,stypes):
res = 0
@ -169,8 +177,9 @@ def do_basic_sql(i, id, conn):
name,
level,
descr,
range_text)
VALUES (?,?,?,?,?,?,?,?)"""
range_text,
trigger)
VALUES (?,?,?,?,?,?,?,?,?)"""
rge = None
if 'range' in i:
@ -180,7 +189,11 @@ def do_basic_sql(i, id, conn):
if 'description' in i:
dscr = i['description']
inp = (id, 1, i['source'], i['nethysUrl'], i['name'], i['level'], dscr, rge)
trg = None
if 'trigger' in i:
trg = i['trigger']
inp = (id, 1, i['source'], i['nethysUrl'], i['name'], i['level'], dscr, rge, trg)
try:
conn.execute(stmt, inp)
except:

View File

@ -32,7 +32,7 @@ CREATE TABLE spells (
sources_pages TEXT, -- generated in spells.py from scraped data
name TEXT NOT NULL UNIQUE, -- scraped from github repo
level INTEGER, -- scraped from github repo
trigger TEXT, -- TODO in spells.py
trigger TEXT, -- scraped from spells.py NOTE, there are no duplicate triggers as of CRB, so not bothering with a separate spell triggers table at this time
descr TEXT, -- scraped from github repo
spelltypes_id INTEGER, -- generated from spells.py
range_text TEXT, -- scraped from github repo