Extract Default data, continue work on installer

This commit is contained in:
Sky Johnson 2024-07-12 23:24:59 -05:00
parent 2e6e492778
commit 08c290ea4f
10 changed files with 340 additions and 36 deletions

View File

@ -12,7 +12,6 @@ class Database
private PDO $c;
private int $queries = 0;
private array $log = [];
private string $error = '';
private float $time = 0;
public function __construct(string $path, array $opts = [])
@ -27,7 +26,6 @@ class Database
$this->c->exec('PRAGMA foreign_keys = ON;'); // Enable foreign keys
$this->c->exec('PRAGMA journal_mode = WAL;'); // Enable WAL
} catch (PDOException $e) {
$this->error = "Failed to open database: " . $e->getMessage();
throw $e;
}
}
@ -42,8 +40,8 @@ class Database
$this->record($query, $start);
return $stmt;
} catch (PDOException $e) {
$this->error = $e->getMessage();
return false;
print_r($query);
throw $e;
}
}
@ -56,8 +54,8 @@ class Database
$this->record($query, $start);
return $stmt;
} catch (PDOException $e) {
$this->error = $e->getMessage();
return false;
print_r($query);
throw $e;
}
}
@ -69,11 +67,6 @@ class Database
$this->time += $time;
}
public function error(): string
{
return $this->error;
}
public function queries(): int
{
return $this->queries;
@ -88,4 +81,39 @@ class Database
{
return $this->time;
}
public function insertFromCSV(string $table, string $path): PDOStatement|false
{
// open the file
$handle = fopen($path, 'r');
if ($handle === false) return false;
// reduce the column names to lower case with underscores
$columns = array_map(function ($column) {
return strtolower(str_replace(' ', '_', $column));
}, fgetcsv($handle));
// set up the query
$query = "INSERT INTO $table (" . implode(',', $columns) . ') VALUES ';
// read the rows and add them to the query
while (($row = fgetcsv($handle)) !== false) {
// go through the row and put strings into single quotes
$row = array_map(function ($column) {
if (is_numeric($column)) return $column;
return "'" . str_replace("'", "\'", $column) . "'";
}, $row);
// add the row to the query
$query .= '(' . implode(',', $row) . '),';
}
// remove the trailing comma
$query = rtrim($query, ',') . ';';
dd($query);
// execute the insert
return $this->q($query);
}
}

View File

@ -4,7 +4,10 @@ This folder serves as the home for the game's database; `dragon.db` by default.
### 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!
The `Default` 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!
#### Installing
@TODO
### 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.
When performing a **Complete** install, the installer will look for and use the `Default` 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.

Binary file not shown.

View File

@ -0,0 +1,4 @@
Name,"Start HP","Start MP","Start STR","Start ATK","Start DEF","Start DEX","Growth HP","Growth MP","Growth STR","Growth ATK","Growth DEF","Growth DEX",Spells
Mage,10,10,5,5,5,5,3,5,1,3,1,3,"1:6,18"
Warrior,20,0,10,5,10,5,6,2,3,1,3,1,
Paladin,15,5,5,5,10,10,4,4,2,2,2,2,"1:1,15,18"
1 Name Start HP Start MP Start STR Start ATK Start DEF Start DEX Growth HP Growth MP Growth STR Growth ATK Growth DEF Growth DEX Spells
2 Mage 10 10 5 5 5 5 3 5 1 3 1 3 1:6,18
3 Warrior 20 0 10 5 10 5 6 2 3 1 3 1
4 Paladin 15 5 5 5 10 10 4 4 2 2 2 2 1:1,15,18

View File

