diff --git a/data/alignments.sql b/data/alignments.sql new file mode 100644 index 0000000..d93ffae --- /dev/null +++ b/data/alignments.sql @@ -0,0 +1,16 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +BEGIN TRANSACTION; +INSERT INTO alignments VALUES(1,'Lawful Good','LG'); +INSERT INTO alignments VALUES(2,'Neutral Good','NG'); +INSERT INTO alignments VALUES(3,'Chaotic Good','CG'); +INSERT INTO alignments VALUES(4,'Lawful Neutral','LN'); +INSERT INTO alignments VALUES(5,'True Neutral','N'); -- per CRB they use 'True + -- Neutral' and 'N' only +INSERT INTO alignments VALUES(6,'Chaotic Neutral','CN'); +INSERT INTO alignments VALUES(7,'Lawful Evil','LE'); +INSERT INTO alignments VALUES(8,'Neutral Evil','NE'); +INSERT INTO alignments VALUES(9,'Chaotic Evil','CE'); +COMMIT; diff --git a/data/movements.sql b/data/movements.sql new file mode 100644 index 0000000..c96a2dc --- /dev/null +++ b/data/movements.sql @@ -0,0 +1,16 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +-- TODO any other movements? + +BEGIN TRANSACTION; +INSERT INTO movements VALUES(0, 'Land'); -- This is already incorporated into + -- monsters and ancestries but is + -- included here so we have the type of + -- speed +INSERT INTO movements VALUES(1, 'Burrow'); +INSERT INTO movements VALUES(2, 'Climb'); +INSERT INTO movements VALUES(3, 'Fly'); +INSERT INTO movements VALUES(4, 'Swim'); +COMMIT; diff --git a/data/senses.sql b/data/senses.sql index fc655a0..905852f 100644 --- a/data/senses.sql +++ b/data/senses.sql @@ -8,6 +8,8 @@ PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned /* TODO smoke vision is from young-red dragon */ INSERT INTO senses (senses_id, + sources_id, + sources_pages, short_name, description) VALUES diff --git a/data/skills.sql b/data/skills.sql new file mode 100644 index 0000000..e096cc8 --- /dev/null +++ b/data/skills.sql @@ -0,0 +1,25 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +-- TODO Need to enter descriptions + +BEGIN TRANSACTION; +INSERT INTO skills VALUES(1, 1, '240', 'Acrobatics', 'TODO'); +INSERT INTO skills VALUES(2, 1, '241', 'Arcana', 'TODO'); +INSERT INTO skills VALUES(3, 1, '241', 'Athletics', 'TODO'); +INSERT INTO skills VALUES(4, 1, '243', 'Crafting', 'TODO'); +INSERT INTO skills VALUES(5, 1, '245', 'Deception', 'TODO'); +INSERT INTO skills VALUES(6, 1, '246', 'Diplomacy', 'TODO'); +INSERT INTO skills VALUES(7, 1, '247', 'Intimidation', 'TODO'); +INSERT INTO skills VALUES(8, 1, '247', 'Lore', 'TODO'); -- TODO special case +INSERT INTO skills VALUES(9, 1, '248', 'Medicine', 'TODO'); +INSERT INTO skills VALUES(10, 1, '249', 'Nature', 'TODO'); +INSERT INTO skills VALUES(11, 1, '249', 'Occultism', 'TODO'); +INSERT INTO skills VALUES(12, 1, '250', 'Performance', 'TODO'); +INSERT INTO skills VALUES(13, 1, '250', 'Religion', 'TODO'); +INSERT INTO skills VALUES(14, 1, '250', 'Society', 'TODO'); +INSERT INTO skills VALUES(15, 1, '251', 'Stealth', 'TODO'); +INSERT INTO skills VALUES(16, 1, '252', 'Survival', 'TODO'); +INSERT INTO skills VALUES(17, 1, '253', 'Thievery', 'TODO'); +COMMIT; diff --git a/gendb.sh b/gendb.sh index dd0b307..ff485c0 100755 --- a/gendb.sh +++ b/gendb.sh @@ -1,6 +1,10 @@ +# UNCOMMENT FOR DEBUGGING #!/bin/sh -v rm pf2.db echo 'loading schema' sqlite3 pf2.db < schema/sources.sql +sqlite3 pf2.db < schema/alignments.sql +sqlite3 pf2.db < schema/skills.sql +sqlite3 pf2.db < schema/movements.sql sqlite3 pf2.db < schema/damagetypes.sql sqlite3 pf2.db < schema/conditions.sql sqlite3 pf2.db < schema/backgrounds.sql @@ -20,6 +24,9 @@ sqlite3 pf2.db < schema/weapons.sql sqlite3 pf2.db < schema/ammunition.sql echo 'loading data' sqlite3 pf2.db < data/sources.sql +sqlite3 pf2.db < data/alignments.sql +sqlite3 pf2.db < data/skills.sql +sqlite3 pf2.db < data/movements.sql sqlite3 pf2.db < data/damagetypes.sql sqlite3 pf2.db < data/conditions.sql sqlite3 pf2.db < data/backgrounds.sql diff --git a/schema/alignments.sql b/schema/alignments.sql new file mode 100644 index 0000000..be4c6a9 --- /dev/null +++ b/schema/alignments.sql @@ -0,0 +1,9 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +CREATE TABLE alignments ( + alignments_id INTEGER PRIMARY KEY, + "name" TEXT UNIQUE NOT NULL, -- 'Lawful Good' + abbr TEXT UNIQUE NOT NULL -- 'LG' +); diff --git a/schema/monsters.sql b/schema/monsters.sql new file mode 100644 index 0000000..a4448e0 --- /dev/null +++ b/schema/monsters.sql @@ -0,0 +1,135 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +-- TODO needs data + +-- CREATE TABLE monstercategories( +-- monstercategories_id INTEGER PRIMARY KEY, +-- is_comty_use BOOLEAN NOT NULL, -- false = no community use policy req +-- "name" TEXT NOT NULL UNIQUE +-- ); + +-- Rarity will be by trait +-- Monster 'type' will be by trait +-- Monster category is also by trait + +-- So the bestiary breaks down trait versus category or family, but then sticks +-- them all in the trait position on the stat block, so I think we just do it +-- all with traits. Thoughts? + +CREATE TABLE monsters ( + monsters_id INTEGER PRIMARY KEY, + is_comty_use BOOLEAN NOT NULL, -- false = no community use policy req + sources_id INTEGER, -- old style source entries + sources_pages TEXT, -- old style source entries + sourceentries_id INTEGER, -- new style source entries + -- monstercategories_id INTEGER, -- Humanoid etc.. + "name" TEXT NOT NULL UNIQUE, + "level" INTEGER, + alignment_id INTEGER, -- i.e. NG, LE etc.. + perception INTEGER, + sizes_id INTEGER, -- i.e. large medium small etc.. + ac INTEGER, + fortitude INTEGER, + reflex INTEGER, + will INTEGER, + hp INTEGER, + land_speed INTEGER, -- will have separate many-to-many table for other movements + str_mod INTEGER, + dex_mod INTEGER, + con_mod INTEGER, + int_mod INTEGER, + wis_mod INTEGER, + cha_mod INTEGER, + descr TEXT, -- The idea with this is for this to hold the entire stat block + -- text in it for those that want to do a simple query. I DO + -- intend to break out all the actions etc. into a separate table + -- and do many-to-many joins. Yes, this duplicates some data but + -- this is more for getting markdown formatting of the stat block + -- in one nice column. + FOREIGN KEY (alignments_id) REFERENCES alignments(alignments_id), + -- FOREIGN KEY (monstercategories_id) REFERENCES monstercategories(monstercategories_id), + FOREIGN KEY (sizes_id) REFERENCES sizes(sizes_id), + FOREIGN KEY (sources_id) REFERENCES sources(sources_id), + FOREIGN KEY (sourceentries_id) REFERENCES sourceentries(sourceentries_id) +); + +CREATE TABLE monsterflavortexttypes ( + monsterflavortexttypes_id INTEGER PRIMARY KEY, + "name" TEXT NOT NULL UNIQUE + -- page 7 Bestiary + -- 'Monster Category' -- i.e. "Bear" + -- 'Specific Monster' -- i.e. "Grizzly Bear" + -- 'Advice and Rules' + -- 'Related Creatures' + -- 'Additional Lore' + -- 'Treasure and Rewards' + -- 'Locations' +); + +CREATE TABLE monsterflavortexts ( + monsterflavortexts_id INTEGER PRIMARY KEY, + monsterflavortexttypes_id INTEGER, + heading TEXT NOT NULL, + mft_text TEXT NOT NULL, + FOREIGN KEY (monsterflavortexttypes_id) REFERENCES monsterflavortexttypes(monsterflavortexttype_id) +); + +CREATE TABLE monsters_senses ( + id INTEGER PRIMARY KEY, + monsters_id INTEGER NOT NULL, + immunities_id INTEGER NOT NULL, + FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id), + FOREIGN KEY (senses_id) REFERENCES senses(senses_id) +); + +CREATE TABLE monsters_immunities ( + id INTEGER PRIMARY KEY, + monsters_id INTEGER NOT NULL, + immunities_id INTEGER NOT NULL, + FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id), + FOREIGN KEY (immunities_id) REFERENCES immunities(immunities_id) +); + +CREATE TABLE monsters_skills ( + id INTEGER PRIMARY KEY, + monsters_id INTEGER NOT NULL, + skills_id INTEGER NOT NULL, -- will ID the specific skill + skill_mod INTEGER NOT NULL, -- will hold the modifier value + UNIQUE(monsters_id, skills_id), -- so we don't get duplicate rows for a specific monster + FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id), + FOREIGN KEY (skills_id) REFERENCES skills(skills_id) +); + +CREATE TABLE monsters_traits ( + id INTEGER PRIMARY KEY, + monsters_id INTEGER NOT NULL, + trait_id INTEGER NOT NULL, + FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id), + FOREIGN KEY (traits_id) REFERENCES traits(trait_id) +); + +CREATE TABLE monster_movements ( + id INTEGER PRIMARY KEY, + monsters_id INTEGER NOT NULL, + movements_id INTEGER NOT NULL, + movement_speed INTEGER NOT NULL, -- this is the actual monster speed + UNIQUE (monsters_id, movements_id), -- prevent duplicates + FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id), + FOREIGN KEY (movements_id) REFERENCES movements(movements_id) +); + +-- TODO does this need to be separate table for monsters only or share the main +-- actions table +CREATE TABLE monsteractions ( + monsteractions_id INTEGER PRIMARY KEY, + "name" TEXT, + -- TODO +); + +CREATE TABLE monsters_actions ( + id INTEGER PRIMARY KEY, + monsters_id INTEGER NOT NULL, + actions_id INTEGER NOT NULL, -- TODO actions table? or monsteractions table? +); diff --git a/schema/movements.sql b/schema/movements.sql new file mode 100644 index 0000000..f652597 --- /dev/null +++ b/schema/movements.sql @@ -0,0 +1,12 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +-- TODO needs data + +CREATE TABLE movements ( + movements_id INTEGER PRIMARY KEY, + "name" TEXT UNIQUE NOT NULL +); + + diff --git a/schema/skills.sql b/schema/skills.sql new file mode 100644 index 0000000..e356558 --- /dev/null +++ b/schema/skills.sql @@ -0,0 +1,12 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; + +CREATE TABLE skills ( + skills_id INTEGER PRIMARY KEY, + sources_id INTEGER, + sources_pages TEXT, + "name" TEXT UNIQUE NOT NULL, + descr TEXT, + FOREIGN KEY (sources_id) REFERENCES sources(sources_id) +); diff --git a/schema/sources.sql b/schema/sources.sql index 41bcd57..b42aebe 100644 --- a/schema/sources.sql +++ b/schema/sources.sql @@ -29,7 +29,7 @@ CREATE TABLE monsters_sourceentries ( monsters_id INTEGER NOT NULL, sourceentries_id INTEGER NOT NULL, FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id), - FOREIGN KEY (sourceentries_id_id) REFERENCES sourceentries_id(sourceentries_id_id) + FOREIGN KEY (sourceentries_id) REFERENCES sourceentries(sourceentries_id) ); -- TODO add in new many-to-many tables for the various things we want to have sources be listed this way