spells now have triggers working in them
parent
b0b6a20b83
commit
83f140d3a6
|
@ -46,17 +46,25 @@ def main():
|
||||||
stypes = c.fetchall()
|
stypes = c.fetchall()
|
||||||
# print(traits)
|
# 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
|
id = 0
|
||||||
for i in sorted_dicts:
|
for i in sorted_dicts:
|
||||||
id += 1
|
id += 1
|
||||||
# insert basics of a spell
|
|
||||||
do_basic_sql(i, id, conn)
|
do_basic_sql(i, id, conn)
|
||||||
do_range_numbers(i,id,conn)
|
do_range_numbers(i,id,conn)
|
||||||
do_sources_pages(i,id,conn)
|
do_sources_pages(i,id,conn)
|
||||||
do_spell_traits(i,id,conn,traits)
|
do_spell_traits(i,id,conn,traits)
|
||||||
do_spell_types(i,id,conn,stypes)
|
do_spell_types(i,id,conn,stypes)
|
||||||
# TODO do all the traits, FK stuff etc...
|
|
||||||
|
|
||||||
def do_spell_types(i,id,conn,stypes):
|
def do_spell_types(i,id,conn,stypes):
|
||||||
res = 0
|
res = 0
|
||||||
|
@ -169,8 +177,9 @@ def do_basic_sql(i, id, conn):
|
||||||
name,
|
name,
|
||||||
level,
|
level,
|
||||||
descr,
|
descr,
|
||||||
range_text)
|
range_text,
|
||||||
VALUES (?,?,?,?,?,?,?,?)"""
|
trigger)
|
||||||
|
VALUES (?,?,?,?,?,?,?,?,?)"""
|
||||||
|
|
||||||
rge = None
|
rge = None
|
||||||
if 'range' in i:
|
if 'range' in i:
|
||||||
|
@ -180,7 +189,11 @@ def do_basic_sql(i, id, conn):
|
||||||
if 'description' in i:
|
if 'description' in i:
|
||||||
dscr = i['description']
|
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:
|
try:
|
||||||
conn.execute(stmt, inp)
|
conn.execute(stmt, inp)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -32,7 +32,7 @@ CREATE TABLE spells (
|
||||||
sources_pages TEXT, -- generated in spells.py from scraped data
|
sources_pages TEXT, -- generated in spells.py from scraped data
|
||||||
name TEXT NOT NULL UNIQUE, -- scraped from github repo
|
name TEXT NOT NULL UNIQUE, -- scraped from github repo
|
||||||
level INTEGER, -- 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
|
descr TEXT, -- scraped from github repo
|
||||||
spelltypes_id INTEGER, -- generated from spells.py
|
spelltypes_id INTEGER, -- generated from spells.py
|
||||||
range_text TEXT, -- scraped from github repo
|
range_text TEXT, -- scraped from github repo
|
||||||
|
|
Loading…
Reference in New Issue