@ -0,0 +1,42 @@
Name,Level,Type,Attr
"Life Pebble",1,1,"hp,10"
"Life Stone",10,1,"hp,25"
"Life Rock",25,1,"hp,50"
"Life Ore",50,1,"hp,100"
"Life Gem",75,1,"hp,150"
"Magic Pebble",1,1,"mp,10"
"Magic Stone",10,1,"mp,25"
"Magic Rock",25,1,"mp,50"
"Magic Ore",50,1,"mp,100"
"Magic Gem",75,1,"mp,150"
"Dragon's Scale",10,1,"def,25"
"Dragon's Plate",30,1,"def,50"
"Dragon's Claw",10,1,"atk,25"
"Dragon's Fang",30,1,"atk,50"
"Dragon's Tear",35,1,"str,75"
"Dragon's Wing",35,1,"dex,75"
"Demon's Sin",35,1,"hp,-50|str,65"
"Demon's Fall",35,1,"mp,-50|str,65"
"Demon's Lie",45,1,"hp,-100|str,125"
"Demon's Hate",45,1,"mp,-100|str,125"
"Angel's Joy",25,1,"hp,25|str,25"
"Angel's Rise",30,1,"hp,50|str,50"
"Angel's Truth",35,1,"hp,75|str,75"
"Angel's Grace",40,1,"hp,100|str,100"
"Seraph's Strength",25,1,"mp,25|dex,25"
"Seraph's Power",30,1,"mp,50|dex,50"
"Seraph's Justice",35,1,"mp,75|dex,75"
"Seraph's Judgement",40,1,"mp,100|dex,100"
Ruby,50,1,"hp,150"
Sapphire,50,1,"mp,150"
Emerald,50,1,"str,150"
Amethyst,50,1,"dex,150"
Topaz,50,1,"atk,150"
Diamond,50,1,"def,150"
"Ocean Blessing",77,1,"str,7007|dex,7007"
"Memory Tonic",5,1,"exp,10"
"Memory Potion",30,1,"exp,20"
"Memory Elixir",50,1,"exp,30"
"Gold Tonic",5,1,"gold,10"
"Gold Potion",30,1,"gold,20"
"Gold Elixir",50,1,"gold,30"
1 Name Level Type Attr
2 Life Pebble 1 1 hp,10
3 Life Stone 10 1 hp,25
4 Life Rock 25 1 hp,50
5 Life Ore 50 1 hp,100
6 Life Gem 75 1 hp,150
7 Magic Pebble 1 1 mp,10
8 Magic Stone 10 1 mp,25
9 Magic Rock 25 1 mp,50
10 Magic Ore 50 1 mp,100
11 Magic Gem 75 1 mp,150
12 Dragon's Scale 10 1 def,25
13 Dragon's Plate 30 1 def,50
14 Dragon's Claw 10 1 atk,25
15 Dragon's Fang 30 1 atk,50
16 Dragon's Tear 35 1 str,75
17 Dragon's Wing 35 1 dex,75
18 Demon's Sin 35 1 hp,-50|str,65
19 Demon's Fall 35 1 mp,-50|str,65
20 Demon's Lie 45 1 hp,-100|str,125
21 Demon's Hate 45 1 mp,-100|str,125
22 Angel's Joy 25 1 hp,25|str,25
23 Angel's Rise 30 1 hp,50|str,50
24 Angel's Truth 35 1 hp,75|str,75
25 Angel's Grace 40 1 hp,100|str,100
26 Seraph's Strength 25 1 mp,25|dex,25
27 Seraph's Power 30 1 mp,50|dex,50
28 Seraph's Justice 35 1 mp,75|dex,75
29 Seraph's Judgement 40 1 mp,100|dex,100
30 Ruby 50 1 hp,150
31 Sapphire 50 1 mp,150
32 Emerald 50 1 str,150
33 Amethyst 50 1 dex,150
34 Topaz 50 1 atk,150
35 Diamond 50 1 def,150
36 Ocean Blessing 77 1 str,7007|dex,7007
37 Memory Tonic 5 1 exp,10
38 Memory Potion 30 1 exp,20
39 Memory Elixir 50 1 exp,30
40 Gold Tonic 5 1 gold,10
41 Gold Potion 30 1 gold,20
42 Gold Elixir 50 1 gold,30

View File

