From f9135fcfc0686aaa48d0d19c30f33f8af4e2288a Mon Sep 17 00:00:00 2001 From: James Miller Date: Fri, 2 Aug 2019 18:04:34 -0500 Subject: [PATCH 1/4] add new schema files --- schema/ancestries.sql | 0 schema/backgrounds.sql | 0 schema/classes.sql | 0 schema/equipment.sql | 0 schema/feats.sql | 0 schema/skills.sql | 0 schema/spells.sql | 0 7 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 schema/ancestries.sql create mode 100644 schema/backgrounds.sql create mode 100644 schema/classes.sql create mode 100644 schema/equipment.sql create mode 100644 schema/feats.sql create mode 100644 schema/skills.sql create mode 100644 schema/spells.sql diff --git a/schema/ancestries.sql b/schema/ancestries.sql new file mode 100644 index 0000000..e69de29 diff --git a/schema/backgrounds.sql b/schema/backgrounds.sql new file mode 100644 index 0000000..e69de29 diff --git a/schema/classes.sql b/schema/classes.sql new file mode 100644 index 0000000..e69de29 diff --git a/schema/equipment.sql b/schema/equipment.sql new file mode 100644 index 0000000..e69de29 diff --git a/schema/feats.sql b/schema/feats.sql new file mode 100644 index 0000000..e69de29 diff --git a/schema/skills.sql b/schema/skills.sql new file mode 100644 index 0000000..e69de29 diff --git a/schema/spells.sql b/schema/spells.sql new file mode 100644 index 0000000..e69de29 From 598fbb65818121c8ae56e4a2d1eed1b5696df925 Mon Sep 17 00:00:00 2001 From: James Miller Date: Fri, 2 Aug 2019 18:12:59 -0500 Subject: [PATCH 2/4] added values for ability scores in binary form --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 7a1c041..1f7d8ce 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,20 @@ sqlite database. 2. Write script to generate sqlite database from sql code; 3. Write sql code; and 4. Drinks for all when finished! + +# Conventions in the Code + +## Ability Scores in Integer Representation + +| Ability Type | Value | +|--------------|-------| +| STR | 1 | +| DEX | 2 | +| CON | 4 | +| INT | 8 | +| WIS | 16 | +| CHA | 32 | + +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 not have to have more database +tables than necessary when trying to list one or more ability scores. From 541b07da241e9779f1276e74b66889413e7a5041 Mon Sep 17 00:00:00 2001 From: James Miller Date: Fri, 2 Aug 2019 21:32:19 -0500 Subject: [PATCH 3/4] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1f7d8ce..194468c 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ sqlite database. | INT | 8 | | WIS | 16 | | CHA | 32 | +| Free 1 | 64 | +| Free 2 | 128 | 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 not have to have more database From a748fbe2b46f68bf38535d76b005aeffd4d0cb4b Mon Sep 17 00:00:00 2001 From: James Miller Date: Fri, 2 Aug 2019 21:32:51 -0500 Subject: [PATCH 4/4] first mockups of ancestry schema and some data --- data/traits.sql | 19 +++++++ schema/ancestries.sql | 113 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 data/traits.sql diff --git a/data/traits.sql b/data/traits.sql new file mode 100644 index 0000000..c8c6003 --- /dev/null +++ b/data/traits.sql @@ -0,0 +1,19 @@ + +/* TODO Fill in all the other traits from here: https://2e.aonprd.com/Traits.aspx */ + + +INSERT INTO traits (trait_id, + short_name, + description) +VALUES + (1, 'Dwarf', 'A creature with this trait is a member of the dwarf ancestry. Dwarves are stout folk who often live underground and typically have darkvision. An ability with this trait can be used or selected only by dwarves. An item with this trait is created and used by dwarves.'), + (2, 'Elf', 'A creature with this trait is a member of the elf ancestry. Elves are mysterious people with rich traditions of magic and scholarship who typically have low-light vision. An ability with this trait can be used or selected only by elves. A weapon with this trait is created and used by elves.'), + (3, 'Gnome', 'TODO'), + (4, 'Goblin', 'TODO'), + (5, 'Halfling', 'TODO'), + (6, 'Human', 'TODO'), + (7, 'Half-Elf', 'TODO'), + (8, 'Half-Orc', 'TODO'), + (9, 'Humanoid', 'TODO') +); + diff --git a/schema/ancestries.sql b/schema/ancestries.sql index e69de29..6427f02 100644 --- a/schema/ancestries.sql +++ b/schema/ancestries.sql @@ -0,0 +1,113 @@ + +/* + +TODO Need to decide on whether to do a massive feats table, or to split feats +into separate tables for general feats, ancestry feats, background feats, etc... + +I think one big feat table that has a feat type in it and then an ancestry_feat +table that matches feats to ancestries, etc.. + +*/ + + +CREATE TABLE ancestries ( + ancestry_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE, + flavor_text TEXT NOT NULL, + hp INTEGER NOT NULL, + size_id INTEGER NOT NULL, + boosts INTEGER NOT NULL, + flaws INTEGER NOT NULL, + vision_id INTEGER NOT NULL, + FOREIGN KEY (vision_id) REFERENCES visions(vision_id), + FOREIGN KEY (size_id) REFERENCES sizes(size_id) +); + +CREATE TABLE visions ( + vision_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE, + description TEXT NOT NULL +); + +/* Need to figure out how to model heritages that also have reactions / feats +etc.. */ + +CREATE TABLE heritages ( + heritage_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE, + description TEXT NOT NULL +); + +CREATE TABLE ancestries_heritages ( + id INTEGER PRIMARY KEY, + ancestry_id INTEGER NOT NULL, + heritage_id INTEGER NOT NULL, + UNIQUE(ancestry_id, heritage_id), + FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id), + FOREIGN KEY (heritage_id) REFERENCES heritages(heritage_id) +); + +/* TODO can the description var be UNIQUE? */ +/* has partial data done */ +CREATE TABLE traits ( + trait_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE, + description TEXT NOT NULL +); + +CREATE TABLE ancestries_traits ( + id INTEGER PRIMARY KEY, + ancestry_id INTEGER NOT NULL, + trait_id INTEGER NOT NULL, + UNIQUE(ancestry_id, trait_id), + FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id), + FOREIGN KEY (trait_id) REFERENCES traits(trait_id) +); + +CREATE TABLE sizes ( + size_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE +); + +CREATE TABLE langs ( + lang_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE +); + +CREATE TABLE ancestries_langs ( + id INTEGER PRIMARY KEY, + ancestry_id INTEGER NOT NULL, + lang_id INTEGER NOT NULL, + FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id), + FOREIGN KEY (lang_id) REFERENCES langs(lang_id), +); + + +CREATE TABLE ancestry_additionalangs ( + id INTEGER PRIMARY KEY, + ancestry_id INTEGER NOT NULL, + lang_id INTEGER NOT NULL, + FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id), + FOREIGN KEY (lang_id) REFERENCES langs(lang_id), +); + +/* Need to rethink how to model the various prerequisites */ + +CREATE TABLE feats ( + feat_id INTEGER PRIMARY KEY, + short_name TEXT NOT NULL UNIQUE, + prereq_feats INTEGER, + prereq_ability_scores INTEGER, + prereq_proficiency_ranks INTEGER, + frequency TEXT, + triggers TEXT, + reqs TEXT, +); + +CREATE TABLE feats_traits ( + id INTEGER PRIMARY KEY, + feat_id INTEGER NOT NULL, + trait_id INTEGER NOT NULL, + FOREIGN KEY (feat_id) REFERENCES feats(feat_id), + FOREIGN KEY (trait_id) REFERENCES traits(trait_id) +);