Compare commits
5 Commits
aa4d338c96
...
0511da22fb
Author | SHA1 | Date | |
---|---|---|---|
0511da22fb | |||
ce06aecf84 | |||
743c3cd6c4 | |||
c7e1e2ce9a | |||
07823cea01 |
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.installed
|
||||||
|
database.db
|
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017 renderse7en
|
Copyright (c) 2024 Sharkk
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
11
config.php
|
@ -1,11 +0,0 @@
|
||||||
<?php // config.php :: Low-level app/database variables.
|
|
||||||
|
|
||||||
$dbsettings = Array(
|
|
||||||
"server" => "localhost", // MySQL server name. (Default: localhost)
|
|
||||||
"user" => "", // MySQL username.
|
|
||||||
"pass" => "", // MySQL password.
|
|
||||||
"name" => "", // MySQL database name.
|
|
||||||
"prefix" => "dk", // Prefix for table names. (Default: dk)
|
|
||||||
"secretword" => ""); // Secret word used when hashing information for cookies.
|
|
||||||
|
|
||||||
?>
|
|
32
cookies.php
|
@ -1,32 +0,0 @@
|
||||||
<?php // cookies.php :: Handles cookies. (Mmm, tasty!)
|
|
||||||
|
|
||||||
function checkcookies() {
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
|
|
||||||
$row = false;
|
|
||||||
|
|
||||||
if (isset($_COOKIE["dkgame"])) {
|
|
||||||
|
|
||||||
// COOKIE FORMAT:
|
|
||||||
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
|
||||||
$theuser = explode(" ",$_COOKIE["dkgame"]);
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE username='$theuser[1]'", "users");
|
|
||||||
if (mysql_num_rows($query) != 1) { die("Invalid cookie data (Error 1). Please clear cookies and log in again."); }
|
|
||||||
$row = mysql_fetch_array($query);
|
|
||||||
if ($row["id"] != $theuser[0]) { die("Invalid cookie data (Error 2). Please clear cookies and log in again."); }
|
|
||||||
if (md5($row["password"] . "--" . $dbsettings["secretword"]) !== $theuser[2]) { die("Invalid cookie data (Error 3). Please clear cookies and log in again."); }
|
|
||||||
|
|
||||||
// If we've gotten this far, cookie should be valid, so write a new one.
|
|
||||||
$newcookie = implode(" ",$theuser);
|
|
||||||
if ($theuser[3] == 1) { $expiretime = time()+31536000; } else { $expiretime = 0; }
|
|
||||||
setcookie ("dkgame", $newcookie, $expiretime, "/", "", 0);
|
|
||||||
$onlinequery = doquery("UPDATE {{table}} SET onlinetime=NOW() WHERE id='$theuser[0]' LIMIT 1", "users");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return $row;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
812
install.php
|
@ -1,812 +0,0 @@
|
||||||
<?php // install.php :: creates/populates database tables on a new installation.
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$start = getmicrotime();
|
|
||||||
|
|
||||||
if (isset($_GET["page"])) {
|
|
||||||
$page = $_GET["page"];
|
|
||||||
if ($page == 2) { second(); }
|
|
||||||
elseif ($page == 3) { third(); }
|
|
||||||
elseif ($page == 4) { fourth(); }
|
|
||||||
elseif ($page == 5) { fifth(); }
|
|
||||||
else { first(); }
|
|
||||||
} else { first(); }
|
|
||||||
|
|
||||||
// Thanks to Predrag Supurovic from php.net for this function!
|
|
||||||
function dobatch ($p_query) {
|
|
||||||
$query_split = preg_split ("/[;]+/", $p_query);
|
|
||||||
foreach ($query_split as $command_line) {
|
|
||||||
$command_line = trim($command_line);
|
|
||||||
if ($command_line != '') {
|
|
||||||
$query_result = mysql_query($command_line);
|
|
||||||
if ($query_result == 0) {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return $query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function first() { // First page - show warnings and gather info.
|
|
||||||
|
|
||||||
$page = <<<END
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Dragon Knight Installation</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<b>Dragon Knight Installation: Page One</b><br /><br />
|
|
||||||
<b>NOTE:</b> Please ensure you have filled in the correct values in config.php before continuing. Installation will fail if these values are not correct. Also, the MySQL database needs to already exist. This installer script will take care of setting up its structure and content, but the database itself must already exist on your MySQL server before the installer will work.<br /><br />
|
|
||||||
Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.<br /><br />
|
|
||||||
You have two options for database setup: complete or partial.
|
|
||||||
<ul>
|
|
||||||
<li /><b>Complete Setup</b> includes table structure and all default data (items, drops, monsters, levels, spells, towns) - after complete setup, the game is totally ready to run.
|
|
||||||
<li /><b>Partial Setup</b> only creates the table structure, it does not populate the tables - use this if you are going to be creating and importing your own customized game data later.
|
|
||||||
</ul>
|
|
||||||
Click the appropriate button below for your preferred installation method.<br /><br />
|
|
||||||
<form action="install.php?page=2" method="post">
|
|
||||||
<input type="submit" name="complete" value="Complete Setup" /><br /> - OR - <br /><input type="submit" name="partial" value="Partial Setup" />
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
END;
|
|
||||||
echo $page;
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function second() { // Second page - set up the database tables.
|
|
||||||
|
|
||||||
global $dbsettings;
|
|
||||||
echo "<html><head><title>Dragon Knight Installation</title></head><body><b>Dragon Knight Installation: Page Two</b><br /><br />";
|
|
||||||
$prefix = $dbsettings["prefix"];
|
|
||||||
$babble = $prefix . "_babble";
|
|
||||||
$control = $prefix . "_control";
|
|
||||||
$drops = $prefix . "_drops";
|
|
||||||
$forum = $prefix . "_forum";
|
|
||||||
$items = $prefix . "_items";
|
|
||||||
$levels = $prefix . "_levels";
|
|
||||||
$monsters = $prefix . "_monsters";
|
|
||||||
$news = $prefix . "_news";
|
|
||||||
$spells = $prefix . "_spells";
|
|
||||||
$towns = $prefix . "_towns";
|
|
||||||
$users = $prefix . "_users";
|
|
||||||
|
|
||||||
if (isset($_POST["complete"])) { $full = true; } else { $full = false; }
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$babble` (
|
|
||||||
`id` int(10) unsigned NOT NULL auto_increment,
|
|
||||||
`posttime` time NOT NULL default '00:00:00',
|
|
||||||
`author` varchar(30) NOT NULL default '',
|
|
||||||
`babble` varchar(120) NOT NULL default '',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Babble Box table created.<br />"; } else { echo "Error creating Babble Box table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$control` (
|
|
||||||
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
|
||||||
`gamename` varchar(50) NOT NULL default '',
|
|
||||||
`gamesize` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`gameopen` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`gameurl` varchar(200) NOT NULL default '',
|
|
||||||
`adminemail` varchar(100) NOT NULL default '',
|
|
||||||
`forumtype` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`forumaddress` varchar(200) NOT NULL default '',
|
|
||||||
`class1name` varchar(50) NOT NULL default '',
|
|
||||||
`class2name` varchar(50) NOT NULL default '',
|
|
||||||
`class3name` varchar(50) NOT NULL default '',
|
|
||||||
`diff1name` varchar(50) NOT NULL default '',
|
|
||||||
`diff1mod` float unsigned NOT NULL default '0',
|
|
||||||
`diff2name` varchar(50) NOT NULL default '',
|
|
||||||
`diff2mod` float unsigned NOT NULL default '0',
|
|
||||||
`diff3name` varchar(50) NOT NULL default '',
|
|
||||||
`diff3mod` float unsigned NOT NULL default '0',
|
|
||||||
`compression` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`verifyemail` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`shownews` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`showbabble` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`showonline` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Control table created.<br />"; } else { echo "Error creating Control table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$control` VALUES (1, 'Dragon Knight', 250, 1, '', '', 1, '', 'Mage', 'Warrior', 'Paladin', 'Easy', '1', 'Medium', '1.2', 'Hard', '1.5', 1, 1, 1, 1, 1);
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Control table populated.<br />"; } else { echo "Error populating Control table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$drops` (
|
|
||||||
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
|
||||||
`name` varchar(30) NOT NULL default '',
|
|
||||||
`mlevel` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`type` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`attribute1` varchar(30) NOT NULL default '',
|
|
||||||
`attribute2` varchar(30) NOT NULL default '',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Drops table created.<br />"; } else { echo "Error creating Drops table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($full == true) {
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$drops` VALUES (1, 'Life Pebble', 1, 1, 'maxhp,10', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (2, 'Life Stone', 10, 1, 'maxhp,25', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (3, 'Life Rock', 25, 1, 'maxhp,50', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (4, 'Magic Pebble', 1, 1, 'maxmp,10', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (5, 'Magic Stone', 10, 1, 'maxmp,25', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (6, 'Magic Rock', 25, 1, 'maxmp,50', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (7, 'Dragon\'s Scale', 10, 1, 'defensepower,25', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (8, 'Dragon\'s Plate', 30, 1, 'defensepower,50', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (9, 'Dragon\'s Claw', 10, 1, 'attackpower,25', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (10, 'Dragon\'s Tooth', 30, 1, 'attackpower,50', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (11, 'Dragon\'s Tear', 35, 1, 'strength,50', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (12, 'Dragon\'s Wing', 35, 1, 'dexterity,50', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (13, 'Demon\'s Sin', 35, 1, 'maxhp,-50', 'strength,50');
|
|
||||||
INSERT INTO `$drops` VALUES (14, 'Demon\'s Fall', 35, 1, 'maxmp,-50', 'strength,50');
|
|
||||||
INSERT INTO `$drops` VALUES (15, 'Demon\'s Lie', 45, 1, 'maxhp,-100', 'strength,100');
|
|
||||||
INSERT INTO `$drops` VALUES (16, 'Demon\'s Hate', 45, 1, 'maxmp,-100', 'strength,100');
|
|
||||||
INSERT INTO `$drops` VALUES (17, 'Angel\'s Joy', 25, 1, 'maxhp,25', 'strength,25');
|
|
||||||
INSERT INTO `$drops` VALUES (18, 'Angel\'s Rise', 30, 1, 'maxhp,50', 'strength,50');
|
|
||||||
INSERT INTO `$drops` VALUES (19, 'Angel\'s Truth', 35, 1, 'maxhp,75', 'strength,75');
|
|
||||||
INSERT INTO `$drops` VALUES (20, 'Angel\'s Love', 40, 1, 'maxhp,100', 'strength,100');
|
|
||||||
INSERT INTO `$drops` VALUES (21, 'Seraph\'s Joy', 25, 1, 'maxmp,25', 'dexterity,25');
|
|
||||||
INSERT INTO `$drops` VALUES (22, 'Seraph\'s Rise', 30, 1, 'maxmp,50', 'dexterity,50');
|
|
||||||
INSERT INTO `$drops` VALUES (23, 'Seraph\'s Truth', 35, 1, 'maxmp,75', 'dexterity,75');
|
|
||||||
INSERT INTO `$drops` VALUES (24, 'Seraph\'s Love', 40, 1, 'maxmp,100', 'dexterity,100');
|
|
||||||
INSERT INTO `$drops` VALUES (25, 'Ruby', 50, 1, 'maxhp,150', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (26, 'Pearl', 50, 1, 'maxmp,150', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (27, 'Emerald', 50, 1, 'strength,150', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (28, 'Topaz', 50, 1, 'dexterity,150', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (29, 'Obsidian', 50, 1, 'attackpower,150', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (30, 'Diamond', 50, 1, 'defensepower,150', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (31, 'Memory Drop', 5, 1, 'expbonus,10', 'X');
|
|
||||||
INSERT INTO `$drops` VALUES (32, 'Fortune Drop', 5, 1, 'goldbonus,10', 'X');
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Drops table populated.<br />"; } else { echo "Error populating Drops table."; }
|
|
||||||
unset($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$forum` (
|
|
||||||
`id` int(11) NOT NULL auto_increment,
|
|
||||||
`postdate` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`newpostdate` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`author` varchar(30) NOT NULL default '',
|
|
||||||
`parent` int(11) NOT NULL default '0',
|
|
||||||
`replies` int(11) NOT NULL default '0',
|
|
||||||
`title` varchar(100) NOT NULL default '',
|
|
||||||
`content` text NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Forum table created.<br />"; } else { echo "Error creating Forum table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$items` (
|
|
||||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
|
||||||
`type` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`name` varchar(30) NOT NULL default '',
|
|
||||||
`buycost` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`attribute` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`special` varchar(50) NOT NULL default '',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Items table created.<br />"; } else { echo "Error creating Items table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($full == true) {
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$items` VALUES (1, 1, 'Stick', 10, 2, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (2, 1, 'Branch', 30, 4, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (3, 1, 'Club', 40, 5, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (4, 1, 'Dagger', 90, 8, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (5, 1, 'Hatchet', 150, 12, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (6, 1, 'Axe', 200, 16, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (7, 1, 'Brand', 300, 25, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (8, 1, 'Poleaxe', 500, 35, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (9, 1, 'Broadsword', 800, 45, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (10, 1, 'Battle Axe', 1200, 50, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (11, 1, 'Claymore', 2000, 60, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (12, 1, 'Dark Axe', 3000, 100, 'expbonus,-5');
|
|
||||||
INSERT INTO `$items` VALUES (13, 1, 'Dark Sword', 4500, 125, 'expbonus,-10');
|
|
||||||
INSERT INTO `$items` VALUES (14, 1, 'Bright Sword', 6000, 100, 'expbonus,10');
|
|
||||||
INSERT INTO `$items` VALUES (15, 1, 'Magic Sword', 10000, 150, 'maxmp,50');
|
|
||||||
INSERT INTO `$items` VALUES (16, 1, 'Destiny Blade', 50000, 250, 'strength,50');
|
|
||||||
INSERT INTO `$items` VALUES (17, 2, 'Skivvies', 25, 2, 'goldbonus,10');
|
|
||||||
INSERT INTO `$items` VALUES (18, 2, 'Clothes', 50, 5, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (19, 2, 'Leather Armor', 75, 10, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (20, 2, 'Hard Leather Armor', 150, 25, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (21, 2, 'Chain Mail', 300, 30, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (22, 2, 'Bronze Plate', 900, 50, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (23, 2, 'Iron Plate', 2000, 100, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (24, 2, 'Magic Armor', 4000, 125, 'maxmp,50');
|
|
||||||
INSERT INTO `$items` VALUES (25, 2, 'Dark Armor', 5000, 150, 'expbonus,-10');
|
|
||||||
INSERT INTO `$items` VALUES (26, 2, 'Bright Armor', 10000, 175, 'expbonus,10');
|
|
||||||
INSERT INTO `$items` VALUES (27, 2, 'Destiny Raiment', 50000, 200, 'dexterity,50');
|
|
||||||
INSERT INTO `$items` VALUES (28, 3, 'Reed Shield', 50, 2, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (29, 3, 'Buckler', 100, 4, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (30, 3, 'Small Shield', 500, 10, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (31, 3, 'Large Shield', 2500, 30, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (32, 3, 'Silver Shield', 10000, 60, 'X');
|
|
||||||
INSERT INTO `$items` VALUES (33, 3, 'Destiny Aegis', 25000, 100, 'maxhp,50');
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Items table populated.<br />"; } else { echo "Error populating Items table."; }
|
|
||||||
unset($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$levels` (
|
|
||||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
|
||||||
`1_exp` mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
`1_hp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`1_mp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`1_tp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`1_strength` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`1_dexterity` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`1_spells` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`2_exp` mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
`2_hp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`2_mp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`2_tp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`2_strength` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`2_dexterity` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`2_spells` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`3_exp` mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
`3_hp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`3_mp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`3_tp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`3_strength` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`3_dexterity` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`3_spells` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Levels table created.<br />"; } else { echo "Error creating Levels table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($full == true) {
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$levels` VALUES (1, 0, 15, 0, 5, 5, 5, 0, 0, 15, 0, 5, 5, 5, 0, 0, 15, 0, 5, 5, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (2, 15, 2, 5, 1, 0, 1, 1, 18, 2, 4, 1, 2, 1, 1, 20, 2, 5, 1, 0, 2, 1);
|
|
||||||
INSERT INTO `$levels` VALUES (3, 45, 3, 4, 2, 1, 2, 0, 54, 2, 3, 2, 3, 2, 0, 60, 2, 3, 2, 1, 3, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (4, 105, 3, 3, 2, 1, 2, 6, 126, 2, 3, 2, 3, 2, 0, 140, 2, 4, 2, 1, 3, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (5, 195, 2, 5, 2, 0, 1, 0, 234, 2, 4, 2, 2, 1, 6, 260, 2, 4, 2, 0, 2, 6);
|
|
||||||
INSERT INTO `$levels` VALUES (6, 330, 4, 5, 2, 2, 3, 0, 396, 3, 4, 2, 4, 3, 0, 440, 3, 5, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (7, 532, 3, 4, 2, 1, 2, 11, 639, 2, 3, 2, 3, 2, 0, 710, 2, 3, 2, 1, 3, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (8, 835, 2, 4, 2, 0, 1, 0, 1003, 2, 3, 2, 2, 1, 11, 1115, 2, 4, 2, 0, 2, 11);
|
|
||||||
INSERT INTO `$levels` VALUES (9, 1290, 5, 3, 2, 3, 4, 2, 1549, 4, 2, 2, 5, 4, 0, 1722, 4, 2, 2, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (10, 1973, 10, 3, 2, 4, 3, 0, 2369, 10, 2, 2, 6, 3, 0, 2633, 10, 3, 2, 4, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (11, 2997, 5, 2, 2, 3, 4, 0, 3598, 4, 1, 2, 5, 4, 2, 3999, 4, 1, 2, 3, 5, 2);
|
|
||||||
INSERT INTO `$levels` VALUES (12, 4533, 4, 2, 2, 2, 3, 7, 5441, 4, 1, 2, 4, 3, 0, 6047, 4, 2, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (13, 6453, 4, 3, 2, 2, 3, 0, 7745, 4, 2, 2, 4, 3, 0, 8607, 4, 2, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (14, 8853, 5, 4, 2, 3, 4, 17, 10625, 4, 3, 2, 5, 4, 7, 11807, 4, 4, 2, 3, 5, 7);
|
|
||||||
INSERT INTO `$levels` VALUES (15, 11853, 5, 5, 2, 3, 4, 0, 14225, 4, 4, 2, 5, 4, 0, 15808, 4, 4, 2, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (16, 15603, 5, 3, 2, 3, 4, 0, 18725, 5, 2, 2, 5, 4, 0, 20807, 5, 3, 2, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (17, 20290, 4, 2, 2, 2, 3, 12, 24350, 4, 1, 2, 4, 3, 0, 27057, 4, 1, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (18, 25563, 4, 2, 2, 2, 3, 0, 30678, 3, 1, 2, 4, 3, 14, 34869, 3, 2, 2, 2, 4, 17);
|
|
||||||
INSERT INTO `$levels` VALUES (19, 31495, 4, 5, 2, 2, 3, 0, 37797, 3, 4, 2, 4, 3, 0, 43657, 3, 4, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (20, 38169, 10, 6, 2, 3, 3, 0, 45805, 10, 5, 2, 5, 3, 0, 53543, 10, 6, 2, 3, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (21, 45676, 4, 4, 2, 2, 3, 0, 54814, 4, 3, 2, 4, 3, 0, 64664, 4, 3, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (22, 54121, 5, 5, 2, 3, 4, 0, 64949, 4, 4, 2, 5, 4, 12, 77175, 4, 5, 2, 3, 5, 12);
|
|
||||||
INSERT INTO `$levels` VALUES (23, 63622, 5, 3, 2, 3, 4, 0, 76350, 4, 2, 2, 5, 4, 0, 91250, 4, 2, 2, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (24, 74310, 5, 5, 2, 3, 4, 0, 89176, 4, 4, 2, 5, 4, 0, 107083, 4, 5, 2, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (25, 86334, 4, 4, 2, 2, 3, 3, 103605, 3, 3, 2, 4, 3, 17, 124895, 3, 3, 2, 2, 4, 14);
|
|
||||||
INSERT INTO `$levels` VALUES (26, 99861, 6, 3, 2, 4, 5, 0, 119837, 5, 2, 2, 6, 5, 0, 144933, 5, 3, 2, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (27, 115078, 6, 2, 2, 4, 5, 0, 138098, 5, 1, 2, 6, 5, 0, 167475, 5, 1, 2, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (28, 132197, 4, 2, 2, 2, 3, 0, 158641, 4, 1, 2, 4, 3, 0, 192835, 4, 2, 2, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (29, 151456, 6, 3, 2, 4, 5, 0, 181751, 5, 2, 2, 6, 5, 3, 221365, 5, 2, 2, 4, 6, 3);
|
|
||||||
INSERT INTO `$levels` VALUES (30, 173121, 10, 4, 3, 4, 4, 0, 207749, 10, 3, 3, 6, 4, 0, 253461, 10, 4, 3, 4, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (31, 197494, 5, 5, 3, 3, 4, 8, 236996, 4, 3, 3, 5, 4, 0, 289568, 4, 3, 3, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (32, 224913, 6, 4, 3, 4, 5, 0, 269898, 5, 3, 3, 6, 5, 0, 330188, 5, 4, 3, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (33, 255758, 5, 4, 3, 3, 4, 0, 306912, 5, 3, 3, 5, 4, 0, 375885, 5, 3, 3, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (34, 290458, 6, 4, 3, 4, 5, 0, 348552, 5, 3, 3, 6, 5, 8, 427294, 5, 4, 3, 4, 6, 8);
|
|
||||||
INSERT INTO `$levels` VALUES (35, 329495, 5, 3, 3, 3, 4, 0, 395397, 4, 2, 3, 5, 4, 0, 485126, 4, 2, 3, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (36, 373412, 4, 3, 3, 2, 3, 18, 448097, 5, 2, 3, 4, 3, 0, 550188, 5, 3, 3, 2, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (37, 422818, 5, 4, 3, 3, 4, 0, 507384, 5, 3, 3, 5, 4, 0, 623383, 5, 3, 3, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (38, 478399, 6, 5, 3, 4, 5, 0, 574081, 5, 4, 3, 6, 5, 15, 705726, 5, 5, 3, 4, 6, 18);
|
|
||||||
INSERT INTO `$levels` VALUES (39, 540927, 6, 4, 3, 4, 5, 0, 649115, 5, 3, 3, 6, 5, 0, 798362, 5, 3, 3, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (40, 611271, 15, 3, 3, 5, 5, 13, 733528, 15, 2, 3, 7, 5, 0, 902577, 15, 3, 3, 5, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (41, 690408, 7, 3, 3, 5, 2, 0, 828492, 6, 2, 3, 7, 2, 0, 1019818, 6, 2, 3, 5, 3, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (42, 779437, 7, 4, 3, 5, 6, 0, 935326, 6, 3, 3, 7, 6, 0, 1151714, 6, 4, 3, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (43, 879592, 8, 5, 3, 6, 7, 0, 1055514, 7, 4, 3, 8, 7, 0, 1300096, 7, 4, 3, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (44, 992268, 6, 3, 3, 4, 5, 0, 1190725, 5, 2, 3, 6, 5, 0, 1448478, 5, 3, 3, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (45, 1119028, 5, 8, 3, 3, 4, 4, 1325936, 5, 8, 3, 5, 4, 18, 1596860, 5, 8, 3, 3, 5, 4);
|
|
||||||
INSERT INTO `$levels` VALUES (46, 1245788, 6, 5, 3, 4, 5, 0, 1461147, 5, 4, 3, 6, 5, 0, 1745242, 5, 5, 3, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (47, 1372548, 7, 4, 3, 5, 6, 0, 1596358, 6, 3, 3, 7, 6, 0, 1893624, 6, 3, 3, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (48, 1499308, 6, 4, 3, 4, 5, 0, 1731569, 5, 3, 3, 6, 5, 0, 2042006, 5, 4, 3, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (49, 1626068, 5, 3, 3, 3, 4, 0, 1866780, 4, 2, 3, 5, 4, 0, 2190388, 4, 2, 3, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (50, 1752828, 15, 3, 3, 5, 5, 0, 2001991, 15, 2, 3, 7, 5, 0, 2338770, 15, 3, 3, 5, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (51, 1879588, 6, 2, 3, 4, 5, 9, 2137202, 5, 1, 3, 6, 5, 13, 2487152, 5, 1, 3, 4, 6, 13);
|
|
||||||
INSERT INTO `$levels` VALUES (52, 2006348, 7, 2, 3, 5, 6, 0, 2272413, 6, 1, 3, 7, 6, 0, 2635534, 6, 2, 3, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (53, 2133108, 8, 2, 3, 6, 7, 0, 2407624, 7, 1, 3, 8, 7, 0, 2783916, 7, 1, 3, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (54, 2259868, 8, 4, 3, 6, 7, 0, 2542835, 7, 3, 3, 8, 7, 0, 2932298, 7, 4, 3, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (55, 2386628, 7, 4, 3, 5, 6, 0, 2678046, 6, 3, 3, 7, 6, 0, 3080680, 6, 3, 3, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (56, 2513388, 7, 4, 3, 5, 6, 0, 2813257, 6, 3, 3, 7, 6, 0, 3229062, 6, 4, 3, 5, 7, 9);
|
|
||||||
INSERT INTO `$levels` VALUES (57, 2640148, 6, 5, 3, 4, 5, 0, 2948468, 6, 4, 3, 6, 5, 0, 3377444, 6, 4, 3, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (58, 2766908, 5, 5, 3, 3, 4, 0, 3083679, 5, 4, 3, 5, 4, 19, 3525826, 5, 5, 3, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (59, 2893668, 8, 3, 3, 6, 7, 0, 3218890, 7, 2, 3, 8, 7, 0, 3674208, 7, 2, 3, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (60, 3020428, 15, 4, 4, 6, 6, 19, 3354101, 15, 3, 4, 8, 6, 0, 3822590, 15, 4, 4, 6, 7, 15);
|
|
||||||
INSERT INTO `$levels` VALUES (61, 3147188, 8, 5, 4, 6, 7, 0, 3489312, 7, 4, 4, 8, 7, 0, 3970972, 7, 4, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (62, 3273948, 8, 4, 4, 6, 7, 0, 3624523, 7, 3, 4, 8, 7, 0, 4119354, 7, 4, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (63, 3400708, 9, 5, 4, 7, 8, 0, 3759734, 8, 4, 4, 9, 8, 0, 4267736, 8, 4, 4, 7, 9, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (64, 3527468, 5, 5, 4, 3, 4, 0, 3894945, 5, 4, 4, 5, 4, 0, 4416118, 5, 5, 4, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (65, 3654228, 6, 4, 4, 4, 5, 0, 4030156, 6, 3, 4, 6, 5, 0, 4564500, 6, 3, 4, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (66, 3780988, 8, 4, 4, 6, 7, 0, 4165367, 8, 3, 4, 8, 7, 0, 4712882, 8, 4, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (67, 3907748, 7, 3, 4, 5, 6, 0, 4300578, 7, 2, 4, 7, 6, 0, 4861264, 7, 2, 4, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (68, 4034508, 9, 3, 4, 7, 8, 0, 4435789, 8, 2, 4, 9, 8, 0, 5009646, 8, 3, 4, 7, 9, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (69, 4161268, 5, 4, 4, 3, 4, 0, 4571000, 5, 3, 4, 5, 4, 0, 5158028, 5, 3, 4, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (70, 4288028, 20, 4, 4, 6, 6, 5, 4706211, 20, 3, 4, 8, 6, 16, 5306410, 20, 4, 4, 6, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (71, 4414788, 5, 5, 4, 3, 4, 0, 4841422, 5, 4, 4, 5, 4, 0, 5454792, 5, 4, 4, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (72, 4541548, 6, 2, 4, 4, 5, 0, 4976633, 5, 1, 4, 6, 5, 0, 5603174, 5, 2, 4, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (73, 4668308, 8, 4, 4, 6, 7, 0, 5111844, 8, 3, 4, 8, 7, 0, 5751556, 8, 3, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (74, 4795068, 7, 5, 4, 5, 6, 0, 5247055, 6, 4, 4, 7, 6, 0, 5899938, 6, 5, 4, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (75, 4921828, 5, 3, 4, 3, 4, 0, 5382266, 5, 2, 4, 5, 4, 0, 6048320, 5, 2, 4, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (76, 5048588, 6, 3, 4, 4, 5, 0, 5517477, 6, 2, 4, 6, 5, 0, 6196702, 6, 3, 4, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (77, 5175348, 6, 4, 4, 4, 5, 0, 5652688, 7, 3, 4, 6, 5, 0, 6345084, 7, 3, 4, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (78, 5302108, 7, 4, 4, 5, 6, 0, 5787899, 7, 3, 4, 7, 6, 0, 6493466, 7, 4, 4, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (79, 5428868, 8, 4, 4, 6, 7, 10, 5923110, 7, 3, 4, 8, 7, 0, 6641848, 7, 3, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (80, 5555628, 20, 5, 4, 6, 7, 0, 6058321, 20, 4, 4, 8, 7, 0, 6790230, 20, 5, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (81, 5682388, 7, 3, 4, 5, 6, 0, 6193532, 7, 2, 4, 7, 6, 0, 6938612, 7, 2, 4, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (82, 5809148, 6, 4, 4, 4, 5, 0, 6328743, 5, 3, 4, 6, 5, 0, 7086994, 5, 4, 4, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (83, 5935908, 6, 2, 4, 4, 5, 0, 6463954, 6, 1, 4, 6, 5, 0, 7235376, 6, 1, 4, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (84, 6062668, 5, 4, 4, 3, 4, 0, 6599165, 5, 3, 4, 5, 4, 0, 7383758, 5, 4, 4, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (85, 6189428, 7, 4, 4, 5, 6, 0, 6734376, 6, 3, 4, 7, 6, 0, 7532140, 6, 3, 4, 5, 7, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (86, 6316188, 8, 5, 4, 6, 7, 0, 6869587, 8, 4, 4, 8, 7, 0, 7680522, 8, 5, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (87, 6442948, 8, 4, 4, 6, 7, 0, 7004798, 7, 3, 4, 8, 7, 0, 7828904, 7, 3, 4, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (88, 6569708, 9, 5, 4, 7, 8, 0, 7140009, 8, 4, 4, 9, 8, 0, 7977286, 8, 5, 4, 7, 9, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (89, 6696468, 5, 2, 4, 3, 4, 0, 7275220, 5, 1, 4, 5, 4, 0, 8125668, 5, 1, 4, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (90, 6823228, 20, 2, 5, 7, 8, 0, 7410431, 20, 1, 5, 9, 8, 0, 8274050, 20, 2, 5, 7, 9, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (91, 6949988, 5, 3, 5, 3, 4, 0, 7545642, 5, 2, 5, 5, 4, 0, 8422432, 5, 2, 5, 3, 5, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (92, 7076748, 6, 3, 5, 4, 5, 0, 7680853, 4, 2, 5, 6, 5, 0, 8570814, 4, 3, 5, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (93, 7203508, 8, 4, 5, 6, 7, 0, 7816064, 6, 2, 5, 8, 7, 0, 8719196, 6, 2, 5, 6, 8, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (94, 7330268, 4, 4, 5, 3, 3, 0, 7951275, 4, 3, 5, 5, 3, 0, 8867578, 4, 4, 5, 3, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (95, 7457028, 3, 3, 5, 5, 2, 0, 8086486, 4, 2, 5, 7, 2, 0, 9015960, 4, 2, 5, 5, 3, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (96, 7583788, 5, 3, 5, 4, 3, 0, 8221697, 5, 2, 5, 7, 3, 0, 9164342, 5, 3, 5, 4, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (97, 7710548, 5, 4, 5, 4, 5, 0, 8356908, 5, 3, 5, 7, 5, 0, 9312724, 5, 3, 5, 4, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (98, 7837308, 4, 5, 5, 4, 3, 0, 8492119, 4, 3, 5, 7, 3, 0, 9461106, 4, 4, 5, 4, 4, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (99, 7964068, 50, 5, 5, 6, 5, 0, 8627330, 50, 3, 5, 9, 5, 0, 9609488, 50, 4, 5, 6, 6, 0);
|
|
||||||
INSERT INTO `$levels` VALUES (100, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0);
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Levels table populated.<br />"; } else { echo "Error populating Levels table."; }
|
|
||||||
unset($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$monsters` (
|
|
||||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
|
||||||
`name` varchar(50) NOT NULL default '',
|
|
||||||
`maxhp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`maxdam` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`armor` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`level` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`maxexp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`maxgold` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`immune` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Monsters table created.<br />"; } else { echo "Error creating Monsters table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($full == true) {
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$monsters` VALUES (1, 'Blue Slime', 4, 3, 1, 1, 1, 1, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (2, 'Red Slime', 6, 5, 1, 1, 2, 1, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (3, 'Critter', 6, 5, 2, 1, 4, 2, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (4, 'Creature', 10, 8, 2, 2, 4, 2, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (5, 'Shadow', 10, 9, 3, 2, 6, 2, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (6, 'Drake', 11, 10, 3, 2, 8, 3, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (7, 'Shade', 12, 10, 3, 3, 10, 3, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (8, 'Drakelor', 14, 12, 4, 3, 10, 3, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (9, 'Silver Slime', 15, 100, 200, 30, 15, 1000, 2);
|
|
||||||
INSERT INTO `$monsters` VALUES (10, 'Scamp', 16, 13, 5, 4, 15, 5, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (11, 'Raven', 16, 13, 5, 4, 18, 6, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (12, 'Scorpion', 18, 14, 6, 5, 20, 7, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (13, 'Illusion', 20, 15, 6, 5, 20, 7, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (14, 'Nightshade', 22, 16, 6, 6, 24, 8, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (15, 'Drakemal', 22, 18, 7, 6, 24, 8, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (16, 'Shadow Raven', 24, 18, 7, 6, 26, 9, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (17, 'Ghost', 24, 20, 8, 6, 28, 9, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (18, 'Frost Raven', 26, 20, 8, 7, 30, 10, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (19, 'Rogue Scorpion', 28, 22, 9, 7, 32, 11, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (20, 'Ghoul', 29, 24, 9, 7, 34, 11, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (21, 'Magician', 30, 24, 10, 8, 36, 12, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (22, 'Rogue', 30, 25, 12, 8, 40, 13, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (23, 'Drakefin', 32, 26, 12, 8, 40, 13, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (24, 'Shimmer', 32, 26, 14, 8, 45, 15, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (25, 'Fire Raven', 34, 28, 14, 9, 45, 15, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (26, 'Dybbuk', 34, 28, 14, 9, 50, 17, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (27, 'Knave', 36, 30, 15, 9, 52, 17, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (28, 'Goblin', 36, 30, 15, 10, 54, 18, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (29, 'Skeleton', 38, 30, 18, 10, 58, 19, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (30, 'Dark Slime', 38, 32, 18, 10, 62, 21, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (31, 'Silver Scorpion', 30, 160, 350, 40, 63, 2000, 2);
|
|
||||||
INSERT INTO `$monsters` VALUES (32, 'Mirage', 40, 32, 20, 11, 64, 21, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (33, 'Sorceror', 41, 33, 22, 11, 68, 23, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (34, 'Imp', 42, 34, 22, 12, 70, 23, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (35, 'Nymph', 43, 35, 22, 12, 70, 23, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (36, 'Scoundrel', 43, 35, 22, 12, 75, 25, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (37, 'Megaskeleton', 44, 36, 24, 13, 78, 26, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (38, 'Grey Wolf', 44, 36, 24, 13, 82, 27, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (39, 'Phantom', 46, 38, 24, 14, 85, 28, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (40, 'Specter', 46, 38, 24, 14, 90, 30, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (41, 'Dark Scorpion', 48, 40, 26, 15, 95, 32, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (42, 'Warlock', 48, 40, 26, 15, 100, 33, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (43, 'Orc', 49, 42, 28, 15, 104, 35, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (44, 'Sylph', 49, 42, 28, 15, 106, 35, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (45, 'Wraith', 50, 45, 30, 16, 108, 36, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (46, 'Hellion', 50, 45, 30, 16, 110, 37, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (47, 'Bandit', 52, 45, 30, 16, 114, 38, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (48, 'Ultraskeleton', 52, 46, 32, 16, 116, 39, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (49, 'Dark Wolf', 54, 47, 36, 17, 120, 40, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (50, 'Troll', 56, 48, 36, 17, 120, 40, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (51, 'Werewolf', 56, 48, 38, 17, 124, 41, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (52, 'Hellcat', 58, 50, 38, 18, 128, 43, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (53, 'Spirit', 58, 50, 38, 18, 132, 44, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (54, 'Nisse', 60, 52, 40, 19, 132, 44, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (55, 'Dawk', 60, 54, 40, 19, 136, 45, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (56, 'Figment', 64, 55, 42, 19, 140, 47, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (57, 'Hellhound', 66, 56, 44, 20, 140, 47, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (58, 'Wizard', 66, 56, 44, 20, 144, 48, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (59, 'Uruk', 68, 58, 44, 20, 146, 49, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (60, 'Siren', 68, 400, 800, 50, 10000, 50, 2);
|
|
||||||
INSERT INTO `$monsters` VALUES (61, 'Megawraith', 70, 60, 46, 21, 155, 52, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (62, 'Dawkin', 70, 60, 46, 21, 155, 52, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (63, 'Grey Bear', 70, 62, 48, 21, 160, 53, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (64, 'Haunt', 72, 62, 48, 22, 160, 53, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (65, 'Hellbeast', 74, 64, 50, 22, 165, 55, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (66, 'Fear', 76, 66, 52, 23, 165, 55, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (67, 'Beast', 76, 66, 52, 23, 170, 57, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (68, 'Ogre', 78, 68, 54, 23, 170, 57, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (69, 'Dark Bear', 80, 70, 56, 24, 175, 58, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (70, 'Fire', 80, 72, 56, 24, 175, 58, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (71, 'Polgergeist', 84, 74, 58, 25, 180, 60, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (72, 'Fright', 86, 76, 58, 25, 180, 60, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (73, 'Lycan', 88, 78, 60, 25, 185, 62, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (74, 'Terra Elemental', 88, 80, 62, 25, 185, 62, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (75, 'Necromancer', 90, 80, 62, 26, 190, 63, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (76, 'Ultrawraith', 90, 82, 64, 26, 190, 63, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (77, 'Dawkor', 92, 82, 64, 26, 195, 65, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (78, 'Werebear', 92, 84, 65, 26, 195, 65, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (79, 'Brute', 94, 84, 65, 27, 200, 67, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (80, 'Large Beast', 96, 88, 66, 27, 200, 67, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (81, 'Horror', 96, 88, 68, 27, 210, 70, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (82, 'Flame', 100, 90, 70, 28, 210, 70, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (83, 'Lycanthor', 100, 90, 70, 28, 210, 70, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (84, 'Wyrm', 100, 92, 72, 28, 220, 73, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (85, 'Aero Elemental', 104, 94, 74, 29, 220, 73, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (86, 'Dawkare', 106, 96, 76, 29, 220, 73, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (87, 'Large Brute', 108, 98, 78, 29, 230, 77, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (88, 'Frost Wyrm', 110, 100, 80, 30, 230, 77, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (89, 'Knight', 110, 102, 80, 30, 240, 80, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (90, 'Lycanthra', 112, 104, 82, 30, 240, 80, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (91, 'Terror', 115, 108, 84, 31, 250, 83, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (92, 'Blaze', 118, 108, 84, 31, 250, 83, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (93, 'Aqua Elemental', 120, 110, 90, 31, 260, 87, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (94, 'Fire Wyrm', 120, 110, 90, 32, 260, 87, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (95, 'Lesser Wyvern', 122, 110, 92, 32, 270, 90, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (96, 'Doomer', 124, 112, 92, 32, 270, 90, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (97, 'Armor Knight', 130, 115, 95, 33, 280, 93, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (98, 'Wyvern', 134, 120, 95, 33, 290, 97, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (99, 'Nightmare', 138, 125, 100, 33, 300, 100, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (100, 'Fira Elemental', 140, 125, 100, 34, 310, 103, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (101, 'Megadoomer', 140, 128, 105, 34, 320, 107, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (102, 'Greater Wyvern', 145, 130, 105, 34, 335, 112, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (103, 'Advocate', 148, 132, 108, 35, 350, 117, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (104, 'Strong Knight', 150, 135, 110, 35, 365, 122, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (105, 'Liche', 150, 135, 110, 35, 380, 127, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (106, 'Ultradoomer', 155, 140, 115, 36, 395, 132, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (107, 'Fanatic', 160, 140, 115, 36, 410, 137, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (108, 'Green Dragon', 160, 140, 115, 36, 425, 142, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (109, 'Fiend', 160, 145, 120, 37, 445, 148, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (110, 'Greatest Wyvern', 162, 150, 120, 37, 465, 155, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (111, 'Lesser Devil', 164, 150, 120, 37, 485, 162, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (112, 'Liche Master', 168, 155, 125, 38, 505, 168, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (113, 'Zealot', 168, 155, 125, 38, 530, 177, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (114, 'Serafiend', 170, 155, 125, 38, 555, 185, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (115, 'Pale Knight', 175, 160, 130, 39, 580, 193, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (116, 'Blue Dragon', 180, 160, 130, 39, 605, 202, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (117, 'Obsessive', 180, 160, 135, 40, 630, 210, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (118, 'Devil', 184, 164, 135, 40, 666, 222, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (119, 'Liche Prince', 190, 168, 138, 40, 660, 220, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (120, 'Cherufiend', 195, 170, 140, 41, 690, 230, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (121, 'Red Dragon', 200, 180, 145, 41, 720, 240, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (122, 'Greater Devil', 200, 180, 145, 41, 750, 250, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (123, 'Renegade', 205, 185, 150, 42, 780, 260, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (124, 'Archfiend', 210, 190, 150, 42, 810, 270, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (125, 'Liche Lord', 210, 190, 155, 42, 850, 283, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (126, 'Greatest Devil', 215, 195, 160, 43, 890, 297, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (127, 'Dark Knight', 220, 200, 160, 43, 930, 310, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (128, 'Giant', 220, 200, 165, 43, 970, 323, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (129, 'Shadow Dragon', 225, 200, 170, 44, 1010, 337, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (130, 'Liche King', 225, 205, 170, 44, 1050, 350, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (131, 'Incubus', 230, 205, 175, 44, 1100, 367, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (132, 'Traitor', 230, 205, 175, 45, 1150, 383, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (133, 'Demon', 240, 210, 180, 45, 1200, 400, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (134, 'Dark Dragon', 245, 215, 180, 45, 1250, 417, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (135, 'Insurgent', 250, 220, 190, 46, 1300, 433, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (136, 'Leviathan', 255, 225, 190, 46, 1350, 450, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (137, 'Grey Daemon', 260, 230, 190, 46, 1400, 467, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (138, 'Succubus', 265, 240, 200, 47, 1460, 487, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (139, 'Demon Prince', 270, 240, 200, 47, 1520, 507, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (140, 'Black Dragon', 275, 250, 205, 47, 1580, 527, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (141, 'Nihilist', 280, 250, 205, 47, 1640, 547, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (142, 'Behemoth', 285, 260, 210, 48, 1700, 567, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (143, 'Demagogue', 290, 260, 210, 48, 1760, 587, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (144, 'Demon Lord', 300, 270, 220, 48, 1820, 607, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (145, 'Red Daemon', 310, 280, 230, 48, 1880, 627, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (146, 'Colossus', 320, 300, 240, 49, 1940, 647, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (147, 'Demon King', 330, 300, 250, 49, 2000, 667, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (148, 'Dark Daemon', 340, 320, 260, 49, 2200, 733, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (149, 'Titan', 360, 340, 270, 50, 2400, 800, 0);
|
|
||||||
INSERT INTO `$monsters` VALUES (150, 'Black Daemon', 400, 400, 280, 50, 3000, 1000, 1);
|
|
||||||
INSERT INTO `$monsters` VALUES (151, 'Lucifuge', 600, 600, 400, 50, 10000, 10000, 2);
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Monsters table populated.<br />"; } else { echo "Error populating Monsters table."; }
|
|
||||||
unset($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$news` (
|
|
||||||
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
|
||||||
`postdate` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`content` text NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "News table created.<br />"; } else { echo "Error creating News table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$news` VALUES (1, '2004-01-01 12:00:00', 'This is the first news post. Please use the admin control panel to add another one and make this one go away.');
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "News table populated.<br />"; } else { echo "Error populating News table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$spells` (
|
|
||||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
|
||||||
`name` varchar(30) NOT NULL default '',
|
|
||||||
`mp` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`attribute` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`type` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Spells table created.<br />"; } else { echo "Error creating Spells table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($full == true) {
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$spells` VALUES (1, 'Heal', 5, 10, 1);
|
|
||||||
INSERT INTO `$spells` VALUES (2, 'Revive', 10, 25, 1);
|
|
||||||
INSERT INTO `$spells` VALUES (3, 'Life', 25, 50, 1);
|
|
||||||
INSERT INTO `$spells` VALUES (4, 'Breath', 50, 100, 1);
|
|
||||||
INSERT INTO `$spells` VALUES (5, 'Gaia', 75, 150, 1);
|
|
||||||
INSERT INTO `$spells` VALUES (6, 'Hurt', 5, 15, 2);
|
|
||||||
INSERT INTO `$spells` VALUES (7, 'Pain', 12, 35, 2);
|
|
||||||
INSERT INTO `$spells` VALUES (8, 'Maim', 25, 70, 2);
|
|
||||||
INSERT INTO `$spells` VALUES (9, 'Rend', 40, 100, 2);
|
|
||||||
INSERT INTO `$spells` VALUES (10, 'Chaos', 50, 130, 2);
|
|
||||||
INSERT INTO `$spells` VALUES (11, 'Sleep', 10, 5, 3);
|
|
||||||
INSERT INTO `$spells` VALUES (12, 'Dream', 30, 9, 3);
|
|
||||||
INSERT INTO `$spells` VALUES (13, 'Nightmare', 60, 13, 3);
|
|
||||||
INSERT INTO `$spells` VALUES (14, 'Craze', 10, 10, 4);
|
|
||||||
INSERT INTO `$spells` VALUES (15, 'Rage', 20, 25, 4);
|
|
||||||
INSERT INTO `$spells` VALUES (16, 'Fury', 30, 50, 4);
|
|
||||||
INSERT INTO `$spells` VALUES (17, 'Ward', 10, 10, 5);
|
|
||||||
INSERT INTO `$spells` VALUES (18, 'Fend', 20, 25, 5);
|
|
||||||
INSERT INTO `$spells` VALUES (19, 'Barrier', 30, 50, 5);
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Spells table populated.<br />"; } else { echo "Error populating Spells table."; }
|
|
||||||
unset($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$towns` (
|
|
||||||
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
|
||||||
`name` varchar(30) NOT NULL default '',
|
|
||||||
`latitude` smallint(6) NOT NULL default '0',
|
|
||||||
`longitude` smallint(6) NOT NULL default '0',
|
|
||||||
`innprice` tinyint(4) NOT NULL default '0',
|
|
||||||
`mapprice` smallint(6) NOT NULL default '0',
|
|
||||||
`travelpoints` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`itemslist` text NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Towns table created.<br />"; } else { echo "Error creating Towns table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($full == true) {
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$towns` VALUES (1, 'Midworld', 0, 0, 5, 0, 0, '1,2,3,17,18,19,28,29');
|
|
||||||
INSERT INTO `$towns` VALUES (2, 'Roma', 30, 30, 10, 25, 5, '2,3,4,18,19,29');
|
|
||||||
INSERT INTO `$towns` VALUES (3, 'Bris', 70, -70, 25, 50, 15, '2,3,4,5,18,19,20,29.30');
|
|
||||||
INSERT INTO `$towns` VALUES (4, 'Kalle', -100, 100, 40, 100, 30, '5,6,8,10,12,21,22,23,29,30');
|
|
||||||
INSERT INTO `$towns` VALUES (5, 'Narcissa', -130, -130, 60, 500, 50, '4,7,9,11,13,21,22,23,29,30,31');
|
|
||||||
INSERT INTO `$towns` VALUES (6, 'Hambry', 170, 170, 90, 1000, 80, '10,11,12,13,14,23,24,30,31');
|
|
||||||
INSERT INTO `$towns` VALUES (7, 'Gilead', 200, -200, 100, 3000, 110, '12,13,14,15,24,25,26,32');
|
|
||||||
INSERT INTO `$towns` VALUES (8, 'Endworld', -250, -250, 125, 9000, 160, '16,27,33');
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Towns table populated.<br />"; } else { echo "Error populating Towns table."; }
|
|
||||||
unset($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
CREATE TABLE `$users` (
|
|
||||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
|
||||||
`username` varchar(30) NOT NULL default '',
|
|
||||||
`password` varchar(32) NOT NULL default '',
|
|
||||||
`email` varchar(100) NOT NULL default '',
|
|
||||||
`verify` varchar(8) NOT NULL default '0',
|
|
||||||
`charname` varchar(30) NOT NULL default '',
|
|
||||||
`regdate` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`onlinetime` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`authlevel` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`latitude` smallint(6) NOT NULL default '0',
|
|
||||||
`longitude` smallint(6) NOT NULL default '0',
|
|
||||||
`difficulty` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`charclass` tinyint(4) unsigned NOT NULL default '0',
|
|
||||||
`currentaction` varchar(30) NOT NULL default 'In Town',
|
|
||||||
`currentfight` tinyint(4) unsigned NOT NULL default '0',
|
|
||||||
`currentmonster` smallint(6) unsigned NOT NULL default '0',
|
|
||||||
`currentmonsterhp` smallint(6) unsigned NOT NULL default '0',
|
|
||||||
`currentmonstersleep` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`currentmonsterimmune` tinyint(4) NOT NULL default '0',
|
|
||||||
`currentuberdamage` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`currentuberdefense` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`currenthp` smallint(6) unsigned NOT NULL default '15',
|
|
||||||
`currentmp` smallint(6) unsigned NOT NULL default '0',
|
|
||||||
`currenttp` smallint(6) unsigned NOT NULL default '10',
|
|
||||||
`maxhp` smallint(6) unsigned NOT NULL default '15',
|
|
||||||
`maxmp` smallint(6) unsigned NOT NULL default '0',
|
|
||||||
`maxtp` smallint(6) unsigned NOT NULL default '10',
|
|
||||||
`level` smallint(5) unsigned NOT NULL default '1',
|
|
||||||
`gold` mediumint(8) unsigned NOT NULL default '100',
|
|
||||||
`experience` mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
`goldbonus` smallint(5) NOT NULL default '0',
|
|
||||||
`expbonus` smallint(5) NOT NULL default '0',
|
|
||||||
`strength` smallint(5) unsigned NOT NULL default '5',
|
|
||||||
`dexterity` smallint(5) unsigned NOT NULL default '5',
|
|
||||||
`attackpower` smallint(5) unsigned NOT NULL default '5',
|
|
||||||
`defensepower` smallint(5) unsigned NOT NULL default '5',
|
|
||||||
`weaponid` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`armorid` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`shieldid` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`slot1id` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`slot2id` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`slot3id` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`weaponname` varchar(30) NOT NULL default 'None',
|
|
||||||
`armorname` varchar(30) NOT NULL default 'None',
|
|
||||||
`shieldname` varchar(30) NOT NULL default 'None',
|
|
||||||
`slot1name` varchar(30) NOT NULL default 'None',
|
|
||||||
`slot2name` varchar(30) NOT NULL default 'None',
|
|
||||||
`slot3name` varchar(30) NOT NULL default 'None',
|
|
||||||
`dropcode` mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
`spells` varchar(50) NOT NULL default '0',
|
|
||||||
`towns` varchar(50) NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Users table created.<br />"; } else { echo "Error creating Users table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
global $start;
|
|
||||||
$time = round((getmicrotime() - $start), 4);
|
|
||||||
echo "<br />Database setup complete in $time seconds.<br /><br /><a href=\"install.php?page=3\">Click here to continue with installation.</a></body></html>";
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function third() { // Third page: gather user info for admin account.
|
|
||||||
|
|
||||||
$page = <<<END
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Dragon Knight Installation</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<b>Dragon Knight Installation: Page Three</b><br /><br />
|
|
||||||
Now you must create an administrator account so you can use the control panel. Fill out the form below to create your account. You will be able to customize the class names through the control panel once your admin account is created.<br /><br />
|
|
||||||
<form action="install.php?page=4" method="post">
|
|
||||||
<table width="50%">
|
|
||||||
<tr><td width="20%" style="vertical-align:top;">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Password:</td><td><input type="password" name="password1" size="30" maxlength="30" /></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" /><br /><br /><br /></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Character Name:</td><td><input type="text" name="charname" size="30" maxlength="30" /></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Character Class:</td><td><select name="charclass"><option value="1">Mage</option><option value="2">Warrior</option><option value="3">Paladin</option></select></td></tr>
|
|
||||||
<tr><td style="vertical-align:top;">Difficulty:</td><td><select name="difficulty"><option value="1">Easy</option><option value="2">Medium</option><option value="3">Hard</option></select></td></tr>
|
|
||||||
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
END;
|
|
||||||
echo $page;
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function fourth() { // Final page: insert new user row, congratulate the person on a job well done.
|
|
||||||
|
|
||||||
extract($_POST);
|
|
||||||
if (!isset($username)) { die("Username is required."); }
|
|
||||||
if (!isset($password1)) { die("Password is required."); }
|
|
||||||
if (!isset($password2)) { die("Verify Password is required."); }
|
|
||||||
if ($password1 != $password2) { die("Passwords don't match."); }
|
|
||||||
if (!isset($email1)) { die("Email is required."); }
|
|
||||||
if (!isset($email2)) { die("Verify Email is required."); }
|
|
||||||
if ($email1 != $email2) { die("Emails don't match."); }
|
|
||||||
if (!isset($charname)) { die("Character Name is required."); }
|
|
||||||
$password = md5($password1);
|
|
||||||
|
|
||||||
global $dbsettings;
|
|
||||||
$users = $dbsettings["prefix"] . "_users";
|
|
||||||
$query = mysql_query("INSERT INTO $users SET id='1',username='$username',password='$password',email='$email1',verify='1',charname='$charname',charclass='$charclass',regdate=NOW(),onlinetime=NOW(),authlevel='1'") or die(mysql_error());
|
|
||||||
|
|
||||||
$page = <<<END
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Dragon Knight Installation</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<b>Dragon Knight Installation: Page Four</b><br /><br />
|
|
||||||
Your admin account was created successfully. Installation is complete.<br /><br />
|
|
||||||
Be sure to delete install.php from your Dragon Knight directory for security purposes.<br /><br />
|
|
||||||
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.<br /><br/>
|
|
||||||
Thank you for using Dragon Knight!<br /><br />-----<br /><br />
|
|
||||||
<b>Optional:</b> Dragon Knight is a free product, and does not require registration of any sort. However, there is an
|
|
||||||
optional "call home" function in the installer, which notifies the author of your game installation. The ONLY information
|
|
||||||
transmitted with this function is the URL to your game. This is included mainly to satisfy the author's curiosity about
|
|
||||||
how many copies of the game are being installed and used. If you choose to submit your URL to the author, please
|
|
||||||
<a href="install.php?page=5">click here</a>.
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
END;
|
|
||||||
|
|
||||||
echo $page;
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function fifth() { // Call Home function.
|
|
||||||
|
|
||||||
$url = "http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
|
|
||||||
if (mail("jamin@se7enet.com", "Dragon Knight Call Home", "$url") != true) { die("Dragon Knight was unable to send your URL. Please go back and try again, or just continue on to <a href=\"index.php\">the game</a>."); }
|
|
||||||
|
|
||||||
$page = <<<END
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Dragon Knight Installation</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<b>Dragon Knight Installation: Page Five</b><br /><br />
|
|
||||||
Thank you for submitting your URL!<br /><br />
|
|
||||||
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
END;
|
|
||||||
|
|
||||||
echo $page;
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
42
login.php
|
@ -1,42 +0,0 @@
|
||||||
<?php // login.php :: Handles logins and cookies.
|
|
||||||
|
|
||||||
include('lib.php');
|
|
||||||
if (isset($_GET["do"])) {
|
|
||||||
if ($_GET["do"] == "login") { login(); }
|
|
||||||
elseif ($_GET["do"] == "logout") { logout(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
function login() {
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
$link = opendb();
|
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE username='".$_POST["username"]."' AND password='".md5($_POST["password"])."' LIMIT 1", "users");
|
|
||||||
if (mysql_num_rows($query) != 1) { die("Invalid username or password. Please go back and try again."); }
|
|
||||||
$row = mysql_fetch_array($query);
|
|
||||||
if (isset($_POST["rememberme"])) { $expiretime = time()+31536000; $rememberme = 1; } else { $expiretime = 0; $rememberme = 0; }
|
|
||||||
$cookie = $row["id"] . " " . $row["username"] . " " . md5($row["password"] . "--" . $dbsettings["secretword"]) . " " . $rememberme;
|
|
||||||
setcookie("dkgame", $cookie, $expiretime, "/", "", 0);
|
|
||||||
header("Location: index.php");
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = gettemplate("login");
|
|
||||||
$title = "Log In";
|
|
||||||
display($page, $title, false, false, false, false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function logout() {
|
|
||||||
|
|
||||||
setcookie("dkgame", "", time()-100000, "/", "", 0);
|
|
||||||
header("Location: login.php?do=login");
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 561 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 551 B |
Before Width: | Height: | Size: 486 B After Width: | Height: | Size: 486 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 461 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 112 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1005 B After Width: | Height: | Size: 1005 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
@ -1,63 +1,77 @@
|
||||||
<?php // index.php :: Primary program script, evil alien overlord, you decide.
|
<?php
|
||||||
|
|
||||||
if (file_exists('install.php')) { die("Please delete <b>install.php</b> from your Dragon Knight directory before continuing."); }
|
// index.php :: Primary program script, evil alien overlord, you decide.
|
||||||
include('lib.php');
|
|
||||||
include('cookies.php');
|
if (!file_exists('../.installed')) {
|
||||||
$link = opendb();
|
header('Location: install.php');
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
exit;
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
}
|
||||||
|
|
||||||
|
require_once '../src/lib.php';
|
||||||
|
|
||||||
|
$controlrow = get_control_row();
|
||||||
|
|
||||||
// Login (or verify) if not logged in.
|
// Login (or verify) if not logged in.
|
||||||
$userrow = checkcookies();
|
if (($userrow = checkcookies()) === false) {
|
||||||
if ($userrow == false) {
|
if (isset($_GET['do']) && $_GET['do'] === 'verify') {
|
||||||
if (isset($_GET["do"])) {
|
header("Location: users.php?do=verify");
|
||||||
if ($_GET["do"] == "verify") { header("Location: users.php?do=verify"); die(); }
|
exit;
|
||||||
}
|
}
|
||||||
header("Location: login.php?do=login"); die();
|
|
||||||
|
header("Location: login.php?do=login");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close game.
|
// Close game.
|
||||||
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
|
if ((bool) $controlrow["gameopen"] === false) {
|
||||||
|
display("The game is currently closed for maintanence. Please check back later.", "Game Closed");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Force verify if the user isn't verified yet.
|
// Force verify if the user isn't verified yet.
|
||||||
if ($controlrow["verifyemail"] == 1 && $userrow["verify"] != 1) { header("Location: users.php?do=verify"); die(); }
|
if ((bool) $controlrow["verifyemail"] && (bool) $userrow["verify"] === false) {
|
||||||
|
header("Location: users.php?do=verify");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Block user if he/she has been banned.
|
// Block user if he/she has been banned.
|
||||||
if ($userrow["authlevel"] == 2) { die("Your account has been blocked. Please try back later."); }
|
if ($userrow["authlevel"] === 2) {
|
||||||
|
exit("Your account has been blocked.");
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET["do"])) {
|
require_once '../src/towns.php';
|
||||||
$do = explode(":",$_GET["do"]);
|
require_once '../src/explore.php';
|
||||||
|
require_once '../src/fight.php';
|
||||||
// Town functions.
|
require_once '../src/heal.php';
|
||||||
if ($do[0] == "inn") { include('towns.php'); inn(); }
|
|
||||||
elseif ($do[0] == "buy") { include('towns.php'); buy(); }
|
|
||||||
elseif ($do[0] == "buy2") { include('towns.php'); buy2($do[1]); }
|
|
||||||
elseif ($do[0] == "buy3") { include('towns.php'); buy3($do[1]); }
|
|
||||||
elseif ($do[0] == "sell") { include('towns.php'); sell(); }
|
|
||||||
elseif ($do[0] == "maps") { include('towns.php'); maps(); }
|
|
||||||
elseif ($do[0] == "maps2") { include('towns.php'); maps2($do[1]); }
|
|
||||||
elseif ($do[0] == "maps3") { include('towns.php'); maps3($do[1]); }
|
|
||||||
elseif ($do[0] == "gotown") { include('towns.php'); travelto($do[1]); }
|
|
||||||
|
|
||||||
// Exploring functions.
|
|
||||||
elseif ($do[0] == "move") { include('explore.php'); move(); }
|
|
||||||
|
|
||||||
// Fighting functions.
|
|
||||||
elseif ($do[0] == "fight") { include('fight.php'); fight(); }
|
|
||||||
elseif ($do[0] == "victory") { include('fight.php'); victory(); }
|
|
||||||
elseif ($do[0] == "drop") { include('fight.php'); drop(); }
|
|
||||||
elseif ($do[0] == "dead") { include('fight.php'); dead(); }
|
|
||||||
|
|
||||||
// Misc functions.
|
|
||||||
elseif ($do[0] == "verify") { header("Location: users.php?do=verify"); die(); }
|
|
||||||
elseif ($do[0] == "spell") { include('heal.php'); healspells($do[1]); }
|
|
||||||
elseif ($do[0] == "showchar") { showchar(); }
|
|
||||||
elseif ($do[0] == "onlinechar") { onlinechar($do[1]); }
|
|
||||||
elseif ($do[0] == "showmap") { showmap(); }
|
|
||||||
elseif ($do[0] == "babblebox") { babblebox(); }
|
|
||||||
elseif ($do[0] == "ninja") { ninja(); }
|
|
||||||
|
|
||||||
} else { donothing(); }
|
|
||||||
|
|
||||||
function donothing() {
|
$do = explode(':', $_GET['do'] ?? '');
|
||||||
|
match ($do[0]) {
|
||||||
|
'inn' => inn(),
|
||||||
|
'buy' => buy(),
|
||||||
|
'buy2' => buy2($do[1]),
|
||||||
|
'buy3' => buy3($do[1]),
|
||||||
|
// 'sell' => sell(),
|
||||||
|
'maps' => maps(),
|
||||||
|
'maps2' => maps2($do[1]),
|
||||||
|
'maps3' => maps3($do[1]),
|
||||||
|
'gotown' => travelto($do[1]),
|
||||||
|
'move' => move(),
|
||||||
|
'fight' => fight(),
|
||||||
|
'victory' => victory(),
|
||||||
|
'drop' => drop(),
|
||||||
|
'dead' => dead(),
|
||||||
|
'verify' => header("Location: users.php?do=verify"),
|
||||||
|
'spell' => healspells($do[1]),
|
||||||
|
'showchar' => showchar(),
|
||||||
|
'onlinechar' => onlinechar($do[1]),
|
||||||
|
'showmap' => showmap(),
|
||||||
|
'babblebox' => babblebox(),
|
||||||
|
'ninja' => ninja(),
|
||||||
|
default => donothing()
|
||||||
|
};
|
||||||
|
|
||||||
|
function donothing()
|
||||||
|
{
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
if ($userrow["currentaction"] == "In Town") {
|
if ($userrow["currentaction"] == "In Town") {
|
||||||
|
@ -70,92 +84,108 @@ function donothing() {
|
||||||
$page = dofight();
|
$page = dofight();
|
||||||
$title = "Fighting";
|
$title = "Fighting";
|
||||||
}
|
}
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dotown() { // Spit out the main town page.
|
/**
|
||||||
|
* Spit out the main town page.
|
||||||
global $userrow, $controlrow, $numqueries;
|
*/
|
||||||
|
function dotown()
|
||||||
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
{
|
||||||
if (mysql_num_rows($townquery) == 0) { display("There is an error with your user account, or with the town data. Please try again.","Error"); }
|
global $userrow, $controlrow;
|
||||||
$townrow = mysql_fetch_array($townquery);
|
|
||||||
|
$townquery = db()->query('SELECT * FROM towns WHERE latitude = ? AND longitude = ? LIMIT 1;', [$userrow["latitude"], $userrow["longitude"]]);
|
||||||
|
if ($townquery === false) display("There is an error with your user account, or with the town data. Please try again.", "Error");
|
||||||
|
$townrow = $townquery->fetchArray(SQLITE3_ASSOC);
|
||||||
|
if ($townrow === false) display("There is an error with your user account, or with the town data. Please try again.","Error");
|
||||||
|
|
||||||
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
|
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
|
||||||
if ($controlrow["shownews"] == 1) {
|
if ($controlrow["shownews"] == 1) {
|
||||||
$newsquery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 1", "news");
|
$newsrow = db()->query('SELECT * FROM news ORDER BY id DESC LIMIT 1;')->fetchArray(SQLITE3_ASSOC);
|
||||||
$newsrow = mysql_fetch_array($newsquery);
|
|
||||||
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
|
$townrow["news"] = "<table width=\"95%\"><tr><td class=\"title\">Latest News</td></tr><tr><td>\n";
|
||||||
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br />".nl2br($newsrow["content"]);
|
$townrow["news"] .= "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br />".nl2br($newsrow["content"]);
|
||||||
$townrow["news"] .= "</td></tr></table>\n";
|
$townrow["news"] .= "</td></tr></table>\n";
|
||||||
} else { $townrow["news"] = ""; }
|
} else {
|
||||||
|
$townrow["news"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
// Who's Online. Currently just members. Guests maybe later.
|
// Who's Online. Currently just members. Guests maybe later.
|
||||||
if ($controlrow["showonline"] == 1) {
|
if ($controlrow["showonline"] == 1) {
|
||||||
$onlinequery = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' ORDER BY charname", "users");
|
$onlinequery = db()->query("SELECT * FROM news WHERE strftime('%s', onlinetime) >= strftime('%s', 'now') - 600 ORDER BY charname");
|
||||||
|
|
||||||
|
$online_count = 0;
|
||||||
|
$online_rows = [];
|
||||||
|
|
||||||
|
foreach ($onlinequery->fetchArray(SQLITE3_ASSOC) as $onlinerow) {
|
||||||
|
$online_count++;
|
||||||
|
$online_rows[] = "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["charname"]."</a>" . ", ";
|
||||||
|
}
|
||||||
|
|
||||||
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
|
$townrow["whosonline"] = "<table width=\"95%\"><tr><td class=\"title\">Who's Online</td></tr><tr><td>\n";
|
||||||
$townrow["whosonline"] .= "There are <b>" . mysql_num_rows($onlinequery) . "</b> user(s) online within the last 10 minutes: ";
|
$townrow["whosonline"] .= "There are <b>$online_count</b> user(s) online within the last 10 minutes: ";
|
||||||
while ($onlinerow = mysql_fetch_array($onlinequery)) { $townrow["whosonline"] .= "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["charname"]."</a>" . ", "; }
|
$townrow["whosonline"] .= rtrim(implode(', ', $online_rows), ', ');
|
||||||
$townrow["whosonline"] = rtrim($townrow["whosonline"], ", ");
|
|
||||||
$townrow["whosonline"] .= "</td></tr></table>\n";
|
$townrow["whosonline"] .= "</td></tr></table>\n";
|
||||||
} else { $townrow["whosonline"] = ""; }
|
} else {
|
||||||
|
$townrow["whosonline"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
if ($controlrow["showbabble"] == 1) {
|
if ($controlrow["showbabble"] == 1) {
|
||||||
$townrow["babblebox"] = "<table width=\"95%\"><tr><td class=\"title\">Babble Box</td></tr><tr><td>\n";
|
$townrow["babblebox"] = "<table width=\"95%\"><tr><td class=\"title\">Babble Box</td></tr><tr><td>\n";
|
||||||
$townrow["babblebox"] .= "<iframe src=\"index.php?do=babblebox\" name=\"sbox\" width=\"100%\" height=\"250\" frameborder=\"0\" id=\"bbox\">Your browser does not support inline frames! The Babble Box will not be available until you upgrade to a newer <a href=\"http://www.mozilla.org\" target=\"_new\">browser</a>.</iframe>";
|
$townrow["babblebox"] .= "<iframe src=\"index.php?do=babblebox\" name=\"sbox\" width=\"100%\" height=\"250\" frameborder=\"0\" id=\"bbox\">Your browser does not support inline frames! The Babble Box will not be available until you upgrade to a newer <a href=\"http://www.mozilla.org\" target=\"_new\">browser</a>.</iframe>";
|
||||||
$townrow["babblebox"] .= "</td></tr></table>\n";
|
$townrow["babblebox"] .= "</td></tr></table>\n";
|
||||||
} else { $townrow["babblebox"] = ""; }
|
} else {
|
||||||
|
$townrow["babblebox"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
$page = gettemplate("towns");
|
$page = gettemplate("towns");
|
||||||
$page = parsetemplate($page, $townrow);
|
$page = parsetemplate($page, $townrow);
|
||||||
|
|
||||||
return $page;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function doexplore() { // Just spit out a blank exploring page.
|
|
||||||
|
|
||||||
// Exploring without a GET string is normally when they first log in, or when they've just finished fighting.
|
|
||||||
|
|
||||||
$page = <<<END
|
|
||||||
<table width="100%">
|
|
||||||
<tr><td class="title"><img src="images/title_exploring.gif" alt="Exploring" /></td></tr>
|
|
||||||
<tr><td>
|
|
||||||
You are exploring the map, and nothing has happened. Continue exploring using the direction buttons or the Travel To menus.
|
|
||||||
</td></tr>
|
|
||||||
</table>
|
|
||||||
END;
|
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dofight() { // Redirect to fighting.
|
/**
|
||||||
|
* Just spit out a blank exploring page. Exploring without a GET string is normally when they first log in, or when
|
||||||
|
* they've just finished fighting.
|
||||||
|
*/
|
||||||
|
function doexplore()
|
||||||
|
{
|
||||||
|
return <<<HTML
|
||||||
|
<table width="100%">
|
||||||
|
<tr><td class="title"><img src="images/title_exploring.gif" alt="Exploring" /></td></tr>
|
||||||
|
<tr><td>
|
||||||
|
You are exploring the map, and nothing has happened. Continue exploring using the direction buttons or the Travel To menus.
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to fighting.
|
||||||
|
*/
|
||||||
|
function dofight()
|
||||||
|
{
|
||||||
header("Location: index.php?do=fight");
|
header("Location: index.php?do=fight");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showchar() {
|
function showchar()
|
||||||
|
{
|
||||||
global $userrow, $controlrow;
|
global $userrow, $controlrow;
|
||||||
|
|
||||||
// Format various userrow stuffs.
|
// Format various userrow stuffs.
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
$userrow["gold"] = number_format($userrow["gold"]);
|
$userrow["gold"] = number_format($userrow["gold"]);
|
||||||
if ($userrow["expbonus"] > 0) {
|
if ($userrow["expbonus"] > 0) {
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
|
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
|
||||||
} elseif ($userrow["expbonus"] < 0) {
|
} elseif ($userrow["expbonus"] < 0) {
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
|
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
|
||||||
} else { $userrow["plusexp"] = ""; }
|
} else { $userrow["plusexp"] = ""; }
|
||||||
if ($userrow["goldbonus"] > 0) {
|
if ($userrow["goldbonus"] > 0) {
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
|
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
|
||||||
} elseif ($userrow["goldbonus"] < 0) {
|
} elseif ($userrow["goldbonus"] < 0) {
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
|
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
|
||||||
} else { $userrow["plusgold"] = ""; }
|
} else { $userrow["plusgold"] = ""; }
|
||||||
|
|
||||||
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
||||||
$levelrow = mysql_fetch_array($levelquery);
|
$levelrow = mysql_fetch_array($levelquery);
|
||||||
if ($userrow["level"] < 99) { $userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]); } else { $userrow["nextlevel"] = "<span class=\"light\">None</span>"; }
|
if ($userrow["level"] < 99) { $userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]); } else { $userrow["nextlevel"] = "<span class=\"light\">None</span>"; }
|
||||||
|
@ -163,11 +193,11 @@ function showchar() {
|
||||||
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
||||||
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
|
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
|
||||||
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
|
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
|
||||||
|
|
||||||
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
|
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
|
||||||
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
|
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
|
||||||
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
|
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
|
||||||
|
|
||||||
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
|
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$userrow["magiclist"] = "";
|
$userrow["magiclist"] = "";
|
||||||
|
@ -181,40 +211,39 @@ function showchar() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
// Make page tags for XHTML validation.
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
||||||
|
|
||||||
$charsheet = gettemplate("showchar");
|
$charsheet = gettemplate("showchar");
|
||||||
$page = $xml . gettemplate("minimal");
|
$page = $xml . gettemplate("minimal");
|
||||||
$array = array("content"=>parsetemplate($charsheet, $userrow), "title"=>"Character Information");
|
$array = array("content"=>parsetemplate($charsheet, $userrow), "title"=>"Character Information");
|
||||||
echo parsetemplate($page, $array);
|
echo parsetemplate($page, $array);
|
||||||
die();
|
die();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onlinechar($id) {
|
function onlinechar($id) {
|
||||||
|
|
||||||
global $controlrow;
|
global $controlrow;
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
$userquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
|
||||||
if (mysql_num_rows($userquery) == 1) { $userrow = mysql_fetch_array($userquery); } else { display("No such user.", "Error"); }
|
if (mysql_num_rows($userquery) == 1) { $userrow = mysql_fetch_array($userquery); } else { display("No such user.", "Error"); }
|
||||||
|
|
||||||
// Format various userrow stuffs.
|
// Format various userrow stuffs.
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
$userrow["gold"] = number_format($userrow["gold"]);
|
$userrow["gold"] = number_format($userrow["gold"]);
|
||||||
if ($userrow["expbonus"] > 0) {
|
if ($userrow["expbonus"] > 0) {
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
|
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
|
||||||
} elseif ($userrow["expbonus"] < 0) {
|
} elseif ($userrow["expbonus"] < 0) {
|
||||||
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
|
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
|
||||||
} else { $userrow["plusexp"] = ""; }
|
} else { $userrow["plusexp"] = ""; }
|
||||||
if ($userrow["goldbonus"] > 0) {
|
if ($userrow["goldbonus"] > 0) {
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
|
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
|
||||||
} elseif ($userrow["goldbonus"] < 0) {
|
} elseif ($userrow["goldbonus"] < 0) {
|
||||||
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
|
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
|
||||||
} else { $userrow["plusgold"] = ""; }
|
} else { $userrow["plusgold"] = ""; }
|
||||||
|
|
||||||
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
|
||||||
$levelrow = mysql_fetch_array($levelquery);
|
$levelrow = mysql_fetch_array($levelquery);
|
||||||
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
|
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
|
||||||
|
@ -222,37 +251,37 @@ function onlinechar($id) {
|
||||||
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
|
||||||
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
|
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
|
||||||
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
|
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
|
||||||
|
|
||||||
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
|
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
|
||||||
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
|
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
|
||||||
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
|
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
|
||||||
|
|
||||||
$charsheet = gettemplate("onlinechar");
|
$charsheet = gettemplate("onlinechar");
|
||||||
$page = parsetemplate($charsheet, $userrow);
|
$page = parsetemplate($charsheet, $userrow);
|
||||||
display($page, "Character Information");
|
display($page, "Character Information");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showmap() {
|
function showmap() {
|
||||||
|
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
// Make page tags for XHTML validation.
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
||||||
|
|
||||||
$page = $xml . gettemplate("minimal");
|
$page = $xml . gettemplate("minimal");
|
||||||
$array = array("content"=>"<center><img src=\"images/map.gif\" alt=\"Map\" /></center>", "title"=>"Map");
|
$array = array("content"=>"<center><img src=\"images/map.gif\" alt=\"Map\" /></center>", "title"=>"Map");
|
||||||
echo parsetemplate($page, $array);
|
echo parsetemplate($page, $array);
|
||||||
die();
|
die();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function babblebox() {
|
function babblebox() {
|
||||||
|
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
if (isset($_POST["babble"])) {
|
if (isset($_POST["babble"])) {
|
||||||
$safecontent = makesafe($_POST["babble"]);
|
$safecontent = makesafe($_POST["babble"]);
|
||||||
if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing.
|
if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing.
|
||||||
|
@ -260,17 +289,17 @@ function babblebox() {
|
||||||
header("Location: index.php?do=babblebox");
|
header("Location: index.php?do=babblebox");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$babblebox = array("content"=>"");
|
$babblebox = array("content"=>"");
|
||||||
$bg = 1;
|
$bg = 1;
|
||||||
$babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 20", "babble");
|
$babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 20", "babble");
|
||||||
while ($babblerow = mysql_fetch_array($babblequery)) {
|
while ($babblerow = mysql_fetch_array($babblequery)) {
|
||||||
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
|
if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
|
||||||
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
|
else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
|
||||||
$babblebox["content"] = $new . $babblebox["content"];
|
$babblebox["content"] = $new . $babblebox["content"];
|
||||||
}
|
}
|
||||||
$babblebox["content"] .= "<center><form action=\"index.php?do=babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br /><input type=\"submit\" name=\"submit\" value=\"Babble\" /> <input type=\"reset\" name=\"reset\" value=\"Clear\" /></form></center>";
|
$babblebox["content"] .= "<center><form action=\"index.php?do=babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br /><input type=\"submit\" name=\"submit\" value=\"Babble\" /> <input type=\"reset\" name=\"reset\" value=\"Clear\" /></form></center>";
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
// Make page tags for XHTML validation.
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
||||||
|
@ -281,8 +310,10 @@ function babblebox() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ninja() {
|
/**
|
||||||
header("Location: http://www.se7enet.com/img/shirtninja.jpg");
|
* NINJA! 🥷
|
||||||
|
*/
|
||||||
|
function ninja(): void
|
||||||
|
{
|
||||||
|
exit('NINJA! 🥷');
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
810
public/install.php
Normal file
|
@ -0,0 +1,810 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (file_exists('../.installed')) {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once '../src/lib.php';
|
||||||
|
|
||||||
|
match ((int) $_GET['page'] ?? 1) {
|
||||||
|
2 => second(),
|
||||||
|
3 => third(),
|
||||||
|
4 => fourth(),
|
||||||
|
5 => fifth(),
|
||||||
|
default => first(),
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First page - show warnings and gather info
|
||||||
|
*/
|
||||||
|
function first()
|
||||||
|
{
|
||||||
|
echo <<<HTML
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dragon Knight Installation</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<b>Dragon Knight Installation: Page One</b><br /><br />
|
||||||
|
<b>NOTE:</b> Please ensure you have filled in the correct values in config.php before continuing. Installation will fail if these values are not correct. Also, the MySQL database needs to already exist. This installer script will take care of setting up its structure and content, but the database itself must already exist on your MySQL server before the installer will work.<br /><br />
|
||||||
|
Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.<br /><br />
|
||||||
|
You have two options for database setup: complete or partial.
|
||||||
|
<ul>
|
||||||
|
<li><b>Complete Setup</b> includes table structure and all default data (items, drops, monsters, levels, spells, towns) - after complete setup, the game is totally ready to run.</li>
|
||||||
|
<li><b>Partial Setup</b> only creates the table structure, it does not populate the tables - use this if you are going to be creating and importing your own customized game data later.</li>
|
||||||
|
</ul>
|
||||||
|
Click the appropriate button below for your preferred installation method.<br /><br />
|
||||||
|
<form action="install.php?page=2" method="post">
|
||||||
|
<input type="submit" name="complete" value="Complete Setup" /><br /> - OR - <br /><input type="submit" name="partial" value="Partial Setup" />
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up database tables.
|
||||||
|
*/
|
||||||
|
function second()
|
||||||
|
{
|
||||||
|
echo "<html><head><title>Dragon Knight Installation</title></head><body><b>Dragon Knight Installation: Page Two</b><br /><br />";
|
||||||
|
|
||||||
|
$full = isset($_POST["complete"]);
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE babble (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`posttime` TEXT NOT NULL DEFAULT '00:00:00',
|
||||||
|
`author` TEXT NOT NULL DEFAULT '',
|
||||||
|
`babble` TEXT NOT NULL DEFAULT ''
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Babble Box table created.<br />' : 'Error creating Babble Box table.';
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE control (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`gamename` TEXT NOT NULL DEFAULT '',
|
||||||
|
`gamesize` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`gameopen` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`gameurl` TEXT NOT NULL DEFAULT '',
|
||||||
|
`adminemail` TEXT NOT NULL DEFAULT '',
|
||||||
|
`forumtype` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`forumaddress` TEXT NOT NULL DEFAULT '',
|
||||||
|
`class1name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`class2name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`class3name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`diff1name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`diff1mod` REAL NOT NULL DEFAULT 0,
|
||||||
|
`diff2name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`diff2mod` REAL NOT NULL DEFAULT 0,
|
||||||
|
`diff3name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`diff3mod` REAL NOT NULL DEFAULT 0,
|
||||||
|
`verifyemail` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`shownews` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`showbabble` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`showonline` INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Control table created.<br />' : 'Error creating Control table.';
|
||||||
|
|
||||||
|
$query = db()->exec("INSERT INTO control VALUES (1, 'Dragon Knight', 250, 1, '', '', 1, '', 'Mage', 'Warrior', 'Paladin', 'Easy', 1, 'Medium', 1.2, 'Hard', 1.5, 1, 1, 1, 1);");
|
||||||
|
|
||||||
|
echo $query === true ? 'Control table populated.<br />' : 'Error populating Control table.';
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE drops (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`mlevel` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`type` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`attribute1` TEXT NOT NULL DEFAULT '',
|
||||||
|
`attribute2` TEXT NOT NULL DEFAULT ''
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query == true ? 'Drops table created.<br />' : 'Error creating Drops table.';
|
||||||
|
|
||||||
|
if ($full) {
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
INSERT INTO drops VALUES
|
||||||
|
(1, 'Life Pebble', 1, 1, 'maxhp,10', 'X'),
|
||||||
|
(2, 'Life Stone', 10, 1, 'maxhp,25', 'X'),
|
||||||
|
(3, 'Life Rock', 25, 1, 'maxhp,50', 'X'),
|
||||||
|
(4, 'Magic Pebble', 1, 1, 'maxmp,10', 'X'),
|
||||||
|
(5, 'Magic Stone', 10, 1, 'maxmp,25', 'X'),
|
||||||
|
(6, 'Magic Rock', 25, 1, 'maxmp,50', 'X'),
|
||||||
|
(7, 'Dragon''s Scale', 10, 1, 'defensepower,25', 'X'),
|
||||||
|
(8, 'Dragon''s Plate', 30, 1, 'defensepower,50', 'X'),
|
||||||
|
(9, 'Dragon''s Claw', 10, 1, 'attackpower,25', 'X'),
|
||||||
|
(10, 'Dragon''s Tooth', 30, 1, 'attackpower,50', 'X'),
|
||||||
|
(11, 'Dragon''s Tear', 35, 1, 'strength,50', 'X'),
|
||||||
|
(12, 'Dragon''s Wing', 35, 1, 'dexterity,50', 'X'),
|
||||||
|
(13, 'Demon''s Sin', 35, 1, 'maxhp,-50', 'strength,50'),
|
||||||
|
(14, 'Demon''s Fall', 35, 1, 'maxmp,-50', 'strength,50'),
|
||||||
|
(15, 'Demon''s Lie', 45, 1, 'maxhp,-100', 'strength,100'),
|
||||||
|
(16, 'Demon''s Hate', 45, 1, 'maxmp,-100', 'strength,100'),
|
||||||
|
(17, 'Angel''s Joy', 25, 1, 'maxhp,25', 'strength,25'),
|
||||||
|
(18, 'Angel''s Rise', 30, 1, 'maxhp,50', 'strength,50'),
|
||||||
|
(19, 'Angel''s Truth', 35, 1, 'maxhp,75', 'strength,75'),
|
||||||
|
(20, 'Angel''s Love', 40, 1, 'maxhp,100', 'strength,100'),
|
||||||
|
(21, 'Seraph''s Joy', 25, 1, 'maxmp,25', 'dexterity,25'),
|
||||||
|
(22, 'Seraph''s Rise', 30, 1, 'maxmp,50', 'dexterity,50'),
|
||||||
|
(23, 'Seraph''s Truth', 35, 1, 'maxmp,75', 'dexterity,75'),
|
||||||
|
(24, 'Seraph''s Love', 40, 1, 'maxmp,100', 'dexterity,100'),
|
||||||
|
(25, 'Ruby', 50, 1, 'maxhp,150', 'X'),
|
||||||
|
(26, 'Pearl', 50, 1, 'maxmp,150', 'X'),
|
||||||
|
(27, 'Emerald', 50, 1, 'strength,150', 'X'),
|
||||||
|
(28, 'Topaz', 50, 1, 'dexterity,150', 'X'),
|
||||||
|
(29, 'Obsidian', 50, 1, 'attackpower,150', 'X'),
|
||||||
|
(30, 'Diamond', 50, 1, 'defensepower,150', 'X'),
|
||||||
|
(31, 'Memory Drop', 5, 1, 'expbonus,10', 'X'),
|
||||||
|
(32, 'Fortune Drop', 5, 1, 'goldbonus,10', 'X');
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Drops table populated.<br />' : 'Error populating Drops table.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE forum (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`postdate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`newpostdate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`author` TEXT NOT NULL DEFAULT '',
|
||||||
|
`parent` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`replies` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`title` TEXT NOT NULL DEFAULT '',
|
||||||
|
`content` TEXT NOT NULL
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Forum table created.<br />' : 'Error creating Forum table.';
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE items (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`type` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`buycost` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`attribute` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`special` TEXT NOT NULL DEFAULT ''
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Items table created.<br />' : 'Error creating Items table.';
|
||||||
|
|
||||||
|
if ($full) {
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
INSERT INTO items VALUES
|
||||||
|
(1, 1, 'Stick', 10, 2, 'X'),
|
||||||
|
(2, 1, 'Branch', 30, 4, 'X'),
|
||||||
|
(3, 1, 'Club', 40, 5, 'X'),
|
||||||
|
(4, 1, 'Dagger', 90, 8, 'X'),
|
||||||
|
(5, 1, 'Hatchet', 150, 12, 'X'),
|
||||||
|
(6, 1, 'Axe', 200, 16, 'X'),
|
||||||
|
(7, 1, 'Brand', 300, 25, 'X'),
|
||||||
|
(8, 1, 'Poleaxe', 500, 35, 'X'),
|
||||||
|
(9, 1, 'Broadsword', 800, 45, 'X'),
|
||||||
|
(10, 1, 'Battle Axe', 1200, 50, 'X'),
|
||||||
|
(11, 1, 'Claymore', 2000, 60, 'X'),
|
||||||
|
(12, 1, 'Dark Axe', 3000, 100, 'expbonus,-5'),
|
||||||
|
(13, 1, 'Dark Sword', 4500, 125, 'expbonus,-10'),
|
||||||
|
(14, 1, 'Bright Sword', 6000, 100, 'expbonus,10'),
|
||||||
|
(15, 1, 'Magic Sword', 10000, 150, 'maxmp,50'),
|
||||||
|
(16, 1, 'Destiny Blade', 50000, 250, 'strength,50'),
|
||||||
|
(17, 2, 'Skivvies', 25, 2, 'goldbonus,10'),
|
||||||
|
(18, 2, 'Clothes', 50, 5, 'X'),
|
||||||
|
(19, 2, 'Leather Armor', 75, 10, 'X'),
|
||||||
|
(20, 2, 'Hard Leather Armor', 150, 25, 'X'),
|
||||||
|
(21, 2, 'Chain Mail', 300, 30, 'X'),
|
||||||
|
(22, 2, 'Bronze Plate', 900, 50, 'X'),
|
||||||
|
(23, 2, 'Iron Plate', 2000, 100, 'X'),
|
||||||
|
(24, 2, 'Magic Armor', 4000, 125, 'maxmp,50'),
|
||||||
|
(25, 2, 'Dark Armor', 5000, 150, 'expbonus,-10'),
|
||||||
|
(26, 2, 'Bright Armor', 10000, 175, 'expbonus,10'),
|
||||||
|
(27, 2, 'Destiny Raiment', 50000, 200, 'dexterity,50'),
|
||||||
|
(28, 3, 'Reed Shield', 50, 2, 'X'),
|
||||||
|
(29, 3, 'Buckler', 100, 4, 'X'),
|
||||||
|
(30, 3, 'Small Shield', 500, 10, 'X'),
|
||||||
|
(31, 3, 'Large Shield', 2500, 30, 'X'),
|
||||||
|
(32, 3, 'Silver Shield', 10000, 60, 'X'),
|
||||||
|
(33, 3, 'Destiny Aegis', 25000, 100, 'maxhp,50');
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Items table populated.<br />' : 'Error populating Items table.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE levels (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`1_exp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`1_hp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`1_mp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`1_tp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`1_strength` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`1_dexterity` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`1_spells` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_exp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_hp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_mp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_tp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_strength` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_dexterity` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`2_spells` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_exp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_hp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_mp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_tp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_strength` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_dexterity` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`3_spells` INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Levels table created.<br />' : 'Error creating Levels table.';
|
||||||
|
|
||||||
|
if ($full) {
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
INSERT INTO levels VALUES
|
||||||
|
(1, 0, 15, 0, 5, 5, 5, 0, 0, 15, 0, 5, 5, 5, 0, 0, 15, 0, 5, 5, 5, 0),
|
||||||
|
(2, 15, 2, 5, 1, 0, 1, 1, 18, 2, 4, 1, 2, 1, 1, 20, 2, 5, 1, 0, 2, 1),
|
||||||
|
(3, 45, 3, 4, 2, 1, 2, 0, 54, 2, 3, 2, 3, 2, 0, 60, 2, 3, 2, 1, 3, 0),
|
||||||
|
(4, 105, 3, 3, 2, 1, 2, 6, 126, 2, 3, 2, 3, 2, 0, 140, 2, 4, 2, 1, 3, 0),
|
||||||
|
(5, 195, 2, 5, 2, 0, 1, 0, 234, 2, 4, 2, 2, 1, 6, 260, 2, 4, 2, 0, 2, 6),
|
||||||
|
(6, 330, 4, 5, 2, 2, 3, 0, 396, 3, 4, 2, 4, 3, 0, 440, 3, 5, 2, 2, 4, 0),
|
||||||
|
(7, 532, 3, 4, 2, 1, 2, 11, 639, 2, 3, 2, 3, 2, 0, 710, 2, 3, 2, 1, 3, 0),
|
||||||
|
(8, 835, 2, 4, 2, 0, 1, 0, 1003, 2, 3, 2, 2, 1, 11, 1115, 2, 4, 2, 0, 2, 11),
|
||||||
|
(9, 1290, 5, 3, 2, 3, 4, 2, 1549, 4, 2, 2, 5, 4, 0, 1722, 4, 2, 2, 3, 5, 0),
|
||||||
|
(10, 1973, 10, 3, 2, 4, 3, 0, 2369, 10, 2, 2, 6, 3, 0, 2633, 10, 3, 2, 4, 4, 0),
|
||||||
|
(11, 2997, 5, 2, 2, 3, 4, 0, 3598, 4, 1, 2, 5, 4, 2, 3999, 4, 1, 2, 3, 5, 2),
|
||||||
|
(12, 4533, 4, 2, 2, 2, 3, 7, 5441, 4, 1, 2, 4, 3, 0, 6047, 4, 2, 2, 2, 4, 0),
|
||||||
|
(13, 6453, 4, 3, 2, 2, 3, 0, 7745, 4, 2, 2, 4, 3, 0, 8607, 4, 2, 2, 2, 4, 0),
|
||||||
|
(14, 8853, 5, 4, 2, 3, 4, 17, 10625, 4, 3, 2, 5, 4, 7, 11807, 4, 4, 2, 3, 5, 7),
|
||||||
|
(15, 11853, 5, 5, 2, 3, 4, 0, 14225, 4, 4, 2, 5, 4, 0, 15808, 4, 4, 2, 3, 5, 0),
|
||||||
|
(16, 15603, 5, 3, 2, 3, 4, 0, 18725, 5, 2, 2, 5, 4, 0, 20807, 5, 3, 2, 3, 5, 0),
|
||||||
|
(17, 20290, 4, 2, 2, 2, 3, 12, 24350, 4, 1, 2, 4, 3, 0, 27057, 4, 1, 2, 2, 4, 0),
|
||||||
|
(18, 25563, 4, 2, 2, 2, 3, 0, 30678, 3, 1, 2, 4, 3, 14, 34869, 3, 2, 2, 2, 4, 17),
|
||||||
|
(19, 31495, 4, 5, 2, 2, 3, 0, 37797, 3, 4, 2, 4, 3, 0, 43657, 3, 4, 2, 2, 4, 0),
|
||||||
|
(20, 38169, 10, 6, 2, 3, 3, 0, 45805, 10, 5, 2, 5, 3, 0, 53543, 10, 6, 2, 3, 4, 0),
|
||||||
|
(21, 45676, 4, 4, 2, 2, 3, 0, 54814, 4, 3, 2, 4, 3, 0, 64664, 4, 3, 2, 2, 4, 0),
|
||||||
|
(22, 54121, 5, 5, 2, 3, 4, 0, 64949, 4, 4, 2, 5, 4, 12, 77175, 4, 5, 2, 3, 5, 12),
|
||||||
|
(23, 63622, 5, 3, 2, 3, 4, 0, 76350, 4, 2, 2, 5, 4, 0, 91250, 4, 2, 2, 3, 5, 0),
|
||||||
|
(24, 74310, 5, 5, 2, 3, 4, 0, 89176, 4, 4, 2, 5, 4, 0, 107083, 4, 5, 2, 3, 5, 0),
|
||||||
|
(25, 86334, 4, 4, 2, 2, 3, 3, 103605, 3, 3, 2, 4, 3, 17, 124895, 3, 3, 2, 2, 4, 14),
|
||||||
|
(26, 99861, 6, 3, 2, 4, 5, 0, 119837, 5, 2, 2, 6, 5, 0, 144933, 5, 3, 2, 4, 6, 0),
|
||||||
|
(27, 115078, 6, 2, 2, 4, 5, 0, 138098, 5, 1, 2, 6, 5, 0, 167475, 5, 1, 2, 4, 6, 0),
|
||||||
|
(28, 132197, 4, 2, 2, 2, 3, 0, 158641, 4, 1, 2, 4, 3, 0, 192835, 4, 2, 2, 2, 4, 0),
|
||||||
|
(29, 151456, 6, 3, 2, 4, 5, 0, 181751, 5, 2, 2, 6, 5, 3, 221365, 5, 2, 2, 4, 6, 3),
|
||||||
|
(30, 173121, 10, 4, 3, 4, 4, 0, 207749, 10, 3, 3, 6, 4, 0, 253461, 10, 4, 3, 4, 5, 0),
|
||||||
|
(31, 197494, 5, 5, 3, 3, 4, 8, 236996, 4, 3, 3, 5, 4, 0, 289568, 4, 3, 3, 3, 5, 0),
|
||||||
|
(32, 224913, 6, 4, 3, 4, 5, 0, 269898, 5, 3, 3, 6, 5, 0, 330188, 5, 4, 3, 4, 6, 0),
|
||||||
|
(33, 255758, 5, 4, 3, 3, 4, 0, 306912, 5, 3, 3, 5, 4, 0, 375885, 5, 3, 3, 3, 5, 0),
|
||||||
|
(34, 290458, 6, 4, 3, 4, 5, 0, 348552, 5, 3, 3, 6, 5, 8, 427294, 5, 4, 3, 4, 6, 8),
|
||||||
|
(35, 329495, 5, 3, 3, 3, 4, 0, 395397, 4, 2, 3, 5, 4, 0, 485126, 4, 2, 3, 3, 5, 0),
|
||||||
|
(36, 373412, 4, 3, 3, 2, 3, 18, 448097, 5, 2, 3, 4, 3, 0, 550188, 5, 3, 3, 2, 4, 0),
|
||||||
|
(37, 422818, 5, 4, 3, 3, 4, 0, 507384, 5, 3, 3, 5, 4, 0, 623383, 5, 3, 3, 3, 5, 0),
|
||||||
|
(38, 478399, 6, 5, 3, 4, 5, 0, 574081, 5, 4, 3, 6, 5, 15, 705726, 5, 5, 3, 4, 6, 18),
|
||||||
|
(39, 540927, 6, 4, 3, 4, 5, 0, 649115, 5, 3, 3, 6, 5, 0, 798362, 5, 3, 3, 4, 6, 0),
|
||||||
|
(40, 611271, 15, 3, 3, 5, 5, 13, 733528, 15, 2, 3, 7, 5, 0, 902577, 15, 3, 3, 5, 6, 0),
|
||||||
|
(41, 690408, 7, 3, 3, 5, 2, 0, 828492, 6, 2, 3, 7, 2, 0, 1019818, 6, 2, 3, 5, 3, 0),
|
||||||
|
(42, 779437, 7, 4, 3, 5, 6, 0, 935326, 6, 3, 3, 7, 6, 0, 1151714, 6, 4, 3, 5, 7, 0),
|
||||||
|
(43, 879592, 8, 5, 3, 6, 7, 0, 1055514, 7, 4, 3, 8, 7, 0, 1300096, 7, 4, 3, 6, 8, 0),
|
||||||
|
(44, 992268, 6, 3, 3, 4, 5, 0, 1190725, 5, 2, 3, 6, 5, 0, 1448478, 5, 3, 3, 4, 6, 0),
|
||||||
|
(45, 1119028, 5, 8, 3, 3, 4, 4, 1325936, 5, 8, 3, 5, 4, 18, 1596860, 5, 8, 3, 3, 5, 4),
|
||||||
|
(46, 1245788, 6, 5, 3, 4, 5, 0, 1461147, 5, 4, 3, 6, 5, 0, 1745242, 5, 5, 3, 4, 6, 0),
|
||||||
|
(47, 1372548, 7, 4, 3, 5, 6, 0, 1596358, 6, 3, 3, 7, 6, 0, 1893624, 6, 3, 3, 5, 7, 0),
|
||||||
|
(48, 1499308, 6, 4, 3, 4, 5, 0, 1731569, 5, 3, 3, 6, 5, 0, 2042006, 5, 4, 3, 4, 6, 0),
|
||||||
|
(49, 1626068, 5, 3, 3, 3, 4, 0, 1866780, 4, 2, 3, 5, 4, 0, 2190388, 4, 2, 3, 3, 5, 0),
|
||||||
|
(50, 1752828, 15, 3, 3, 5, 5, 0, 2001991, 15, 2, 3, 7, 5, 0, 2338770, 15, 3, 3, 5, 6, 0),
|
||||||
|
(51, 1879588, 6, 2, 3, 4, 5, 9, 2137202, 5, 1, 3, 6, 5, 13, 2487152, 5, 1, 3, 4, 6, 13),
|
||||||
|
(52, 2006348, 7, 2, 3, 5, 6, 0, 2272413, 6, 1, 3, 7, 6, 0, 2635534, 6, 2, 3, 5, 7, 0),
|
||||||
|
(53, 2133108, 8, 2, 3, 6, 7, 0, 2407624, 7, 1, 3, 8, 7, 0, 2783916, 7, 1, 3, 6, 8, 0),
|
||||||
|
(54, 2259868, 8, 4, 3, 6, 7, 0, 2542835, 7, 3, 3, 8, 7, 0, 2932298, 7, 4, 3, 6, 8, 0),
|
||||||
|
(55, 2386628, 7, 4, 3, 5, 6, 0, 2678046, 6, 3, 3, 7, 6, 0, 3080680, 6, 3, 3, 5, 7, 0),
|
||||||
|
(56, 2513388, 7, 4, 3, 5, 6, 0, 2813257, 6, 3, 3, 7, 6, 0, 3229062, 6, 4, 3, 5, 7, 9),
|
||||||
|
(57, 2640148, 6, 5, 3, 4, 5, 0, 2948468, 6, 4, 3, 6, 5, 0, 3377444, 6, 4, 3, 4, 6, 0),
|
||||||
|
(58, 2766908, 5, 5, 3, 3, 4, 0, 3083679, 5, 4, 3, 5, 4, 19, 3525826, 5, 5, 3, 3, 5, 0),
|
||||||
|
(59, 2893668, 8, 3, 3, 6, 7, 0, 3218890, 7, 2, 3, 8, 7, 0, 3674208, 7, 2, 3, 6, 8, 0),
|
||||||
|
(60, 3020428, 15, 4, 4, 6, 6, 19, 3354101, 15, 3, 4, 8, 6, 0, 3822590, 15, 4, 4, 6, 7, 15),
|
||||||
|
(61, 3147188, 8, 5, 4, 6, 7, 0, 3489312, 7, 4, 4, 8, 7, 0, 3970972, 7, 4, 4, 6, 8, 0),
|
||||||
|
(62, 3273948, 8, 4, 4, 6, 7, 0, 3624523, 7, 3, 4, 8, 7, 0, 4119354, 7, 4, 4, 6, 8, 0),
|
||||||
|
(63, 3400708, 9, 5, 4, 7, 8, 0, 3759734, 8, 4, 4, 9, 8, 0, 4267736, 8, 4, 4, 7, 9, 0),
|
||||||
|
(64, 3527468, 5, 5, 4, 3, 4, 0, 3894945, 5, 4, 4, 5, 4, 0, 4416118, 5, 5, 4, 3, 5, 0),
|
||||||
|
(65, 3654228, 6, 4, 4, 4, 5, 0, 4030156, 6, 3, 4, 6, 5, 0, 4564500, 6, 3, 4, 4, 6, 0),
|
||||||
|
(66, 3780988, 8, 4, 4, 6, 7, 0, 4165367, 8, 3, 4, 8, 7, 0, 4712882, 8, 4, 4, 6, 8, 0),
|
||||||
|
(67, 3907748, 7, 3, 4, 5, 6, 0, 4300578, 7, 2, 4, 7, 6, 0, 4861264, 7, 2, 4, 5, 7, 0),
|
||||||
|
(68, 4034508, 9, 3, 4, 7, 8, 0, 4435789, 8, 2, 4, 9, 8, 0, 5009646, 8, 3, 4, 7, 9, 0),
|
||||||
|
(69, 4161268, 5, 4, 4, 3, 4, 0, 4571000, 5, 3, 4, 5, 4, 0, 5158028, 5, 3, 4, 3, 5, 0),
|
||||||
|
(70, 4288028, 20, 4, 4, 6, 6, 5, 4706211, 20, 3, 4, 8, 6, 16, 5306410, 20, 4, 4, 6, 7, 0),
|
||||||
|
(71, 4414788, 5, 5, 4, 3, 4, 0, 4841422, 5, 4, 4, 5, 4, 0, 5454792, 5, 4, 4, 3, 5, 0),
|
||||||
|
(72, 4541548, 6, 2, 4, 4, 5, 0, 4976633, 5, 1, 4, 6, 5, 0, 5603174, 5, 2, 4, 4, 6, 0),
|
||||||
|
(73, 4668308, 8, 4, 4, 6, 7, 0, 5111844, 8, 3, 4, 8, 7, 0, 5751556, 8, 3, 4, 6, 8, 0),
|
||||||
|
(74, 4795068, 7, 5, 4, 5, 6, 0, 5247055, 6, 4, 4, 7, 6, 0, 5899938, 6, 5, 4, 5, 7, 0),
|
||||||
|
(75, 4921828, 5, 3, 4, 3, 4, 0, 5382266, 5, 2, 4, 5, 4, 0, 6048320, 5, 2, 4, 3, 5, 0),
|
||||||
|
(76, 5048588, 6, 3, 4, 4, 5, 0, 5517477, 6, 2, 4, 6, 5, 0, 6196702, 6, 3, 4, 4, 6, 0),
|
||||||
|
(77, 5175348, 6, 4, 4, 4, 5, 0, 5652688, 7, 3, 4, 6, 5, 0, 6345084, 7, 3, 4, 4, 6, 0),
|
||||||
|
(78, 5302108, 7, 4, 4, 5, 6, 0, 5787899, 7, 3, 4, 7, 6, 0, 6493466, 7, 4, 4, 5, 7, 0),
|
||||||
|
(79, 5428868, 8, 4, 4, 6, 7, 10, 5923110, 7, 3, 4, 8, 7, 0, 6641848, 7, 3, 4, 6, 8, 0),
|
||||||
|
(80, 5555628, 20, 5, 4, 6, 7, 0, 6058321, 20, 4, 4, 8, 7, 0, 6790230, 20, 5, 4, 6, 8, 0),
|
||||||
|
(81, 5682388, 7, 3, 4, 5, 6, 0, 6193532, 7, 2, 4, 7, 6, 0, 6938612, 7, 2, 4, 5, 7, 0),
|
||||||
|
(82, 5809148, 6, 4, 4, 4, 5, 0, 6328743, 5, 3, 4, 6, 5, 0, 7086994, 5, 4, 4, 4, 6, 0),
|
||||||
|
(83, 5935908, 6, 2, 4, 4, 5, 0, 6463954, 6, 1, 4, 6, 5, 0, 7235376, 6, 1, 4, 4, 6, 0),
|
||||||
|
(84, 6062668, 5, 4, 4, 3, 4, 0, 6599165, 5, 3, 4, 5, 4, 0, 7383758, 5, 4, 4, 3, 5, 0),
|
||||||
|
(85, 6189428, 7, 4, 4, 5, 6, 0, 6734376, 6, 3, 4, 7, 6, 0, 7532140, 6, 3, 4, 5, 7, 0),
|
||||||
|
(86, 6316188, 8, 5, 4, 6, 7, 0, 6869587, 8, 4, 4, 8, 7, 0, 7680522, 8, 5, 4, 6, 8, 0),
|
||||||
|
(87, 6442948, 8, 4, 4, 6, 7, 0, 7004798, 7, 3, 4, 8, 7, 0, 7828904, 7, 3, 4, 6, 8, 0),
|
||||||
|
(88, 6569708, 9, 5, 4, 7, 8, 0, 7140009, 8, 4, 4, 9, 8, 0, 7977286, 8, 5, 4, 7, 9, 0),
|
||||||
|
(89, 6696468, 5, 2, 4, 3, 4, 0, 7275220, 5, 1, 4, 5, 4, 0, 8125668, 5, 1, 4, 3, 5, 0),
|
||||||
|
(90, 6823228, 20, 2, 5, 7, 8, 0, 7410431, 20, 1, 5, 9, 8, 0, 8274050, 20, 2, 5, 7, 9, 0),
|
||||||
|
(91, 6949988, 5, 3, 5, 3, 4, 0, 7545642, 5, 2, 5, 5, 4, 0, 8422432, 5, 2, 5, 3, 5, 0),
|
||||||
|
(92, 7076748, 6, 3, 5, 4, 5, 0, 7680853, 4, 2, 5, 6, 5, 0, 8570814, 4, 3, 5, 4, 6, 0),
|
||||||
|
(93, 7203508, 8, 4, 5, 6, 7, 0, 7816064, 6, 2, 5, 8, 7, 0, 8719196, 6, 2, 5, 6, 8, 0),
|
||||||
|
(94, 7330268, 4, 4, 5, 3, 3, 0, 7951275, 4, 3, 5, 5, 3, 0, 8867578, 4, 4, 5, 3, 4, 0),
|
||||||
|
(95, 7457028, 3, 3, 5, 5, 2, 0, 8086486, 4, 2, 5, 7, 2, 0, 9015960, 4, 2, 5, 5, 3, 0),
|
||||||
|
(96, 7583788, 5, 3, 5, 4, 3, 0, 8221697, 5, 2, 5, 7, 3, 0, 9164342, 5, 3, 5, 4, 4, 0),
|
||||||
|
(97, 7710548, 5, 4, 5, 4, 5, 0, 8356908, 5, 3, 5, 7, 5, 0, 9312724, 5, 3, 5, 4, 6, 0),
|
||||||
|
(98, 7837308, 4, 5, 5, 4, 3, 0, 8492119, 4, 3, 5, 7, 3, 0, 9461106, 4, 4, 5, 4, 4, 0),
|
||||||
|
(99, 7964068, 50, 5, 5, 6, 5, 0, 8627330, 50, 3, 5, 9, 5, 0, 9609488, 50, 4, 5, 6, 6, 0),
|
||||||
|
(100, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Levels table populated.<br />' : 'Error populating Levels table.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE monsters (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`name` TEXT NOT NULL DEFAULT '',
|
||||||
|
`maxhp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`maxdam` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`armor` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`level` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`maxexp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`maxgold` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`immune` INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Monsters table created.<br />' : 'Error creating Monsters table.';
|
||||||
|
|
||||||
|
if ($full) {
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
INSERT INTO monsters VALUES
|
||||||
|
(1, 'Blue Slime', 4, 3, 1, 1, 1, 1, 0),
|
||||||
|
(2, 'Red Slime', 6, 5, 1, 1, 2, 1, 0),
|
||||||
|
(3, 'Critter', 6, 5, 2, 1, 4, 2, 0),
|
||||||
|
(4, 'Creature', 10, 8, 2, 2, 4, 2, 0),
|
||||||
|
(5, 'Shadow', 10, 9, 3, 2, 6, 2, 1),
|
||||||
|
(6, 'Drake', 11, 10, 3, 2, 8, 3, 0),
|
||||||
|
(7, 'Shade', 12, 10, 3, 3, 10, 3, 1),
|
||||||
|
(8, 'Drakelor', 14, 12, 4, 3, 10, 3, 0),
|
||||||
|
(9, 'Silver Slime', 15, 100, 200, 30, 15, 1000, 2),
|
||||||
|
(10, 'Scamp', 16, 13, 5, 4, 15, 5, 0),
|
||||||
|
(11, 'Raven', 16, 13, 5, 4, 18, 6, 0),
|
||||||
|
(12, 'Scorpion', 18, 14, 6, 5, 20, 7, 0),
|
||||||
|
(13, 'Illusion', 20, 15, 6, 5, 20, 7, 1),
|
||||||
|
(14, 'Nightshade', 22, 16, 6, 6, 24, 8, 0),
|
||||||
|
(15, 'Drakemal', 22, 18, 7, 6, 24, 8, 0),
|
||||||
|
(16, 'Shadow Raven', 24, 18, 7, 6, 26, 9, 1),
|
||||||
|
(17, 'Ghost', 24, 20, 8, 6, 28, 9, 0),
|
||||||
|
(18, 'Frost Raven', 26, 20, 8, 7, 30, 10, 0),
|
||||||
|
(19, 'Rogue Scorpion', 28, 22, 9, 7, 32, 11, 0),
|
||||||
|
(20, 'Ghoul', 29, 24, 9, 7, 34, 11, 0),
|
||||||
|
(21, 'Magician', 30, 24, 10, 8, 36, 12, 0),
|
||||||
|
(22, 'Rogue', 30, 25, 12, 8, 40, 13, 0),
|
||||||
|
(23, 'Drakefin', 32, 26, 12, 8, 40, 13, 0),
|
||||||
|
(24, 'Shimmer', 32, 26, 14, 8, 45, 15, 1),
|
||||||
|
(25, 'Fire Raven', 34, 28, 14, 9, 45, 15, 0),
|
||||||
|
(26, 'Dybbuk', 34, 28, 14, 9, 50, 17, 0),
|
||||||
|
(27, 'Knave', 36, 30, 15, 9, 52, 17, 0),
|
||||||
|
(28, 'Goblin', 36, 30, 15, 10, 54, 18, 0),
|
||||||
|
(29, 'Skeleton', 38, 30, 18, 10, 58, 19, 0),
|
||||||
|
(30, 'Dark Slime', 38, 32, 18, 10, 62, 21, 0),
|
||||||
|
(31, 'Silver Scorpion', 30, 160, 350, 40, 63, 2000, 2),
|
||||||
|
(32, 'Mirage', 40, 32, 20, 11, 64, 21, 1),
|
||||||
|
(33, 'Sorceror', 41, 33, 22, 11, 68, 23, 0),
|
||||||
|
(34, 'Imp', 42, 34, 22, 12, 70, 23, 0),
|
||||||
|
(35, 'Nymph', 43, 35, 22, 12, 70, 23, 0),
|
||||||
|
(36, 'Scoundrel', 43, 35, 22, 12, 75, 25, 0),
|
||||||
|
(37, 'Megaskeleton', 44, 36, 24, 13, 78, 26, 0),
|
||||||
|
(38, 'Grey Wolf', 44, 36, 24, 13, 82, 27, 0),
|
||||||
|
(39, 'Phantom', 46, 38, 24, 14, 85, 28, 1),
|
||||||
|
(40, 'Specter', 46, 38, 24, 14, 90, 30, 0),
|
||||||
|
(41, 'Dark Scorpion', 48, 40, 26, 15, 95, 32, 1),
|
||||||
|
(42, 'Warlock', 48, 40, 26, 15, 100, 33, 1),
|
||||||
|
(43, 'Orc', 49, 42, 28, 15, 104, 35, 0),
|
||||||
|
(44, 'Sylph', 49, 42, 28, 15, 106, 35, 0),
|
||||||
|
(45, 'Wraith', 50, 45, 30, 16, 108, 36, 0),
|
||||||
|
(46, 'Hellion', 50, 45, 30, 16, 110, 37, 0),
|
||||||
|
(47, 'Bandit', 52, 45, 30, 16, 114, 38, 0),
|
||||||
|
(48, 'Ultraskeleton', 52, 46, 32, 16, 116, 39, 0),
|
||||||
|
(49, 'Dark Wolf', 54, 47, 36, 17, 120, 40, 1),
|
||||||
|
(50, 'Troll', 56, 48, 36, 17, 120, 40, 0),
|
||||||
|
(51, 'Werewolf', 56, 48, 38, 17, 124, 41, 0),
|
||||||
|
(52, 'Hellcat', 58, 50, 38, 18, 128, 43, 0),
|
||||||
|
(53, 'Spirit', 58, 50, 38, 18, 132, 44, 0),
|
||||||
|
(54, 'Nisse', 60, 52, 40, 19, 132, 44, 0),
|
||||||
|
(55, 'Dawk', 60, 54, 40, 19, 136, 45, 0),
|
||||||
|
(56, 'Figment', 64, 55, 42, 19, 140, 47, 1),
|
||||||
|
(57, 'Hellhound', 66, 56, 44, 20, 140, 47, 0),
|
||||||
|
(58, 'Wizard', 66, 56, 44, 20, 144, 48, 0),
|
||||||
|
(59, 'Uruk', 68, 58, 44, 20, 146, 49, 0),
|
||||||
|
(60, 'Siren', 68, 400, 800, 50, 10000, 50, 2),
|
||||||
|
(61, 'Megawraith', 70, 60, 46, 21, 155, 52, 0),
|
||||||
|
(62, 'Dawkin', 70, 60, 46, 21, 155, 52, 0),
|
||||||
|
(63, 'Grey Bear', 70, 62, 48, 21, 160, 53, 0),
|
||||||
|
(64, 'Haunt', 72, 62, 48, 22, 160, 53, 0),
|
||||||
|
(65, 'Hellbeast', 74, 64, 50, 22, 165, 55, 0),
|
||||||
|
(66, 'Fear', 76, 66, 52, 23, 165, 55, 0),
|
||||||
|
(67, 'Beast', 76, 66, 52, 23, 170, 57, 0),
|
||||||
|
(68, 'Ogre', 78, 68, 54, 23, 170, 57, 0),
|
||||||
|
(69, 'Dark Bear', 80, 70, 56, 24, 175, 58, 1),
|
||||||
|
(70, 'Fire', 80, 72, 56, 24, 175, 58, 0),
|
||||||
|
(71, 'Polgergeist', 84, 74, 58, 25, 180, 60, 0),
|
||||||
|
(72, 'Fright', 86, 76, 58, 25, 180, 60, 0),
|
||||||
|
(73, 'Lycan', 88, 78, 60, 25, 185, 62, 0),
|
||||||
|
(74, 'Terra Elemental', 88, 80, 62, 25, 185, 62, 1),
|
||||||
|
(75, 'Necromancer', 90, 80, 62, 26, 190, 63, 0),
|
||||||
|
(76, 'Ultrawraith', 90, 82, 64, 26, 190, 63, 0),
|
||||||
|
(77, 'Dawkor', 92, 82, 64, 26, 195, 65, 0),
|
||||||
|
(78, 'Werebear', 92, 84, 65, 26, 195, 65, 0),
|
||||||
|
(79, 'Brute', 94, 84, 65, 27, 200, 67, 0),
|
||||||
|
(80, 'Large Beast', 96, 88, 66, 27, 200, 67, 0),
|
||||||
|
(81, 'Horror', 96, 88, 68, 27, 210, 70, 0),
|
||||||
|
(82, 'Flame', 100, 90, 70, 28, 210, 70, 0),
|
||||||
|
(83, 'Lycanthor', 100, 90, 70, 28, 210, 70, 0),
|
||||||
|
(84, 'Wyrm', 100, 92, 72, 28, 220, 73, 0),
|
||||||
|
(85, 'Aero Elemental', 104, 94, 74, 29, 220, 73, 1),
|
||||||
|
(86, 'Dawkare', 106, 96, 76, 29, 220, 73, 0),
|
||||||
|
(87, 'Large Brute', 108, 98, 78, 29, 230, 77, 0),
|
||||||
|
(88, 'Frost Wyrm', 110, 100, 80, 30, 230, 77, 0),
|
||||||
|
(89, 'Knight', 110, 102, 80, 30, 240, 80, 0),
|
||||||
|
(90, 'Lycanthra', 112, 104, 82, 30, 240, 80, 0),
|
||||||
|
(91, 'Terror', 115, 108, 84, 31, 250, 83, 0),
|
||||||
|
(92, 'Blaze', 118, 108, 84, 31, 250, 83, 0),
|
||||||
|
(93, 'Aqua Elemental', 120, 110, 90, 31, 260, 87, 1),
|
||||||
|
(94, 'Fire Wyrm', 120, 110, 90, 32, 260, 87, 0),
|
||||||
|
(95, 'Lesser Wyvern', 122, 110, 92, 32, 270, 90, 0),
|
||||||
|
(96, 'Doomer', 124, 112, 92, 32, 270, 90, 0),
|
||||||
|
(97, 'Armor Knight', 130, 115, 95, 33, 280, 93, 0),
|
||||||
|
(98, 'Wyvern', 134, 120, 95, 33, 290, 97, 0),
|
||||||
|
(99, 'Nightmare', 138, 125, 100, 33, 300, 100, 0),
|
||||||
|
(100, 'Fira Elemental', 140, 125, 100, 34, 310, 103, 1),
|
||||||
|
(101, 'Megadoomer', 140, 128, 105, 34, 320, 107, 0),
|
||||||
|
(102, 'Greater Wyvern', 145, 130, 105, 34, 335, 112, 0),
|
||||||
|
(103, 'Advocate', 148, 132, 108, 35, 350, 117, 0),
|
||||||
|
(104, 'Strong Knight', 150, 135, 110, 35, 365, 122, 0),
|
||||||
|
(105, 'Liche', 150, 135, 110, 35, 380, 127, 0),
|
||||||
|
(106, 'Ultradoomer', 155, 140, 115, 36, 395, 132, 0),
|
||||||
|
(107, 'Fanatic', 160, 140, 115, 36, 410, 137, 0),
|
||||||
|
(108, 'Green Dragon', 160, 140, 115, 36, 425, 142, 0),
|
||||||
|
(109, 'Fiend', 160, 145, 120, 37, 445, 148, 0),
|
||||||
|
(110, 'Greatest Wyvern', 162, 150, 120, 37, 465, 155, 0),
|
||||||
|
(111, 'Lesser Devil', 164, 150, 120, 37, 485, 162, 0),
|
||||||
|
(112, 'Liche Master', 168, 155, 125, 38, 505, 168, 0),
|
||||||
|
(113, 'Zealot', 168, 155, 125, 38, 530, 177, 0),
|
||||||
|
(114, 'Serafiend', 170, 155, 125, 38, 555, 185, 0),
|
||||||
|
(115, 'Pale Knight', 175, 160, 130, 39, 580, 193, 0),
|
||||||
|
(116, 'Blue Dragon', 180, 160, 130, 39, 605, 202, 0),
|
||||||
|
(117, 'Obsessive', 180, 160, 135, 40, 630, 210, 0),
|
||||||
|
(118, 'Devil', 184, 164, 135, 40, 666, 222, 0),
|
||||||
|
(119, 'Liche Prince', 190, 168, 138, 40, 660, 220, 0),
|
||||||
|
(120, 'Cherufiend', 195, 170, 140, 41, 690, 230, 0),
|
||||||
|
(121, 'Red Dragon', 200, 180, 145, 41, 720, 240, 0),
|
||||||
|
(122, 'Greater Devil', 200, 180, 145, 41, 750, 250, 0),
|
||||||
|
(123, 'Renegade', 205, 185, 150, 42, 780, 260, 0),
|
||||||
|
(124, 'Archfiend', 210, 190, 150, 42, 810, 270, 0),
|
||||||
|
(125, 'Liche Lord', 210, 190, 155, 42, 850, 283, 0),
|
||||||
|
(126, 'Greatest Devil', 215, 195, 160, 43, 890, 297, 0),
|
||||||
|
(127, 'Dark Knight', 220, 200, 160, 43, 930, 310, 0),
|
||||||
|
(128, 'Giant', 220, 200, 165, 43, 970, 323, 0),
|
||||||
|
(129, 'Shadow Dragon', 225, 200, 170, 44, 1010, 337, 0),
|
||||||
|
(130, 'Liche King', 225, 205, 170, 44, 1050, 350, 0),
|
||||||
|
(131, 'Incubus', 230, 205, 175, 44, 1100, 367, 1),
|
||||||
|
(132, 'Traitor', 230, 205, 175, 45, 1150, 383, 0),
|
||||||
|
(133, 'Demon', 240, 210, 180, 45, 1200, 400, 0),
|
||||||
|
(134, 'Dark Dragon', 245, 215, 180, 45, 1250, 417, 1),
|
||||||
|
(135, 'Insurgent', 250, 220, 190, 46, 1300, 433, 0),
|
||||||
|
(136, 'Leviathan', 255, 225, 190, 46, 1350, 450, 0),
|
||||||
|
(137, 'Grey Daemon', 260, 230, 190, 46, 1400, 467, 0),
|
||||||
|
(138, 'Succubus', 265, 240, 200, 47, 1460, 487, 1),
|
||||||
|
(139, 'Demon Prince', 270, 240, 200, 47, 1520, 507, 0),
|
||||||
|
(140, 'Black Dragon', 275, 250, 205, 47, 1580, 527, 1),
|
||||||
|
(141, 'Nihilist', 280, 250, 205, 47, 1640, 547, 0),
|
||||||
|
(142, 'Behemoth', 285, 260, 210, 48, 1700, 567, 0),
|
||||||
|
(143, 'Demagogue', 290, 260, 210, 48, 1760, 587, 0),
|
||||||
|
(144, 'Demon Lord', 300, 270, 220, 48, 1820, 607, 0),
|
||||||
|
(145, 'Red Daemon', 310, 280, 230, 48, 1880, 627, 0),
|
||||||
|
(146, 'Colossus', 320, 300, 240, 49, 1940, 647, 0),
|
||||||
|
(147, 'Demon King', 330, 300, 250, 49, 2000, 667, 0),
|
||||||
|
(148, 'Dark Daemon', 340, 320, 260, 49, 2200, 733, 1),
|
||||||
|
(149, 'Titan', 360, 340, 270, 50, 2400, 800, 0),
|
||||||
|
(150, 'Black Daemon', 400, 400, 280, 50, 3000, 1000, 1),
|
||||||
|
(151, 'Lucifuge', 600, 600, 400, 50, 10000, 10000, 2);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Monsters table populated.<br />' : 'Error populating Monsters table.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE news (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`postdate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`content` TEXT NOT NULL
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'News table created.<br />' : 'Error creating News table.';
|
||||||
|
|
||||||
|
$query = db()->exec("INSERT INTO news VALUES (1, '2004-01-01 12:00:00', 'This is the first news post. Please use the admin control panel to add another one and make this one go away.');");
|
||||||
|
|
||||||
|
echo $query === true ? 'News table populated.<br />' : 'Error populating News table.';
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE spells (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`name` TEXT NOT NULL,
|
||||||
|
`mp` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`attribute` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`type` INTEGER NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Spells table created.<br />' : 'Error creating Spells table.';
|
||||||
|
|
||||||
|
if ($full) {
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
INSERT INTO spells VALUES
|
||||||
|
(1, 'Heal', 5, 10, 1),
|
||||||
|
(2, 'Revive', 10, 25, 1),
|
||||||
|
(3, 'Life', 25, 50, 1),
|
||||||
|
(4, 'Breath', 50, 100, 1),
|
||||||
|
(5, 'Gaia', 75, 150, 1),
|
||||||
|
(6, 'Hurt', 5, 15, 2),
|
||||||
|
(7, 'Pain', 12, 35, 2),
|
||||||
|
(8, 'Maim', 25, 70, 2),
|
||||||
|
(9, 'Rend', 40, 100, 2),
|
||||||
|
(10, 'Chaos', 50, 130, 2),
|
||||||
|
(11, 'Sleep', 10, 5, 3),
|
||||||
|
(12, 'Dream', 30, 9, 3),
|
||||||
|
(13, 'Nightmare', 60, 13, 3),
|
||||||
|
(14, 'Craze', 10, 10, 4),
|
||||||
|
(15, 'Rage', 20, 25, 4),
|
||||||
|
(16, 'Fury', 30, 50, 4),
|
||||||
|
(17, 'Ward', 10, 10, 5),
|
||||||
|
(18, 'Fend', 20, 25, 5),
|
||||||
|
(19, 'Barrier', 30, 50, 5);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Spells table populated.<br />' : 'Error populating Spells table.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE towns (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`name` TEXT NOT NULL,
|
||||||
|
`latitude` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`longitude` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`innprice` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`mapprice` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`travelpoints` INTEGER NOT NULL DEFAULT 0,
|
||||||
|
`itemslist` TEXT NOT NULL
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Towns table created.<br />' : 'Error creating Towns table.';
|
||||||
|
|
||||||
|
if ($full) {
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
INSERT INTO towns VALUES
|
||||||
|
(1, 'Midworld', 0, 0, 5, 0, 0, '1,2,3,17,18,19,28,29'),
|
||||||
|
(2, 'Roma', 30, 30, 10, 25, 5, '2,3,4,18,19,29'),
|
||||||
|
(3, 'Bris', 70, -70, 25, 50, 15, '2,3,4,5,18,19,20,29.30'),
|
||||||
|
(4, 'Kalle', -100, 100, 40, 100, 30, '5,6,8,10,12,21,22,23,29,30'),
|
||||||
|
(5, 'Narcissa', -130, -130, 60, 500, 50, '4,7,9,11,13,21,22,23,29,30,31'),
|
||||||
|
(6, 'Hambry', 170, 170, 90, 1000, 80, '10,11,12,13,14,23,24,30,31'),
|
||||||
|
(7, 'Gilead', 200, -200, 100, 3000, 110, '12,13,14,15,24,25,26,32'),
|
||||||
|
(8, 'Endworld', -250, -250, 125, 9000, 160, '16,27,33');
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Towns table populated.<br />' : 'Error populating Towns table.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = db()->exec(<<<SQL
|
||||||
|
CREATE TABLE users (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`username` TEXT NOT NULL,
|
||||||
|
`password` TEXT NOT NULL,
|
||||||
|
`email` TEXT NOT NULL,
|
||||||
|
`verify` INTEGER NOT NULL default 0,
|
||||||
|
`regdate` datetime NOT NULL default CURRENT_TIMESTAMP,
|
||||||
|
`onlinetime` datetime NOT NULL default CURRENT_TIMESTAMP,
|
||||||
|
`authlevel` INTEGER NOT NULL default 0,
|
||||||
|
`latitude` INTEGER NOT NULL default 0,
|
||||||
|
`longitude` INTEGER NOT NULL default 0,
|
||||||
|
`difficulty` INTEGER NOT NULL default 0,
|
||||||
|
`charclass` INTEGER NOT NULL default 0,
|
||||||
|
`currentaction` TEXT NOT NULL default 'In Town',
|
||||||
|
`currentfight` INTEGER NOT NULL default 0,
|
||||||
|
`currentmonster` INTEGER NOT NULL default 0,
|
||||||
|
`currentmonsterhp` INTEGER NOT NULL default 0,
|
||||||
|
`currentmonstersleep` INTEGER NOT NULL default 0,
|
||||||
|
`currentmonsterimmune` INTEGER NOT NULL default 0,
|
||||||
|
`currentuberdamage` INTEGER NOT NULL default 0,
|
||||||
|
`currentuberdefense` INTEGER NOT NULL default 0,
|
||||||
|
`currenthp` INTEGER NOT NULL default 15,
|
||||||
|
`currentmp` INTEGER NOT NULL default 0,
|
||||||
|
`currenttp` INTEGER NOT NULL default 10,
|
||||||
|
`maxhp` INTEGER NOT NULL default 15,
|
||||||
|
`maxmp` INTEGER NOT NULL default 0,
|
||||||
|
`maxtp` INTEGER NOT NULL default 10,
|
||||||
|
`level` INTEGER NOT NULL default 1,
|
||||||
|
`gold` INTEGER NOT NULL default 100,
|
||||||
|
`experience` INTEGER NOT NULL default 0,
|
||||||
|
`goldbonus` INTEGER NOT NULL default 0,
|
||||||
|
`expbonus` INTEGER NOT NULL default 0,
|
||||||
|
`strength` INTEGER NOT NULL default 5,
|
||||||
|
`dexterity` INTEGER NOT NULL default 5,
|
||||||
|
`attackpower` INTEGER NOT NULL default 5,
|
||||||
|
`defensepower` INTEGER NOT NULL default 5,
|
||||||
|
`weaponid` INTEGER NOT NULL default 0,
|
||||||
|
`armorid` INTEGER NOT NULL default 0,
|
||||||
|
`shieldid` INTEGER NOT NULL default 0,
|
||||||
|
`slot1id` INTEGER NOT NULL default 0,
|
||||||
|
`slot2id` INTEGER NOT NULL default 0,
|
||||||
|
`slot3id` INTEGER NOT NULL default 0,
|
||||||
|
`weaponname` TEXT NOT NULL default 'None',
|
||||||
|
`armorname` TEXT NOT NULL default 'None',
|
||||||
|
`shieldname` TEXT NOT NULL default 'None',
|
||||||
|
`slot1name` TEXT NOT NULL default 'None',
|
||||||
|
`slot2name` TEXT NOT NULL default 'None',
|
||||||
|
`slot3name` TEXT NOT NULL default 'None',
|
||||||
|
`dropcode` INTEGER NOT NULL default 0,
|
||||||
|
`spells` TEXT NOT NULL default '0',
|
||||||
|
`towns` TEXT NOT NULL default '0'
|
||||||
|
);
|
||||||
|
SQL);
|
||||||
|
|
||||||
|
echo $query === true ? 'Users table created.<br />' : 'Error creating Users table.';
|
||||||
|
|
||||||
|
$time = round((microtime(true) - START), 4);
|
||||||
|
echo "<br />Database setup complete in $time seconds.<br /><br /><a href=\"install.php?page=3\">Click here to continue with installation.</a></body></html>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gather user info for admin account.
|
||||||
|
*/
|
||||||
|
function third()
|
||||||
|
{
|
||||||
|
echo <<<HTML
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dragon Knight Installation</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<b>Dragon Knight Installation: Page Three</b><br /><br />
|
||||||
|
Now you must create an administrator account so you can use the control panel. Fill out the form below to create your account. You will be able to customize the class names through the control panel once your admin account is created.<br /><br />
|
||||||
|
<form action="install.php?page=4" method="post">
|
||||||
|
<table width="50%">
|
||||||
|
<tr><td width="20%" style="vertical-align:top;">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
||||||
|
<tr><td style="vertical-align:top;">Password:</td><td><input type="password" name="password1" size="30" maxlength="30" /></td></tr>
|
||||||
|
<tr><td style="vertical-align:top;">Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br /><br /><br /></td></tr>
|
||||||
|
<tr><td style="vertical-align:top;">Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
|
||||||
|
<tr><td style="vertical-align:top;">Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" /><br /><br /><br /></td></tr>
|
||||||
|
<tr><td style="vertical-align:top;">Character Class:</td><td><select name="charclass"><option value="1">Mage</option><option value="2">Warrior</option><option value="3">Paladin</option></select></td></tr>
|
||||||
|
<tr><td style="vertical-align:top;">Difficulty:</td><td><select name="difficulty"><option value="1">Easy</option><option value="2">Medium</option><option value="3">Hard</option></select></td></tr>
|
||||||
|
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Final page: insert new user row, congratulate the person on a job well done.
|
||||||
|
*/
|
||||||
|
function fourth()
|
||||||
|
{
|
||||||
|
$u = trim($_POST['username'] ??= '');
|
||||||
|
$e = trim($_POST['email1'] ??= '');
|
||||||
|
$ec = trim($_POST['email2'] ??= '');
|
||||||
|
$p = $_POST['password1'] ??= '';
|
||||||
|
$pc = $_POST['password2'] ??= '';
|
||||||
|
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
if (empty($u) || strlen($u) < 3 || strlen($u) > 18 || !ctype_alnum(str_replace(' ', '', $u))) {
|
||||||
|
$errors[] = 'Username is required and must be between 3 and 18 characters long and contain only
|
||||||
|
alphanumeric characters and spaces.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($e) || strlen($e) > 255 || !filter_var($e, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$errors[] = 'Email is required must be a valid email address.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($e !== $ec) {
|
||||||
|
$errors[] = 'Verify Email must match.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($p) || strlen($p) < 6) {
|
||||||
|
$errors[] = 'Password is required and must be at least 6 characters long.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pc !== $p) {
|
||||||
|
$errors[] = 'Verify Password must match.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($errors)) {
|
||||||
|
echo "<ul>";
|
||||||
|
foreach ($errors as $error) echo "<li>$error</li>";
|
||||||
|
echo "</ul>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db()->query(
|
||||||
|
"INSERT INTO users (username, password, email, verify, charclass, authlevel) VALUES (?, ?, ?, 1, ?, 1)",
|
||||||
|
[$u, password_hash($p, PASSWORD_ARGON2ID), $e, $_POST['charclass']]
|
||||||
|
) === false) {
|
||||||
|
echo "Failed to create user.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents('../.installed', date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
|
echo <<<HTML
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dragon Knight Installation</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<b>Dragon Knight Installation: Page Four</b><br /><br />
|
||||||
|
Your admin account was created successfully. Installation is complete.<br /><br />
|
||||||
|
Be sure to delete install.php from your Dragon Knight directory for security purposes.<br /><br />
|
||||||
|
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.<br /><br/>
|
||||||
|
Thank you for using Dragon Knight!<br /><br />-----<br /><br />
|
||||||
|
<b>Optional:</b> Dragon Knight is a free product, and does not require registration of any sort. However, there is an
|
||||||
|
optional "call home" function in the installer, which notifies the author of your game installation. The ONLY information
|
||||||
|
transmitted with this function is the URL to your game. This is included mainly to satisfy the author's curiosity about
|
||||||
|
how many copies of the game are being installed and used. If you choose to submit your URL to the author, please
|
||||||
|
<a href="install.php?page=5">click here</a>.
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call Home function.
|
||||||
|
*/
|
||||||
|
function fifth()
|
||||||
|
{
|
||||||
|
if (mail("sky@sharkk.net", "Dragon Knight Call Home", $_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]) !== true) {
|
||||||
|
die('Dragon Knight was unable to send your URL. Please go back and try again, or just continue on to <a href=\"index.php\">the game</a>.');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo <<<HTML
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dragon Knight Installation</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<b>Dragon Knight Installation: Page Five</b><br /><br />
|
||||||
|
Thank you for submitting your URL!<br /><br />
|
||||||
|
You are now ready to <a href="index.php">play the game</a>. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
47
public/login.php
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// login.php :: Handles logins and cookies.
|
||||||
|
|
||||||
|
if (!file_exists('../.installed')) {
|
||||||
|
header('Location: install.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once '../src/lib.php';
|
||||||
|
|
||||||
|
match ($_GET['do'] ?? 'login') {
|
||||||
|
'login' => login(),
|
||||||
|
'logout' => logout()
|
||||||
|
};
|
||||||
|
|
||||||
|
function login()
|
||||||
|
{
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$u = trim($_POST['username'] ?? '');
|
||||||
|
|
||||||
|
$query = db()->query('SELECT * FROM users WHERE username = ? LIMIT 1;', [$u]);
|
||||||
|
if ($query === false) die("Invalid username or password. Please go back and try again.");
|
||||||
|
$row = $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
if (!password_verify($_POST['password'] ?? '', $row['password'])) die("Invalid username or password. Please go back and try again.");
|
||||||
|
|
||||||
|
$expiretime = isset($_POST["rememberme"]) ? time() + 31536000 : 0;
|
||||||
|
$rememberme = isset($_POST["rememberme"]) ? 1 : 0;
|
||||||
|
$cookie = implode(' ', [$row['id'], $row['username'], $row['password'], $rememberme]);
|
||||||
|
|
||||||
|
set_cookie("dkgame", $cookie, $expiretime);
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$page = gettemplate("login");
|
||||||
|
$title = "Log In";
|
||||||
|
display($page, $title, false, false, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function logout()
|
||||||
|
{
|
||||||
|
set_cookie("dkgame", "", -3600);
|
||||||
|
header("Location: login.php?do=login");
|
||||||
|
die();
|
||||||
|
}
|
71
src/database.php
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An extension to the SQLite3 class to add our own logging and binding semantics!
|
||||||
|
*/
|
||||||
|
class Database extends SQLite3
|
||||||
|
{
|
||||||
|
public int $count = 0;
|
||||||
|
public array $log = [];
|
||||||
|
public float $query_time = 0;
|
||||||
|
|
||||||
|
public function __construct(string $db_path)
|
||||||
|
{
|
||||||
|
parent::__construct($db_path);
|
||||||
|
|
||||||
|
parent::exec('PRAGMA cache_size = 32000');
|
||||||
|
parent::exec('PRAGMA journal_mode = WAL');
|
||||||
|
parent::exec('PRAGMA temp_store = MEMORY');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function query(string $query, array $params = []): SQLite3Result|false
|
||||||
|
{
|
||||||
|
$p = strpos($query, '?') !== false;
|
||||||
|
$stmt = $this->prepare($query);
|
||||||
|
|
||||||
|
foreach ($params ?? [] as $k => $v) $stmt->bindValue($p ? $k + 1 : $k, $v, $this->getSQLiteType($v));
|
||||||
|
|
||||||
|
$start = microtime(true);
|
||||||
|
$r = $stmt->execute();
|
||||||
|
$this->log($query, microtime(true) - $start);
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exec(string $query): bool
|
||||||
|
{
|
||||||
|
$start = microtime(true);
|
||||||
|
$r = parent::exec($query);
|
||||||
|
$this->log($query, microtime(true) - $start);
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exists(string $table, string $column, mixed $value, bool $case_insensitive = true): bool
|
||||||
|
{
|
||||||
|
if ($case_insensitive) {
|
||||||
|
$query = "SELECT 1 FROM $table WHERE $column = :v COLLATE NOCASE LIMIT 1";
|
||||||
|
} else {
|
||||||
|
$query = "SELECT 1 FROM $table WHERE $column = :v LIMIT 1";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->query($query, [':v' => $value]);
|
||||||
|
return $result->fetchArray(SQLITE3_NUM) !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function log(string $query, float $time_taken): void
|
||||||
|
{
|
||||||
|
$this->count++;
|
||||||
|
$this->query_time += $time_taken;
|
||||||
|
$this->log[] = [$query, $time_taken];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSQLiteType(mixed $value): int
|
||||||
|
{
|
||||||
|
return match (true) {
|
||||||
|
is_int($value) => SQLITE3_INTEGER,
|
||||||
|
is_float($value) => SQLITE3_FLOAT,
|
||||||
|
is_null($value) => SQLITE3_NULL,
|
||||||
|
default => SQLITE3_TEXT
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,94 +1,40 @@
|
||||||
<?php // lib.php :: Common functions used throughout the program.
|
<?php
|
||||||
|
|
||||||
$starttime = getmicrotime();
|
require_once __DIR__ . '/database.php';
|
||||||
$numqueries = 0;
|
|
||||||
$version = "1.1.11";
|
|
||||||
$build = "";
|
|
||||||
|
|
||||||
// Handling for servers with magic_quotes turned on.
|
define('VERSION', '1.1.11');
|
||||||
// Example from php.net.
|
define('BUILD', '');
|
||||||
if (get_magic_quotes_gpc()) {
|
define('START', microtime(true));
|
||||||
|
|
||||||
$_POST = array_map('stripslashes_deep', $_POST);
|
|
||||||
$_GET = array_map('stripslashes_deep', $_GET);
|
|
||||||
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
|
||||||
|
|
||||||
}
|
|
||||||
$_POST = array_map('addslashes_deep', $_POST);
|
|
||||||
$_POST = array_map('html_deep', $_POST);
|
|
||||||
$_GET = array_map('addslashes_deep', $_GET);
|
|
||||||
$_GET = array_map('html_deep', $_GET);
|
|
||||||
$_COOKIE = array_map('addslashes_deep', $_COOKIE);
|
|
||||||
$_COOKIE = array_map('html_deep', $_COOKIE);
|
|
||||||
|
|
||||||
function stripslashes_deep($value) {
|
|
||||||
|
|
||||||
$value = is_array($value) ?
|
|
||||||
array_map('stripslashes_deep', $value) :
|
|
||||||
stripslashes($value);
|
|
||||||
return $value;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function addslashes_deep($value) {
|
|
||||||
|
|
||||||
$value = is_array($value) ?
|
|
||||||
array_map('addslashes_deep', $value) :
|
|
||||||
addslashes($value);
|
|
||||||
return $value;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function html_deep($value) {
|
|
||||||
|
|
||||||
$value = is_array($value) ?
|
|
||||||
array_map('html_deep', $value) :
|
|
||||||
htmlspecialchars($value);
|
|
||||||
return $value;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function opendb() { // Open database connection.
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
extract($dbsettings);
|
|
||||||
$link = mysql_connect($server, $user, $pass) or die(mysql_error());
|
|
||||||
mysql_select_db($name) or die(mysql_error());
|
|
||||||
return $link;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function doquery($query, $table) { // Something of a tiny little database abstraction layer.
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
global $numqueries;
|
|
||||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . "_" . $table, $query)) or die(mysql_error());
|
|
||||||
$numqueries++;
|
|
||||||
return $sqlquery;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open or get SQLite database connection.
|
||||||
|
*/
|
||||||
|
function db(): Database
|
||||||
|
{
|
||||||
|
return $GLOBALS['database'] ??= new Database(__DIR__ . '/../database.db');
|
||||||
}
|
}
|
||||||
|
|
||||||
function gettemplate($templatename) { // SQL query for the template.
|
function gettemplate($templatename) { // SQL query for the template.
|
||||||
|
|
||||||
$filename = "templates/" . $templatename . ".php";
|
$filename = __DIR__ . "/../templates/" . $templatename . ".php";
|
||||||
include("$filename");
|
include("$filename");
|
||||||
return $template;
|
return $template;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parsetemplate($template, $array) { // Replace template with proper content.
|
function parsetemplate($template, $array) { // Replace template with proper content.
|
||||||
|
|
||||||
foreach($array as $a => $b) {
|
foreach($array as $a => $b) {
|
||||||
$template = str_replace("{{{$a}}}", $b, $template);
|
$template = str_replace("{{{$a}}}", $b, $template);
|
||||||
}
|
}
|
||||||
return $template;
|
return $template;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getmicrotime() { // Used for timing script operations.
|
function getmicrotime() { // Used for timing script operations.
|
||||||
|
|
||||||
list($usec, $sec) = explode(" ",microtime());
|
list($usec, $sec) = explode(" ",microtime());
|
||||||
return ((float)$usec + (float)$sec);
|
return ((float)$usec + (float)$sec);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +57,7 @@ function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net
|
||||||
}
|
}
|
||||||
|
|
||||||
function makesafe($d) {
|
function makesafe($d) {
|
||||||
|
|
||||||
$d = str_replace("\t","",$d);
|
$d = str_replace("\t","",$d);
|
||||||
$d = str_replace("<","<",$d);
|
$d = str_replace("<","<",$d);
|
||||||
$d = str_replace(">",">",$d);
|
$d = str_replace(">",">",$d);
|
||||||
|
@ -119,56 +65,40 @@ function makesafe($d) {
|
||||||
$d = str_replace("|","??",$d);
|
$d = str_replace("|","??",$d);
|
||||||
$d = str_replace(" "," ",$d);
|
$d = str_replace(" "," ",$d);
|
||||||
return $d;
|
return $d;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function admindisplay($content, $title) { // Finalize page and output to browser.
|
function admindisplay($content, $title) { // Finalize page and output to browser.
|
||||||
|
|
||||||
global $numqueries, $userrow, $controlrow, $starttime, $version, $build;
|
global $userrow, $controlrow;
|
||||||
if (!isset($controlrow)) {
|
if (!isset($controlrow)) {
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$query = db()->query('SELECT * FROM control WHERE id=1 LIMIT 1;');
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = $query->fetchArray(SQLITE3_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = gettemplate("admin");
|
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
|
||||||
|
|
||||||
$finalarray = array(
|
$page = parsetemplate(gettemplate("admin"), [
|
||||||
"title"=>$title,
|
"title" => $title,
|
||||||
"content"=>$content,
|
"content" => $content,
|
||||||
"totaltime"=>round(getmicrotime() - $starttime, 4),
|
"totaltime" => round(getmicrotime() - START, 4),
|
||||||
"numqueries"=>$numqueries,
|
"numqueries" => db()->count,
|
||||||
"version"=>$version,
|
"version" => VERSION,
|
||||||
"build"=>$build);
|
"build" => BUILD
|
||||||
$page = parsetemplate($template, $finalarray);
|
]);
|
||||||
$page = $xml . $page;
|
|
||||||
|
|
||||||
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
|
echo "<html>\n" . $page;
|
||||||
echo $page;
|
|
||||||
die();
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, $badstart=false) { // Finalize page and output to browser.
|
function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, $badstart=false) { // Finalize page and output to browser.
|
||||||
|
|
||||||
global $numqueries, $userrow, $controlrow, $version, $build;
|
global $numqueries, $userrow, $controlrow, $version, $build;
|
||||||
if (!isset($controlrow)) {
|
if (!isset($controlrow)) {
|
||||||
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
|
$query = db()->query('SELECT * FROM control WHERE id=1 LIMIT 1;');
|
||||||
$controlrow = mysql_fetch_array($controlquery);
|
$controlrow = $query->fetchArray(SQLITE3_ASSOC);
|
||||||
}
|
}
|
||||||
if ($badstart == false) { global $starttime; } else { $starttime = $badstart; }
|
if ($badstart == false) { global $starttime; } else { $starttime = $badstart; }
|
||||||
|
|
||||||
// Make page tags for XHTML validation.
|
|
||||||
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
|
|
||||||
. "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"
|
|
||||||
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
|
|
||||||
|
|
||||||
$template = gettemplate("primary");
|
|
||||||
|
|
||||||
if ($rightnav == true) { $rightnav = gettemplate("rightnav"); } else { $rightnav = ""; }
|
if ($rightnav == true) { $rightnav = gettemplate("rightnav"); } else { $rightnav = ""; }
|
||||||
if ($leftnav == true) { $leftnav = gettemplate("leftnav"); } else { $leftnav = ""; }
|
if ($leftnav == true) { $leftnav = gettemplate("leftnav"); } else { $leftnav = ""; }
|
||||||
if ($topnav == true) {
|
if ($topnav == true) {
|
||||||
|
@ -176,34 +106,34 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
} else {
|
} else {
|
||||||
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" title=\"Log In\" border=\"0\" /></a> <a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" title=\"Register\" border=\"0\" /></a> <a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" title=\"Help\" border=\"0\" /></a>";
|
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" title=\"Log In\" border=\"0\" /></a> <a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" title=\"Register\" border=\"0\" /></a> <a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" title=\"Help\" border=\"0\" /></a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($userrow)) {
|
if (isset($userrow)) {
|
||||||
|
|
||||||
// Get userrow again, in case something has been updated.
|
// Get userrow again, in case something has been updated.
|
||||||
$userquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$userquery = db()->query('SELECT * FROM users WHERE id = ? LIMIT 1;', [$userrow['id']]);
|
||||||
unset($userrow);
|
unset($userrow);
|
||||||
$userrow = mysql_fetch_array($userquery);
|
$userrow = $userquery->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
// Current town name.
|
// Current town name.
|
||||||
if ($userrow["currentaction"] == "In Town") {
|
if ($userrow["currentaction"] == "In Town") {
|
||||||
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = db()->query('SELECT * FROM towns WHERE latitude = ? AND longitude = ? LIMIT 1;', [$userrow["latitude"], $userrow["longitude"]]);
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = $townquery->fetchArray(SQLITE3_ASSOC);
|
||||||
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
|
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
|
||||||
} else {
|
} else {
|
||||||
$userrow["currenttown"] = "";
|
$userrow["currenttown"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; }
|
if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; }
|
||||||
elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "<a href=\"forum.php\">Forum</a><br />"; }
|
elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "<a href=\"forum.php\">Forum</a><br />"; }
|
||||||
elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "<a href=\"".$controlrow["forumaddress"]."\">Forum</a><br />"; }
|
elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "<a href=\"".$controlrow["forumaddress"]."\">Forum</a><br />"; }
|
||||||
|
|
||||||
// Format various userrow stuffs...
|
// Format various userrow stuffs...
|
||||||
if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; }
|
if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; }
|
||||||
if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; }
|
if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; }
|
||||||
$userrow["experience"] = number_format($userrow["experience"]);
|
$userrow["experience"] = number_format($userrow["experience"]);
|
||||||
$userrow["gold"] = number_format($userrow["gold"]);
|
$userrow["gold"] = number_format($userrow["gold"]);
|
||||||
if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=\"admin.php\">Admin</a><br />"; } else { $userrow["adminlink"] = ""; }
|
if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=\"admin.php\">Admin</a><br />"; } else { $userrow["adminlink"] = ""; }
|
||||||
|
|
||||||
// HP/MP/TP bars.
|
// HP/MP/TP bars.
|
||||||
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
|
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
|
||||||
if ($userrow["maxmp"] != 0) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100); } else { $statmp = 0; }
|
if ($userrow["maxmp"] != 0) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100); } else { $statmp = 0; }
|
||||||
|
@ -226,15 +156,15 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
$stattable .= "</td></tr></table></td>\n";
|
$stattable .= "</td></tr></table></td>\n";
|
||||||
$stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n";
|
$stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n";
|
||||||
$userrow["statbars"] = $stattable;
|
$userrow["statbars"] = $stattable;
|
||||||
|
|
||||||
// Now make numbers stand out if they're low.
|
// Now make numbers stand out if they're low.
|
||||||
if ($userrow["currenthp"] <= ($userrow["maxhp"]/5)) { $userrow["currenthp"] = "<blink><span class=\"highlight\"><b>*".$userrow["currenthp"]."*</b></span></blink>"; }
|
if ($userrow["currenthp"] <= ($userrow["maxhp"]/5)) { $userrow["currenthp"] = "<blink><span class=\"highlight\"><b>*".$userrow["currenthp"]."*</b></span></blink>"; }
|
||||||
if ($userrow["currentmp"] <= ($userrow["maxmp"]/5)) { $userrow["currentmp"] = "<blink><span class=\"highlight\"><b>*".$userrow["currentmp"]."*</b></span></blink>"; }
|
if ($userrow["currentmp"] <= ($userrow["maxmp"]/5)) { $userrow["currentmp"] = "<blink><span class=\"highlight\"><b>*".$userrow["currentmp"]."*</b></span></blink>"; }
|
||||||
|
|
||||||
$spellquery = doquery("SELECT id,name,type FROM {{table}}","spells");
|
$spellquery = db()->query('SELECT id, name, type FROM spells;');
|
||||||
$userspells = explode(",",$userrow["spells"]);
|
$userspells = explode(",",$userrow["spells"]);
|
||||||
$userrow["magiclist"] = "";
|
$userrow["magiclist"] = "";
|
||||||
while ($spellrow = mysql_fetch_array($spellquery)) {
|
foreach ($spellquery->fetchArray(SQLITE3_ASSOC) as $spellrow) {
|
||||||
$spell = false;
|
$spell = false;
|
||||||
foreach($userspells as $a => $b) {
|
foreach($userspells as $a => $b) {
|
||||||
if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; }
|
if ($b == $spellrow["id"] && $spellrow["type"] == 1) { $spell = true; }
|
||||||
|
@ -244,43 +174,83 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
|
||||||
|
|
||||||
// Travel To list.
|
// Travel To list.
|
||||||
$townslist = explode(",",$userrow["towns"]);
|
$townslist = explode(",",$userrow["towns"]);
|
||||||
$townquery2 = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
$townquery2 = db()->query('SELECT * FROM towns ORDER BY id;');
|
||||||
$userrow["townslist"] = "";
|
$userrow["townslist"] = "";
|
||||||
while ($townrow2 = mysql_fetch_array($townquery2)) {
|
foreach ($townquery2->fetchArray(SQLITE3_ASSOC) as $townrow2) {
|
||||||
$town = false;
|
$town = false;
|
||||||
foreach($townslist as $a => $b) {
|
foreach($townslist as $a => $b) {
|
||||||
if ($b == $townrow2["id"]) { $town = true; }
|
if ($b == $townrow2["id"]) { $town = true; }
|
||||||
}
|
}
|
||||||
if ($town == true) {
|
if ($town == true) {
|
||||||
$userrow["townslist"] .= "<a href=\"index.php?do=gotown:".$townrow2["id"]."\">".$townrow2["name"]."</a><br />\n";
|
$userrow["townslist"] .= "<a href=\"index.php?do=gotown:".$townrow2["id"]."\">".$townrow2["name"]."</a><br />\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$userrow = array();
|
$userrow = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$finalarray = array(
|
$page = parsetemplate(gettemplate("primary"), [
|
||||||
"dkgamename"=>$controlrow["gamename"],
|
"dkgamename" => $controlrow["gamename"],
|
||||||
"title"=>$title,
|
"title" => $title,
|
||||||
"content"=>$content,
|
"content" => $content,
|
||||||
"rightnav"=>parsetemplate($rightnav,$userrow),
|
"rightnav" => parsetemplate($rightnav, $userrow),
|
||||||
"leftnav"=>parsetemplate($leftnav,$userrow),
|
"leftnav" => parsetemplate($leftnav, $userrow),
|
||||||
"topnav"=>$topnav,
|
"topnav" => $topnav,
|
||||||
"totaltime"=>round(getmicrotime() - $starttime, 4),
|
"totaltime" => round(getmicrotime() - START, 4),
|
||||||
"numqueries"=>$numqueries,
|
"numqueries" => db()->count,
|
||||||
"version"=>$version,
|
"version" => VERSION,
|
||||||
"build"=>$build);
|
"build" => BUILD
|
||||||
$page = parsetemplate($template, $finalarray);
|
]);
|
||||||
$page = $xml . $page;
|
|
||||||
|
echo "<html>\n" . $page;
|
||||||
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
|
exit;
|
||||||
echo $page;
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
function checkcookies()
|
||||||
|
{
|
||||||
|
$row = false;
|
||||||
|
|
||||||
|
if (isset($_COOKIE["dkgame"])) {
|
||||||
|
// COOKIE FORMAT:
|
||||||
|
// {ID} {USERNAME} {PASSWORDHASH} {REMEMBERME}
|
||||||
|
$theuser = explode(" ",$_COOKIE["dkgame"]);
|
||||||
|
$query = db()->query('SELECT * FROM users WHERE id = ?, username = ?, password = ? LIMIT 1;', [$theuser[0], $theuser[1], $theuser[2]]);
|
||||||
|
if ($query === false) {
|
||||||
|
set_cookie('dkgame', '', -3600);
|
||||||
|
die("Invalid cookie data. Please log in again.");
|
||||||
|
}
|
||||||
|
$row = $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
set_cookie('dkgame', implode(" ", $theuser), (int) $theuser[3] === 1 ? time() + 31536000 : 0);
|
||||||
|
db()->exec('UPDATE users SET onlinetime = CURRENT_TIMESTAMP WHERE id = ? LIMIT 1;', [$theuser[0]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a cookie with secure and HTTP-only flags.
|
||||||
|
*/
|
||||||
|
function set_cookie($name, $value, $expires)
|
||||||
|
{
|
||||||
|
setcookie($name, $value, [
|
||||||
|
'expires' => $expires,
|
||||||
|
'path' => '/',
|
||||||
|
'domain' => '', // Defaults to the current domain
|
||||||
|
'secure' => true, // Ensure the cookie is only sent over HTTPS
|
||||||
|
'httponly' => true, // Prevent access to cookie via JavaScript
|
||||||
|
'samesite' => 'Strict' // Enforce SameSite=Strict
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current control row from the database.
|
||||||
|
*/
|
||||||
|
function get_control_row(): array|false
|
||||||
|
{
|
||||||
|
$query = db()->query('SELECT * FROM control WHERE id = 1 LIMIT 1;');
|
||||||
|
if ($query === false) return false;
|
||||||
|
return $query->fetchArray(SQLITE3_ASSOC);
|
||||||
|
}
|
|
@ -1,56 +1,56 @@
|
||||||
<?php // towns.php :: Handles all actions you can do in town.
|
<?php // towns.php :: Handles all actions you can do in town.
|
||||||
|
|
||||||
function inn() { // Staying at the inn resets all expendable stats to their max values.
|
function inn() { // Staying at the inn resets all expendable stats to their max values.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,innprice FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,innprice FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["innprice"]) { display("You do not have enough gold to stay at this Inn tonight.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.", "Inn"); die(); }
|
if ($userrow["gold"] < $townrow["innprice"]) { display("You do not have enough gold to stay at this Inn tonight.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.", "Inn"); die(); }
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
if (isset($_POST["submit"])) {
|
||||||
|
|
||||||
$newgold = $userrow["gold"] - $townrow["innprice"];
|
$newgold = $userrow["gold"] - $townrow["innprice"];
|
||||||
$query = doquery("UPDATE {{table}} SET gold='$newgold',currenthp='".$userrow["maxhp"]."',currentmp='".$userrow["maxmp"]."',currenttp='".$userrow["maxtp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$query = doquery("UPDATE {{table}} SET gold='$newgold',currenthp='".$userrow["maxhp"]."',currentmp='".$userrow["maxmp"]."',currenttp='".$userrow["maxtp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
$title = "Inn";
|
$title = "Inn";
|
||||||
$page = "You wake up feeling refreshed and ready for action.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.";
|
$page = "You wake up feeling refreshed and ready for action.<br /><br />You may return to <a href=\"index.php\">town</a>, or use the direction buttons on the left to start exploring.";
|
||||||
|
|
||||||
} elseif (isset($_POST["cancel"])) {
|
} elseif (isset($_POST["cancel"])) {
|
||||||
|
|
||||||
header("Location: index.php"); die();
|
header("Location: index.php"); die();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$title = "Inn";
|
$title = "Inn";
|
||||||
$page = "Resting at the inn will refill your current HP, MP, and TP to their maximum levels.<br /><br />\n";
|
$page = "Resting at the inn will refill your current HP, MP, and TP to their maximum levels.<br /><br />\n";
|
||||||
$page .= "A night's sleep at this Inn will cost you <b>" . $townrow["innprice"] . " gold</b>. Is that ok?<br /><br />\n";
|
$page .= "A night's sleep at this Inn will cost you <b>" . $townrow["innprice"] . " gold</b>. Is that ok?<br /><br />\n";
|
||||||
$page .= "<form action=\"index.php?do=inn\" method=\"post\">\n";
|
$page .= "<form action=\"index.php?do=inn\" method=\"post\">\n";
|
||||||
$page .= "<input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" />\n";
|
$page .= "<input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" />\n";
|
||||||
$page .= "</form>\n";
|
$page .= "</form>\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buy() { // Displays a list of available items for purchase.
|
function buy() { // Displays a list of available items for purchase.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
|
|
||||||
$itemslist = explode(",",$townrow["itemslist"]);
|
$itemslist = explode(",",$townrow["itemslist"]);
|
||||||
$querystring = "";
|
$querystring = "";
|
||||||
foreach($itemslist as $a=>$b) {
|
foreach($itemslist as $a=>$b) {
|
||||||
$querystring .= "id='$b' OR ";
|
$querystring .= "id='$b' OR ";
|
||||||
}
|
}
|
||||||
$querystring = rtrim($querystring, " OR ");
|
$querystring = rtrim($querystring, " OR ");
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE $querystring ORDER BY id", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} WHERE $querystring ORDER BY id", "items");
|
||||||
$page = "Buying weapons will increase your Attack Power. Buying armor and shields will increase your Defense Power.<br /><br />Click an item name to purchase it.<br /><br />The following items are available at this town:<br /><br />\n";
|
$page = "Buying weapons will increase your Attack Power. Buying armor and shields will increase your Defense Power.<br /><br />Click an item name to purchase it.<br /><br />The following items are available at this town:<br /><br />\n";
|
||||||
$page .= "<table width=\"80%\">\n";
|
$page .= "<table width=\"80%\">\n";
|
||||||
|
@ -70,28 +70,28 @@ function buy() { // Displays a list of available items for purchase.
|
||||||
$page .= "</table><br />\n";
|
$page .= "</table><br />\n";
|
||||||
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
||||||
$title = "Buy Items";
|
$title = "Buy Items";
|
||||||
|
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buy2($id) { // Confirm user's intent to purchase item.
|
function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
$townitems = explode(",",$townrow["itemslist"]);
|
$townitems = explode(",",$townrow["itemslist"]);
|
||||||
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
||||||
$itemsrow = mysql_fetch_array($itemsquery);
|
$itemsrow = mysql_fetch_array($itemsquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
||||||
|
|
||||||
if ($itemsrow["type"] == 1) {
|
if ($itemsrow["type"] == 1) {
|
||||||
if ($userrow["weaponid"] != 0) {
|
if ($userrow["weaponid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
@ -99,7 +99,7 @@ function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
}
|
}
|
||||||
} elseif ($itemsrow["type"] == 2) {
|
} elseif ($itemsrow["type"] == 2) {
|
||||||
if ($userrow["armorid"] != 0) {
|
if ($userrow["armorid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
@ -107,7 +107,7 @@ function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
}
|
}
|
||||||
} elseif ($itemsrow["type"] == 3) {
|
} elseif ($itemsrow["type"] == 3) {
|
||||||
if ($userrow["shieldid"] != 0) {
|
if ($userrow["shieldid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
||||||
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "If you are buying the ".$itemsrow["name"].", then I will buy your ".$itemsrow2["name"]." for ".ceil($itemsrow2["buycost"]/2)." gold. Is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
@ -115,39 +115,39 @@ function buy2($id) { // Confirm user's intent to purchase item.
|
||||||
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$itemsrow["name"].", is that ok?<br /><br /><form action=\"index.php?do=buy3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = "Buy Items";
|
$title = "Buy Items";
|
||||||
display($page, $title);
|
display($page, $title);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buy3($id) { // Update user profile with new item & stats.
|
function buy3($id) { // Update user profile with new item & stats.
|
||||||
|
|
||||||
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
|
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
|
||||||
|
|
||||||
global $userrow;
|
global $userrow;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
|
||||||
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (mysql_num_rows($townquery) != 1) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
$townitems = explode(",",$townrow["itemslist"]);
|
$townitems = explode(",",$townrow["itemslist"]);
|
||||||
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (! in_array($id, $townitems)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
|
|
||||||
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
|
||||||
$itemsrow = mysql_fetch_array($itemsquery);
|
$itemsrow = mysql_fetch_array($itemsquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
if ($userrow["gold"] < $itemsrow["buycost"]) { display("You do not have enough gold to buy this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items"); die(); }
|
||||||
|
|
||||||
if ($itemsrow["type"] == 1) { // weapon
|
if ($itemsrow["type"] == 1) { // weapon
|
||||||
|
|
||||||
// Check if they already have an item in the slot.
|
// Check if they already have an item in the slot.
|
||||||
if ($userrow["weaponid"] != 0) {
|
if ($userrow["weaponid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
||||||
} else {
|
} else {
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special item fields.
|
// Special item fields.
|
||||||
$specialchange1 = "";
|
$specialchange1 = "";
|
||||||
$specialchange2 = "";
|
$specialchange2 = "";
|
||||||
|
@ -167,7 +167,7 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
||||||
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// New stats.
|
// New stats.
|
||||||
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
||||||
$newattack = $userrow["attackpower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
$newattack = $userrow["attackpower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
||||||
|
@ -177,20 +177,20 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
||||||
|
|
||||||
// Final update.
|
// Final update.
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', attackpower='$newattack', weaponid='$newid', weaponname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', attackpower='$newattack', weaponid='$newid', weaponname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
||||||
|
|
||||||
} elseif ($itemsrow["type"] == 2) { // Armor
|
} elseif ($itemsrow["type"] == 2) { // Armor
|
||||||
|
|
||||||
// Check if they already have an item in the slot.
|
// Check if they already have an item in the slot.
|
||||||
if ($userrow["armorid"] != 0) {
|
if ($userrow["armorid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
||||||
} else {
|
} else {
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special item fields.
|
// Special item fields.
|
||||||
$specialchange1 = "";
|
$specialchange1 = "";
|
||||||
$specialchange2 = "";
|
$specialchange2 = "";
|
||||||
|
@ -210,7 +210,7 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
||||||
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// New stats.
|
// New stats.
|
||||||
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
||||||
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
||||||
|
@ -220,20 +220,20 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
||||||
|
|
||||||
// Final update.
|
// Final update.
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', defensepower='$newdefense', armorid='$newid', armorname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', defensepower='$newdefense', armorid='$newid', armorname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
||||||
|
|
||||||
} elseif ($itemsrow["type"] == 3) { // Shield
|
} elseif ($itemsrow["type"] == 3) { // Shield
|
||||||
|
|
||||||
// Check if they already have an item in the slot.
|
// Check if they already have an item in the slot.
|
||||||
if ($userrow["shieldid"] != 0) {
|
if ($userrow["shieldid"] != 0) {
|
||||||
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
|
||||||
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
$itemsrow2 = mysql_fetch_array($itemsquery2);
|
||||||
} else {
|
} else {
|
||||||
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special item fields.
|
// Special item fields.
|
||||||
$specialchange1 = "";
|
$specialchange1 = "";
|
||||||
$specialchange2 = "";
|
$specialchange2 = "";
|
||||||
|
@ -253,7 +253,7 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
|
||||||
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// New stats.
|
// New stats.
|
||||||
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
|
||||||
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
|
||||||
|
@ -263,32 +263,32 @@ function buy3($id) { // Update user profile with new item & stats.
|
||||||
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
if ($userrow["currenthp"] > $userrow["maxhp"]) { $newhp = $userrow["maxhp"]; } else { $newhp = $userrow["currenthp"]; }
|
||||||
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
if ($userrow["currentmp"] > $userrow["maxmp"]) { $newmp = $userrow["maxmp"]; } else { $newmp = $userrow["currentmp"]; }
|
||||||
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
if ($userrow["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
|
||||||
|
|
||||||
// Final update.
|
// Final update.
|
||||||
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', defensepower='$newdefense', shieldid='$newid', shieldname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET $specialchange1 $specialchange2 gold='$newgold', defensepower='$newdefense', shieldid='$newid', shieldname='$newname', currenthp='$newhp', currentmp='$newmp', currenttp='$newtp' WHERE id='$userid' LIMIT 1", "users");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
display("Thank you for purchasing this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items");
|
display("Thank you for purchasing this item.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=buy\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Items");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps() { // List maps the user can buy.
|
function maps() { // List maps the user can buy.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$mappedtowns = explode(",",$userrow["towns"]);
|
$mappedtowns = explode(",",$userrow["towns"]);
|
||||||
|
|
||||||
$page = "Buying maps will put the town in your Travel To box, and it won't cost you as many TP to get there.<br /><br />\n";
|
$page = "Buying maps will put the town in your Travel To box, and it won't cost you as many TP to get there.<br /><br />\n";
|
||||||
$page .= "Click a town name to purchase its map.<br /><br />\n";
|
$page .= "Click a town name to purchase its map.<br /><br />\n";
|
||||||
$page .= "<table width=\"90%\">\n";
|
$page .= "<table width=\"90%\">\n";
|
||||||
|
|
||||||
$townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
$townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
|
||||||
while ($townrow = mysql_fetch_array($townquery)) {
|
while ($townrow = mysql_fetch_array($townquery)) {
|
||||||
|
|
||||||
if ($townrow["latitude"] >= 0) { $latitude = $townrow["latitude"] . "N,"; } else { $latitude = ($townrow["latitude"]*-1) . "S,"; }
|
if ($townrow["latitude"] >= 0) { $latitude = $townrow["latitude"] . "N,"; } else { $latitude = ($townrow["latitude"]*-1) . "S,"; }
|
||||||
if ($townrow["longitude"] >= 0) { $longitude = $townrow["longitude"] . "E"; } else { $longitude = ($townrow["longitude"]*-1) . "W"; }
|
if ($townrow["longitude"] >= 0) { $longitude = $townrow["longitude"] . "E"; } else { $longitude = ($townrow["longitude"]*-1) . "W"; }
|
||||||
|
|
||||||
$mapped = false;
|
$mapped = false;
|
||||||
foreach($mappedtowns as $a => $b) {
|
foreach($mappedtowns as $a => $b) {
|
||||||
if ($b == $townrow["id"]) { $mapped = true; }
|
if ($b == $townrow["id"]) { $mapped = true; }
|
||||||
|
@ -298,76 +298,76 @@ function maps() { // List maps the user can buy.
|
||||||
} else {
|
} else {
|
||||||
$page .= "<tr><td width=\"25%\"><span class=\"light\">".$townrow["name"]."</span></td><td width=\"25%\"><span class=\"light\">Already mapped.</span></td><td width=\"35%\"><span class=\"light\">Location: $latitude $longitude</span></td><td width=\"15%\"><span class=\"light\">TP: ".$townrow["travelpoints"]."</span></td></tr>\n";
|
$page .= "<tr><td width=\"25%\"><span class=\"light\">".$townrow["name"]."</span></td><td width=\"25%\"><span class=\"light\">Already mapped.</span></td><td width=\"35%\"><span class=\"light\">Location: $latitude $longitude</span></td><td width=\"15%\"><span class=\"light\">TP: ".$townrow["travelpoints"]."</span></td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$page .= "</table><br />\n";
|
$page .= "</table><br />\n";
|
||||||
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
$page .= "If you've changed your mind, you may also return back to <a href=\"index.php\">town</a>.\n";
|
||||||
|
|
||||||
display($page, "Buy Maps");
|
display($page, "Buy Maps");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps2($id) { // Confirm user's intent to purchase map.
|
function maps2($id) { // Confirm user's intent to purchase map.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
||||||
|
|
||||||
$page = "You are buying the ".$townrow["name"]." map. Is that ok?<br /><br /><form action=\"index.php?do=maps3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
$page = "You are buying the ".$townrow["name"]." map. Is that ok?<br /><br /><form action=\"index.php?do=maps3:$id\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Yes\" /> <input type=\"submit\" name=\"cancel\" value=\"No\" /></form>";
|
||||||
|
|
||||||
display($page, "Buy Maps");
|
display($page, "Buy Maps");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps3($id) { // Add new map to user's profile.
|
function maps3($id) { // Add new map to user's profile.
|
||||||
|
|
||||||
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
|
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
|
|
||||||
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
if ($userrow["gold"] < $townrow["mapprice"]) { display("You do not have enough gold to buy this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps"); die(); }
|
||||||
|
|
||||||
$mappedtowns = $userrow["towns"].",$id";
|
$mappedtowns = $userrow["towns"].",$id";
|
||||||
$newgold = $userrow["gold"] - $townrow["mapprice"];
|
$newgold = $userrow["gold"] - $townrow["mapprice"];
|
||||||
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET towns='$mappedtowns',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET towns='$mappedtowns',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
|
||||||
|
|
||||||
display("Thank you for purchasing this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps");
|
display("Thank you for purchasing this map.<br /><br />You may return to <a href=\"index.php\">town</a>, <a href=\"index.php?do=maps\">store</a>, or use the direction buttons on the left to start exploring.", "Buy Maps");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function travelto($id, $usepoints=true) { // Send a user to a town from the Travel To menu.
|
function travelto($id, $usepoints=true) { // Send a user to a town from the Travel To menu.
|
||||||
|
|
||||||
global $userrow, $numqueries;
|
global $userrow, $numqueries;
|
||||||
|
|
||||||
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
|
||||||
|
|
||||||
$townquery = doquery("SELECT name,travelpoints,latitude,longitude FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
$townquery = doquery("SELECT name,travelpoints,latitude,longitude FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
|
||||||
$townrow = mysql_fetch_array($townquery);
|
$townrow = mysql_fetch_array($townquery);
|
||||||
|
|
||||||
if ($usepoints==true) {
|
if ($usepoints==true) {
|
||||||
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
|
if ($userrow["currenttp"] < $townrow["travelpoints"]) {
|
||||||
display("You do not have enough TP to travel here. Please go back and try again when you get more TP.", "Travel To"); die();
|
display("You do not have enough TP to travel here. Please go back and try again when you get more TP.", "Travel To"); die();
|
||||||
}
|
}
|
||||||
$mapped = explode(",",$userrow["towns"]);
|
$mapped = explode(",",$userrow["towns"]);
|
||||||
if (!in_array($id, $mapped)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
if (!in_array($id, $mapped)) { display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($userrow["latitude"] == $townrow["latitude"]) && ($userrow["longitude"] == $townrow["longitude"])) { display("You are already in this town. <a href=\"index.php\">Click here</a> to return to the main town screen.", "Travel To"); die(); }
|
if (($userrow["latitude"] == $townrow["latitude"]) && ($userrow["longitude"] == $townrow["longitude"])) { display("You are already in this town. <a href=\"index.php\">Click here</a> to return to the main town screen.", "Travel To"); die(); }
|
||||||
|
|
||||||
if ($usepoints == true) { $newtp = $userrow["currenttp"] - $townrow["travelpoints"]; } else { $newtp = $userrow["currenttp"]; }
|
if ($usepoints == true) { $newtp = $userrow["currenttp"] - $townrow["travelpoints"]; } else { $newtp = $userrow["currenttp"]; }
|
||||||
|
|
||||||
$newlat = $townrow["latitude"];
|
$newlat = $townrow["latitude"];
|
||||||
$newlon = $townrow["longitude"];
|
$newlon = $townrow["longitude"];
|
||||||
$newid = $userrow["id"];
|
$newid = $userrow["id"];
|
||||||
|
|
||||||
// If they got here by exploring, add this town to their map.
|
// If they got here by exploring, add this town to their map.
|
||||||
$mapped = explode(",",$userrow["towns"]);
|
$mapped = explode(",",$userrow["towns"]);
|
||||||
$town = false;
|
$town = false;
|
||||||
|
@ -375,19 +375,16 @@ function travelto($id, $usepoints=true) { // Send a user to a town from the Trav
|
||||||
if ($b == $id) { $town = true; }
|
if ($b == $id) { $town = true; }
|
||||||
}
|
}
|
||||||
$mapped = implode(",",$mapped);
|
$mapped = implode(",",$mapped);
|
||||||
if ($town == false) {
|
if ($town == false) {
|
||||||
$mapped .= ",$id";
|
$mapped .= ",$id";
|
||||||
$mapped = "towns='".$mapped."',";
|
$mapped = "towns='".$mapped."',";
|
||||||
} else {
|
} else {
|
||||||
$mapped = "towns='".$mapped."',";
|
$mapped = "towns='".$mapped."',";
|
||||||
}
|
}
|
||||||
|
|
||||||
$updatequery = doquery("UPDATE {{table}} SET currentaction='In Town',$mapped currenttp='$newtp',latitude='$newlat',longitude='$newlon' WHERE id='$newid' LIMIT 1", "users");
|
$updatequery = doquery("UPDATE {{table}} SET currentaction='In Town',$mapped currenttp='$newtp',latitude='$newlat',longitude='$newlon' WHERE id='$newid' LIMIT 1", "users");
|
||||||
|
|
||||||
$page = "You have travelled to ".$townrow["name"].". You may now <a href=\"index.php\">enter this town</a>.";
|
$page = "You have travelled to ".$townrow["name"].". You may now <a href=\"index.php\">enter this town</a>.";
|
||||||
display($page, "Travel To");
|
display($page, "Travel To");
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
}
|
|
@ -1,96 +0,0 @@
|
||||||
<?
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$prefix = $dbsettings["prefix"];
|
|
||||||
|
|
||||||
// Thanks to Predrag Supurovic from php.net for this function!
|
|
||||||
function dobatch ($p_query) {
|
|
||||||
$query_split = preg_split ("/[;]+/", $p_query);
|
|
||||||
foreach ($query_split as $command_line) {
|
|
||||||
$command_line = trim($command_line);
|
|
||||||
if ($command_line != '') {
|
|
||||||
$query_result = mysql_query($command_line);
|
|
||||||
if ($query_result == 0) {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return $query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
|
||||||
|
|
||||||
$control = $prefix . "_control";
|
|
||||||
$users = $prefix . "_users";
|
|
||||||
$query = <<<END
|
|
||||||
DROP TABLE IF EXISTS `$control`;
|
|
||||||
CREATE TABLE `$control` (
|
|
||||||
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
|
||||||
`gamename` varchar(50) NOT NULL default '',
|
|
||||||
`gamesize` smallint(5) unsigned NOT NULL default '0',
|
|
||||||
`gameopen` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`gameurl` varchar(200) NOT NULL default '',
|
|
||||||
`adminemail` varchar(100) NOT NULL default '',
|
|
||||||
`forumtype` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`forumaddress` varchar(200) NOT NULL default '',
|
|
||||||
`class1name` varchar(50) NOT NULL default '',
|
|
||||||
`class2name` varchar(50) NOT NULL default '',
|
|
||||||
`class3name` varchar(50) NOT NULL default '',
|
|
||||||
`diff1name` varchar(50) NOT NULL default '',
|
|
||||||
`diff1mod` float unsigned NOT NULL default '0',
|
|
||||||
`diff2name` varchar(50) NOT NULL default '',
|
|
||||||
`diff2mod` float unsigned NOT NULL default '0',
|
|
||||||
`diff3name` varchar(50) NOT NULL default '',
|
|
||||||
`diff3mod` float unsigned NOT NULL default '0',
|
|
||||||
`compression` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`verifyemail` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`shownews` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`showbabble` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
`showonline` tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) TYPE=MyISAM;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Control table upgraded.<br />"; } else { echo "Error upgrading Control table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = <<<END
|
|
||||||
INSERT INTO `$control` VALUES (1, 'Dragon Knight', 250, 0, '', '', 1, '', 'Mage', 'Warrior', 'Paladin', 'Easy', '1', 'Medium', '1.2', 'Hard', '1.5', 1, 1, 1, 1, 1);
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Control table populated.<br />"; } else { echo "Error populating Control table."; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
$query = mysql_query("SELECT * FROM $users ORDER BY id") or die(mysql_error());
|
|
||||||
$errors = 0; $errorlist = "";
|
|
||||||
while ($row = mysql_fetch_array($query)) {
|
|
||||||
$id = $row["id"];
|
|
||||||
$oldspells = explode(",",$row["spells"]);
|
|
||||||
$newspells = "0,";
|
|
||||||
$oldtowns = explode(",",$row["towns"]);
|
|
||||||
$newtowns = "0,";
|
|
||||||
foreach($oldspells as $a => $b) {
|
|
||||||
if ($b == 1) { $newspells .= "$a,"; }
|
|
||||||
}
|
|
||||||
$newspells = rtrim($newspells,",");
|
|
||||||
foreach($oldtowns as $c => $d) {
|
|
||||||
if ($d == 1) { $newtowns .= "$c,"; }
|
|
||||||
}
|
|
||||||
$newtowns = rtrim($newtowns,",");
|
|
||||||
$update = mysql_query("UPDATE $users SET spells='$newspells',towns='$newtowns',verify='1' WHERE id='$id' LIMIT 1");
|
|
||||||
if ($update == false) { $errors++; $errorlist .= mysql_error() . "<br />"; } else { echo "User $id upgraded.<br />"; }
|
|
||||||
}
|
|
||||||
if ($errors != 0) {
|
|
||||||
echo "<br /><b><span style=\"color:red\">The following errors occurred while upgrading the users list:</span></b><br />$errorlist";
|
|
||||||
} else {
|
|
||||||
echo "<br /><b>The upgrade completed successfully. Please log in to the game and visit the control panel to update your main game settings.<br /><br />You should also delete this file from your Dragon Knight directory for security reasons.</b>";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
echo "Click the button below to run the upgrade script.<br /><form action=\"upgrade_to_110.php\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Upgrade\" /></form>";
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,361 +0,0 @@
|
||||||
<?
|
|
||||||
|
|
||||||
include('config.php');
|
|
||||||
include('lib.php');
|
|
||||||
$link = opendb();
|
|
||||||
$prefix = $dbsettings["prefix"];
|
|
||||||
|
|
||||||
// Thanks to Predrag Supurovic from php.net for this function!
|
|
||||||
function dobatch ($p_query) {
|
|
||||||
$query_split = preg_split ("/[;]+/", $p_query);
|
|
||||||
foreach ($query_split as $command_line) {
|
|
||||||
$command_line = trim($command_line);
|
|
||||||
if ($command_line != '') {
|
|
||||||
$query_result = mysql_query($command_line);
|
|
||||||
if ($query_result == 0) {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return $query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["submit"])) {
|
|
||||||
|
|
||||||
$users = $prefix . "_users";
|
|
||||||
|
|
||||||
$levels = array(1=>"",2=>"",3=>"");
|
|
||||||
$levels["1"] = array(
|
|
||||||
1=>"0",
|
|
||||||
2=>"0,1",
|
|
||||||
3=>"0,1",
|
|
||||||
4=>"0,1,6",
|
|
||||||
5=>"0,1,6",
|
|
||||||
6=>"0,1,6",
|
|
||||||
7=>"0,1,6,11",
|
|
||||||
8=>"0,1,6,11",
|
|
||||||
9=>"0,1,6,11,2",
|
|
||||||
10=>"0,1,6,11,2",
|
|
||||||
11=>"0,1,6,11,2",
|
|
||||||
12=>"0,1,6,11,2,7",
|
|
||||||
13=>"0,1,6,11,2,7",
|
|
||||||
14=>"0,1,6,11,2,7,17",
|
|
||||||
15=>"0,1,6,11,2,7,17",
|
|
||||||
16=>"0,1,6,11,2,7,17",
|
|
||||||
17=>"0,1,6,11,2,7,17,12",
|
|
||||||
18=>"0,1,6,11,2,7,17,12",
|
|
||||||
19=>"0,1,6,11,2,7,17,12",
|
|
||||||
20=>"0,1,6,11,2,7,17,12",
|
|
||||||
21=>"0,1,6,11,2,7,17,12",
|
|
||||||
22=>"0,1,6,11,2,7,17,12",
|
|
||||||
23=>"0,1,6,11,2,7,17,12",
|
|
||||||
24=>"0,1,6,11,2,7,17,12",
|
|
||||||
25=>"0,1,6,11,2,7,17,12,3",
|
|
||||||
26=>"0,1,6,11,2,7,17,12,3",
|
|
||||||
27=>"0,1,6,11,2,7,17,12,3",
|
|
||||||
28=>"0,1,6,11,2,7,17,12,3",
|
|
||||||
29=>"0,1,6,11,2,7,17,12,3",
|
|
||||||
30=>"0,1,6,11,2,7,17,12,3",
|
|
||||||
31=>"0,1,6,11,2,7,17,12,3,8",
|
|
||||||
32=>"0,1,6,11,2,7,17,12,3,8",
|
|
||||||
33=>"0,1,6,11,2,7,17,12,3,8",
|
|
||||||
34=>"0,1,6,11,2,7,17,12,3,8",
|
|
||||||
35=>"0,1,6,11,2,7,17,12,3,8",
|
|
||||||
36=>"0,1,6,11,2,7,17,12,3,8,18",
|
|
||||||
37=>"0,1,6,11,2,7,17,12,3,8,18",
|
|
||||||
38=>"0,1,6,11,2,7,17,12,3,8,18",
|
|
||||||
39=>"0,1,6,11,2,7,17,12,3,8,18",
|
|
||||||
40=>"0,1,6,11,2,7,17,12,3,8,18,13",
|
|
||||||
41=>"0,1,6,11,2,7,17,12,3,8,18,13",
|
|
||||||
42=>"0,1,6,11,2,7,17,12,3,8,18,13",
|
|
||||||
43=>"0,1,6,11,2,7,17,12,3,8,18,13",
|
|
||||||
44=>"0,1,6,11,2,7,17,12,3,8,18,13",
|
|
||||||
45=>"0,1,6,11,2,7,17,12,3,8,18,13,4",
|
|
||||||
46=>"0,1,6,11,2,7,17,12,3,8,18,13,4",
|
|
||||||
47=>"0,1,6,11,2,7,17,12,3,8,18,13,4",
|
|
||||||
48=>"0,1,6,11,2,7,17,12,3,8,18,13,4",
|
|
||||||
49=>"0,1,6,11,2,7,17,12,3,8,18,13,4",
|
|
||||||
50=>"0,1,6,11,2,7,17,12,3,8,18,13,4",
|
|
||||||
51=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
52=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
53=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
54=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
55=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
56=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
57=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
58=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
59=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9",
|
|
||||||
60=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
61=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
62=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
63=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
64=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
65=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
66=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
67=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
68=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
69=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19",
|
|
||||||
70=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
71=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
72=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
73=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
74=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
75=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
76=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
77=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
78=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5",
|
|
||||||
79=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
80=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
81=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
82=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
83=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
84=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
85=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
86=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
87=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
88=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
89=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
90=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
91=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
92=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
93=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
94=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
95=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
96=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
97=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
98=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10",
|
|
||||||
99=>"0,1,6,11,2,7,17,12,3,8,18,13,4,9,19,5,10");
|
|
||||||
|
|
||||||
$levels["2"] = array(
|
|
||||||
1=>"0",
|
|
||||||
2=>"0,1",
|
|
||||||
3=>"0,1",
|
|
||||||
4=>"0,1",
|
|
||||||
5=>"0,1,6",
|
|
||||||
6=>"0,1,6",
|
|
||||||
7=>"0,1,6",
|
|
||||||
8=>"0,1,6,11",
|
|
||||||
9=>"0,1,6,11",
|
|
||||||
10=>"0,1,6,11",
|
|
||||||
11=>"0,1,6,11,2",
|
|
||||||
12=>"0,1,6,11,2",
|
|
||||||
13=>"0,1,6,11,2",
|
|
||||||
14=>"0,1,6,11,2,7",
|
|
||||||
15=>"0,1,6,11,2,7",
|
|
||||||
16=>"0,1,6,11,2,7",
|
|
||||||
17=>"0,1,6,11,2,7",
|
|
||||||
18=>"0,1,6,11,2,7,14",
|
|
||||||
19=>"0,1,6,11,2,7,14",
|
|
||||||
20=>"0,1,6,11,2,7,14",
|
|
||||||
21=>"0,1,6,11,2,7,14",
|
|
||||||
22=>"0,1,6,11,2,7,14,12",
|
|
||||||
23=>"0,1,6,11,2,7,14,12",
|
|
||||||
24=>"0,1,6,11,2,7,14,12",
|
|
||||||
25=>"0,1,6,11,2,7,14,12,17",
|
|
||||||
26=>"0,1,6,11,2,7,14,12,17",
|
|
||||||
27=>"0,1,6,11,2,7,14,12,17",
|
|
||||||
28=>"0,1,6,11,2,7,14,12,17",
|
|
||||||
29=>"0,1,6,11,2,7,14,12,17,3",
|
|
||||||
30=>"0,1,6,11,2,7,14,12,17,3",
|
|
||||||
31=>"0,1,6,11,2,7,14,12,17,3",
|
|
||||||
32=>"0,1,6,11,2,7,14,12,17,3",
|
|
||||||
33=>"0,1,6,11,2,7,14,12,17,3",
|
|
||||||
34=>"0,1,6,11,2,7,14,12,17,3,8",
|
|
||||||
35=>"0,1,6,11,2,7,14,12,17,3,8",
|
|
||||||
36=>"0,1,6,11,2,7,14,12,17,3,8",
|
|
||||||
37=>"0,1,6,11,2,7,14,12,17,3,8",
|
|
||||||
38=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
39=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
40=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
41=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
42=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
43=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
44=>"0,1,6,11,2,7,14,12,17,3,8,15",
|
|
||||||
45=>"0,1,6,11,2,7,14,12,17,3,8,15,18",
|
|
||||||
46=>"0,1,6,11,2,7,14,12,17,3,8,15,18",
|
|
||||||
47=>"0,1,6,11,2,7,14,12,17,3,8,15,18",
|
|
||||||
48=>"0,1,6,11,2,7,14,12,17,3,8,15,18",
|
|
||||||
49=>"0,1,6,11,2,7,14,12,17,3,8,15,18",
|
|
||||||
50=>"0,1,6,11,2,7,14,12,17,3,8,15,18",
|
|
||||||
51=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
52=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
53=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
54=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
55=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
56=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
57=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13",
|
|
||||||
58=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
59=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
60=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
61=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
62=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
63=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
64=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
65=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
66=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
67=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
68=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
69=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19",
|
|
||||||
70=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
71=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
72=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
73=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
74=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
75=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
76=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
77=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
78=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
79=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
80=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
81=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
82=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
83=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
84=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
85=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
86=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
87=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
88=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
89=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
90=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
91=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
92=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
93=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
94=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
95=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
96=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
97=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
98=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16",
|
|
||||||
99=>"0,1,6,11,2,7,14,12,17,3,8,15,18,13,19,16");
|
|
||||||
|
|
||||||
$levels["3"] = array(
|
|
||||||
1=>"0",
|
|
||||||
2=>"0,1",
|
|
||||||
3=>"0,1",
|
|
||||||
4=>"0,1",
|
|
||||||
5=>"0,1,6",
|
|
||||||
6=>"0,1,6",
|
|
||||||
7=>"0,1,6",
|
|
||||||
8=>"0,1,6,11",
|
|
||||||
9=>"0,1,6,11",
|
|
||||||
10=>"0,1,6,11",
|
|
||||||
11=>"0,1,6,11,2",
|
|
||||||
12=>"0,1,6,11,2",
|
|
||||||
13=>"0,1,6,11,2",
|
|
||||||
14=>"0,1,6,11,2,7",
|
|
||||||
15=>"0,1,6,11,2,7",
|
|
||||||
16=>"0,1,6,11,2,7",
|
|
||||||
17=>"0,1,6,11,2,7",
|
|
||||||
18=>"0,1,6,11,2,7,17",
|
|
||||||
19=>"0,1,6,11,2,7,17",
|
|
||||||
20=>"0,1,6,11,2,7,17",
|
|
||||||
21=>"0,1,6,11,2,7,17",
|
|
||||||
22=>"0,1,6,11,2,7,17,12",
|
|
||||||
23=>"0,1,6,11,2,7,17,12",
|
|
||||||
24=>"0,1,6,11,2,7,17,12",
|
|
||||||
25=>"0,1,6,11,2,7,17,12,14",
|
|
||||||
26=>"0,1,6,11,2,7,17,12,14",
|
|
||||||
27=>"0,1,6,11,2,7,17,12,14",
|
|
||||||
28=>"0,1,6,11,2,7,17,12,14",
|
|
||||||
29=>"0,1,6,11,2,7,17,12,14,3",
|
|
||||||
30=>"0,1,6,11,2,7,17,12,14,3",
|
|
||||||
31=>"0,1,6,11,2,7,17,12,14,3",
|
|
||||||
32=>"0,1,6,11,2,7,17,12,14,3",
|
|
||||||
33=>"0,1,6,11,2,7,17,12,14,3",
|
|
||||||
34=>"0,1,6,11,2,7,17,12,14,3,8",
|
|
||||||
35=>"0,1,6,11,2,7,17,12,14,3,8",
|
|
||||||
36=>"0,1,6,11,2,7,17,12,14,3,8",
|
|
||||||
37=>"0,1,6,11,2,7,17,12,14,3,8",
|
|
||||||
38=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
39=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
40=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
41=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
42=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
43=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
44=>"0,1,6,11,2,7,17,12,14,3,8,18",
|
|
||||||
45=>"0,1,6,11,2,7,17,12,14,3,8,18,4",
|
|
||||||
46=>"0,1,6,11,2,7,17,12,14,3,8,18,4",
|
|
||||||
47=>"0,1,6,11,2,7,17,12,14,3,8,18,4",
|
|
||||||
48=>"0,1,6,11,2,7,17,12,14,3,8,18,4",
|
|
||||||
49=>"0,1,6,11,2,7,17,12,14,3,8,18,4",
|
|
||||||
50=>"0,1,6,11,2,7,17,12,14,3,8,18,4",
|
|
||||||
51=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13",
|
|
||||||
52=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13",
|
|
||||||
53=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13",
|
|
||||||
54=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13",
|
|
||||||
55=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13",
|
|
||||||
56=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9",
|
|
||||||
57=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9",
|
|
||||||
58=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9",
|
|
||||||
59=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9",
|
|
||||||
60=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
61=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
62=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
63=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
64=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
65=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
66=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
67=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
68=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
69=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
70=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
71=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
72=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
73=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
74=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
75=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
76=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
77=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
78=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
79=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
80=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
81=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
82=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
83=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
84=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
85=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
86=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
87=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
88=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
89=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
90=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
91=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
92=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
93=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
94=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
95=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
96=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
97=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
98=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15",
|
|
||||||
99=>"0,1,6,11,2,7,17,12,14,3,8,18,4,13,9,15");
|
|
||||||
|
|
||||||
$errors = 0; $errorlist = "";
|
|
||||||
|
|
||||||
$mainquery = mysql_query("SELECT id,level,charclass,spells FROM $users ORDER BY id");
|
|
||||||
while ($mainrow = mysql_fetch_array($mainquery)) {
|
|
||||||
$level = $mainrow["level"];
|
|
||||||
$charclass = $mainrow["charclass"];
|
|
||||||
$newspell = $levels[$charclass][$level];
|
|
||||||
$newquery = mysql_query("UPDATE $users SET spells='$newspell' WHERE id='".$mainrow["id"]."' LIMIT 1");
|
|
||||||
if ($newquery != true) {
|
|
||||||
$errors++; $errorlist .= mysql_error() . "<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$users = $prefix . "_users";
|
|
||||||
$query = <<<END
|
|
||||||
ALTER TABLE `$users` CHANGE `towns` `towns` VARCHAR( 50 ) DEFAULT '0' NOT NULL;
|
|
||||||
ALTER TABLE `$users` CHANGE `spells` `spells` VARCHAR( 50 ) DEFAULT '0' NOT NULL;
|
|
||||||
END;
|
|
||||||
if (dobatch($query) == 1) { echo "Users table upgraded.<br />"; } else { $errors++; $errorlist .= "Error upgrading Users table.<br />"; }
|
|
||||||
unset($query);
|
|
||||||
|
|
||||||
if ($errors == 0) { echo "<br />Upgrade finished."; } else { echo $errorlist; }
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
echo "Click the button below to run the upgrade script.<br /><form action=\"upgrade_to_112.php\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"Upgrade\" /></form>";
|
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|