@ -0,0 +1,35 @@
Type,Name,Cost,Attr,Icon
1,Stick,10,"atk,2",stick.png
1,Branch,30,"atk,4",branch.png
1,Club,40,"atk,6",club.png
1,Dagger,80,"atk,8",dagger.png
1,Hatchet,120,"atk,12",hatchet.png
1,Axe,200,"atk,18",axe.png
1,Spear,300,"atk,25",spear.png
1,Poleaxe,500,"atk,35",poleaxe.png
1,Warhammer,800,"atk,50",warhammer.png
1,Longsword,1200,"atk,65",longsword.png
1,Claymore,1800,"atk,85",claymore.png
1,"Demon Axe",2800,"atk,125|exp,-5",demonaxe.png
1,"Dark Sword",4500,"atk,225|exp,-10",darksword.png
1,"Magic Axe",2800,"atk,95|exp,5",magicaxe.png
1,"Bright Sword",4500,"atk,185|exp,10",brightsword.png
1,Dragonbane,10000,"atk,300|str,50",dragonbane.png
2,Underwear,25,"def,2|gold,10",underwear.png
2,Clothes,50,"def,5",clothes.png
2,Leather,75,"def,10",leather.png
2,"Hard Leather",150,"def,25",hardleather.png
2,Chainmail,300,"def,35",chainmail.png
2,"Scale Armor",900,"def,50",scalearmor.png
2,Platemail,1800,"def,100",platemail.png
2,"Magic Plate",3000,"def,125|mp,50",magicplate.png
2,Darkmail,5000,"def,200|exp,-10",darkmail.png
2,"Dragon Plate",10000,"def,165|exp,10",dragonplate.png
2,"Destiny Raiment",50000,"def,200|dex,50",destinyraiment.png
3,"Reed Shield",50,"def,5",reedshield.png
3,Buckler,100,"def,10",nuckler.png
3,"Round Shield",500,"def,25",roundshield.png
3,"Tower Shield",2500,"def,50",towershield.png
3,"Silver Shield",10000,"def,100",silvershield.png
3,"Dragon Shield",25000,"def,125|mp,100",dragonshield.png
3,Aegis,50000,"def,225|exp,10",aegis.png
1 Type Name Cost Attr Icon
2 1 Stick 10 atk,2 stick.png
3 1 Branch 30 atk,4 branch.png
4 1 Club 40 atk,6 club.png
5 1 Dagger 80 atk,8 dagger.png
6 1 Hatchet 120 atk,12 hatchet.png
7 1 Axe 200 atk,18 axe.png
8 1 Spear 300 atk,25 spear.png
9 1 Poleaxe 500 atk,35 poleaxe.png
10 1 Warhammer 800 atk,50 warhammer.png
11 1 Longsword 1200 atk,65 longsword.png
12 1 Claymore 1800 atk,85 claymore.png
13 1 Demon Axe 2800 atk,125|exp,-5 demonaxe.png
14 1 Dark Sword 4500 atk,225|exp,-10 darksword.png
15 1 Magic Axe 2800 atk,95|exp,5 magicaxe.png
16 1 Bright Sword 4500 atk,185|exp,10 brightsword.png
17 1 Dragonbane 10000 atk,300|str,50 dragonbane.png
18 2 Underwear 25 def,2|gold,10 underwear.png
19 2 Clothes 50 def,5 clothes.png
20 2 Leather 75 def,10 leather.png
21 2 Hard Leather 150 def,25 hardleather.png
22 2 Chainmail 300 def,35 chainmail.png
23 2 Scale Armor 900 def,50 scalearmor.png
24 2 Platemail 1800 def,100 platemail.png
25 2 Magic Plate 3000 def,125|mp,50 magicplate.png
26 2 Darkmail 5000 def,200|exp,-10 darkmail.png
27 2 Dragon Plate 10000 def,165|exp,10 dragonplate.png
28 2 Destiny Raiment 50000 def,200|dex,50 destinyraiment.png
29 3 Reed Shield 50 def,5 reedshield.png
30 3 Buckler 100 def,10 nuckler.png
31 3 Round Shield 500 def,25 roundshield.png
32 3 Tower Shield 2500 def,50 towershield.png
33 3 Silver Shield 10000 def,100 silvershield.png
34 3 Dragon Shield 25000 def,125|mp,100 dragonshield.png
35 3 Aegis 50000 def,225|exp,10 aegis.png

View File

