From 2e6e4927789880c4af0e3e24c3365927a9068737 Mon Sep 17 00:00:00 2001 From: Sky Johnson Date: Fri, 12 Jul 2024 22:29:34 -0500 Subject: [PATCH] Introduce data packs --- server/database/README.md | 14 ++++++++++---- server/database/packs/Default.zip | Bin 0 -> 4542 bytes server/modules/InstallModule.php | 13 +++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 server/database/packs/Default.zip 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 0000000000000000000000000000000000000000..81c6c0f8c079e7642020da4ea90e1c020c0f3411 GIT binary patch literal 4542 zcmZ{ocQjmE1H~tL3&H3THA*mA7(|O+V~7?(5TlGXdY1?xdhcD7QKO3*j54A`8$F_z z=q75A&wFpJm;CX*d;d81uDgC~?RC#SXYG9;>ex6y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|f!2+i)`yn=;bXK@_~^Cx0U^eCb`n1W~_*C4>F{PZn-| z=-*de;9tWZ=L~;>|5fb&!2p1|z~-CBe{24q*nf4u-`McYeE!=6|HS?)yZ^=%Z%X8! uN&Zjrzt-(+OGXI7G<+ literal 0 HcmV?d00001 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