diff --git a/server/database/README.md b/server/database/README.md index 62eb5f8..93b603f 100644 --- a/server/database/README.md +++ b/server/database/README.md @@ -1,4 +1,10 @@ -## /server/database -This README is here to allow git to keep this folder present in the repo. -The SQLite database for the game is generated into this folder, and PDO -will not create the path TO the SQLite database. \ No newline at end of file +## Database +This folder serves as the home for the game's database; `dragon.db` by default. This is a WAL- and foreign key-enabled SQLite database wrapped in a very thin class based on the PDO wrapper in PHP. In production, the `dragon.db` file will be created if it doesn't exist, and the installer should be used to populate the database. This file does not exist in the repo. + +### Packs +New to Dragon Knight is the ability to upload "data packs" to the game! Using this feature, it is possible to upload and store `.zip` files that contain `.csv` files (spreadsheets) of data for the game. These spreadsheets must have a 1:1 structure to what's expected in Dragon Knight. This allows an admin to populate the game data quickly and easily with data they either make or get from someone else. + +The `Default.zip` data pack is the default data used when doing a **Complete** install of Dragon Knight. You can edit this before running the installer to change the default data. You can also use it as a template for your own data packs! + +### Installation +When performing a **Complete** install, the installer will look for and use the `Default.zip` data pack if it exists. If not, the installer will error. When performing a **Partial** install, the installer itself will insert the bare minimum data needed (at the moment this is a single class, "Adventurer") to create a user account, and data can be added in the admin panel afterwards. \ No newline at end of file diff --git a/server/database/packs/Default.zip b/server/database/packs/Default.zip new file mode 100644 index 0000000..81c6c0f Binary files /dev/null and b/server/database/packs/Default.zip differ diff --git a/server/modules/InstallModule.php b/server/modules/InstallModule.php index bd07a1c..b8fa2d6 100644 --- a/server/modules/InstallModule.php +++ b/server/modules/InstallModule.php @@ -25,7 +25,7 @@ class InstallModule $istart = microtime(true); // time the database setup if (!isset($_POST['mode'])) redirect('/install'); // redirect if no mode $complete = $_POST['mode'] == 'complete'; // complete or partial setup - $resFmt = '%s (%fs)
'; + $resFmt = '%s (%ss)
'; $results = ''; @@ -63,7 +63,7 @@ class InstallModule start_str INT DEFAULT 0, start_atk INT DEFAULT 0, start_dex INT DEFAULT 0, - start_def INT DEFAULT 0 + start_def INT DEFAULT 0, growth_hp INT DEFAULT 0, growth_mp INT DEFAULT 0, growth_str INT DEFAULT 0, @@ -97,5 +97,14 @@ class InstallModule );"); $results .= sprintf($resFmt, 'Babble table created', stopwatch($istart)); + + // @Drops + App::$db->q("CREATE TABLE IF NOT EXISTS drops ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + level INTEGER DEFAULT 1, + type INTEGER DEFAULT 1, + attr TEXT DEFAULT '' + );"); } } \ No newline at end of file