@ -0,0 +1,152 @@
Name,Level,HP,ATK,DEF,EXP,Gold,Immune
"Blue Slime",1,4,3,1,1,1,0
"Red Slime",1,6,5,1,2,1,0
Critter,1,6,5,2,4,2,0
Creature,2,10,8,2,4,2,0
Shadow,2,10,9,3,6,2,1
Drake,2,11,10,3,8,3,0
Shade,3,12,10,3,10,3,1
Drakelor,3,14,12,4,10,3,0
"Silver Slime",30,15,100,200,15,1000,2
Scamp,4,16,13,5,15,5,0
Raven,4,16,13,5,18,6,0
Scorpion,5,18,14,6,20,7,0
Illusion,5,20,15,6,20,7,1
Nightshade,6,22,16,6,24,8,0
Drakemal,6,22,18,7,24,8,0
"Shadow Raven",6,24,18,7,26,9,1
Ghost,6,24,20,8,28,9,0
"Frost Raven",7,26,20,8,30,10,0
"Rogue Scorpion",7,28,22,9,32,11,0
Ghoul,7,29,24,9,34,11,0
Magician,8,30,24,10,36,12,0
Rogue,8,30,25,12,40,13,0
Drakefin,8,32,26,12,40,13,0
Shimmer,8,32,26,14,45,15,1
"Fire Raven",9,34,28,14,45,15,0
Dybbuk,9,34,28,14,50,17,0
Knave,9,36,30,15,52,17,0
Goblin,10,36,30,15,54,18,0
Skeleton,10,38,30,18,58,19,0
"Dark Slime",10,38,32,18,62,21,0
"Silver Scorpion",40,30,160,350,63,2000,2
Mirage,11,40,32,20,64,21,1
Sorceror,11,41,33,22,68,23,0
Imp,12,42,34,22,70,23,0
Nymph,12,43,35,22,70,23,0
Scoundrel,12,43,35,22,75,25,0
Megaskeleton,13,44,36,24,78,26,0
"Grey Wolf",13,44,36,24,82,27,0
Phantom,14,46,38,24,85,28,1
Specter,14,46,38,24,90,30,0
"Dark Scorpion",15,48,40,26,95,32,1
Warlock,15,48,40,26,100,33,1
Orc,15,49,42,28,104,35,0
Sylph,15,49,42,28,106,35,0
Wraith,16,50,45,30,108,36,0
Hellion,16,50,45,30,110,37,0
Bandit,16,52,45,30,114,38,0
Ultraskeleton,16,52,46,32,116,39,0
"Dark Wolf",17,54,47,36,120,40,1
Troll,17,56,48,36,120,40,0
Werewolf,17,56,48,38,124,41,0
Hellcat,18,58,50,38,128,43,0
Spirit,18,58,50,38,132,44,0
Nisse,19,60,52,40,132,44,0
Dawk,19,60,54,40,136,45,0
Figment,19,64,55,42,140,47,1
Hellhound,20,66,56,44,140,47,0
Wizard,20,66,56,44,144,48,0
Uruk,20,68,58,44,146,49,0
Siren,50,68,400,800,10000,50,2
Megawraith,21,70,60,46,155,52,0
Dawkin,21,70,60,46,155,52,0
"Grey Bear",21,70,62,48,160,53,0
Haunt,22,72,62,48,160,53,0
Hellbeast,22,74,64,50,165,55,0
Fear,23,76,66,52,165,55,0
Beast,23,76,66,52,170,57,0
Ogre,23,78,68,54,170,57,0
"Dark Bear",24,80,70,56,175,58,1
Fire,24,80,72,56,175,58,0
Polgergeist,25,84,74,58,180,60,0
Fright,25,86,76,58,180,60,0
Lycan,25,88,78,60,185,62,0
"Terra Elemental",25,88,80,62,185,62,1
Necromancer,26,90,80,62,190,63,0
Ultrawraith,26,90,82,64,190,63,0
Dawkor,26,92,82,64,195,65,0
Werebear,26,92,84,65,195,65,0
Brute,27,94,84,65,200,67,0
"Large Beast",27,96,88,66,200,67,0
Horror,27,96,88,68,210,70,0
Flame,28,100,90,70,210,70,0
Lycanthor,28,100,90,70,210,70,0
Wyrm,28,100,92,72,220,73,0
"Aero Elemental",29,104,94,74,220,73,1
Dawkare,29,106,96,76,220,73,0
"Large Brute",29,108,98,78,230,77,0
"Frost Wyrm",30,110,100,80,230,77,0
Knight,30,110,102,80,240,80,0
Lycanthra,30,112,104,82,240,80,0
Terror,31,115,108,84,250,83,0
Blaze,31,118,108,84,250,83,0
"Aqua Elemental",31,120,110,90,260,87,1
"Fire Wyrm",32,120,110,90,260,87,0
"Lesser Wyvern",32,122,110,92,270,90,0
Doomer,32,124,112,92,270,90,0
"Armor Knight",33,130,115,95,280,93,0
Wyvern,33,134,120,95,290,97,0
Nightmare,33,138,125,100,300,100,0
"Fira Elemental",34,140,125,100,310,103,1
Megadoomer,34,140,128,105,320,107,0
"Greater Wyvern",34,145,130,105,335,112,0
Advocate,35,148,132,108,350,117,0
"Strong Knight",35,150,135,110,365,122,0
Liche,35,150,135,110,380,127,0
Ultradoomer,36,155,140,115,395,132,0
Fanatic,36,160,140,115,410,137,0
"Green Dragon",36,160,140,115,425,142,0
Fiend,37,160,145,120,445,148,0
"Greatest Wyvern",37,162,150,120,465,155,0
"Lesser Devil",37,164,150,120,485,162,0
"Liche Master",38,168,155,125,505,168,0
Zealot,38,168,155,125,530,177,0
Serafiend,38,170,155,125,555,185,0
"Pale Knight",39,175,160,130,580,193,0
"Blue Dragon",39,180,160,130,605,202,0
Obsessive,40,180,160,135,630,210,0
Devil,40,184,164,135,666,222,0
"Liche Prince",40,190,168,138,660,220,0
Cherufiend,41,195,170,140,690,230,0
"Red Dragon",41,200,180,145,720,240,0
"Greater Devil",41,200,180,145,750,250,0
Renegade,42,205,185,150,780,260,0
Archfiend,42,210,190,150,810,270,0
"Liche Lord",42,210,190,155,850,283,0
"Greatest Devil",43,215,195,160,890,297,0
"Dark Knight",43,220,200,160,930,310,0
Giant,43,220,200,165,970,323,0
"Shadow Dragon",44,225,200,170,1010,337,0
"Liche King",44,225,205,170,1050,350,0
Incubus,44,230,205,175,1100,367,1
Traitor,45,230,205,175,1150,383,0
Demon,45,240,210,180,1200,400,0
"Dark Dragon",45,245,215,180,1250,417,1
Insurgent,46,250,220,190,1300,433,0
Leviathan,46,255,225,190,1350,450,0
"Grey Daemon",46,260,230,190,1400,467,0
Succubus,47,265,240,200,1460,487,1
"Demon Prince",47,270,240,200,1520,507,0
"Black Dragon",47,275,250,205,1580,527,1
Nihilist,47,280,250,205,1640,547,0
Behemoth,48,285,260,210,1700,567,0
Demagogue,48,290,260,210,1760,587,0
"Demon Lord",48,300,270,220,1820,607,0
"Red Daemon",48,310,280,230,1880,627,0
Colossus,49,320,300,240,1940,647,0
"Demon King",49,330,300,250,2000,667,0
"Dark Daemon",49,340,320,260,2200,733,1
Titan,50,360,340,270,2400,800,0
"Black Daemon",50,400,400,280,3000,1000,1
Lucifuge,50,600,600,400,10000,10000,2
1 Name Level HP ATK DEF EXP Gold Immune
2 Blue Slime 1 4 3 1 1 1 0
3 Red Slime 1 6 5 1 2 1 0
4 Critter 1 6 5 2 4 2 0
5 Creature 2 10 8 2 4 2 0
6 Shadow 2 10 9 3 6 2 1
7 Drake 2 11 10 3 8 3 0
8 Shade 3 12 10 3 10 3 1
9 Drakelor 3 14 12 4 10 3 0
10 Silver Slime 30 15 100 200 15 1000 2
11 Scamp 4 16 13 5 15 5 0
12 Raven 4 16 13 5 18 6 0
13 Scorpion 5 18 14 6 20 7 0
14 Illusion 5 20 15 6 20 7 1
15 Nightshade 6 22 16 6 24 8 0
16 Drakemal 6 22 18 7 24 8 0
17 Shadow Raven 6 24 18 7 26 9 1
18 Ghost 6 24 20 8 28 9 0
19 Frost Raven 7 26 20 8 30 10 0
20 Rogue Scorpion 7 28 22 9 32 11 0
21 Ghoul 7 29 24 9 34 11 0
22 Magician 8 30 24 10 36 12 0
23 Rogue 8 30 25 12 40 13 0
24 Drakefin 8 32 26 12 40 13 0
25 Shimmer 8 32 26 14 45 15 1
26 Fire Raven 9 34 28 14 45 15 0
27 Dybbuk 9 34 28 14 50 17 0
28 Knave 9 36 30 15 52 17 0
29 Goblin 10 36 30 15 54 18 0
30 Skeleton 10 38 30 18 58 19 0
31 Dark Slime 10 38 32 18 62 21 0
32 Silver Scorpion 40 30 160 350 63 2000 2
33 Mirage 11 40 32 20 64 21 1
34 Sorceror 11 41 33 22 68 23 0
35 Imp 12 42 34 22 70 23 0
36 Nymph 12 43 35 22 70 23 0
37 Scoundrel 12 43 35 22 75 25 0
38 Megaskeleton 13 44 36 24 78 26 0
39 Grey Wolf 13 44 36 24 82 27 0
40 Phantom 14 46 38 24 85 28 1
41 Specter 14 46 38 24 90 30 0
42 Dark Scorpion 15 48 40 26 95 32 1
43 Warlock 15 48 40 26 100 33 1
44 Orc 15 49 42 28 104 35 0
45 Sylph 15 49 42 28 106 35 0
46 Wraith 16 50 45 30 108 36 0
47 Hellion 16 50 45 30 110 37 0
48 Bandit 16 52 45 30 114 38 0
49 Ultraskeleton 16 52 46 32 116 39 0
50 Dark Wolf 17 54 47 36 120 40 1
51 Troll 17 56 48 36 120 40 0
52 Werewolf 17 56 48 38 124 41 0
53 Hellcat 18 58 50 38 128 43 0
54 Spirit 18 58 50 38 132 44 0
55 Nisse 19 60 52 40 132 44 0
56 Dawk 19 60 54 40 136 45 0
57 Figment 19 64 55 42 140 47 1
58 Hellhound 20 66 56 44 140 47 0
59 Wizard 20 66 56 44 144 48 0
60 Uruk 20 68 58 44 146 49 0
61 Siren 50 68 400 800 10000 50 2
62 Megawraith 21 70 60 46 155 52 0
63 Dawkin 21 70 60 46 155 52 0
64 Grey Bear 21 70 62 48 160 53 0
65 Haunt 22 72 62 48 160 53 0
66 Hellbeast 22 74 64 50 165 55 0
67 Fear 23 76 66 52 165 55 0
68 Beast 23 76 66 52 170 57 0
69 Ogre 23 78 68 54 170 57 0
70 Dark Bear 24 80 70 56 175 58 1
71 Fire 24 80 72 56 175 58 0
72 Polgergeist 25 84 74 58 180 60 0
73 Fright 25 86 76 58 180 60 0
74 Lycan 25 88 78 60 185 62 0
75 Terra Elemental 25 88 80 62 185 62 1
76 Necromancer 26 90 80 62 190 63 0
77 Ultrawraith 26 90 82 64 190 63 0
78 Dawkor 26 92 82 64 195 65 0
79 Werebear 26 92 84 65 195 65 0
80 Brute 27 94 84 65 200 67 0
81 Large Beast 27 96 88 66 200 67 0
82 Horror 27 96 88 68 210 70 0
83 Flame 28 100 90 70 210 70 0
84 Lycanthor 28 100 90 70 210 70 0
85 Wyrm 28 100 92 72 220 73 0
86 Aero Elemental 29 104 94 74 220 73 1
87 Dawkare 29 106 96 76 220 73 0
88 Large Brute 29 108 98 78 230 77 0
89 Frost Wyrm 30 110 100 80 230 77 0
90 Knight 30 110 102 80 240 80 0
91 Lycanthra 30 112 104 82 240 80 0
92 Terror 31 115 108 84 250 83 0
93 Blaze 31 118 108 84 250 83 0
94 Aqua Elemental 31 120 110 90 260 87 1
95 Fire Wyrm 32 120 110 90 260 87 0
96 Lesser Wyvern 32 122 110 92 270 90 0
97 Doomer 32 124 112 92 270 90 0
98 Armor Knight 33 130 115 95 280 93 0
99 Wyvern 33 134 120 95 290 97 0
100 Nightmare 33 138 125 100 300 100 0
101 Fira Elemental 34 140 125 100 310 103 1
102 Megadoomer 34 140 128 105 320 107 0
103 Greater Wyvern 34 145 130 105 335 112 0
104 Advocate 35 148 132 108 350 117 0
105 Strong Knight 35 150 135 110 365 122 0
106 Liche 35 150 135 110 380 127 0
107 Ultradoomer 36 155 140 115 395 132 0
108 Fanatic 36 160 140 115 410 137 0
109 Green Dragon 36 160 140 115 425 142 0
110 Fiend 37 160 145 120 445 148 0
111 Greatest Wyvern 37 162 150 120 465 155 0
112 Lesser Devil 37 164 150 120 485 162 0
113 Liche Master 38 168 155 125 505 168 0
114 Zealot 38 168 155 125 530 177 0
115 Serafiend 38 170 155 125 555 185 0
116 Pale Knight 39 175 160 130 580 193 0
117 Blue Dragon 39 180 160 130 605 202 0
118 Obsessive 40 180 160 135 630 210 0
119 Devil 40 184 164 135 666 222 0
120 Liche Prince 40 190 168 138 660 220 0
121 Cherufiend 41 195 170 140 690 230 0
122 Red Dragon 41 200 180 145 720 240 0
123 Greater Devil 41 200 180 145 750 250 0
124 Renegade 42 205 185 150 780 260 0
125 Archfiend 42 210 190 150 810 270 0
126 Liche Lord 42 210 190 155 850 283 0
127 Greatest Devil 43 215 195 160 890 297 0
128 Dark Knight 43 220 200 160 930 310 0
129 Giant 43 220 200 165 970 323 0
130 Shadow Dragon 44 225 200 170 1010 337 0
131 Liche King 44 225 205 170 1050 350 0
132 Incubus 44 230 205 175 1100 367 1
133 Traitor 45 230 205 175 1150 383 0
134 Demon 45 240 210 180 1200 400 0
135 Dark Dragon 45 245 215 180 1250 417 1
136 Insurgent 46 250 220 190 1300 433 0
137 Leviathan 46 255 225 190 1350 450 0
138 Grey Daemon 46 260 230 190 1400 467 0
139 Succubus 47 265 240 200 1460 487 1
140 Demon Prince 47 270 240 200 1520 507 0
141 Black Dragon 47 275 250 205 1580 527 1
142 Nihilist 47 280 250 205 1640 547 0
143 Behemoth 48 285 260 210 1700 567 0
144 Demagogue 48 290 260 210 1760 587 0
145 Demon Lord 48 300 270 220 1820 607 0
146 Red Daemon 48 310 280 230 1880 627 0
147 Colossus 49 320 300 240 1940 647 0
148 Demon King 49 330 300 250 2000 667 0
149 Dark Daemon 49 340 320 260 2200 733 1
150 Titan 50 360 340 270 2400 800 0
151 Black Daemon 50 400 400 280 3000 1000 1
152 Lucifuge 50 600 600 400 10000 10000 2

