Merge branch 'master' of https://gitlab.com/M3tin1/pathfinder-2-sqlite
						commit
						5fa2bef25b
					
				|  | @ -6,4 +6,4 @@ | ||||||
| 6. Mirko Rainer | 6. Mirko Rainer | ||||||
| 7. Joey Burney | 7. Joey Burney | ||||||
| 8. Brad Laney | 8. Brad Laney | ||||||
| 9. Gitlab name: @M3tin1 (TODO: Get name.) | 9. Metin Ünüvar | ||||||
|  |  | ||||||
							
								
								
									
										42
									
								
								bin/gendb.py
								
								
								
								
							
							
						
						
									
										42
									
								
								bin/gendb.py
								
								
								
								
							|  | @ -150,6 +150,7 @@ def main(): | ||||||
|         data = yaml.full_load(yl) |         data = yaml.full_load(yl) | ||||||
|     do_ancestries(data, conn) |     do_ancestries(data, conn) | ||||||
| 
 | 
 | ||||||
|  |     # Must be called after feats are loaded | ||||||
|     with open('ancestriesheritages.yaml') as yl: |     with open('ancestriesheritages.yaml') as yl: | ||||||
|         data = yaml.full_load(yl) |         data = yaml.full_load(yl) | ||||||
|     do_heritages(data, conn) |     do_heritages(data, conn) | ||||||
|  | @ -459,7 +460,7 @@ def get_actioncost_id_by_name(ac, conn): | ||||||
| 
 | 
 | ||||||
