Introduce data packs
This commit is contained in:
parent
0cdb25029f
commit
2e6e492778
|
@ -1,4 +1,10 @@
|
||||||
## /server/database
|
## Database
|
||||||
This README is here to allow git to keep this folder present in the repo.
|
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.
|
||||||
The SQLite database for the game is generated into this folder, and PDO
|
|
||||||
will not create the path TO the SQLite database.
|
### 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.
|
BIN
server/database/packs/Default.zip
Normal file
BIN
server/database/packs/Default.zip
Normal file
Binary file not shown.
|
@ -25,7 +25,7 @@ class InstallModule
|
||||||
$istart = microtime(true); // time the database setup
|
$istart = microtime(true); // time the database setup
|
||||||
if (!isset($_POST['mode'])) redirect('/install'); // redirect if no mode
|
if (!isset($_POST['mode'])) redirect('/install'); // redirect if no mode
|
||||||
$complete = $_POST['mode'] == 'complete'; // complete or partial setup
|
$complete = $_POST['mode'] == 'complete'; // complete or partial setup
|
||||||
$resFmt = '%s <span class="extra-data">(%fs)</span><br />';
|
$resFmt = '%s <span class="extra-data">(%ss)</span><br />';
|
||||||
|
|
||||||
$results = '';
|
$results = '';
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class InstallModule
|
||||||
start_str INT DEFAULT 0,
|
start_str INT DEFAULT 0,
|
||||||
start_atk INT DEFAULT 0,
|
start_atk INT DEFAULT 0,
|
||||||
start_dex INT DEFAULT 0,
|
start_dex INT DEFAULT 0,
|
||||||
start_def INT DEFAULT 0
|
start_def INT DEFAULT 0,
|
||||||
growth_hp INT DEFAULT 0,
|
growth_hp INT DEFAULT 0,
|
||||||
growth_mp INT DEFAULT 0,
|
growth_mp INT DEFAULT 0,
|
||||||
growth_str INT DEFAULT 0,
|
growth_str INT DEFAULT 0,
|
||||||
|
@ -97,5 +97,14 @@ class InstallModule
|
||||||
);");
|
);");
|
||||||
|
|
||||||
$results .= sprintf($resFmt, 'Babble table created', stopwatch($istart));
|
$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 ''
|
||||||
|
);");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user