View File

@ -0,0 +1,21 @@
Name,Type,MP,Effect,Icon
Heal,1,5,"heal:self,10",heal.png
Cure,1,10,"heal:self,25",cure.png
Breath,1,25,"heal:self,50",breath.png
Revive,1,50,"heal:self,100",revive.png
Gaia,1,75,"heal:self,150",gaia.png
Slash,2,5,"damage:opp,10",slash.png
"Magic Missile",2,12,"damage:opp,35",missile.png
Fireball,2,25,"damage:opp,70",fireball.png
Pain,2,40,"damage:opp,100",pain.png
Lightning,2,50,"damage:opp,130",lightning.png
Chaos,2,75,"damage:opp,200",chaos.png
Sleep,3,10,"sleep:opp,3",sleep.png
Dream,3,30,"sleep:opp,6",dream.png
Nightmare,3,60,"sleep:opp,13",nightmare.png
Craze,4,10,"rage:self,3",craze.png
Rage,4,30,"rage:self,6",rage.png
Fury,4,60,"rage:self,13",fury.png
Ward,5,10,"protect:self,3",ward.png
Guard,5,30,"protect:self,6",guard.png
Barrier,5,60,"protect:self,13",barrier.png
1 Name Type MP Effect Icon
2 Heal 1 5 heal:self,10 heal.png
3 Cure 1 10 heal:self,25 cure.png
4 Breath 1 25 heal:self,50 breath.png
5 Revive 1 50 heal:self,100 revive.png
6 Gaia 1 75 heal:self,150 gaia.png
7 Slash 2 5 damage:opp,10 slash.png
8 Magic Missile 2 12 damage:opp,35 missile.png
9 Fireball 2 25 damage:opp,70 fireball.png
10 Pain 2 40 damage:opp,100 pain.png
11 Lightning 2 50 damage:opp,130 lightning.png
12 Chaos 2 75 damage:opp,200 chaos.png
13 Sleep 3 10 sleep:opp,3 sleep.png
14 Dream 3 30 sleep:opp,6 dream.png
15 Nightmare 3 60 sleep:opp,13 nightmare.png
16 Craze 4 10 rage:self,3 craze.png
17 Rage 4 30 rage:self,6 rage.png
18 Fury 4 60 rage:self,13 fury.png
19 Ward 5 10 protect:self,3 ward.png
20 Guard 5 30 protect:self,6 guard.png
21 Barrier 5 60 protect:self,13 barrier.png