| def do_heritages(data, conn): | def do_heritages(data, conn): | ||||||
|     table = """ |     table = """ | ||||||
|     CREATE TABLE heritages ( |     CREATE TABLE heritage ( | ||||||
|         heritage_id INTEGER PRIMARY KEY, |         heritage_id INTEGER PRIMARY KEY, | ||||||
|         name TEXT NOT NULL UNIQUE, |         name TEXT NOT NULL UNIQUE, | ||||||
|         descr TEXT NOT NULL, |         descr TEXT NOT NULL, | ||||||
|  | @ -471,6 +472,19 @@ def do_heritages(data, conn): | ||||||
|     c = conn.cursor() |     c = conn.cursor() | ||||||
|     c.execute(table) |     c.execute(table) | ||||||
| 
 | 
 | ||||||
|  |     table = """ | ||||||
|  |     CREATE TABLE heritage_feat ( | ||||||
|  |       id INTEGER PRIMARY KEY, | ||||||
|  |       heritage_id INTEGER NOT NULL, | ||||||
|  |       feat_id INTEGER NOT NULL, | ||||||
|  |       FOREIGN KEY (heritage_id) REFERENCES heritage(heritage_id), | ||||||
|  |       FOREIGN KEY (feat_id) REFERENCES feat(feat_id) | ||||||
|  |     ); | ||||||
|  |     """ | ||||||
|  | 
 | ||||||
|  |     c = conn.cursor() | ||||||
|  |     c.execute(table) | ||||||
|  | 
 | ||||||
|     for i in data['ancestries']: |     for i in data['ancestries']: | ||||||
|         #GET ID OF ANCESTRY |         #GET ID OF ANCESTRY | ||||||
|         stmt = "SELECT ancestry_id FROM ancestries WHERE name=?;" |         stmt = "SELECT ancestry_id FROM ancestries WHERE name=?;" | ||||||
|  | @ -479,14 +493,32 @@ def do_heritages(data, conn): | ||||||
|         #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 heritage (name, descr, ancestry_id) VALUES (?,?,?);" | ||||||
|  |             try: | ||||||
|                 c.execute(stmt, (j['name'], j['descr'], rowid[0])) |                 c.execute(stmt, (j['name'], j['descr'], rowid[0])) | ||||||
|  |             except sqlite3.Error as e: | ||||||
|  |                     print("Error inserting a heritage: {}".format(e)) | ||||||
|  |             except: | ||||||
|  |                     print("Error inserting a heritage other than sqlite3 error") | ||||||
|  |             else: | ||||||
|                 conn.commit() |                 conn.commit() | ||||||
| 
 | 
 | ||||||
|             if j['feat'] != None: |             if j['feat'] != None: | ||||||
|                 print("We have a feat that is not equal to none: {}".format(j['feat'])) |                 # print("We have a feat that is not equal to none: {}".format(j['feat'])) | ||||||
|                 print("TODO THIS NEEDS TO GET DONE AFTER FEATS ARE IN SQL") |                 stmt = """INSERT INTO heritage_feat | ||||||
|                 # i.e. TODO select feat_id where name = j['feat] then insert into a heritages_feats table |                 (heritage_id, feat_id) | ||||||
|  |                 VALUES ( | ||||||
|  |                   (SELECT heritage_id FROM heritage WHERE name=?), | ||||||
|  |                   (SELECT feat_id FROM feat WHERE name=?) | ||||||
|  |                 );""" | ||||||
|  |                 try: | ||||||
|  |                     c.execute(stmt, (j['name'],j['feat'])) | ||||||
|  |                 except sqlite3.Error as e: | ||||||
|  |                     print("Error linking a heritage to its feat: {}".format(e)) | ||||||
|  |                 except: | ||||||
|  |                     print("Error linking a heritage something other than sqlite3 error") | ||||||
|  |                 else: | ||||||
|  |                     conn.commit() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def do_ancestries(data, conn): | def do_ancestries(data, conn): | ||||||
|  |  | ||||||
|  | @ -1,89 +1,107 @@ | ||||||
| weapongroups: | weapongroups: | ||||||
| - descr: TODO descr from pg 283-84 | - descr: Choose one creature adjacent to the initial target and within reach. If its | ||||||
|  |     AC is lower than your attack roll result for the critical hit, you deal damage | ||||||
|  |     to that creature equal to the result of the weapon damage die you rolled (including | ||||||
|  |     extra dice for its potency rune, if any). This amount isn't doubled, and no bonuses | ||||||
|  |     or other additional dice apply to this damage. | ||||||
|   name: Axe |   name: Axe | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 283 |     page_start: 283 | ||||||
|     page_stop: 283 |     page_stop: 283 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: Increase the radius of the bomb's splash damage (if any) to 10 feet. | ||||||
|   name: Bomb |   name: Bomb | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: If the target of the critical hit is adjacent to a surface, it gets stuck | ||||||
|  |     to that surface by the missile. The target is immobilized and must spend an Interact | ||||||
|  |     action to attempt a DC 10 Athletics check to pull the missile free; it can't move | ||||||
|  |     from its space until it succeeds. The creature doesn’t become stuck if it is incorporeal, | ||||||
|  |     is liquid (like a water elemental or some oozes), or could otherwise escape without | ||||||
|  |     effort. | ||||||
|   name: Bow |   name: Bow | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target must succeed at a Fortitude save against your class DC or be slowed | ||||||
|  |     1 until the end of your next turn. | ||||||
|   name: Brawling |   name: Brawling | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: You knock the target away from you up to 10 feet (you choose the distance). | ||||||
|  |     This is forced movement. | ||||||
|   name: Club |   name: Club | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target takes 1d6 persistent bleed damage. You gain an item bonus to this | ||||||
|  |     bleed damage equal to the weapon's item bonus to attack rolls. | ||||||
|   name: Dart |   name: Dart | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target is knocked prone. | ||||||
|   name: Flail |   name: Flail | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target is knocked prone. | ||||||
|   name: Hammer |   name: Hammer | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target takes 1d6 persistent bleed damage. You gain an item bonus to this | ||||||
|  |     bleed damage equal to the weapon's item bonus to attack rolls. | ||||||
|   name: Knife |   name: Knife | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The weapon viciously pierces the target, who takes 2 additional damage per | ||||||
|  |     weapon damage die. | ||||||
|   name: Pick |   name: Pick | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target is moved 5 feet in a direction of your choice. This is forced | ||||||
|  |     movement. | ||||||
|   name: Polearm |   name: Polearm | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: You knock the target back from you 5 feet. This is forced movement. | ||||||
|   name: Shield |   name: Shield | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target must succeed at a Fortitude save against your class DC or be stunned | ||||||
|  |     1. | ||||||
|   name: Sling |   name: Sling | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The weapon pierces the target, weakening its attacks. The target is clumsy | ||||||
|  |     1 until the start of your next turn. | ||||||
|   name: Spear |   name: Spear | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|     page_start: 284 |     page_start: 284 | ||||||
|     page_stop: 284 |     page_stop: 284 | ||||||
| - descr: TODO descr from pg 283-84 | - descr: The target is made off-balance by your attack, becoming flat-footed until | ||||||
|  |     the start of your next turn. | ||||||
|   name: Sword |   name: Sword | ||||||
|   source: |   source: | ||||||
|   - abbr: CRB |   - abbr: CRB | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue