working on feats
parent
6677811fae
commit
5ffd104c6c
|
@ -1906,7 +1906,7 @@ feat:
|
||||||
descr: Given time to collect yourself after a near-death scrape, you can rebuild
|
descr: Given time to collect yourself after a near-death scrape, you can rebuild
|
||||||
your ferocity and withstand additional finishing blows. You can use Orc Ferocity
|
your ferocity and withstand additional finishing blows. You can use Orc Ferocity
|
||||||
with a frequency of once per hour, rather than once per day.
|
with a frequency of once per hour, rather than once per day.
|
||||||
frequency: null
|
frequency: once per hour
|
||||||
has_been_manually_proofread: false
|
has_been_manually_proofread: false
|
||||||
level: 13
|
level: 13
|
||||||
name: Incredible Ferocity
|
name: Incredible Ferocity
|
||||||
|
@ -3138,7 +3138,7 @@ feat:
|
||||||
prereqs:
|
prereqs:
|
||||||
- descr: 'Feature: dragon instinct'
|
- descr: 'Feature: dragon instinct'
|
||||||
feat: null
|
feat: null
|
||||||
requirement: You haven’t used this ability since you last Raged.
|
requirement: You haven't used this ability since you last Raged.
|
||||||
source:
|
source:
|
||||||
- abbr: CRB
|
- abbr: CRB
|
||||||
page_start: 90
|
page_start: 90
|
||||||
|
@ -3605,7 +3605,7 @@ feat:
|
||||||
prereqs:
|
prereqs:
|
||||||
- descr: 'Come And Get Me'
|
- descr: 'Come And Get Me'
|
||||||
feat: Come and Get Me
|
feat: Come and Get Me
|
||||||
requirement: You’re under the effect of Come and Get Me.
|
requirement: You're under the effect of Come and Get Me.
|
||||||
source:
|
source:
|
||||||
- abbr: CRB
|
- abbr: CRB
|
||||||
page_start: 93
|
page_start: 93
|
||||||
|
|
|
@ -75,3 +75,4 @@ requirement:
|
||||||
- You have an unexpended spell slot you could use to cast the triggered spell.
|
- You have an unexpended spell slot you could use to cast the triggered spell.
|
||||||
- Your most recent action was to cast a non-cantrip spell.
|
- Your most recent action was to cast a non-cantrip spell.
|
||||||
- The last action you used was Drain Bonded Item.
|
- The last action you used was Drain Bonded Item.
|
||||||
|
- You have a focus pool, and you have spent at least 1 Focus Point since you last regained any Focus Points.
|
||||||
|
|
115
gendb/gendb.py
115
gendb/gendb.py
|
@ -124,6 +124,10 @@ def main():
|
||||||
data = yaml.full_load(yl)
|
data = yaml.full_load(yl)
|
||||||
do_gear(data, conn)
|
do_gear(data, conn)
|
||||||
|
|
||||||
|
with open('feats.yaml') as yl:
|
||||||
|
data = yaml.full_load(yl)
|
||||||
|
do_feats(data, conn)
|
||||||
|
|
||||||
with open('ancestriesheritages.yaml') as yl:
|
with open('ancestriesheritages.yaml') as yl:
|
||||||
data = yaml.full_load(yl)
|
data = yaml.full_load(yl)
|
||||||
do_ancestries(data, conn)
|
do_ancestries(data, conn)
|
||||||
|
@ -132,6 +136,101 @@ def main():
|
||||||
data = yaml.full_load(yl)
|
data = yaml.full_load(yl)
|
||||||
do_heritages(data, conn)
|
do_heritages(data, conn)
|
||||||
|
|
||||||
|
def do_feats(data, conn):
|
||||||
|
|
||||||
|
table = """
|
||||||
|
CREATE TABLE feat (
|
||||||
|
feat_id INTEGER PRIMARY KEY,
|
||||||
|
actioncost_id INTEGER,
|
||||||
|
descr TEXT NOT NULL,
|
||||||
|
freq_id INTEGER,
|
||||||
|
level INTEGER NOT NULL,
|
||||||
|
name TEXT NOT NULL UNIQUE,
|
||||||
|
requirement_id INTEGER,
|
||||||
|
trigger_id INTEGER,
|
||||||
|
FOREIGN KEY (actioncost_id) REFERENCES actioncost(actioncost_id),
|
||||||
|
FOREIGN KEY (freq_id) REFERENCES frequency(freq_id),
|
||||||
|
FOREIGN KEY (requirement_id) REFERENCES requirement(requirement_id),
|
||||||
|
FOREIGN KEY (trigger_id) REFERENCES trigger(trigger_id)
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(table)
|
||||||
|
|
||||||
|
|
||||||
|
feat_result_list = []
|
||||||
|
for i in data['feat']:
|
||||||
|
if i['actioncost'] == None:
|
||||||
|
ac_id = None
|
||||||
|
else:
|
||||||
|
ac_id = get_actioncost_id_by_name(i['actioncost'], conn)
|
||||||
|
# print("ac_id for {} is {}".format(i['actioncost'], ac_id))
|
||||||
|
if i['frequency'] == None:
|
||||||
|
f_id = None
|
||||||
|
else:
|
||||||
|
f_id = get_freq_id_by_descr(i['frequency'], conn)
|
||||||
|
# print("f_id for {} is {}".format(i['frequency'], f_id))
|
||||||
|
if i['requirement'] == None:
|
||||||
|
r_id = None
|
||||||
|
else:
|
||||||
|
r_id = get_requirement_id_by_descr(i['requirement'], conn)
|
||||||
|
# print("f_id for {} is {}".format(i['frequency'], f_id))
|
||||||
|
|
||||||
|
# res = (ac_id, i['descr'], f_id, i['level'], i['name'], r_id, t_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
insert_stmt = "INSERT INTO feat (actioncost_id, descr, freq_id, level, name, requirement_id, trigger_id) VALUES (?,?,?,?,?,?,?);"
|
||||||
|
|
||||||
|
def get_requirement_id_by_descr(r, conn):
|
||||||
|
qstmt = "SELECT requirement_id FROM requirement WHERE descr=?;"
|
||||||
|
try:
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(qstmt, (r,))
|
||||||
|
except sqlite3.Error as e:
|
||||||
|
print("Error getting an requirement_id by name: {} Error: {}".format(r, e))
|
||||||
|
except:
|
||||||
|
print("Error getting an requirement_id_by_name something other than sqlite3 error")
|
||||||
|
else:
|
||||||
|
x = c.fetchone()
|
||||||
|
if x == None:
|
||||||
|
raise AssertionError('there was no requirement_id for given requirement name: {}\nYou should check to see if this requirement is in requirements.yaml and sometimes it is a straight apostrophe versus uni-code curly apostrophe.'.format(r))
|
||||||
|
else:
|
||||||
|
return x[0]
|
||||||
|
|
||||||
|
def get_freq_id_by_descr(f, conn):
|
||||||
|
qstmt = "SELECT freq_id FROM frequency WHERE freq_descr=?;"
|
||||||
|
try:
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(qstmt, (f,))
|
||||||
|
except sqlite3.Error as e:
|
||||||
|
print("Error getting an freq_id_id by name: {} Error: {}".format(f, e))
|
||||||
|
except:
|
||||||
|
print("Error getting an freq_id_id_by_name something other than sqlite3 error")
|
||||||
|
else:
|
||||||
|
x = c.fetchone()
|
||||||
|
if x == None:
|
||||||
|
raise AssertionError('there was no freq_id_id for given freq_id name: {}'.format(f))
|
||||||
|
else:
|
||||||
|
return x[0]
|
||||||
|
|
||||||
|
def get_actioncost_id_by_name(ac, conn):
|
||||||
|
qstmt = "SELECT actioncost_id FROM actioncost WHERE name=?;"
|
||||||
|
try:
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(qstmt, (ac,))
|
||||||
|
except sqlite3.Error as e:
|
||||||
|
print("Error getting an actioncost_id by name: {} Error: {}".format(ac, e))
|
||||||
|
except:
|
||||||
|
print("Error getting an actioncost_id_by_name something other than sqlite3 error")
|
||||||
|
else:
|
||||||
|
x = c.fetchone()
|
||||||
|
if x == None:
|
||||||
|
raise AssertionError('there was no actioncost_id for given actioncost name: {}'.format(ac))
|
||||||
|
else:
|
||||||
|
return x[0]
|
||||||
|
|
||||||
|
|
||||||
def do_heritages(data, conn):
|
def do_heritages(data, conn):
|
||||||
table = """
|
table = """
|
||||||
CREATE TABLE heritages (
|
CREATE TABLE heritages (
|
||||||
|
@ -153,7 +252,7 @@ def do_heritages(data, conn):
|
||||||
rowid = c.fetchone()
|
rowid = c.fetchone()
|
||||||
#FOR EACH HERITAGE, INSERT INTO TABLE USING ANCESTRY ID
|
#FOR EACH HERITAGE, INSERT INTO TABLE USING ANCESTRY ID
|
||||||
for j in i['heritages']:
|
for j in i['heritages']:
|
||||||
print("doing this heritage: {}".format(j['name']))
|
# print("doing this heritage: {}".format(j['name']))
|
||||||
stmt = "INSERT INTO heritages (name, descr, ancestry_id) VALUES (?,?,?);"
|
stmt = "INSERT INTO heritages (name, descr, ancestry_id) VALUES (?,?,?);"
|
||||||
c.execute(stmt, (j['name'], j['descr'], rowid[0]))
|
c.execute(stmt, (j['name'], j['descr'], rowid[0]))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
@ -226,7 +325,7 @@ def do_ancestries(data, conn):
|
||||||
sinp_data = (i['size'], )
|
sinp_data = (i['size'], )
|
||||||
sres = c.execute(sstmt, sinp_data).fetchall()
|
sres = c.execute(sstmt, sinp_data).fetchall()
|
||||||
sid = sres[0][0]
|
sid = sres[0][0]
|
||||||
print(sid)
|
# print(sid)
|
||||||
|
|
||||||
# Get the vision_id
|
# Get the vision_id
|
||||||
vstmt = """
|
vstmt = """
|
||||||
|
@ -234,12 +333,12 @@ def do_ancestries(data, conn):
|
||||||
"""
|
"""
|
||||||
vinp_data = (i['senses'], )
|
vinp_data = (i['senses'], )
|
||||||
vres = c.execute(vstmt, vinp_data).fetchall()
|
vres = c.execute(vstmt, vinp_data).fetchall()
|
||||||
print(vres)
|
# print(vres)
|
||||||
if len(vres) > 0:
|
if len(vres) > 0:
|
||||||
vid = vres[0][0]
|
vid = vres[0][0]
|
||||||
else:
|
else:
|
||||||
vid = None
|
vid = None
|
||||||
print(vid)
|
# print(vid)
|
||||||
|
|
||||||
#print(i)
|
#print(i)
|
||||||
inp_data.append(
|
inp_data.append(
|
||||||
|
@ -261,7 +360,7 @@ def do_ancestries(data, conn):
|
||||||
if i['boosts'] != None:
|
if i['boosts'] != None:
|
||||||
for j in i['boosts']:
|
for j in i['boosts']:
|
||||||
boostlist.append((i['name'], j))
|
boostlist.append((i['name'], j))
|
||||||
print("boostlist is:\t{}".format(boostlist))
|
# print("boostlist is:\t{}".format(boostlist))
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
INSERT INTO ancestries_boosts (ancestry_id, abilityscore_id) VALUES (
|
INSERT INTO ancestries_boosts (ancestry_id, abilityscore_id) VALUES (
|
||||||
|
@ -286,7 +385,7 @@ def do_ancestries(data, conn):
|
||||||
if i['flaws'] != None:
|
if i['flaws'] != None:
|
||||||
for j in i['flaws']:
|
for j in i['flaws']:
|
||||||
flawlist.append((i['name'], j))
|
flawlist.append((i['name'], j))
|
||||||
print("flawlist is:\t{}".format(flawlist))
|
# print("flawlist is:\t{}".format(flawlist))
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
INSERT INTO ancestries_flaws (ancestry_id, abilityscore_id) VALUES (
|
INSERT INTO ancestries_flaws (ancestry_id, abilityscore_id) VALUES (
|
||||||
|
@ -311,7 +410,7 @@ def do_ancestries(data, conn):
|
||||||
if i['traits'] != None:
|
if i['traits'] != None:
|
||||||
for j in i['traits']:
|
for j in i['traits']:
|
||||||
traitlist.append((i['name'], j))
|
traitlist.append((i['name'], j))
|
||||||
print("traitlist is:\t{}".format(traitlist))
|
# print("traitlist is:\t{}".format(traitlist))
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
INSERT INTO ancestries_traits (ancestry_id, trait_id) VALUES (
|
INSERT INTO ancestries_traits (ancestry_id, trait_id) VALUES (
|
||||||
|
@ -605,7 +704,7 @@ def do_armor(data, conn):
|
||||||
# insert basics into armorcategory table
|
# insert basics into armorcategory table
|
||||||
inp_data = []
|
inp_data = []
|
||||||
for i in data['armorcategory']:
|
for i in data['armorcategory']:
|
||||||
print(i)
|
# print(i)
|
||||||
inp_data.append((i, ))
|
inp_data.append((i, ))
|
||||||
|
|
||||||
stmt = "INSERT INTO armorcategory(name) VALUES (?)"
|
stmt = "INSERT INTO armorcategory(name) VALUES (?)"
|
||||||
|
|
Loading…
Reference in New Issue