View File

@ -0,0 +1,9 @@
Name,X,Y,"Inn Cost","Map Cost","TP Cost","Shop List",Image
Midworld,0,0,5,5,0,"1,2,3,17,18,19,28,29",midworld.png
Roma,30,30,10,25,5,"2,3,4,18,19,29",roma.png
Bris,70,-70,25,50,15,"2,3,4,5,18,19,20,29,30",bris.png
Kalle,-100,100,40,100,30,"5,6,8,10,12,21,22,23,29,30",kalle.png
Narcissa,-130,-130,60,500,50,"4,7,9,11,13,21,22,23,29,30,31",narcissa.png
Hambry,170,170,90,1000,80,"10,11,12,13,14,23,24,30,31",hambry.png
Gilead,200,-200,100,3000,110,"12,13,14,15,24,25,26,32",gilead.png
Endworld,-250,-250,150,9000,160,"16,27,33",endworld.png
1 Name X Y Inn Cost Map Cost TP Cost Shop List Image
2 Midworld 0 0 5 5 0 1,2,3,17,18,19,28,29 midworld.png
3 Roma 30 30 10 25 5 2,3,4,18,19,29 roma.png
4 Bris 70 -70 25 50 15 2,3,4,5,18,19,20,29,30 bris.png
5 Kalle -100 100 40 100 30 5,6,8,10,12,21,22,23,29,30 kalle.png
6 Narcissa -130 -130 60 500 50 4,7,9,11,13,21,22,23,29,30,31 narcissa.png
7 Hambry 170 170 90 1000 80 10,11,12,13,14,23,24,30,31 hambry.png
8 Gilead 200 -200 100 3000 110 12,13,14,15,24,25,26,32 gilead.png
9 Endworld -250 -250 150 9000 160 16,27,33 endworld.png

