Merge branch 'schema-mockups'
commit
409e0aba61
19
README.md
19
README.md
|
@ -26,3 +26,22 @@ sqlite database.
|
||||||
2. Write script to generate sqlite database from sql code;
|
2. Write script to generate sqlite database from sql code;
|
||||||
3. Write sql code; and
|
3. Write sql code; and
|
||||||
4. Drinks for all when finished!
|
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 |
|
||||||
|
| 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
|
||||||
|
tables than necessary when trying to list one or more ability scores.
|
||||||
|
|
|
@ -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')
|
||||||
|
);
|
||||||
|
|
|
@ -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)
|
||||||
|
);
|
Loading…
Reference in New Issue