View File

@ -26,11 +26,12 @@ class InstallModule
if (!isset($_POST['mode'])) redirect('/install'); // redirect if no mode
$complete = $_POST['mode'] == 'complete'; // complete or partial setup
$resFmt = '%s <span class="extra-data">(%ss)</span><br />';
$defaults = SERVER.'/database/packs/Default/';
$results = '';
// @Settings
App::$db->q("CREATE TABLE IF NOT EXISTS settings (
App::$db->q("CREATE TABLE IF NOT EXISTS 'settings' (
id INTEGER PRIMARY KEY,
game_name TEXT DEFAULT 'Dragon Knight',
game_version TEXT DEFAULT '1.0',
@ -55,32 +56,29 @@ class InstallModule
$results .= sprintf($resFmt, 'Default settings inserted', stopwatch($istart));
// @Classes
App::$db->q("CREATE TABLE IF NOT EXISTS classes (
id INTEGER PRIMARY KEY,
name TEXT DEFAULT '',
start_hp INT DEFAULT 0,
start_mp INT DEFAULT 0,
start_str INT DEFAULT 0,
start_atk INT DEFAULT 0,
start_dex INT DEFAULT 0,
start_def INT DEFAULT 0,
growth_hp INT DEFAULT 0,
growth_mp INT DEFAULT 0,
growth_str INT DEFAULT 0,
growth_atk INT DEFAULT 0,
growth_dex INT DEFAULT 0,
growth_def INT DEFAULT 0,
spells TEXT DEFAULT '',
App::$db->q("CREATE TABLE IF NOT EXISTS 'classes' (
'id' INTEGER PRIMARY KEY,
'name' TEXT DEFAULT '',
'start_hp' INT DEFAULT 0,
'start_mp' INT DEFAULT 0,
'start_str' INT DEFAULT 0,
'start_atk' INT DEFAULT 0,
'start_dex' INT DEFAULT 0,
'start_def' INT DEFAULT 0,
'growth_hp' INT DEFAULT 0,
'growth_mp' INT DEFAULT 0,
'growth_str' INT DEFAULT 0,
'growth_atk' INT DEFAULT 0,
'growth_dex' INT DEFAULT 0,
'growth_def' INT DEFAULT 0,
'spells' TEXT DEFAULT ''
);");
$results .= sprintf($resFmt, 'Classes table created', stopwatch($istart));
if ($complete) {
// add default classes if complete install
App::$db->q("INSERT INTO classes VALUES
(1, 'Mage', 10, 10, 5, 5, 5, 5, 3, 5, 1, 3, 1, 3, '1:6,18'),
(2, 'Warrior', 20, 0, 10, 5, 10, 5, 6, 2, 3, 1, 3, 1, ''),
(3, 'Paladin', 15, 5, 5, 5, 10, 10, 4, 4, 2, 2, 2, 2, '1:1,15,18');");
App::$db->insertFromCSV('classes', "$defaults/classes.csv");
} else {
// there must be at least one class, for user creation to work
App::$db->q("INSERT INTO classes (name) VALUES ('Adventurer');");
@ -89,7 +87,7 @@ class InstallModule
$results .= sprintf($resFmt, 'Default classes inserted', stopwatch($istart));
// @Babble
App::$db->q("CREATE TABLE IF NOT EXISTS babble (
App::$db->q("CREATE TABLE IF NOT EXISTS 'babble' (
id INTEGER PRIMARY KEY,
author INTEGER NOT NULL,
babble TEXT NOT NULL,
@ -99,12 +97,24 @@ class InstallModule
$results .= sprintf($resFmt, 'Babble table created', stopwatch($istart));
// @Drops
App::$db->q("CREATE TABLE IF NOT EXISTS 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 ''
);");
$results .= sprintf($resFmt, 'Drops table created', stopwatch($istart));
if ($complete) {
// add default drops if complete install
App::$db->insertFromCSV('drops', "$defaults/drops.csv");
$results .= sprintf($resFmt, 'Default drops inserted', stopwatch($istart));
}
echo $results;
}
}