The first "final" version of Dragon Knight.
This commit is contained in:
Jamin Blount 2017-02-05 10:49:37 -06:00
parent 141d7df715
commit accb18b059
70 changed files with 5467 additions and 0 deletions

896
admin/admin.php Normal file
View File

@ -0,0 +1,896 @@
<?php // admin.php :: primary administration script.
include('lib.php');
$link = opendb();
$userrow = checkcookies();
if ($userrow == false) { die("Please log in to the <a href=\"../login.php?do=login\">game</a> before using the control panel."); }
if ($userrow["authlevel"] != 1) { die("You must have administrator privileges to use the control panel."); }
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
if (isset($_GET["do"])) {
$do = explode(":",$_GET["do"]);
if ($do[0] == "main") { main(); }
elseif ($do[0] == "items") { items(); }
elseif ($do[0] == "edititem") { edititem($do[1]); }
elseif ($do[0] == "drops") { drops(); }
elseif ($do[0] == "editdrop") { editdrop($do[1]); }
elseif ($do[0] == "towns") { towns(); }
elseif ($do[0] == "edittown") { edittown($do[1]); }
elseif ($do[0] == "monsters") { monsters(); }
elseif ($do[0] == "editmonster") { editmonster($do[1]); }
elseif ($do[0] == "levels") { levels(); }
elseif ($do[0] == "editlevel") { editlevel(); }
elseif ($do[0] == "spells") { spells(); }
elseif ($do[0] == "editspell") { editspell($do[1]); }
elseif ($do[0] == "users") { users(); }
elseif ($do[0] == "edituser") { edituser($do[1]); }
elseif ($do[0] == "news") { addnews(); }
} else { donothing(); }
function donothing() {
$page = "Welcome to the Dragon Knight Administration section. Use the links on the left bar to control and edit various elements of the game.<br /><br />Please note that the control panel has been created mostly as a shortcut for certain individual settings. It is meant for use primarily with editing one thing at a time. If you need to completely replace an entire table (say, to replace all stock monsters with your own new ones), it is suggested that you use a more in-depth database tool such as <a href=\"http://www.phpmyadmin.net\" target=\"_new\">phpMyAdmin</a>. Also, you may want to have a copy of the Dragon Knight development kit, available from the <a href=\"http://dragon.se7enet.com/dev.php\">Dragon Knight homepage</a>.<br /><br />Also, you should be aware that certain portions of the DK code are dependent on the formatting of certain database results (for example, the special attributes on item drops). While I have attempted to point these out throughout the admin script, you should definitely pay attention and be careful when editing some fields, because mistakes in the database content may result in script errors or your game breaking completely.";
display($page, "Admin Home");
}
function main() {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($gamename == "") { $errors++; $errorlist .= "Game name is required.<br />"; }
if (($gamesize % 5) != 0) { $errors++; $errorlist .= "Map size must be divisible by five.<br />"; }
if (!is_numeric($gamesize)) { $errors++; $errorlist .= "Map size must be a number.<br />"; }
if ($forumtype == 2 && $forumaddress == "") { $errors++; $errorlist .= "You must specify a forum address when using the External setting.<br />"; }
if ($class1name == "") { $errors++; $errorlist .= "Class 1 name is required.<br />"; }
if ($class2name == "") { $errors++; $errorlist .= "Class 2 name is required.<br />"; }
if ($class3name == "") { $errors++; $errorlist .= "Class 3 name is required.<br />"; }
if ($diff1name == "") { $errors++; $errorlist .= "Difficulty 1 name is required.<br />"; }
if ($diff2name == "") { $errors++; $errorlist .= "Difficulty 2 name is required.<br />"; }
if ($diff3name == "") { $errors++; $errorlist .= "Difficulty 3 name is required.<br />"; }
if ($diff2mod == "") { $errors++; $errorlist .= "Difficulty 2 value is required.<br />"; }
if ($diff3mod == "") { $errors++; $errorlist .= "Difficulty 3 value is required.<br />"; }
if ($errors == 0) {
$query = doquery("UPDATE {{table}} SET gamename='$gamename',gamesize='$gamesize',forumtype='$forumtype',forumaddress='$forumaddress',compression='$compression',class1name='$class1name',class2name='$class2name',class3name='$class3name',diff1name='$diff1name',diff2name='$diff2name',diff3name='$diff3name',diff2mod='$diff2mod',diff3mod='$diff3mod',gameopen='$gameopen' WHERE id='1' LIMIT 1", "control");
display("Settings updated.","Main Settings");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Main Settings");
}
}
global $controlrow;
$page = <<<END
<b><u>Main Settings</u></b><br />
These options control several major settings for the overall game engine.<br /><br />
<form action="admin.php?do=main" method="post">
<table width="90%">
<tr><td width="20%"><span class="highlight">Game Open:</span></td><td><select name="gameopen"><option value="1" {{open1select}}>Open</option><option value="0" {{open0select}}>Closed</option></select><br /><span class="small">Close the game if you are upgrading or working on settings and don't want to cause odd errors for end-users. Closing the game will completely halt all activity.</span></td></tr>
<tr><td width="20%">Game Name:</td><td><input type="text" name="gamename" size="30" maxlength="50" value="{{gamename}}" /><br /><span class="small">Default is "Dragon Knight". Change this if you want to change to call your game something different.</span></td></tr>
<tr><td width="20%">Map Size:</td><td><input type="text" name="gamesize" size="3" maxlength="3" value="{{gamesize}}" /><br /><span class="small">Default is 250. This is the size of each map quadrant. Note that monster levels increase every 5 spaces, so you should ensure that you have at least (map size / 5) monster levels total, otherwise there will be parts of the map without any monsters, or some monsters won't ever get used. Ex: with a map size of 250, you should have 50 monster levels total.</span></td></tr>
<tr><td width="20%">Forum Type:</td><td><select name="forumtype"><option value="0" {{selecttype0}}>Disabled</option><option value="1" {{selecttype1}}>Internal</option><option value="2" {{selecttype2}}>External</option></select><br /><span class="small">'Disabled' removes the forum link. 'Internal' uses the built-in (and very stripped-down) forum program included with Dragon Knight, if you don't have your own forums software already installed. 'External' uses the address provided below and links to your own forums software.</span></td></tr>
<tr><td width="20%">External Forum:</td><td><input type="text" name="forumaddress" size="30" maxlength="200" value="{{forumaddress}}" /><br /><span class="small">If the above value is set to 'External,' please specify the complete URL to your forums here.</span></td></tr>
<tr><td width="20%">Page Compression:</td><td><select name="compression"><option value="0" {{selectcomp0}}>Disabled</option><option value="1" {{selectcomp1}}>Enabled</option></select><br /><span class="small">Enable page compression if it is supported by your server, and this will greatly reduce the amount of bandwidth required by the game.</span></td></tr>
<tr><td width="20%">Class 1 Name:</td><td><input type="text" name="class1name" size="20" maxlength="50" value="{{class1name}}" /><br /></td></tr>
<tr><td width="20%">Class 2 Name:</td><td><input type="text" name="class2name" size="20" maxlength="50" value="{{class2name}}" /><br /></td></tr>
<tr><td width="20%">Class 3 Name:</td><td><input type="text" name="class3name" size="20" maxlength="50" value="{{class3name}}" /><br /></td></tr>
<tr><td width="20%">Difficulty 1 Name:</td><td><input type="text" name="diff1name" size="20" maxlength="50" value="{{diff1name}}" /><br /></td></tr>
<tr><td width="20%">Difficulty 2 Name:</td><td><input type="text" name="diff2name" size="20" maxlength="50" value="{{diff2name}}" /><br /></td></tr>
<tr><td width="20%">Difficulty 2 Value:</td><td><input type="text" name="diff2mod" size="3" maxlength="3" value="{{diff2mod}}" /><br /><span class="small">Default is 1.2. Specify factoral value for medium difficulty here.</span></td></tr>
<tr><td width="20%">Difficulty 3 Name:</td><td><input type="text" name="diff3name" size="20" maxlength="50" value="{{diff3name}}" /><br /></td></tr>
<tr><td width="20%">Difficulty 3 Value:</td><td><input type="text" name="diff3mod" size="3" maxlength="3" value="{{diff3mod}}" /><br /><span class="small">Default is 1.5. Specify factoral value for hard difficulty here.</span></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
if ($controlrow["forumtype"] == 0) { $controlrow["selecttype0"] = "selected=\"selected\" "; } else { $controlrow["selecttype0"] = ""; }
if ($controlrow["forumtype"] == 1) { $controlrow["selecttype1"] = "selected=\"selected\" "; } else { $controlrow["selecttype1"] = ""; }
if ($controlrow["forumtype"] == 2) { $controlrow["selecttype2"] = "selected=\"selected\" "; } else { $controlrow["selecttype2"] = ""; }
if ($controlrow["compression"] == 0) { $controlrow["selectcomp0"] = "selected=\"selected\" "; } else { $controlrow["selectcomp0"] = ""; }
if ($controlrow["compression"] == 1) { $controlrow["selectcomp1"] = "selected=\"selected\" "; } else { $controlrow["selectcomp1"] = ""; }
if ($controlrow["gameopen"] == 1) { $controlrow["open1select"] = "selected=\"selected\" "; } else { $controlrow["open1select"] = ""; }
if ($controlrow["gameopen"] == 0) { $controlrow["open0select"] = "selected=\"selected\" "; } else { $controlrow["open0select"] = ""; }
$page = parsetemplate($page, $controlrow);
display($page, "Main Settings");
}
function items() {
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "items");
$page = "<b><u>Edit Items</u></b><br />Click an item's name to edit it.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edititem:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edititem:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Items");
}
function edititem($id) {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($name == "") { $errors++; $errorlist .= "Name is required.<br />"; }
if ($buycost == "") { $errors++; $errorlist .= "Cost is required.<br />"; }
if (!is_numeric($buycost)) { $errors++; $errorlist .= "Cost must be a number.<br />"; }
if ($attribute == "") { $errors++; $errorlist .= "Attribute is required.<br />"; }
if (!is_numeric($attribute)) { $errors++; $errorlist .= "Attribute must be a number.<br />"; }
if ($special == "" || $special == " ") { $special = "X"; }
if ($errors == 0) {
$query = doquery("UPDATE {{table}} SET name='$name',type='$type',buycost='$buycost',attribute='$attribute',special='$special' WHERE id='$id' LIMIT 1", "items");
display("Item updated.","Edit Items");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Items");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
$row = mysql_fetch_array($query);
$page = <<<END
<b><u>Edit Items</u></b><br /><br />
<form action="admin.php?do=edititem:$id" method="post">
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td width="20%">Name:</td><td><input type="text" name="name" size="30" maxlength="30" value="{{name}}" /></td></tr>
<tr><td width="20%">Type:</td><td><select name="type"><option value="1" {{type1select}}>Weapon</option><option value="2" {{type2select}}>Armor</option><option value="3" {{type3select}}>Shield</option></select></td></tr>
<tr><td width="20%">Cost:</td><td><input type="text" name="buycost" size="5" maxlength="10" value="{{buycost}}" /> gold</td></tr>
<tr><td width="20%">Attribute:</td><td><input type="text" name="attribute" size="5" maxlength="10" value="{{attribute}}" /><br /><span class="small">How much the item adds to total attackpower (weapons) or defensepower (armor/shields).</span></td></tr>
<tr><td width="20%">Special:</td><td><input type="text" name="special" size="30" maxlength="50" value="{{special}}" /><br /><span class="small">Should be either a special code or <span class="highlight">X</span> to disable. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.</span></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
<b>Special Codes:</b><br />
Special codes can be added in the item's Special field to give it extra user attributes. Special codes are in the format <span class="highlight">attribute,value</span>. <span class="highlight">Attribute</span> can be any database field from the Users table - however, it is suggested that you only use the ones from the list below, otherwise things can get freaky. <span class="highlight">Value</span> may be any positive or negative whole number. For example, if you want a weapon to give an additional 50 max hit points, the special code would be <span class="highlight">maxhp,50</span>.<br /><br />
Suggested user fields for special codes:<br />
maxhp - max hit points<br />
maxmp - max magic points<br />
maxtp - max travel points<br />
goldbonus - gold bonus, in percent<br />
expbonus - experience bonus, in percent<br />
strength - strength (which also adds to attackpower)<br />
dexterity - dexterity (which also adds to defensepower)<br />
attackpower - total attack power<br />
defensepower - total defense power
END;
if ($row["type"] == 1) { $row["type1select"] = "selected=\"selected\" "; } else { $row["type1select"] = ""; }
if ($row["type"] == 2) { $row["type2select"] = "selected=\"selected\" "; } else { $row["type2select"] = ""; }
if ($row["type"] == 3) { $row["type3select"] = "selected=\"selected\" "; } else { $row["type3select"] = ""; }
$page = parsetemplate($page, $row);
display($page, "Edit Items");
}
function drops() {
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "drops");
$page = "<b><u>Edit Drops</u></b><br />Click an item's name to edit it.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editdrop:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editdrop:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Drops");
}
function editdrop($id) {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($name == "") { $errors++; $errorlist .= "Name is required.<br />"; }
if ($mlevel == "") { $errors++; $errorlist .= "Monster level is required.<br />"; }
if (!is_numeric($mlevel)) { $errors++; $errorlist .= "Monster level must be a number.<br />"; }
if ($attribute1 == "" || $attribute1 == " " || $attribute1 == "X") { $errors++; $errorlist .= "First attribute is required.<br />"; }
if ($attribute2 == "" || $attribute2 == " ") { $attribute2 = "X"; }
if ($errors == 0) {
$query = doquery("UPDATE {{table}} SET name='$name',mlevel='$mlevel',attribute1='$attribute1',attribute2='$attribute2' WHERE id='$id' LIMIT 1", "drops");
display("Item updated.","Edit Drops");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Drops");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "drops");
$row = mysql_fetch_array($query);
$page = <<<END
<b><u>Edit Drops</u></b><br /><br />
<form action="admin.php?do=editdrop:$id" method="post">
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td width="20%">Name:</td><td><input type="text" name="name" size="30" maxlength="30" value="{{name}}" /></td></tr>
<tr><td width="20%">Monster Level:</td><td><input type="text" name="mlevel" size="5" maxlength="10" value="{{mlevel}}" /><br /><span class="small">Minimum monster level that will drop this item.</span></td></tr>
<tr><td width="20%">Attribute 1:</td><td><input type="text" name="attribute1" size="30" maxlength="50" value="{{attribute1}}" /><br /><span class="small">Must be a special code. First attribute cannot be disabled. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.</span></td></tr>
<tr><td width="20%">Attribute 2:</td><td><input type="text" name="attribute2" size="30" maxlength="50" value="{{attribute2}}" /><br /><span class="small">Should be either a special code or <span class="highlight">X</span> to disable. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.</span></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
<b>Special Codes:</b><br />
Special codes are used in the two attribute fields to give the item properties. The first attribute field must contain a special code, but the second one may be left empty ("X") if you wish. Special codes are in the format <span class="highlight">attribute,value</span>. <span class="highlight">Attribute</span> can be any database field from the Users table - however, it is suggested that you only use the ones from the list below, otherwise things can get freaky. <span class="highlight">Value</span> may be any positive or negative whole number. For example, if you want a weapon to give an additional 50 max hit points, the special code would be <span class="highlight">maxhp,50</span>.<br /><br />
Suggested user fields for special codes:<br />
maxhp - max hit points<br />
maxmp - max magic points<br />
maxtp - max travel points<br />
goldbonus - gold bonus, in percent<br />
expbonus - experience bonus, in percent<br />
strength - strength (which also adds to attackpower)<br />
dexterity - dexterity (which also adds to defensepower)<br />
attackpower - total attack power<br />
defensepower - total defense power
END;
$page = parsetemplate($page, $row);
display($page, "Edit Drops");
}
function towns() {
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "towns");
$page = "<b><u>Edit Towns</u></b><br />Click an town's name to edit it.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edittown:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edittown:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Towns");
}
function edittown($id) {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($name == "") { $errors++; $errorlist .= "Name is required.<br />"; }
if ($latitude == "") { $errors++; $errorlist .= "Latitude is required.<br />"; }
if (!is_numeric($latitude)) { $errors++; $errorlist .= "Latitude must be a number.<br />"; }
if ($longitude == "") { $errors++; $errorlist .= "Longitude is required.<br />"; }
if (!is_numeric($longitude)) { $errors++; $errorlist .= "Longitude must be a number.<br />"; }
if ($innprice == "") { $errors++; $errorlist .= "Inn Price is required.<br />"; }
if (!is_numeric($innprice)) { $errors++; $errorlist .= "Inn Price must be a number.<br />"; }
if ($mapprice == "") { $errors++; $errorlist .= "Map Price is required.<br />"; }
if (!is_numeric($mapprice)) { $errors++; $errorlist .= "Map Price must be a number.<br />"; }
if ($travelpoints == "") { $errors++; $errorlist .= "Travel Points is required.<br />"; }
if (!is_numeric($travelpoints)) { $errors++; $errorlist .= "Travel Points must be a number.<br />"; }
if ($itemslist == "") { $errors++; $errorlist .= "Items List is required.<br />"; }
if ($errors == 0) {
$query = doquery("UPDATE {{table}} SET name='$name',latitude='$latitude',longitude='$longitude',innprice='$innprice',mapprice='$mapprice',travelpoints='$travelpoints',itemslist='$itemslist' WHERE id='$id' LIMIT 1", "towns");
display("Town updated.","Edit Towns");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Towns");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
$row = mysql_fetch_array($query);
$page = <<<END
<b><u>Edit Towns</u></b><br /><br />
<form action="admin.php?do=edittown:$id" method="post">
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td width="20%">Name:</td><td><input type="text" name="name" size="30" maxlength="30" value="{{name}}" /></td></tr>
<tr><td width="20%">Latitude:</td><td><input type="text" name="latitude" size="5" maxlength="10" value="{{latitude}}" /><br /><span class="small">Positive or negative integer.</span></td></tr>
<tr><td width="20%">Longitude:</td><td><input type="text" name="longitude" size="5" maxlength="10" value="{{longitude}}" /><br /><span class="small">Positive or negative integer.</span></td></tr>
<tr><td width="20%">Inn Price:</td><td><input type="text" name="innprice" size="5" maxlength="10" value="{{innprice}}" /> gold</td></tr>
<tr><td width="20%">Map Price:</td><td><input type="text" name="mapprice" size="5" maxlength="10" value="{{mapprice}}" /> gold<br /><span class="small">How much it costs to buy the map to this town.</span></td></tr>
<tr><td width="20%">Travel Points:</td><td><input type="text" name="travelpoints" size="5" maxlength="10" value="{{travelpoints}}" /><br /><span class="small">How many TP are consumed when travelling to this town.</span></td></tr>
<tr><td width="20%">Items List:</td><td><input type="text" name="itemslist" size="30" maxlength="200" value="{{itemslist}}" /><br /><span class="small">Comma-separated list of item ID numbers available for purchase at this town. (Example: <span class="highlight">1,2,3,6,9,10,13,20</span>)</span></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
$page = parsetemplate($page, $row);
display($page, "Edit Towns");
}
function monsters() {
global $controlrow;
$statquery = doquery("SELECT * FROM {{table}} ORDER BY level DESC LIMIT 1", "monsters");
$statrow = mysql_fetch_array($statquery);
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "monsters");
$page = "<b><u>Edit Monsters</u></b><br />";
if (($controlrow["gamesize"]/5) != $statrow["level"]) {
$page .= "<span class=\"highlight\">Note:</span> Your highest monster level does not match with your entered map size. Highest monster level should be ".($controlrow["gamesize"]/5).", yours is ".$statrow["level"].". Please fix this before opening the game to the public.<br /><br />";
} else { $page .= "Monster level and map size match. No further actions are required for map compatibility.<br /><br />"; }
$page .= "Click an monster's name to edit it.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editmonster:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editmonster:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No towns found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Monster");
}
function editmonster($id) {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($name == "") { $errors++; $errorlist .= "Name is required.<br />"; }
if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.<br />"; }
if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.<br />"; }
if ($maxdam == "") { $errors++; $errorlist .= "Max Damage is required.<br />"; }
if (!is_numeric($maxdam)) { $errors++; $errorlist .= "Max Damage must be a number.<br />"; }
if ($armor == "") { $errors++; $errorlist .= "Armor is required.<br />"; }
if (!is_numeric($armor)) { $errors++; $errorlist .= "Armor must be a number.<br />"; }
if ($level == "") { $errors++; $errorlist .= "Monster Level is required.<br />"; }
if (!is_numeric($level)) { $errors++; $errorlist .= "Monster Level must be a number.<br />"; }
if ($maxexp == "") { $errors++; $errorlist .= "Max Exp is required.<br />"; }
if (!is_numeric($maxexp)) { $errors++; $errorlist .= "Max Exp must be a number.<br />"; }
if ($maxgold == "") { $errors++; $errorlist .= "Max Gold is required.<br />"; }
if (!is_numeric($maxgold)) { $errors++; $errorlist .= "Max Gold must be a number.<br />"; }
if ($errors == 0) {
$query = doquery("UPDATE {{table}} SET name='$name',maxhp='$maxhp',maxdam='$maxdam',armor='$armor',level='$level',maxexp='$maxexp',maxgold='$maxgold',immune='$immune' WHERE id='$id' LIMIT 1", "monsters");
display("Monster updated.","Edit monsters");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit monsters");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "monsters");
$row = mysql_fetch_array($query);
$page = <<<END
<b><u>Edit Monsters</u></b><br /><br />
<form action="admin.php?do=editmonster:$id" method="post">
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td width="20%">Name:</td><td><input type="text" name="name" size="30" maxlength="30" value="{{name}}" /></td></tr>
<tr><td width="20%">Max Hit Points:</td><td><input type="text" name="maxhp" size="5" maxlength="10" value="{{maxhp}}" /></td></tr>
<tr><td width="20%">Max Damage:</td><td><input type="text" name="maxdam" size="5" maxlength="10" value="{{maxdam}}" /><br /><span class="small">Compares to player's attackpower.</span></td></tr>
<tr><td width="20%">Armor:</td><td><input type="text" name="armor" size="5" maxlength="10" value="{{armor}}" /><br /><span class="small">Compares to player's defensepower.</span></td></tr>
<tr><td width="20%">Monster Level:</td><td><input type="text" name="level" size="5" maxlength="10" value="{{level}}" /><br /><span class="small">Determines spawn location and item drops.</span></td></tr>
<tr><td width="20%">Max Experience:</td><td><input type="text" name="maxexp" size="5" maxlength="10" value="{{maxexp}}" /><br /><span class="small">Max experience gained from defeating monster.</span></td></tr>
<tr><td width="20%">Max Gold:</td><td><input type="text" name="maxgold" size="5" maxlength="10" value="{{maxgold}}" /><br /><span class="small">Max gold gained from defeating monster.</span></td></tr>
<tr><td width="20%">Immunity:</td><td><select name="immune"><option value="0" {{immune0select}}>None</option><option value="1" {{immune1select}}>Hurt Spells</option><option value="2" {{immune2select}}>Hurt & Sleep Spells</option></select><br /><span class="small">Some monsters may not be hurt by certain spells.</span></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
if ($row["immune"] == 1) { $row["immune1select"] = "selected=\"selected\" "; } else { $row["immune1select"] = ""; }
if ($row["immune"] == 2) { $row["immune2select"] = "selected=\"selected\" "; } else { $row["immune2select"] = ""; }
if ($row["immune"] == 3) { $row["immune3select"] = "selected=\"selected\" "; } else { $row["immune3select"] = ""; }
$page = parsetemplate($page, $row);
display($page, "Edit Monsters");
}
function spells() {
$query = doquery("SELECT id,name FROM {{table}} ORDER BY id", "spells");
$page = "<b><u>Edit Spells</u></b><br />Click an spell's name to edit it.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=editspell:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=editspell:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Spells");
}
function editspell($id) {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($name == "") { $errors++; $errorlist .= "Name is required.<br />"; }
if ($mp == "") { $errors++; $errorlist .= "MP is required.<br />"; }
if (!is_numeric($mp)) { $errors++; $errorlist .= "MP must be a number.<br />"; }
if ($attribute == "") { $errors++; $errorlist .= "Attribute is required.<br />"; }
if (!is_numeric($attribute)) { $errors++; $errorlist .= "Attribute must be a number.<br />"; }
if ($errors == 0) {
$query = doquery("UPDATE {{table}} SET name='$name',mp='$mp',attribute='$attribute',type='$type' WHERE id='$id' LIMIT 1", "spells");
display("Spell updated.","Edit Spells");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Spells");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
$row = mysql_fetch_array($query);
$page = <<<END
<b><u>Edit Spells</u></b><br /><br />
<form action="admin.php?do=editspell:$id" method="post">
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td width="20%">Name:</td><td><input type="text" name="name" size="30" maxlength="30" value="{{name}}" /></td></tr>
<tr><td width="20%">Magic Points:</td><td><input type="text" name="mp" size="5" maxlength="10" value="{{mp}}" /><br /><span class="small">MP required to cast spell.</span></td></tr>
<tr><td width="20%">Attribute:</td><td><input type="text" name="attribute" size="5" maxlength="10" value="{{attribute}}" /><br /><span class="small">Numeric value of the spell's effect. Ties with type, below.</span></td></tr>
<tr><td width="20%">Type:</td><td><select name="type"><option value="1" {{type1select}}>Heal</option><option value="2" {{type2select}}>Hurt</option><option value="3" {{type3select}}>Sleep</option><option value="4" {{type4select}}>Uber Attack</option><option value="5" {{type5select}}>Uber Defense</option></select><br /><span class="small">- Heal gives player back [attribute] hit points.<br />- Hurt deals [attribute] damage to monster.<br />- Sleep keeps monster from attacking ([attribute] is monster's chance out of 15 to stay asleep each turn).<br />- Uber Attack increases total attack damage by [attribute] percent.<br />- Uber Defense increases total defense from attack by [attribute] percent.</span></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
if ($row["type"] == 1) { $row["type1select"] = "selected=\"selected\" "; } else { $row["type1select"] = ""; }
if ($row["type"] == 2) { $row["type2select"] = "selected=\"selected\" "; } else { $row["type2select"] = ""; }
if ($row["type"] == 3) { $row["type3select"] = "selected=\"selected\" "; } else { $row["type3select"] = ""; }
if ($row["type"] == 4) { $row["type4select"] = "selected=\"selected\" "; } else { $row["type4select"] = ""; }
if ($row["type"] == 5) { $row["type5select"] = "selected=\"selected\" "; } else { $row["type5select"] = ""; }
$page = parsetemplate($page, $row);
display($page, "Edit Spells");
}
function levels() {
$query = doquery("SELECT id FROM {{table}} ORDER BY id DESC LIMIT 1", "levels");
$row = mysql_fetch_array($query);
$options = "";
for($i=2; $i<$row["id"]; $i++) {
$options .= "<option value=\"$i\">$i</option>\n";
}
$page = <<<END
<b><u>Edit Levels</u></b><br />Select a level number from the dropdown box to edit it.<br /><br />
<form action="admin.php?do=editlevel" method="post">
<select name="level">
$options
</select>
<input type="submit" name="go" value="Submit" />
</form>
END;
display($page, "Edit Levels");
}
function editlevel() {
if (!isset($_POST["level"])) { display("No level to edit.", "Edit Levels"); die(); }
$id = $_POST["level"];
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($_POST["1_exp"] == "") { $errors++; $errorlist .= "Class 1 Experience is required.<br />"; }
if ($_POST["1_hp"] == "") { $errors++; $errorlist .= "Class 1 HP is required.<br />"; }
if ($_POST["1_mp"] == "") { $errors++; $errorlist .= "Class 1 MP is required.<br />"; }
if ($_POST["1_tp"] == "") { $errors++; $errorlist .= "Class 1 TP is required.<br />"; }
if ($_POST["1_strength"] == "") { $errors++; $errorlist .= "Class 1 Strength is required.<br />"; }
if ($_POST["1_dexterity"] == "") { $errors++; $errorlist .= "Class 1 Dexterity is required.<br />"; }
if ($_POST["1_spells"] == "") { $errors++; $errorlist .= "Class 1 Spells is required.<br />"; }
if (!is_numeric($_POST["1_exp"])) { $errors++; $errorlist .= "Class 1 Experience must be a number.<br />"; }
if (!is_numeric($_POST["1_hp"])) { $errors++; $errorlist .= "Class 1 HP must be a number.<br />"; }
if (!is_numeric($_POST["1_mp"])) { $errors++; $errorlist .= "Class 1 MP must be a number.<br />"; }
if (!is_numeric($_POST["1_tp"])) { $errors++; $errorlist .= "Class 1 TP must be a number.<br />"; }
if (!is_numeric($_POST["1_strength"])) { $errors++; $errorlist .= "Class 1 Strength must be a number.<br />"; }
if (!is_numeric($_POST["1_dexterity"])) { $errors++; $errorlist .= "Class 1 Dexterity must be a number.<br />"; }
if (!is_numeric($_POST["1_spells"])) { $errors++; $errorlist .= "Class 1 Spells must be a number.<br />"; }
if ($_POST["2_exp"] == "") { $errors++; $errorlist .= "Class 2 Experience is required.<br />"; }
if ($_POST["2_hp"] == "") { $errors++; $errorlist .= "Class 2 HP is required.<br />"; }
if ($_POST["2_mp"] == "") { $errors++; $errorlist .= "Class 2 MP is required.<br />"; }
if ($_POST["2_tp"] == "") { $errors++; $errorlist .= "Class 2 TP is required.<br />"; }
if ($_POST["2_strength"] == "") { $errors++; $errorlist .= "Class 2 Strength is required.<br />"; }
if ($_POST["2_dexterity"] == "") { $errors++; $errorlist .= "Class 2 Dexterity is required.<br />"; }
if ($_POST["2_spells"] == "") { $errors++; $errorlist .= "Class 2 Spells is required.<br />"; }
if (!is_numeric($_POST["2_exp"])) { $errors++; $errorlist .= "Class 2 Experience must be a number.<br />"; }
if (!is_numeric($_POST["2_hp"])) { $errors++; $errorlist .= "Class 2 HP must be a number.<br />"; }
if (!is_numeric($_POST["2_mp"])) { $errors++; $errorlist .= "Class 2 MP must be a number.<br />"; }
if (!is_numeric($_POST["2_tp"])) { $errors++; $errorlist .= "Class 2 TP must be a number.<br />"; }
if (!is_numeric($_POST["2_strength"])) { $errors++; $errorlist .= "Class 2 Strength must be a number.<br />"; }
if (!is_numeric($_POST["2_dexterity"])) { $errors++; $errorlist .= "Class 2 Dexterity must be a number.<br />"; }
if (!is_numeric($_POST["2_spells"])) { $errors++; $errorlist .= "Class 2 Spells must be a number.<br />"; }
if ($_POST["3_exp"] == "") { $errors++; $errorlist .= "Class 3 Experience is required.<br />"; }
if ($_POST["3_hp"] == "") { $errors++; $errorlist .= "Class 3 HP is required.<br />"; }
if ($_POST["3_mp"] == "") { $errors++; $errorlist .= "Class 3 MP is required.<br />"; }
if ($_POST["3_tp"] == "") { $errors++; $errorlist .= "Class 3 TP is required.<br />"; }
if ($_POST["3_strength"] == "") { $errors++; $errorlist .= "Class 3 Strength is required.<br />"; }
if ($_POST["3_dexterity"] == "") { $errors++; $errorlist .= "Class 3 Dexterity is required.<br />"; }
if ($_POST["3_spells"] == "") { $errors++; $errorlist .= "Class 3 Spells is required.<br />"; }
if (!is_numeric($_POST["3_exp"])) { $errors++; $errorlist .= "Class 3 Experience must be a number.<br />"; }
if (!is_numeric($_POST["3_hp"])) { $errors++; $errorlist .= "Class 3 HP must be a number.<br />"; }
if (!is_numeric($_POST["3_mp"])) { $errors++; $errorlist .= "Class 3 MP must be a number.<br />"; }
if (!is_numeric($_POST["3_tp"])) { $errors++; $errorlist .= "Class 3 TP must be a number.<br />"; }
if (!is_numeric($_POST["3_strength"])) { $errors++; $errorlist .= "Class 3 Strength must be a number.<br />"; }
if (!is_numeric($_POST["3_dexterity"])) { $errors++; $errorlist .= "Class 3 Dexterity must be a number.<br />"; }
if (!is_numeric($_POST["3_spells"])) { $errors++; $errorlist .= "Class 3 Spells must be a number.<br />"; }
if ($errors == 0) {
$updatequery = <<<END
UPDATE {{table}} SET
1_exp='$1_exp', 1_hp='$1_hp', 1_mp='$1_mp', 1_tp='$1_tp', 1_strength='$1_strength', 1_dexterity='$1_dexterity', 1_spells='$1_spells',
2_exp='$2_exp', 2_hp='$2_hp', 2_mp='$2_mp', 2_tp='$2_tp', 2_strength='$2_strength', 2_dexterity='$2_dexterity', 2_spells='$2_spells',
3_exp='$3_exp', 3_hp='$3_hp', 3_mp='$3_mp', 3_tp='$3_tp', 3_strength='$3_strength', 3_dexterity='$3_dexterity', 3_spells='$3_spells'
WHERE id='$id' LIMIT 1
END;
$query = doquery($updatequery, "levels");
display("Level updated.","Edit Levels");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Spells");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "levels");
$row = mysql_fetch_array($query);
global $controlrow;
$class1name = $controlrow["class1name"];
$class2name = $controlrow["class2name"];
$class3name = $controlrow["class3name"];
$page = <<<END
<b><u>Edit Levels</u></b><br /><br />
Experience values for each level should be the cumulative total amount of experience up to this point. All other values should be only the new amount to add this level.<br /><br />
<form action="admin.php?do=editlevel" method="post">
<input type="hidden" name="level" value="$id" />
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">$class1name Experience:</td><td><input type="text" name="1_exp" size="10" maxlength="8" value="{{1_exp}}" /></td></tr>
<tr><td width="20%">$class1name HP:</td><td><input type="text" name="1_hp" size="5" maxlength="5" value="{{1_hp}}" /></td></tr>
<tr><td width="20%">$class1name MP:</td><td><input type="text" name="1_mp" size="5" maxlength="5" value="{{1_mp}}" /></td></tr>
<tr><td width="20%">$class1name TP:</td><td><input type="text" name="1_tp" size="5" maxlength="5" value="{{1_tp}}" /></td></tr>
<tr><td width="20%">$class1name Strength:</td><td><input type="text" name="1_strength" size="5" maxlength="5" value="{{1_strength}}" /></td></tr>
<tr><td width="20%">$class1name Dexterity:</td><td><input type="text" name="1_dexterity" size="5" maxlength="5" value="{{1_dexterity}}" /></td></tr>
<tr><td width="20%">$class1name Spells:</td><td><input type="text" name="1_spells" size="5" maxlength="3" value="{{1_spells}}" /></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">$class2name Experience:</td><td><input type="text" name="2_exp" size="10" maxlength="8" value="{{2_exp}}" /></td></tr>
<tr><td width="20%">$class2name HP:</td><td><input type="text" name="2_hp" size="5" maxlength="5" value="{{2_hp}}" /></td></tr>
<tr><td width="20%">$class2name MP:</td><td><input type="text" name="2_mp" size="5" maxlength="5" value="{{2_mp}}" /></td></tr>
<tr><td width="20%">$class2name TP:</td><td><input type="text" name="2_tp" size="5" maxlength="5" value="{{2_tp}}" /></td></tr>
<tr><td width="20%">$class2name Strength:</td><td><input type="text" name="2_strength" size="5" maxlength="5" value="{{2_strength}}" /></td></tr>
<tr><td width="20%">$class2name Dexterity:</td><td><input type="text" name="2_dexterity" size="5" maxlength="5" value="{{2_dexterity}}" /></td></tr>
<tr><td width="20%">$class2name Spells:</td><td><input type="text" name="2_spells" size="5" maxlength="3" value="{{2_spells}}" /></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">$class3name Experience:</td><td><input type="text" name="3_exp" size="10" maxlength="8" value="{{3_exp}}" /></td></tr>
<tr><td width="20%">$class3name HP:</td><td><input type="text" name="3_hp" size="5" maxlength="5" value="{{3_hp}}" /></td></tr>
<tr><td width="20%">$class3name MP:</td><td><input type="text" name="3_mp" size="5" maxlength="5" value="{{3_mp}}" /></td></tr>
<tr><td width="20%">$class3name TP:</td><td><input type="text" name="3_tp" size="5" maxlength="5" value="{{3_tp}}" /></td></tr>
<tr><td width="20%">$class3name Strength:</td><td><input type="text" name="3_strength" size="5" maxlength="5" value="{{3_strength}}" /></td></tr>
<tr><td width="20%">$class3name Dexterity:</td><td><input type="text" name="3_dexterity" size="5" maxlength="5" value="{{3_dexterity}}" /></td></tr>
<tr><td width="20%">$class3name Spells:</td><td><input type="text" name="3_spells" size="5" maxlength="3" value="{{3_spells}}" /></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
$page = parsetemplate($page, $row);
display($page, "Edit Levels");
}
function users() {
$query = doquery("SELECT id,username FROM {{table}} ORDER BY id", "users");
$page = "<b><u>Edit Users</u></b><br />Click a username to edit the account.<br /><br /><table width=\"50%\">\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin.php?do=edituser:".$row["id"]."\">".$row["username"]."</a></td></tr>\n"; $count = 2; }
else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin.php?do=edituser:".$row["id"]."\">".$row["username"]."</a></td></tr>\n"; $count = 1; }
}
if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No spells found.</td></tr>\n"; }
$page .= "</table>";
display($page, "Edit Users");
}
function edituser($id) {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($email == "") { $errors++; $errorlist .= "Email is required.<br />"; }
if ($verify == "") { $errors++; $errorlist .= "Verify is required.<br />"; }
if ($charname == "") { $errors++; $errorlist .= "Character Name is required.<br />"; }
if ($authlevel == "") { $errors++; $errorlist .= "Auth Level is required.<br />"; }
if ($latitude == "") { $errors++; $errorlist .= "Latitude is required.<br />"; }
if ($longitude == "") { $errors++; $errorlist .= "Longitude is required.<br />"; }
if ($difficulty == "") { $errors++; $errorlist .= "Difficulty is required.<br />"; }
if ($charclass == "") { $errors++; $errorlist .= "Character Class is required.<br />"; }
if ($currentaction == "") { $errors++; $errorlist .= "Current Action is required.<br />"; }
if ($currentfight == "") { $errors++; $errorlist .= "Current Fight is required.<br />"; }
if ($currentmonster == "") { $errors++; $errorlist .= "Current Monster is required.<br />"; }
if ($currentmonsterhp == "") { $errors++; $errorlist .= "Current Monster HP is required.<br />"; }
if ($currentmonstersleep == "") { $errors++; $errorlist .= "Current Monster Sleep is required.<br />"; }
if ($currentmonsterimmune == "") { $errors++; $errorlist .= "Current Monster Immune is required.<br />"; }
if ($currentuberdamage == "") { $errors++; $errorlist .= "Current Uber Damage is required.<br />"; }
if ($currentuberdefense == "") { $errors++; $errorlist .= "Current Uber Defense is required.<br />"; }
if ($currenthp == "") { $errors++; $errorlist .= "Current HP is required.<br />"; }
if ($currentmp == "") { $errors++; $errorlist .= "Current MP is required.<br />"; }
if ($currenttp == "") { $errors++; $errorlist .= "Current TP is required.<br />"; }
if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.<br />"; }
if ($maxmp == "") { $errors++; $errorlist .= "Max MP is required.<br />"; }
if ($maxtp == "") { $errors++; $errorlist .= "Max TP is required.<br />"; }
if ($level == "") { $errors++; $errorlist .= "Level is required.<br />"; }
if ($gold == "") { $errors++; $errorlist .= "Gold is required.<br />"; }
if ($experience == "") { $errors++; $errorlist .= "Experience is required.<br />"; }
if ($goldbonus == "") { $errors++; $errorlist .= "Gold Bonus is required.<br />"; }
if ($expbonus == "") { $errors++; $errorlist .= "Experience Bonus is required.<br />"; }
if ($strength == "") { $errors++; $errorlist .= "Strength is required.<br />"; }
if ($dexterity == "") { $errors++; $errorlist .= "Dexterity is required.<br />"; }
if ($attackpower == "") { $errors++; $errorlist .= "Attack Power is required.<br />"; }
if ($defensepower == "") { $errors++; $errorlist .= "Defense Power is required.<br />"; }
if ($weaponid == "") { $errors++; $errorlist .= "Weapon ID is required.<br />"; }
if ($armorid == "") { $errors++; $errorlist .= "Armor ID is required.<br />"; }
if ($shieldid == "") { $errors++; $errorlist .= "Shield ID is required.<br />"; }
if ($slot1id == "") { $errors++; $errorlist .= "Slot 1 ID is required.<br />"; }
if ($slot2id == "") { $errors++; $errorlist .= "Slot 2 ID is required.<br />"; }
if ($slot3id == "") { $errors++; $errorlist .= "Slot 3 ID is required.<br />"; }
if ($weaponname == "") { $errors++; $errorlist .= "Weapon Name is required.<br />"; }
if ($armorname == "") { $errors++; $errorlist .= "Armor Name is required.<br />"; }
if ($shieldname == "") { $errors++; $errorlist .= "Shield Name is required.<br />"; }
if ($slot1name == "") { $errors++; $errorlist .= "Slot 1 Name is required.<br />"; }
if ($slot2name == "") { $errors++; $errorlist .= "Slot 2 Name is required.<br />"; }
if ($slot3name == "") { $errors++; $errorlist .= "Slot 3 Name is required.<br />"; }
if ($dropcode == "") { $errors++; $errorlist .= "Drop Code is required.<br />"; }
if ($spells == "") { $errors++; $errorlist .= "Spells is required.<br />"; }
if ($towns == "") { $errors++; $errorlist .= "Towns is required.<br />"; }
if (!is_numeric($authlevel)) { $errors++; $errorlist .= "Auth Level must be a number.<br />"; }
if (!is_numeric($latitude)) { $errors++; $errorlist .= "Latitude must be a number.<br />"; }
if (!is_numeric($longitude)) { $errors++; $errorlist .= "Longitude must be a number.<br />"; }
if (!is_numeric($difficulty)) { $errors++; $errorlist .= "Difficulty must be a number.<br />"; }
if (!is_numeric($charclass)) { $errors++; $errorlist .= "Character Class must be a number.<br />"; }
if (!is_numeric($currentfight)) { $errors++; $errorlist .= "Current Fight must be a number.<br />"; }
if (!is_numeric($currentmonster)) { $errors++; $errorlist .= "Current Monster must be a number.<br />"; }
if (!is_numeric($currentmonsterhp)) { $errors++; $errorlist .= "Current Monster HP must be a number.<br />"; }
if (!is_numeric($currentmonstersleep)) { $errors++; $errorlist .= "Current Monster Sleep must be a number.<br />"; }
if (!is_numeric($currentmonsterimmune)) { $errors++; $errorlist .= "Current Monster Immune must be a number.<br />"; }
if (!is_numeric($currentuberdamage)) { $errors++; $errorlist .= "Current Uber Damage must be a number.<br />"; }
if (!is_numeric($currentuberdefense)) { $errors++; $errorlist .= "Current Uber Defense must be a number.<br />"; }
if (!is_numeric($currenthp)) { $errors++; $errorlist .= "Current HP must be a number.<br />"; }
if (!is_numeric($currentmp)) { $errors++; $errorlist .= "Current MP must be a number.<br />"; }
if (!is_numeric($currenttp)) { $errors++; $errorlist .= "Current TP must be a number.<br />"; }
if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.<br />"; }
if (!is_numeric($maxmp)) { $errors++; $errorlist .= "Max MP must be a number.<br />"; }
if (!is_numeric($maxtp)) { $errors++; $errorlist .= "Max TP must be a number.<br />"; }
if (!is_numeric($level)) { $errors++; $errorlist .= "Level must be a number.<br />"; }
if (!is_numeric($gold)) { $errors++; $errorlist .= "Gold must be a number.<br />"; }
if (!is_numeric($experience)) { $errors++; $errorlist .= "Experience must be a number.<br />"; }
if (!is_numeric($goldbonus)) { $errors++; $errorlist .= "Gold Bonus must be a number.<br />"; }
if (!is_numeric($expbonus)) { $errors++; $errorlist .= "Experience Bonus must be a number.<br />"; }
if (!is_numeric($strength)) { $errors++; $errorlist .= "Strength must be a number.<br />"; }
if (!is_numeric($dexterity)) { $errors++; $errorlist .= "Dexterity must be a number.<br />"; }
if (!is_numeric($attackpower)) { $errors++; $errorlist .= "Attack Power must be a number.<br />"; }
if (!is_numeric($defensepower)) { $errors++; $errorlist .= "Defense Power must be a number.<br />"; }
if (!is_numeric($weaponid)) { $errors++; $errorlist .= "Weapon ID must be a number.<br />"; }
if (!is_numeric($armorid)) { $errors++; $errorlist .= "Armor ID must be a number.<br />"; }
if (!is_numeric($shieldid)) { $errors++; $errorlist .= "Shield ID must be a number.<br />"; }
if (!is_numeric($slot1id)) { $errors++; $errorlist .= "Slot 1 ID must be a number.<br />"; }
if (!is_numeric($slot2id)) { $errors++; $errorlist .= "Slot 2 ID must be a number.<br />"; }
if (!is_numeric($slot3id)) { $errors++; $errorlist .= "Slot 3 ID must be a number.<br />"; }
if (!is_numeric($dropcode)) { $errors++; $errorlist .= "Drop Code must be a number.<br />"; }
if ($errors == 0) {
$updatequery = <<<END
UPDATE {{table}} SET
email='$email', verify='$verify', charname='$charname', authlevel='$authlevel', latitude='$latitude',
longitude='$longitude', difficulty='$difficulty', charclass='$charclass', currentaction='$currentaction', currentfight='$currentfight',
currentmonster='$currentmonster', currentmonsterhp='$currentmonsterhp', currentmonstersleep='$currentmonstersleep', currentmonsterimmune='$currentmonsterimmune', currentuberdamage='$currentuberdamage',
currentuberdefense='$currentuberdefense', currenthp='$currenthp', currentmp='$currentmp', currenttp='$currenttp', maxhp='$maxhp',
maxmp='$maxmp', maxtp='$maxtp', level='$level', gold='$gold', experience='$experience',
goldbonus='$goldbonus', expbonus='$expbonus', strength='$strength', dexterity='$dexterity', attackpower='$attackpower',
defensepower='$defensepower', weaponid='$weaponid', armorid='$armorid', shieldid='$shieldid', slot1id='$slot1id',
slot2id='$slot2id', slot3id='$slot3id', weaponname='$weaponname', armorname='$armorname', shieldname='$shieldname',
slot1name='$slot1name', slot2name='$slot2name', slot3name='$slot3name', dropcode='$dropcode', spells='$spells',
towns='$towns' WHERE id='$id' LIMIT 1
END;
$query = doquery($updatequery, "users");
display("User updated.","Edit Users");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Users");
}
}
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "users");
$row = mysql_fetch_array($query);
global $controlrow;
$diff1name = $controlrow["diff1name"];
$diff2name = $controlrow["diff2name"];
$diff3name = $controlrow["diff3name"];
$class1name = $controlrow["class1name"];
$class2name = $controlrow["class2name"];
$class3name = $controlrow["class3name"];
$page = <<<END
<b><u>Edit Users</u></b><br /><br />
<form action="admin.php?do=edituser:$id" method="post">
<table width="90%">
<tr><td width="20%">ID:</td><td>{{id}}</td></tr>
<tr><td width="20%">Username:</td><td>{{username}}</td></tr>
<tr><td width="20%">Email:</td><td><input type="text" name="email" size="30" maxlength="100" value="{{email}}" /></td></tr>
<tr><td width="20%">Verify:</td><td><input type="text" name="verify" size="30" maxlength="8" value="{{verify}}" /></td></tr>
<tr><td width="20%">Character Name:</td><td><input type="text" name="charname" size="30" maxlength="30" value="{{charname}}" /></td></tr>
<tr><td width="20%">Register Date:</td><td>{{regdate}}</td></tr>
<tr><td width="20%">Last Online:</td><td>{{onlinetime}}</td></tr>
<tr><td width="20%">Auth Level:</td><td><select name="authlevel"><option value="0" {{auth0select}}>User</option><option value="1" {{auth1select}}>Admin</option></select></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">Latitude:</td><td><input type="text" name="latitude" size="5" maxlength="6" value="{{latitude}}" /></td></tr>
<tr><td width="20%">Longitude:</td><td><input type="text" name="longitude" size="5" maxlength="6" value="{{longitude}}" /></td></tr>
<tr><td width="20%">Difficulty:</td><td><select name="difficulty"><option value="1" {{diff1select}}>$diff1name</option><option value="2" {{diff2select}}>$diff2name</option><option value="3" {{diff3select}}>$diff3name</option></select></td></tr>
<tr><td width="20%">Character Class:</td><td><select name="charclass"><option value="1" {{class1select}}>$class1name</option><option value="2" {{class2select}}>$class2name</option><option value="3" {{class3select}}>$class3name</option></select></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">Current Action:</td><td><input type="text" name="currentaction" size="30" maxlength="30" value="{{currentaction}}" /></td></tr>
<tr><td width="20%">Current Fight:</td><td><input type="text" name="currentfight" size="5" maxlength="4" value="{{currentfight}}" /></td></tr>
<tr><td width="20%">Current Monster:</td><td><input type="text" name="currentmonster" size="5" maxlength="6" value="{{currentmonster}}" /></td></tr>
<tr><td width="20%">Current Monster HP:</td><td><input type="text" name="currentmonsterhp" size="5" maxlength="6" value="{{currentmonsterhp}}" /></td></tr>
<tr><td width="20%">Current Monster Sleep:</td><td><input type="text" name="currentmonsterimmune" size="5" maxlength="3" value="{{currentmonsterimmune}}" /></td></tr>
<tr><td width="20%">Current Monster Immune:</td><td><input type="text" name="currentmonstersleep" size="5" maxlength="3" value="{{currentmonstersleep}}" /></td></tr>
<tr><td width="20%">Current Uber Damage:</td><td><input type="text" name="currentuberdamage" size="5" maxlength="3" value="{{currentuberdamage}}" /></td></tr>
<tr><td width="20%">Current Uber Defense:</td><td><input type="text" name="currentuberdefense" size="5" maxlength="3" value="{{currentuberdefense}}" /></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">Current HP:</td><td><input type="text" name="currenthp" size="5" maxlength="6" value="{{currenthp}}" /></td></tr>
<tr><td width="20%">Current MP:</td><td><input type="text" name="currentmp" size="5" maxlength="6" value="{{currentmp}}" /></td></tr>
<tr><td width="20%">Current TP:</td><td><input type="text" name="currenttp" size="5" maxlength="6" value="{{currenttp}}" /></td></tr>
<tr><td width="20%">Max HP:</td><td><input type="text" name="maxhp" size="5" maxlength="6" value="{{maxhp}}" /></td></tr>
<tr><td width="20%">Max MP:</td><td><input type="text" name="maxmp" size="5" maxlength="6" value="{{maxmp}}" /></td></tr>
<tr><td width="20%">Max TP:</td><td><input type="text" name="maxtp" size="5" maxlength="6" value="{{maxtp}}" /></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">Level:</td><td><input type="text" name="level" size="5" maxlength="5" value="{{level}}" /></td></tr>
<tr><td width="20%">Gold:</td><td><input type="text" name="gold" size="10" maxlength="8" value="{{gold}}" /></td></tr>
<tr><td width="20%">Experience:</td><td><input type="text" name="experience" size="10" maxlength="8" value="{{experience}}" /></td></tr>
<tr><td width="20%">Gold Bonus:</td><td><input type="text" name="goldbonus" size="5" maxlength="5" value="{{goldbonus}}" /></td></tr>
<tr><td width="20%">Experience Bonus:</td><td><input type="text" name="expbonus" size="5" maxlength="5" value="{{expbonus}}" /></td></tr>
<tr><td width="20%">Strength:</td><td><input type="text" name="strength" size="5" maxlength="5" value="{{strength}}" /></td></tr>
<tr><td width="20%">Dexterity:</td><td><input type="text" name="dexterity" size="5" maxlength="5" value="{{dexterity}}" /></td></tr>
<tr><td width="20%">Attack Power:</td><td><input type="text" name="attackpower" size="5" maxlength="5" value="{{attackpower}}" /></td></tr>
<tr><td width="20%">Defense Power:</td><td><input type="text" name="defensepower" size="5" maxlength="5" value="{{defensepower}}" /></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">Weapon ID:</td><td><input type="text" name="weaponid" size="5" maxlength="5" value="{{weaponid}}" /></td></tr>
<tr><td width="20%">Armor ID:</td><td><input type="text" name="armorid" size="5" maxlength="5" value="{{armorid}}" /></td></tr>
<tr><td width="20%">Shield ID:</td><td><input type="text" name="shieldid" size="5" maxlength="5" value="{{shieldid}}" /></td></tr>
<tr><td width="20%">Slot 1 ID:</td><td><input type="text" name="slot1id" size="5" maxlength="5" value="{{slot1id}}" /></td></tr>
<tr><td width="20%">Slot 2 ID:</td><td><input type="text" name="slot2id" size="5" maxlength="5" value="{{slot2id}}" /></td></tr>
<tr><td width="20%">Slot 3 ID:</td><td><input type="text" name="slot3id" size="5" maxlength="5" value="{{slot3id}}" /></td></tr>
<tr><td width="20%">Weapon Name:</td><td><input type="text" name="weaponname" size="30" maxlength="30" value="{{weaponname}}" /></td></tr>
<tr><td width="20%">Armor Name:</td><td><input type="text" name="armorname" size="30" maxlength="30" value="{{armorname}}" /></td></tr>
<tr><td width="20%">Shield Name:</td><td><input type="text" name="shieldname" size="30" maxlength="30" value="{{shieldname}}" /></td></tr>
<tr><td width="20%">Slot 1 Name:</td><td><input type="text" name="slot1name" size="30" maxlength="30" value="{{slot1name}}" /></td></tr>
<tr><td width="20%">Slot 2 Name:</td><td><input type="text" name="slot2name" size="30" maxlength="30" value="{{slot2name}}" /></td></tr>
<tr><td width="20%">Slot 3 Name:</td><td><input type="text" name="slot3name" size="30" maxlength="30" value="{{slot3name}}" /></td></tr>
<tr><td colspan="2" style="background-color:#cccccc;">&nbsp;</td></tr>
<tr><td width="20%">Drop Code:</td><td><input type="text" name="dropcode" size="5" maxlength="8" value="{{dropcode}}" /></td></tr>
<tr><td width="20%">Spells:</td><td><input type="text" name="spells" size="50" maxlength="50" value="{{spells}}" /></td></tr>
<tr><td width="20%">Towns:</td><td><input type="text" name="towns" size="50" maxlength="50" value="{{towns}}" /></td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
if ($row["authlevel"] == 0) { $row["auth0select"] = "selected=\"selected\" "; } else { $row["auth0select"] = ""; }
if ($row["authlevel"] == 1) { $row["auth1select"] = "selected=\"selected\" "; } else { $row["auth1select"] = ""; }
if ($row["charclass"] == 1) { $row["class1select"] = "selected=\"selected\" "; } else { $row["class1select"] = ""; }
if ($row["charclass"] == 2) { $row["class2select"] = "selected=\"selected\" "; } else { $row["class2select"] = ""; }
if ($row["charclass"] == 3) { $row["class3select"] = "selected=\"selected\" "; } else { $row["class3select"] = ""; }
if ($row["difficulty"] == 1) { $row["diff1select"] = "selected=\"selected\" "; } else { $row["diff1select"] = ""; }
if ($row["difficulty"] == 2) { $row["diff2select"] = "selected=\"selected\" "; } else { $row["diff2select"] = ""; }
if ($row["difficulty"] == 3) { $row["diff3select"] = "selected=\"selected\" "; } else { $row["diff3select"] = ""; }
$page = parsetemplate($page, $row);
display($page, "Edit Users");
}
function addnews() {
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0;
$errorlist = "";
if ($content == "") { $errors++; $errorlist .= "Content is required.<br />"; }
if ($errors == 0) {
$query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),content='$content'", "news");
display("News post added.","Add News");
} else {
display("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Add News");
}
}
$page = <<<END
<b><u>Add A News Post</u></b><br /><br />
<form action="admin.php?do=news" method="post">
Type your post below and then click Submit to add it.<br />
<textarea name="content" rows="5" cols="50"></textarea><br />
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
display($page, "Add News");
}
?>

589
admin/install.php Normal file
View File

@ -0,0 +1,589 @@
<?php
//include('../config.php');
$link = opendb();
function install() {
global $dbsettings;
$prefix = $dbsettings["prefix"];
$query1 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query1) or die(mysql_error());
echo "Created Babblebox table.<br />";
mysql_query("INSERT INTO '$prefix_babble' VALUES (1, '12:00:00', 'Test', 'First babble.')") or die(mysql_error());
echo "Populated Babblebox table.<br />";
$query2 = <<<END
CREATE TABLE '$prefix_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',
'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 NOT NULL default '0',
'diff2name' varchar(50) NOT NULL default '',
'diff2mod' float NOT NULL default '0',
'diff3name' varchar(50) NOT NULL default '',
'diff3mod' float NOT NULL default '0',
'compression' tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY ('id')
) TYPE=MyISAM ;
END;
mysql_query($query2) or die(mysql_error());
echo "Created Settings table.<br />";
mysql_query("INSERT INTO '$prefix_control' VALUES (1, 'Dragon Knight', 250, 1, 0, 'http://forums.address.here/', 'Mage', 'Warrior', 'Paladin', 'Easy', 1.0, 'Medium', 1.2, 'Hard', 1.5, 0)") or die(mysql_error());
echo "Populated Settings table.<br />";
$query3 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query3) or die(mysql_error());
echo "Created Drops table.<br />";
mysql_query("INSERT INTO '$prefix_drops' VALUES (1, 'Life Pebble', 1, 1, 'maxhp,10', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (2, 'Life Stone', 10, 1, 'maxhp,25', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (3, 'Life Rock', 25, 1, 'maxhp,50', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (4, 'Magic Pebble', 1, 1, 'maxmp,10', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (5, 'Magic Stone', 10, 1, 'maxmp,25', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (6, 'Magic Rock', 25, 1, 'maxmp,50', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (7, 'Dragon\'s Scale', 10, 1, 'defensepower,25', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (8, 'Dragon\'s Plate', 30, 1, 'defensepower,50', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (9, 'Dragon\'s Claw', 10, 1, 'attackpower,25', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (10, 'Dragon\'s Tooth', 30, 1, 'attackpower,50', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (11, 'Dragon\'s Tear', 35, 1, 'strength,50', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (12, 'Dragon\'s Wing', 35, 1, 'dexterity,50', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (13, 'Demon\'s Sin', 35, 1, 'maxhp,-50', 'strength,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (14, 'Demon\'s Fall', 35, 1, 'maxmp,-50', 'strength,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (15, 'Demon\'s Lie', 45, 1, 'maxhp,-100', 'strength,100')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (16, 'Demon\'s Hate', 45, 1, 'maxmp,-100', 'strength,100')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (17, 'Angel\'s Joy', 25, 1, 'maxhp,25', 'strength,25')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (18, 'Angel\'s Rise', 30, 1, 'maxhp,50', 'strength,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (19, 'Angel\'s Truth', 35, 1, 'maxhp,75', 'strength,75')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (20, 'Angel\'s Love', 40, 1, 'maxhp,100', 'strength,100')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (21, 'Seraph\'s Joy', 25, 1, 'maxmp,25', 'dexterity,25')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (22, 'Seraph\'s Rise', 30, 1, 'maxmp,50', 'dexterity,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (23, 'Seraph\'s Truth', 35, 1, 'maxmp,75', 'dexterity,75')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (24, 'Seraph\'s Love', 40, 1, 'maxmp,100', 'dexterity,100')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (25, 'Ruby', 50, 1, 'maxhp,150', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (26, 'Pearl', 50, 1, 'maxmp,150', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (27, 'Emerald', 50, 1, 'strength,150', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (28, 'Topaz', 50, 1, 'dexterity,150', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (29, 'Obsidian', 50, 1, 'attackpower,150', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (30, 'Diamond', 50, 1, 'defensepower,150', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (31, 'Memory Drop', 5, 1, 'expbonus,10', 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_drops' VALUES (32, 'Fortune Drop', 5, 1, 'goldbonus,10', 'X')") or die(mysql_error());
echo "Populated Drops table.<br />";
$query4 = <<<END
CREATE TABLE '$prefix_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;
echo "Created Items table.<br />";
mysql_query("INSERT INTO '$prefix_items' VALUES (1, 1, 'Stick', 10, 2, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (2, 1, 'Branch', 30, 4, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (3, 1, 'Club', 40, 5, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (4, 1, 'Dagger', 90, 8, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (5, 1, 'Hatchet', 150, 12, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (6, 1, 'Axe', 200, 16, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (7, 1, 'Brand', 300, 25, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (8, 1, 'Poleaxe', 500, 35, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (9, 1, 'Broadsword', 800, 45, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (10, 1, 'Battle Axe', 1200, 50, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (11, 1, 'Claymore', 2000, 60, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (12, 1, 'Dark Axe', 3000, 100, 'expbonus,-5')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (13, 1, 'Dark Sword', 4500, 125, 'expbonus,-10')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (14, 1, 'Bright Sword', 6000, 100, 'expbonus,10')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (15, 1, 'Magic Sword', 10000, 150, 'maxmp,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (16, 1, 'Destiny Blade', 50000, 250, 'strength,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (17, 2, 'Skivvies', 25, 2, 'goldbonus,10')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (18, 2, 'Clothes', 50, 5, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (19, 2, 'Leather Armor', 75, 10, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (20, 2, 'Hard Leather Armor', 150, 25, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (21, 2, 'Chain Mail', 300, 30, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (22, 2, 'Bronze Plate', 900, 50, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (23, 2, 'Iron Plate', 2000, 100, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (24, 2, 'Magic Armor', 4000, 125, 'maxmp,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (25, 2, 'Dark Armor', 5000, 150, 'expbonus,-10')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (26, 2, 'Bright Armor', 10000, 175, 'expbonus,10')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (27, 2, 'Destiny Raiment', 50000, 200, 'dexterity,50')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (28, 3, 'Reed Shield', 50, 2, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (29, 3, 'Buckler', 100, 4, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (30, 3, 'Small Shield', 500, 10, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (31, 3, 'Large Shield', 2500, 30, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (32, 3, 'Silver Shield', 10000, 60, 'X')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_items' VALUES (33, 3, 'Destiny Aegis', 25000, 100, 'maxhp,50')") or die(mysql_error());
echo "Populated Items table.<br />";
$query5 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query5) or die(mysql_error());
echo "Created Levels table.<br />";
mysql_query("INSERT INTO '$prefix_levels' VALUES (1, 0, 15, 0, 5, 5, 5, 0, 0, 15, 0, 5, 5, 5, 0, 0, 15, 0, 5, 5, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (2, 15, 2, 5, 1, 0, 1, 1, 18, 2, 4, 1, 2, 1, 1, 20, 2, 5, 1, 0, 2, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (3, 45, 3, 4, 2, 1, 2, 0, 54, 2, 3, 2, 3, 2, 0, 60, 2, 3, 2, 1, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (4, 105, 3, 3, 2, 1, 2, 6, 126, 2, 3, 2, 3, 2, 0, 140, 2, 4, 2, 1, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (5, 195, 2, 5, 2, 0, 1, 0, 234, 2, 4, 2, 2, 1, 6, 260, 2, 4, 2, 0, 2, 6)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (6, 330, 4, 5, 2, 2, 3, 0, 396, 3, 4, 2, 4, 3, 0, 440, 3, 5, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (7, 532, 3, 4, 2, 1, 2, 11, 639, 2, 3, 2, 3, 2, 0, 710, 2, 3, 2, 1, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (8, 835, 2, 4, 2, 0, 1, 0, 1003, 2, 3, 2, 2, 1, 11, 1115, 2, 4, 2, 0, 2, 11)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (9, 1290, 5, 3, 2, 3, 4, 2, 1549, 4, 2, 2, 5, 4, 0, 1722, 4, 2, 2, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (10, 1973, 10, 3, 2, 4, 3, 0, 2369, 10, 2, 2, 6, 3, 0, 2633, 10, 3, 2, 4, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (11, 2997, 5, 2, 2, 3, 4, 0, 3598, 4, 1, 2, 5, 4, 2, 3999, 4, 1, 2, 3, 5, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (12, 4533, 4, 2, 2, 2, 3, 7, 5441, 4, 1, 2, 4, 3, 0, 6047, 4, 2, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (13, 6453, 4, 3, 2, 2, 3, 0, 7745, 4, 2, 2, 4, 3, 0, 8607, 4, 2, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (14, 8853, 5, 4, 2, 3, 4, 17, 10625, 4, 3, 2, 5, 4, 7, 11807, 4, 4, 2, 3, 5, 7)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (15, 11853, 5, 5, 2, 3, 4, 0, 14225, 4, 4, 2, 5, 4, 0, 15808, 4, 4, 2, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (16, 15603, 5, 3, 2, 3, 4, 0, 18725, 5, 2, 2, 5, 4, 0, 20807, 5, 3, 2, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (17, 20290, 4, 2, 2, 2, 3, 12, 24350, 4, 1, 2, 4, 3, 0, 27057, 4, 1, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (18, 25563, 4, 2, 2, 2, 3, 0, 30678, 3, 1, 2, 4, 3, 14, 34869, 3, 2, 2, 2, 4, 17)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (19, 31495, 4, 5, 2, 2, 3, 0, 37797, 3, 4, 2, 4, 3, 0, 43657, 3, 4, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (20, 38169, 10, 6, 2, 3, 3, 0, 45805, 10, 5, 2, 5, 3, 0, 53543, 10, 6, 2, 3, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (21, 45676, 4, 4, 2, 2, 3, 0, 54814, 4, 3, 2, 4, 3, 0, 64664, 4, 3, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (22, 54121, 5, 5, 2, 3, 4, 0, 64949, 4, 4, 2, 5, 4, 12, 77175, 4, 5, 2, 3, 5, 12)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (23, 63622, 5, 3, 2, 3, 4, 0, 76350, 4, 2, 2, 5, 4, 0, 91250, 4, 2, 2, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (24, 74310, 5, 5, 2, 3, 4, 0, 89176, 4, 4, 2, 5, 4, 0, 107083, 4, 5, 2, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (25, 86334, 4, 4, 2, 2, 3, 3, 103605, 3, 3, 2, 4, 3, 17, 124895, 3, 3, 2, 2, 4, 14)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (26, 99861, 6, 3, 2, 4, 5, 0, 119837, 5, 2, 2, 6, 5, 0, 144933, 5, 3, 2, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (27, 115078, 6, 2, 2, 4, 5, 0, 138098, 5, 1, 2, 6, 5, 0, 167475, 5, 1, 2, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (28, 132197, 4, 2, 2, 2, 3, 0, 158641, 4, 1, 2, 4, 3, 0, 192835, 4, 2, 2, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (29, 151456, 6, 3, 2, 4, 5, 0, 181751, 5, 2, 2, 6, 5, 3, 221365, 5, 2, 2, 4, 6, 3)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (30, 173121, 10, 4, 3, 4, 4, 0, 207749, 10, 3, 3, 6, 4, 0, 253461, 10, 4, 3, 4, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (31, 197494, 5, 5, 3, 3, 4, 8, 236996, 4, 3, 3, 5, 4, 0, 289568, 4, 3, 3, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (32, 224913, 6, 4, 3, 4, 5, 0, 269898, 5, 3, 3, 6, 5, 0, 330188, 5, 4, 3, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (33, 255758, 5, 4, 3, 3, 4, 0, 306912, 5, 3, 3, 5, 4, 0, 375885, 5, 3, 3, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (34, 290458, 6, 4, 3, 4, 5, 0, 348552, 5, 3, 3, 6, 5, 8, 427294, 5, 4, 3, 4, 6, 8)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (35, 329495, 5, 3, 3, 3, 4, 0, 395397, 4, 2, 3, 5, 4, 0, 485126, 4, 2, 3, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (36, 373412, 4, 3, 3, 2, 3, 18, 448097, 5, 2, 3, 4, 3, 0, 550188, 5, 3, 3, 2, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (37, 422818, 5, 4, 3, 3, 4, 0, 507384, 5, 3, 3, 5, 4, 0, 623383, 5, 3, 3, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (38, 478399, 6, 5, 3, 4, 5, 0, 574081, 5, 4, 3, 6, 5, 15, 705726, 5, 5, 3, 4, 6, 18)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (39, 540927, 6, 4, 3, 4, 5, 0, 649115, 5, 3, 3, 6, 5, 0, 798362, 5, 3, 3, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (40, 611271, 15, 3, 3, 5, 5, 13, 733528, 15, 2, 3, 7, 5, 0, 902577, 15, 3, 3, 5, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (41, 690408, 7, 3, 3, 5, 2, 0, 828492, 6, 2, 3, 7, 2, 0, 1019818, 6, 2, 3, 5, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (42, 779437, 7, 4, 3, 5, 6, 0, 935326, 6, 3, 3, 7, 6, 0, 1151714, 6, 4, 3, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (43, 879592, 8, 5, 3, 6, 7, 0, 1055514, 7, 4, 3, 8, 7, 0, 1300096, 7, 4, 3, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (44, 992268, 6, 3, 3, 4, 5, 0, 1190725, 5, 2, 3, 6, 5, 0, 1448478, 5, 3, 3, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (45, 1119028, 5, 8, 3, 3, 4, 4, 1325936, 5, 8, 3, 5, 4, 18, 1596860, 5, 8, 3, 3, 5, 4)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (46, 1245788, 6, 5, 3, 4, 5, 0, 1461147, 5, 4, 3, 6, 5, 0, 1745242, 5, 5, 3, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (47, 1372548, 7, 4, 3, 5, 6, 0, 1596358, 6, 3, 3, 7, 6, 0, 1893624, 6, 3, 3, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (48, 1499308, 6, 4, 3, 4, 5, 0, 1731569, 5, 3, 3, 6, 5, 0, 2042006, 5, 4, 3, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (49, 1626068, 5, 3, 3, 3, 4, 0, 1866780, 4, 2, 3, 5, 4, 0, 2190388, 4, 2, 3, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (50, 1752828, 15, 3, 3, 5, 5, 0, 2001991, 15, 2, 3, 7, 5, 0, 2338770, 15, 3, 3, 5, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (51, 1879588, 6, 2, 3, 4, 5, 9, 2137202, 5, 1, 3, 6, 5, 13, 2487152, 5, 1, 3, 4, 6, 13)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (52, 2006348, 7, 2, 3, 5, 6, 0, 2272413, 6, 1, 3, 7, 6, 0, 2635534, 6, 2, 3, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (53, 2133108, 8, 2, 3, 6, 7, 0, 2407624, 7, 1, 3, 8, 7, 0, 2783916, 7, 1, 3, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (54, 2259868, 8, 4, 3, 6, 7, 0, 2542835, 7, 3, 3, 8, 7, 0, 2932298, 7, 4, 3, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (55, 2386628, 7, 4, 3, 5, 6, 0, 2678046, 6, 3, 3, 7, 6, 0, 3080680, 6, 3, 3, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (56, 2513388, 7, 4, 3, 5, 6, 0, 2813257, 6, 3, 3, 7, 6, 0, 3229062, 6, 4, 3, 5, 7, 9)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (57, 2640148, 6, 5, 3, 4, 5, 0, 2948468, 6, 4, 3, 6, 5, 0, 3377444, 6, 4, 3, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (58, 2766908, 5, 5, 3, 3, 4, 0, 3083679, 5, 4, 3, 5, 4, 19, 3525826, 5, 5, 3, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (59, 2893668, 8, 3, 3, 6, 7, 0, 3218890, 7, 2, 3, 8, 7, 0, 3674208, 7, 2, 3, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (60, 3020428, 15, 4, 4, 6, 6, 19, 3354101, 15, 3, 4, 8, 6, 0, 3822590, 15, 4, 4, 6, 7, 15)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (61, 3147188, 8, 5, 4, 6, 7, 0, 3489312, 7, 4, 4, 8, 7, 0, 3970972, 7, 4, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (62, 3273948, 8, 4, 4, 6, 7, 0, 3624523, 7, 3, 4, 8, 7, 0, 4119354, 7, 4, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (63, 3400708, 9, 5, 4, 7, 8, 0, 3759734, 8, 4, 4, 9, 8, 0, 4267736, 8, 4, 4, 7, 9, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (64, 3527468, 5, 5, 4, 3, 4, 0, 3894945, 5, 4, 4, 5, 4, 0, 4416118, 5, 5, 4, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (65, 3654228, 6, 4, 4, 4, 5, 0, 4030156, 6, 3, 4, 6, 5, 0, 4564500, 6, 3, 4, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (66, 3780988, 8, 4, 4, 6, 7, 0, 4165367, 8, 3, 4, 8, 7, 0, 4712882, 8, 4, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (67, 3907748, 7, 3, 4, 5, 6, 0, 4300578, 7, 2, 4, 7, 6, 0, 4861264, 7, 2, 4, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (68, 4034508, 9, 3, 4, 7, 8, 0, 4435789, 8, 2, 4, 9, 8, 0, 5009646, 8, 3, 4, 7, 9, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (69, 4161268, 5, 4, 4, 3, 4, 0, 4571000, 5, 3, 4, 5, 4, 0, 5158028, 5, 3, 4, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (70, 4288028, 20, 4, 4, 6, 6, 5, 4706211, 20, 3, 4, 8, 6, 16, 5306410, 20, 4, 4, 6, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (71, 4414788, 5, 5, 4, 3, 4, 0, 4841422, 5, 4, 4, 5, 4, 0, 5454792, 5, 4, 4, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (72, 4541548, 6, 2, 4, 4, 5, 0, 4976633, 5, 1, 4, 6, 5, 0, 5603174, 5, 2, 4, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (73, 4668308, 8, 4, 4, 6, 7, 0, 5111844, 8, 3, 4, 8, 7, 0, 5751556, 8, 3, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (74, 4795068, 7, 5, 4, 5, 6, 0, 5247055, 6, 4, 4, 7, 6, 0, 5899938, 6, 5, 4, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (75, 4921828, 5, 3, 4, 3, 4, 0, 5382266, 5, 2, 4, 5, 4, 0, 6048320, 5, 2, 4, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (76, 5048588, 6, 3, 4, 4, 5, 0, 5517477, 6, 2, 4, 6, 5, 0, 6196702, 6, 3, 4, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (77, 5175348, 6, 4, 4, 4, 5, 0, 5652688, 7, 3, 4, 6, 5, 0, 6345084, 7, 3, 4, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (78, 5302108, 7, 4, 4, 5, 6, 0, 5787899, 7, 3, 4, 7, 6, 0, 6493466, 7, 4, 4, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (79, 5428868, 8, 4, 4, 6, 7, 10, 5923110, 7, 3, 4, 8, 7, 0, 6641848, 7, 3, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (80, 5555628, 20, 5, 4, 6, 7, 0, 6058321, 20, 4, 4, 8, 7, 0, 6790230, 20, 5, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (81, 5682388, 7, 3, 4, 5, 6, 0, 6193532, 7, 2, 4, 7, 6, 0, 6938612, 7, 2, 4, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (82, 5809148, 6, 4, 4, 4, 5, 0, 6328743, 5, 3, 4, 6, 5, 0, 7086994, 5, 4, 4, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (83, 5935908, 6, 2, 4, 4, 5, 0, 6463954, 6, 1, 4, 6, 5, 0, 7235376, 6, 1, 4, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (84, 6062668, 5, 4, 4, 3, 4, 0, 6599165, 5, 3, 4, 5, 4, 0, 7383758, 5, 4, 4, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (85, 6189428, 7, 4, 4, 5, 6, 0, 6734376, 6, 3, 4, 7, 6, 0, 7532140, 6, 3, 4, 5, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (86, 6316188, 8, 5, 4, 6, 7, 0, 6869587, 8, 4, 4, 8, 7, 0, 7680522, 8, 5, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (87, 6442948, 8, 4, 4, 6, 7, 0, 7004798, 7, 3, 4, 8, 7, 0, 7828904, 7, 3, 4, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (88, 6569708, 9, 5, 4, 7, 8, 0, 7140009, 8, 4, 4, 9, 8, 0, 7977286, 8, 5, 4, 7, 9, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (89, 6696468, 5, 2, 4, 3, 4, 0, 7275220, 5, 1, 4, 5, 4, 0, 8125668, 5, 1, 4, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (90, 6823228, 20, 2, 5, 7, 8, 0, 7410431, 20, 1, 5, 9, 8, 0, 8274050, 20, 2, 5, 7, 9, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (91, 6949988, 5, 3, 5, 3, 4, 0, 7545642, 5, 2, 5, 5, 4, 0, 8422432, 5, 2, 5, 3, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (92, 7076748, 6, 3, 5, 4, 5, 0, 7680853, 4, 2, 5, 6, 5, 0, 8570814, 4, 3, 5, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (93, 7203508, 8, 4, 5, 6, 7, 0, 7816064, 6, 2, 5, 8, 7, 0, 8719196, 6, 2, 5, 6, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (94, 7330268, 4, 4, 5, 3, 3, 0, 7951275, 4, 3, 5, 5, 3, 0, 8867578, 4, 4, 5, 3, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (95, 7457028, 3, 3, 5, 5, 2, 0, 8086486, 4, 2, 5, 7, 2, 0, 9015960, 4, 2, 5, 5, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (96, 7583788, 5, 3, 5, 4, 3, 0, 8221697, 5, 2, 5, 7, 3, 0, 9164342, 5, 3, 5, 4, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (97, 7710548, 5, 4, 5, 4, 5, 0, 8356908, 5, 3, 5, 7, 5, 0, 9312724, 5, 3, 5, 4, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (98, 7837308, 4, 5, 5, 4, 3, 0, 8492119, 4, 3, 5, 7, 3, 0, 9461106, 4, 4, 5, 4, 4, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (99, 7964068, 50, 5, 5, 6, 5, 0, 8627330, 50, 3, 5, 9, 5, 0, 9609488, 50, 4, 5, 6, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_levels' VALUES (100, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0, 16777215, 0, 0, 0, 0, 0, 0)") or die(mysql_error());
echo "Populated Levels table.<br />";
$query6 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query6) or die(mysql_error());
echo "Created Monsters table.<br />";
mysql_query("INSERT INTO '$prefix_monsters' VALUES (1, 'Blue Slime', 4, 3, 1, 1, 1, 1, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (2, 'Red Slime', 6, 5, 1, 1, 2, 1, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (3, 'Critter', 6, 5, 2, 1, 4, 2, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (4, 'Creature', 10, 8, 2, 2, 4, 2, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (5, 'Shadow', 10, 9, 3, 2, 6, 2, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (6, 'Drake', 11, 10, 3, 2, 8, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (7, 'Shade', 12, 10, 3, 3, 10, 3, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (8, 'Drakelor', 14, 12, 4, 3, 10, 3, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (9, 'Silver Slime', 15, 100, 200, 30, 15, 1000, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (10, 'Scamp', 16, 13, 5, 4, 15, 5, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (11, 'Raven', 16, 13, 5, 4, 18, 6, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (12, 'Scorpion', 18, 14, 6, 5, 20, 7, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (13, 'Illusion', 20, 15, 6, 5, 20, 7, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (14, 'Nightshade', 22, 16, 6, 6, 24, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (15, 'Drakemal', 22, 18, 7, 6, 24, 8, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (16, 'Shadow Raven', 24, 18, 7, 6, 26, 9, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (17, 'Ghost', 24, 20, 8, 6, 28, 9, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (18, 'Frost Raven', 26, 20, 8, 7, 30, 10, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (19, 'Rogue Scorpion', 28, 22, 9, 7, 32, 11, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (20, 'Ghoul', 29, 24, 9, 7, 34, 11, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (21, 'Magician', 30, 24, 10, 8, 36, 12, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (22, 'Rogue', 30, 25, 12, 8, 40, 13, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (23, 'Drakefin', 32, 26, 12, 8, 40, 13, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (24, 'Shimmer', 32, 26, 14, 8, 45, 15, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (25, 'Fire Raven', 34, 28, 14, 9, 45, 15, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (26, 'Dybbuk', 34, 28, 14, 9, 50, 17, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (27, 'Knave', 36, 30, 15, 9, 52, 17, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (28, 'Goblin', 36, 30, 15, 10, 54, 18, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (29, 'Skeleton', 38, 30, 18, 10, 58, 19, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (30, 'Dark Slime', 38, 32, 18, 10, 62, 21, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (31, 'Silver Scorpion', 30, 160, 350, 40, 63, 2000, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (32, 'Mirage', 40, 32, 20, 11, 64, 21, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (33, 'Sorceror', 41, 33, 22, 11, 68, 23, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (34, 'Imp', 42, 34, 22, 12, 70, 23, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (35, 'Nymph', 43, 35, 22, 12, 70, 23, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (36, 'Scoundrel', 43, 35, 22, 12, 75, 25, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (37, 'Megaskeleton', 44, 36, 24, 13, 78, 26, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (38, 'Grey Wolf', 44, 36, 24, 13, 82, 27, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (39, 'Phantom', 46, 38, 24, 14, 85, 28, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (40, 'Specter', 46, 38, 24, 14, 90, 30, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (41, 'Dark Scorpion', 48, 40, 26, 15, 95, 32, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (42, 'Warlock', 48, 40, 26, 15, 100, 33, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (43, 'Orc', 49, 42, 28, 15, 104, 35, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (44, 'Sylph', 49, 42, 28, 15, 106, 35, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (45, 'Wraith', 50, 45, 30, 16, 108, 36, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (46, 'Hellion', 50, 45, 30, 16, 110, 37, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (47, 'Bandit', 52, 45, 30, 16, 114, 38, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (48, 'Ultraskeleton', 52, 46, 32, 16, 116, 39, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (49, 'Dark Wolf', 54, 47, 36, 17, 120, 40, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (50, 'Troll', 56, 48, 36, 17, 120, 40, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (51, 'Werewolf', 56, 48, 38, 17, 124, 41, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (52, 'Hellcat', 58, 50, 38, 18, 128, 43, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (53, 'Spirit', 58, 50, 38, 18, 132, 44, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (54, 'Nisse', 60, 52, 40, 19, 132, 44, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (55, 'Dawk', 60, 54, 40, 19, 136, 45, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (56, 'Figment', 64, 55, 42, 19, 140, 47, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (57, 'Hellhound', 66, 56, 44, 20, 140, 47, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (58, 'Wizard', 66, 56, 44, 20, 144, 48, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (59, 'Uruk', 68, 58, 44, 20, 146, 49, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (60, 'Siren', 68, 400, 800, 50, 10000, 50, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (61, 'Megawraith', 70, 60, 46, 21, 155, 52, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (62, 'Dawkin', 70, 60, 46, 21, 155, 52, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (63, 'Grey Bear', 70, 62, 48, 21, 160, 53, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (64, 'Haunt', 72, 62, 48, 22, 160, 53, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (65, 'Hellbeast', 74, 64, 50, 22, 165, 55, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (66, 'Fear', 76, 66, 52, 23, 165, 55, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (67, 'Beast', 76, 66, 52, 23, 170, 57, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (68, 'Ogre', 78, 68, 54, 23, 170, 57, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (69, 'Dark Bear', 80, 70, 56, 24, 175, 58, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (70, 'Fire', 80, 72, 56, 24, 175, 58, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (71, 'Polgergeist', 84, 74, 58, 25, 180, 60, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (72, 'Fright', 86, 76, 58, 25, 180, 60, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (73, 'Lycan', 88, 78, 60, 25, 185, 62, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (74, 'Terra Elemental', 88, 80, 62, 25, 185, 62, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (75, 'Necromancer', 90, 80, 62, 26, 190, 63, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (76, 'Ultrawraith', 90, 82, 64, 26, 190, 63, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (77, 'Dawkor', 92, 82, 64, 26, 195, 65, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (78, 'Werebear', 92, 84, 65, 26, 195, 65, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (79, 'Brute', 94, 84, 65, 27, 200, 67, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (80, 'Large Beast', 96, 88, 66, 27, 200, 67, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (81, 'Horror', 96, 88, 68, 27, 210, 70, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (82, 'Flame', 100, 90, 70, 28, 210, 70, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (83, 'Lycanthor', 100, 90, 70, 28, 210, 70, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (84, 'Wyrm', 100, 92, 72, 28, 220, 73, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (85, 'Aero Elemental', 104, 94, 74, 29, 220, 73, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (86, 'Dawkare', 106, 96, 76, 29, 220, 73, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (87, 'Large Brute', 108, 98, 78, 29, 230, 77, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (88, 'Frost Wyrm', 110, 100, 80, 30, 230, 77, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (89, 'Knight', 110, 102, 80, 30, 240, 80, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (90, 'Lycanthra', 112, 104, 82, 30, 240, 80, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (91, 'Terror', 115, 108, 84, 31, 250, 83, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (92, 'Blaze', 118, 108, 84, 31, 250, 83, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (93, 'Aqua Elemental', 120, 110, 90, 31, 260, 87, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (94, 'Fire Wyrm', 120, 110, 90, 32, 260, 87, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (95, 'Lesser Wyvern', 122, 110, 92, 32, 270, 90, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (96, 'Doomer', 124, 112, 92, 32, 270, 90, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (97, 'Armor Knight', 130, 115, 95, 33, 280, 93, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (98, 'Wyvern', 134, 120, 95, 33, 290, 97, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (99, 'Nightmare', 138, 125, 100, 33, 300, 100, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (100, 'Fira Elemental', 140, 125, 100, 34, 310, 103, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (101, 'Megadoomer', 140, 128, 105, 34, 320, 107, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (102, 'Greater Wyvern', 145, 130, 105, 34, 335, 112, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (103, 'Advocate', 148, 132, 108, 35, 350, 117, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (104, 'Strong Knight', 150, 135, 110, 35, 365, 122, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (105, 'Liche', 150, 135, 110, 35, 380, 127, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (106, 'Ultradoomer', 155, 140, 115, 36, 395, 132, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (107, 'Fanatic', 160, 140, 115, 36, 410, 137, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (108, 'Green Dragon', 160, 140, 115, 36, 425, 142, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (109, 'Fiend', 160, 145, 120, 37, 445, 148, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (110, 'Greatest Wyvern', 162, 150, 120, 37, 465, 155, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (111, 'Lesser Devil', 164, 150, 120, 37, 485, 162, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (112, 'Liche Master', 168, 155, 125, 38, 505, 168, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (113, 'Zealot', 168, 155, 125, 38, 530, 177, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (114, 'Serafiend', 170, 155, 125, 38, 555, 185, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (115, 'Pale Knight', 175, 160, 130, 39, 580, 193, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (116, 'Blue Dragon', 180, 160, 130, 39, 605, 202, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (117, 'Obsessive', 180, 160, 135, 40, 630, 210, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (118, 'Devil', 184, 164, 135, 40, 666, 222, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (119, 'Liche Prince', 190, 168, 138, 40, 660, 220, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (120, 'Cherufiend', 195, 170, 140, 41, 690, 230, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (121, 'Red Dragon', 200, 180, 145, 41, 720, 240, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (122, 'Greater Devil', 200, 180, 145, 41, 750, 250, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (123, 'Renegade', 205, 185, 150, 42, 780, 260, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (124, 'Archfiend', 210, 190, 150, 42, 810, 270, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (125, 'Liche Lord', 210, 190, 155, 42, 850, 283, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (126, 'Greatest Devil', 215, 195, 160, 43, 890, 297, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (127, 'Dark Knight', 220, 200, 160, 43, 930, 310, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (128, 'Giant', 220, 200, 165, 43, 970, 323, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (129, 'Shadow Dragon', 225, 200, 170, 44, 1010, 337, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (130, 'Liche King', 225, 205, 170, 44, 1050, 350, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (131, 'Incubus', 230, 205, 175, 44, 1100, 367, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (132, 'Traitor', 230, 205, 175, 45, 1150, 383, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (133, 'Demon', 240, 210, 180, 45, 1200, 400, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (134, 'Dark Dragon', 245, 215, 180, 45, 1250, 417, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (135, 'Insurgent', 250, 220, 190, 46, 1300, 433, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (136, 'Leviathan', 255, 225, 190, 46, 1350, 450, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (137, 'Grey Daemon', 260, 230, 190, 46, 1400, 467, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (138, 'Succubus', 265, 240, 200, 47, 1460, 487, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (139, 'Demon Prince', 270, 240, 200, 47, 1520, 507, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (140, 'Black Dragon', 275, 250, 205, 47, 1580, 527, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (141, 'Nihilist', 280, 250, 205, 47, 1640, 547, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (142, 'Behemoth', 285, 260, 210, 48, 1700, 567, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (143, 'Demagogue', 290, 260, 210, 48, 1760, 587, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (144, 'Demon Lord', 300, 270, 220, 48, 1820, 607, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (145, 'Red Daemon', 310, 280, 230, 48, 1880, 627, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (146, 'Colossus', 320, 300, 240, 49, 1940, 647, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (147, 'Demon King', 330, 300, 250, 49, 2000, 667, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (148, 'Dark Daemon', 340, 320, 260, 49, 2200, 733, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (149, 'Titan', 360, 340, 270, 50, 2400, 800, 0)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (150, 'Black Daemon', 400, 400, 280, 50, 3000, 1000, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_monsters' VALUES (151, 'Lucifuge', 600, 600, 400, 50, 10000, 10000, 2)") or die(mysql_error());
echo "Populated Monsters table.<br />";
$query7 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query7) or die(mysql_error());
echo "Created News table.<br />";
mysql_query("INSERT INTO '$prefix_news' VALUES (1, '2003-12-18 12:00:00', 'Test news post.')") or die(mysql_query());
echo "Populated News table.<br />";
$query8 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query8) or die(mysql_error());
echo "Created Spells table.<br />";
mysql_query("INSERT INTO '$prefix_spells' VALUES (1, 'Heal', 5, 10, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (2, 'Revive', 10, 25, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (3, 'Life', 25, 50, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (4, 'Breath', 50, 100, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (5, 'Gaia', 75, 150, 1)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (6, 'Hurt', 5, 15, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (7, 'Pain', 12, 35, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (8, 'Maim', 25, 70, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (9, 'Rend', 40, 100, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (10, 'Chaos', 50, 130, 2)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (11, 'Sleep', 10, 5, 3)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (12, 'Dream', 30, 9, 3)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (13, 'Nightmare', 60, 13, 3)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (14, 'Craze', 10, 10, 4)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (15, 'Rage', 20, 25, 4)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (16, 'Fury', 30, 50, 4)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (17, 'Ward', 10, 10, 5)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (18, 'Fend', 20, 25, 5)") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_spells' VALUES (19, 'Barrier', 30, 50, 5)") or die(mysql_error());
echo "Populated Spells table.<br />";
$query9 = <<<END
CREATE TABLE '$prefix_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;
mysql_query($query9) or die(mysql_error());
echo "Created Towns table.<br />";
mysql_query("INSERT INTO '$prefix_towns' VALUES (1, 'Midworld', 0, 0, 5, 0, 0, '1,2,3,17,18,19,28,29')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (2, 'Roma', 30, 30, 10, 25, 5, '2,3,4,18,19,29')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (3, 'Bris', 70, -70, 25, 50, 15, '2,3,4,5,18,19,20,29.30')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (4, 'Kalle', -100, 100, 40, 100, 30, '5,6,8,10,12,21,22,23,29,30')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (5, 'Narcissa', -130, -130, 60, 500, 50, '4,7,9,11,13,21,22,23,29,30,31')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (6, 'Hambry', 170, 170, 90, 1000, 80, '10,11,12,13,14,23,24,30,31')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (7, 'Gilead', 200, -200, 100, 3000, 110, '12,13,14,15,24,25,26,32')") or die(mysql_error());
mysql_query("INSERT INTO '$prefix_towns' VALUES (8, 'Endworld', -250, -250, 125, 9000, 160, '16,27,33')") or die(mysql_error());
echo "Populated Towns table.<br />";
$query10 = <<<END
CREATE TABLE '$prefix_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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0',
'towns' varchar(50) NOT NULL default '0,1,0,0,0,0,0,0,0',
PRIMARY KEY ('id')
) TYPE=MyISAM ;
END;
mysql_query($query10) or die(mysql_error());
echo "Created Users table.<br />";
echo "INSTALL COMPLETE.";
}
?>

147
admin/lib.php Normal file
View File

@ -0,0 +1,147 @@
<?php // lib.php :: Common functions used throughout the program.
$starttime = getmicrotime();
$numqueries = 0;
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;
}
function gettemplate($templatename) { // SQL query for the template.
$filename = "../templates/" . $templatename . ".php";
include("$filename");
return $template;
}
function parsetemplate($template, $array) { // Replace template with proper content.
foreach($array as $a => $b) {
$template = str_replace("{{{$a}}}", $b, $template);
}
return $template;
}
function getmicrotime() { // Used for timing script operations.
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
function prettydate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
}
function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net!
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
}
function my_htmlspecialchars($text) { // Thanks to "etymxris at yahoo dot com" from php.net!
$ALLOWABLE_TAGS = array("b", "i", "u", "p", "blockquote", "ol", "ul", "li");
static $PATTERNS = array();
static $REPLACEMENTS = array();
if (count($PATTERNS) == 0) {
foreach ($ALLOWABLE_TAGS as $tag) {
$PATTERNS[] = "/&lt;$tag&gt;/i";
$PATTERNS[] = "/&lt;\/$tag&gt;/i";
$REPLACEMENTS[] = "<$tag>";
$REPLACEMENTS[] = "</$tag>";
}
}
$result = str_replace(array(">", "<", "\"", "'"),
array("&gt;", "&lt;", "&quot;", "&#039;"),
$text);
$result = preg_replace($PATTERNS, $REPLACEMENTS, $result);
return $result;
}
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;
}
function display($content, $title) { // Finalize page and output to browser.
include('../config.php');
global $numqueries, $userrow, $controlrow, $starttime;
if (!isset($controlrow)) {
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
}
$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(
"title"=>$title,
"content"=>$content,
"totaltime"=>round(getmicrotime() - $starttime, 4),
"numqueries"=>$numqueries,
"version"=>$version,
"build"=>$build);
$page = parsetemplate($template, $finalarray);
$page = $xml . $page;
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
echo $page;
die();
}
?>

16
config.php Normal file
View File

@ -0,0 +1,16 @@
<?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.
// These are used for display purposes only. Technically you could change them, but it's not going to
// do anything special. And I'd prefer if you didn't, just to keep things all nice and standardized.
$version = "1.0.0";
$build = "";
?>

37
explore.php Normal file
View File

@ -0,0 +1,37 @@
<?php // explore.php :: Handles all map exploring, chances to fight, etc.
function move() {
global $userrow, $controlrow;
if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
$latitude = $userrow["latitude"];
$longitude = $userrow["longitude"];
if (isset($_POST["north"])) { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
if (isset($_POST["south"])) { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
if (isset($_POST["east"])) { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
$townquery = doquery("SELECT id FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "towns");
if (mysql_num_rows($townquery) > 0) {
$townrow = mysql_fetch_array($townquery);
include('towns.php');
travelto($townrow["id"], false);
die();
}
$chancetofight = rand(1,5);
if ($chancetofight == 1) {
$action = "currentaction='Fighting', currentfight='1',";
} else {
$action = "currentaction='Exploring',";
}
$updatequery = doquery("UPDATE {{table}} SET $action latitude='$latitude', longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
header("Location: index.php");
}
?>

531
fight.php Normal file
View File

@ -0,0 +1,531 @@
<?php // fight.php :: Handles all fighting action.
function fight() { // One big long function that determines the outcome of the fight.
global $userrow, $controlrow;
$pagearray = array();
$playerisdead = 0;
$pagearray["magiclist"] = "";
$userspells = explode(",",$userrow["spells"]);
$spellquery = doquery("SELECT id,name FROM {{table}}", "spells");
while ($spellrow = mysql_fetch_array($spellquery)) {
if ($userspells[$spellrow["id"]] == 1) {
$pagearray["magiclist"] .= "<option value=\"".$spellrow["id"]."\">".$spellrow["name"]."</option>\n";
}
}
if ($pagearray["magiclist"] == "") { $pagearray["magiclist"] = "<option value=\"0\">None</option>\n"; }
$magiclist = $pagearray["magiclist"];
$chancetoswingfirst = 1;
// First, check to see if we need to pick a monster.
if ($userrow["currentfight"] == 1) {
if ($userrow["latitude"] < 0) { $userrow["latitude"] *= -1; } // Equalize negatives.
if ($userrow["longitude"] < 0) { $userrow["longitude"] *= -1; } // Ditto.
$maxlevel = floor(max($userrow["latitude"]+5, $userrow["longitude"]+5) / 5); // One mlevel per five spaces.
if ($maxlevel < 1) { $maxlevel = 1; }
$minlevel = $maxlevel - 2;
if ($minlevel < 1) { $minlevel = 1; }
// Pick a monster.
$monsterquery = doquery("SELECT * FROM {{table}} WHERE level>='$minlevel' AND level<='$maxlevel' ORDER BY RAND() LIMIT 1", "monsters");
$monsterrow = mysql_fetch_array($monsterquery);
$userrow["currentmonster"] = $monsterrow["id"];
$userrow["currentmonsterhp"] = rand((($monsterrow["maxhp"]/5)*4),$monsterrow["maxhp"]);
if ($userrow["difficulty"] == 2) { $userrow["currentmonsterhp"] = ceil($userrow["currentmonsterhp"] * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $userrow["currentmonsterhp"] = ceil($userrow["currentmonsterhp"] * $controlrow["diff3mod"]); }
$userrow["currentmonstersleep"] = 0;
$userrow["currentmonsterimmune"] = $monsterrow["immune"];
$chancetoswingfirst = rand(1,10) + ceil(sqrt($userrow["dexterity"]));
if ($chancetoswingfirst > (rand(1,7) + ceil(sqrt($monsterrow["maxdam"])))) { $chancetoswingfirst = 1; } else { $chancetoswingfirst = 0; }
unset($monsterquery);
unset($monsterrow);
}
// Next, get the monster statistics.
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
$monsterrow = mysql_fetch_array($monsterquery);
$pagearray["monstername"] = $monsterrow["name"];
// Do run stuff.
if (isset($_POST["run"])) {
$chancetorun = rand(4,10) + ceil(sqrt($userrow["dexterity"]));
if ($chancetorun > (rand(1,5) + ceil(sqrt($monsterrow["maxdam"])))) { $chancetorun = 1; } else { $chancetorun = 0; }
if ($chancetorun == 0) {
$pagearray["yourturn"] = "You tried to run away, but were blocked in front!<br /><br />";
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
$pagearray["monsterturn"] = "";
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
$chancetowake = rand(1,15);
if ($chancetowake > $userrow["currentmonstersleep"]) {
$userrow["currentmonstersleep"] = 0;
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
} else {
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
}
}
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
$tohit = ceil(rand($monsterrow["maxdam"],(($monsterrow["maxdam"]/6)*3)));
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
$toblock = ceil(rand($userrow["defensepower"],$userrow["defensepower"]*.75)/4);
$tododge = rand(1,150);
if ($tododge <= sqrt($userrow["dexterity"])) {
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
$persondamage = 0;
} else {
$persondamage = $tohit - $toblock;
if ($persondamage < 1) { $persondamage = 1; }
if ($userrow["currentuberdefense"] != 0) {
$persondamage -= ceil($persondamage * ($userrow["currentuberdefense"]/100));
}
if ($persondamage < 1) { $persondamage = 1; }
}
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
$userrow["currenthp"] -= $persondamage;
if ($userrow["currenthp"] <= 0) {
$newgold = ceil($userrow["gold"]/2);
$newhp = ceil($userrow["maxhp"]/4);
$updatequery = doquery("UPDATE {{table}} SET currenthp='$newhp',currentaction='In Town',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentfight='0',latitude='0',longitude='0',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$playerisdead = 1;
}
}
}
$updatequery = doquery("UPDATE {{table}} SET currentaction='Exploring' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
header("Location: index.php");
die();
// Do fight stuff.
} elseif (isset($_POST["fight"])) {
// Your turn.
$pagearray["yourturn"] = "";
$tohit = ceil(rand($userrow["attackpower"]*.75,$userrow["attackpower"])/3);
$toexcellent = rand(1,150);
if ($toexcellent <= sqrt($userrow["strength"])) { $tohit *= 2; $pagearray["yourturn"] .= "Excellent hit!<br />"; }
$toblock = ceil(rand($monsterrow["armor"]*.75,$monsterrow["armor"])/3);
$tododge = rand(1,200);
if ($tododge <= sqrt($monsterrow["armor"])) {
$tohit = 0; $pagearray["yourturn"] .= "The monster is dodging. No damage has been scored.<br />";
$monsterdamage = 0;
} else {
$monsterdamage = $tohit - $toblock;
if ($monsterdamage < 1) { $monsterdamage = 1; }
if ($userrow["currentuberdamage"] != 0) {
$monsterdamage += ceil($monsterdamage * ($userrow["currentuberdamage"]/100));
}
}
$pagearray["yourturn"] .= "You attack the monster for $monsterdamage damage.<br /><br />";
$userrow["currentmonsterhp"] -= $monsterdamage;
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
if ($userrow["currentmonsterhp"] <= 0) {
$updatequery = doquery("UPDATE {{table}} SET currentmonsterhp='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
header("Location: index.php?do=victory");
die();
}
// Monster's turn.
$pagearray["monsterturn"] = "";
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
$chancetowake = rand(1,15);
if ($chancetowake > $userrow["currentmonstersleep"]) {
$userrow["currentmonstersleep"] = 0;
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
} else {
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
}
}
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
$tohit = ceil(rand(($monsterrow["maxdam"]*.5),$monsterrow["maxdam"]));
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
$tododge = rand(1,150);
if ($tododge <= sqrt($userrow["dexterity"])) {
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
$persondamage = 0;
} else {
$persondamage = $tohit - $toblock;
if ($persondamage < 1) { $persondamage = 1; }
if ($userrow["currentuberdefense"] != 0) {
$persondamage -= ceil($persondamage * ($userrow["currentuberdefense"]/100));
}
if ($persondamage < 1) { $persondamage = 1; }
}
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
$userrow["currenthp"] -= $persondamage;
if ($userrow["currenthp"] <= 0) {
$newgold = ceil($userrow["gold"]/2);
$newhp = ceil($userrow["maxhp"]/4);
$updatequery = doquery("UPDATE {{table}} SET currenthp='$newhp',currentaction='In Town',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentfight='0',latitude='0',longitude='0',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$playerisdead = 1;
}
}
// Do spell stuff.
} elseif (isset($_POST["spell"])) {
// Your turn.
$pickedspell = $_POST["userspell"];
if ($pickedspell == 0) { display("You must select a spell first. Please go back and try again.", "Error"); die(); }
$newspellquery = doquery("SELECT * FROM {{table}} WHERE id='$pickedspell' LIMIT 1", "spells");
$newspellrow = mysql_fetch_array($newspellquery);
if ($userspells[$pickedspell] != 1) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
if ($userrow["currentmp"] < $newspellrow["mp"]) { display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error"); die(); }
if ($newspellrow["type"] == 1) { // Heal spell.
$newhp = $userrow["currenthp"] + $newspellrow["attribute"];
if ($userrow["maxhp"] < $newhp) { $newspellrow["attribute"] = $userrow["maxhp"] - $userrow["currenthp"]; $newhp = $userrow["currenthp"] + $newspellrow["attribute"]; }
$userrow["currenthp"] = $newhp;
$userrow["currentmp"] -= $newspellrow["mp"];
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and gained ".$newspellrow["attribute"]." Hit Points.<br /><br />";
} elseif ($newspellrow["type"] == 2) { // Hurt spell.
if ($userrow["currentmonsterimmune"] == 0) {
$monsterdamage = rand((($newspellrow["attribute"]/6)*5), $newspellrow["attribute"]);
$userrow["currentmonsterhp"] -= $monsterdamage;
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell for $monsterdamage damage.<br /><br />";
} else {
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.<br /><br />";
}
$userrow["currentmp"] -= $newspellrow["mp"];
} elseif ($newspellrow["type"] == 3) { // Sleep spell.
if ($userrow["currentmonsterimmune"] != 2) {
$userrow["currentmonstersleep"] = $newspellrow["attribute"];
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell. The monster is asleep.<br /><br />";
} else {
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.<br /><br />";
}
$userrow["currentmp"] -= $newspellrow["mp"];
} elseif ($newspellrow["type"] == 4) { // +Damage spell.
$userrow["currentuberdamage"] = $newspellrow["attribute"];
$userrow["currentmp"] -= $newspellrow["mp"];
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and will gain ".$newspellrow["attribute"]."% damage until the end of this fight.<br /><br />";
} elseif ($newspellrow["type"] == 5) { // +Defense spell.
$userrow["currentuberdefense"] = $newspellrow["attribute"];
$userrow["currentmp"] -= $newspellrow["mp"];
$pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, and will gain ".$newspellrow["attribute"]."% defense until the end of this fight.<br /><br />";
}
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
if ($userrow["currentmonsterhp"] <= 0) {
$updatequery = doquery("UPDATE {{table}} SET currentmonsterhp='0',currenthp='".$userrow["currenthp"]."',currentmp='".$userrow["currentmp"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
header("Location: index.php?do=victory");
die();
}
// Monster's turn.
$pagearray["monsterturn"] = "";
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
$chancetowake = rand(1,15);
if ($chancetowake > $userrow["currentmonstersleep"]) {
$userrow["currentmonstersleep"] = 0;
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
} else {
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
}
}
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
$tohit = ceil(rand($monsterrow["maxdam"],(($monsterrow["maxdam"]/6)*3)));
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
$toblock = ceil(rand($userrow["defensepower"],$userrow["defensepower"]*.75)/4);
$tododge = rand(1,150);
if ($tododge <= sqrt($userrow["dexterity"])) {
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
$persondamage = 0;
} else {
if ($tohit <= $toblock) { $tohit = $toblock + 1; }
$persondamage = $tohit - $toblock;
if ($userrow["currentuberdefense"] != 0) {
$persondamage -= ceil($persondamage * ($userrow["currentuberdefense"]/100));
}
if ($persondamage < 1) { $persondamage = 1; }
}
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
$userrow["currenthp"] -= $persondamage;
if ($userrow["currenthp"] <= 0) {
$newgold = ceil($userrow["gold"]/2);
$newhp = ceil($userrow["maxhp"]/4);
$updatequery = doquery("UPDATE {{table}} SET currenthp='$newhp',currentaction='In Town',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentfight='0',latitude='0',longitude='0',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$playerisdead = 1;
}
}
// Do a monster's turn if person lost the chance to swing first. Serves him right!
} elseif ( $chancetoswingfirst == 0 ) {
$pagearray["yourturn"] = "The monster attacks before you are ready!<br /><br />";
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
$pagearray["monsterturn"] = "";
if ($userrow["currentmonstersleep"] != 0) { // Check to wake up.
$chancetowake = rand(1,15);
if ($chancetowake > $userrow["currentmonstersleep"]) {
$userrow["currentmonstersleep"] = 0;
$pagearray["monsterturn"] .= "The monster has woken up.<br />";
} else {
$pagearray["monsterturn"] .= "The monster is still asleep.<br />";
}
}
if ($userrow["currentmonstersleep"] == 0) { // Only do this if the monster is awake.
$tohit = ceil(rand(($monsterrow["maxdam"]*.5),$monsterrow["maxdam"]));
if ($userrow["difficulty"] == 2) { $tohit = ceil($tohit * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $tohit = ceil($tohit * $controlrow["diff3mod"]); }
$toblock = ceil(rand($userrow["defensepower"]*.75,$userrow["defensepower"])/4);
$tododge = rand(1,150);
if ($tododge <= sqrt($userrow["dexterity"])) {
$tohit = 0; $pagearray["monsterturn"] .= "You dodge the monster's attack. No damage has been scored.<br />";
$persondamage = 0;
} else {
$persondamage = $tohit - $toblock;
if ($persondamage < 1) { $persondamage = 1; }
if ($userrow["currentuberdefense"] != 0) {
$persondamage -= ceil($persondamage * ($userrow["currentuberdefense"]/100));
}
if ($persondamage < 1) { $persondamage = 1; }
}
$pagearray["monsterturn"] .= "The monster attacks you for $persondamage damage.<br /><br />";
$userrow["currenthp"] -= $persondamage;
if ($userrow["currenthp"] <= 0) {
$newgold = ceil($userrow["gold"]/2);
$newhp = ceil($userrow["maxhp"]/4);
$updatequery = doquery("UPDATE {{table}} SET currenthp='$newhp',currentaction='In Town',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentfight='0',latitude='0',longitude='0',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$playerisdead = 1;
}
}
} else {
$pagearray["yourturn"] = "";
$pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "<br /><br />";
$pagearray["monsterturn"] = "";
}
$newmonster = $userrow["currentmonster"];
$newmonsterhp = $userrow["currentmonsterhp"];
$newmonstersleep = $userrow["currentmonstersleep"];
$newmonsterimmune = $userrow["currentmonsterimmune"];
$newuberdamage = $userrow["currentuberdamage"];
$newuberdefense = $userrow["currentuberdefense"];
$newfight = $userrow["currentfight"] + 1;
$newhp = $userrow["currenthp"];
$newmp = $userrow["currentmp"];
if ($playerisdead != 1) {
$pagearray["command"] = <<<END
Command?<br /><br />
<form action="index.php?do=fight" method="post">
<input type="submit" name="fight" value="Fight" /><br /><br />
<select name="userspell"><option value="0">Choose One</option>$magiclist</select> <input type="submit" name="spell" value="Spell" /><br /><br />
<input type="submit" name="run" value="Run" /><br /><br />
</form>
END;
$updatequery = doquery("UPDATE {{table}} SET currentaction='Fighting',currenthp='$newhp',currentmp='$newmp',currentfight='$newfight',currentmonster='$newmonster',currentmonsterhp='$newmonsterhp',currentmonstersleep='$newmonstersleep',currentmonsterimmune='$newmonsterimmune',currentuberdamage='$newuberdamage',currentuberdefense='$newuberdefense' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
} else {
$pagearray["command"] = "<b>You have died.</b><br /><br />As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points to continue your journey.<br /><br />You may now continue back to <a href=\"index.php\">town</a>, and we hope you fair better next time.";
}
// Finalize page and display it.
$template = gettemplate("fight");
$page = parsetemplate($template,$pagearray);
display($page, "Fighting");
}
function victory() {
global $userrow, $controlrow;
if ($userrow["currentmonsterhp"] != 0) { header("Location: index.php?do=fight"); die(); }
if ($userrow["currentfight"] == 0) { header("Location: index.php"); die(); }
$monsterquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentmonster"]."' LIMIT 1", "monsters");
$monsterrow = mysql_fetch_array($monsterquery);
$exp = rand((($monsterrow["maxexp"]/6)*5),$monsterrow["maxexp"]);
if ($exp < 1) { $exp = 1; }
if ($userrow["difficulty"] == 2) { $exp = ceil($exp * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $exp = ceil($exp * $controlrow["diff3mod"]); }
if ($userrow["expbonus"] != 0) { $exp += ceil(($userrow["expbonus"]/100)*$exp); }
$gold = rand((($monsterrow["maxgold"]/6)*5),$monsterrow["maxgold"]);
if ($gold < 1) { $gold = 1; }
if ($userrow["difficulty"] == 2) { $gold = ceil($gold * $controlrow["diff2mod"]); }
if ($userrow["difficulty"] == 3) { $gold = ceil($gold * $controlrow["diff3mod"]); }
if ($userrow["goldbonus"] != 0) { $gold += ceil(($userrow["goldbonus"]/100)*$exp); }
$newexp = $userrow["experience"] + $exp;
$newgold = $userrow["gold"] + $gold;
$levelquery = doquery("SELECT * FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
if (mysql_num_rows($levelquery) == 1) { $levelrow = mysql_fetch_array($levelquery); }
if ($userrow["level"] < 100) {
if ($newexp >= $levelrow[$userrow["charclass"]."_exp"]) {
$newhp = $userrow["maxhp"] + $levelrow[$userrow["charclass"]."_hp"];
$newmp = $userrow["maxmp"] + $levelrow[$userrow["charclass"]."_mp"];
$newtp = $userrow["maxtp"] + $levelrow[$userrow["charclass"]."_tp"];
$newstrength = $userrow["strength"] + $levelrow[$userrow["charclass"]."_strength"];
$newdexterity = $userrow["dexterity"] + $levelrow[$userrow["charclass"]."_dexterity"];
$newattack = $userrow["attackpower"] + $levelrow[$userrow["charclass"]."_strength"];
$newdefense = $userrow["defensepower"] + $levelrow[$userrow["charclass"]."_dexterity"];
$newlevel = $levelrow["id"];
if ($levelrow[$userrow["charclass"]."_spells"] != 0) {
$userspells = explode(",",$userrow["spells"]);
$userspells[$levelrow[$userrow["charclass"]."_spells"]] = 1;
$userspells = implode(",",$userspells);
$newspell = "spells='$userspells',";
$spelltext = "You have learned a new spell.<br />";
} else { $spelltext = ""; $newspell=""; }
$page = "Congratulations. You have defeated the ".$monsterrow["name"].".<br />You gain $exp experience.<br />You gain $gold gold.<br /><br /><b>You have gained a level!</b><br /><br />You gain ".$levelrow[$userrow["charclass"]."_hp"]." hit points.<br />You gain ".$levelrow[$userrow["charclass"]."_mp"]." magic points.<br />You gain ".$levelrow[$userrow["charclass"]."_tp"]." travel points.<br />You gain ".$levelrow[$userrow["charclass"]."_strength"]." strength.<br />You gain ".$levelrow[$userrow["charclass"]."_dexterity"]." dexterity.<br />$spelltext<br />You can now continue <a href=\"index.php\">exploring</a>.";
$title = "Courage and Wit have served thee well!";
} else {
$newhp = $userrow["maxhp"];
$newmp = $userrow["maxmp"];
$newtp = $userrow["maxtp"];
$newstrength = $userrow["strength"];
$newdexterity = $userrow["dexterity"];
$newattack = $userrow["attackpower"];
$newdefense = $userrow["defensepower"];
$newlevel = $userrow["level"];
$newspell = "";
$page = "Congratulations. You have defeated the ".$monsterrow["name"].".<br />You gain $exp experience.<br />You gain $gold gold.<br /><br />";
if (rand(1,30) == 1) {
$dropquery = doquery("SELECT * FROM {{table}} WHERE mlevel <= '".$monsterrow["level"]."' ORDER BY RAND() LIMIT 1", "drops");
$droprow = mysql_fetch_array($dropquery);
$dropcode = "dropcode='".$droprow["id"]."',";
$page .= "This monster has dropped an item. <a href=\"index.php?do=drop\">Click here</a> to reveal and equip the item, or you may also move on and continue <a href=\"index.php\">exploring</a>.";
} else {
$dropcode = "";
$page .= "You can now continue <a href=\"index.php\">exploring</a>.";
}
$title = "Victory!";
}
}
$updatequery = doquery("UPDATE {{table}} SET currentaction='Exploring',level='$newlevel',maxhp='$newhp',maxmp='$newmp',maxtp='$newtp',strength='$newstrength',dexterity='$newdexterity',attackpower='$newattack',defensepower='$newdefense', $newspell currentfight='0',currentmonster='0',currentmonsterhp='0',currentmonstersleep='0',currentmonsterimmune='0',currentuberdamage='0',currentuberdefense='0',$dropcode experience='$newexp',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
display($page, $title);
}
function drop() {
global $userrow;
if ($userrow["dropcode"] == 0) { header("Location: index.php"); die(); }
$dropquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["dropcode"]."' LIMIT 1", "drops");
$droprow = mysql_fetch_array($dropquery);
if (isset($_POST["submit"])) {
$slot = $_POST["slot"];
if ($slot == 0) { display("Please go back and select an inventory slot to continue.","Error"); }
if ($userrow["slot".$slot."id"] != 0) {
$slotquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["slot".$slot."id"]."' LIMIT 1", "drops");
$slotrow = mysql_fetch_array($slotquery);
$old1 = explode(",",$slotrow["attribute1"]);
if ($slotrow["attribute2"] != "X") { $old2 = explode(",",$slotrow["attribute2"]); } else { $old2 = array(0=>"maxhp",1=>0); }
$new1 = explode(",",$droprow["attribute1"]);
if ($droprow["attribute2"] != "X") { $new2 = explode(",",$droprow["attribute2"]); } else { $new2 = array(0=>"maxhp",1=>0); }
$userrow[$old1[0]] -= $old1[1];
$userrow[$old2[0]] -= $old2[1];
if ($old1[0] == "strength") { $userrow["attackpower"] -= $old1[1]; }
if ($old1[0] == "dexterity") { $userrow["defensepower"] -= $old1[1]; }
if ($old2[0] == "strength") { $userrow["attackpower"] -= $old2[1]; }
if ($old2[0] == "dexterity") { $userrow["defensepower"] -= $old2[1]; }
$userrow[$new1[0]] += $new1[1];
$userrow[$new2[0]] += $new2[1];
if ($new1[0] == "strength") { $userrow["attackpower"] += $new1[1]; }
if ($new1[0] == "dexterity") { $userrow["defensepower"] += $new1[1]; }
if ($new2[0] == "strength") { $userrow["attackpower"] += $new2[1]; }
if ($new2[0] == "dexterity") { $userrow["defensepower"] += $new2[1]; }
if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; }
if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; }
if ($userrow["currenttp"] > $userrow["maxtp"]) { $userrow["currenttp"] = $userrow["maxtp"]; }
$newname = addslashes($droprow["name"]);
$query = doquery("UPDATE {{table}} SET slot".$_POST["slot"]."name='$newname',slot".$_POST["slot"]."id='".$droprow["id"]."',$old1[0]='".$userrow[$old1[0]]."',$old2[0]='".$userrow[$old2[0]]."',$new1[0]='".$userrow[$new1[0]]."',$new2[0]='".$userrow[$new2[0]]."',attackpower='".$userrow["attackpower"]."',defensepower='".$userrow["defensepower"]."',currenthp='".$userrow["currenthp"]."',currentmp='".$userrow["currentmp"]."',currenttp='".$userrow["currenttp"]."',dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
} else {
$new1 = explode(",",$droprow["attribute1"]);
if ($droprow["attribute2"] != "X") { $new2 = explode(",",$droprow["attribute2"]); } else { $new2 = array(0=>"maxhp",1=>0); }
$userrow[$new1[0]] += $new1[1];
$userrow[$new2[0]] += $new2[1];
if ($new1[0] == "strength") { $userrow["attackpower"] += $new1[1]; }
if ($new1[0] == "dexterity") { $userrow["defensepower"] += $new1[1]; }
if ($new2[0] == "strength") { $userrow["attackpower"] += $new2[1]; }
if ($new2[0] == "dexterity") { $userrow["defensepower"] += $new2[1]; }
$newname = addslashes($droprow["name"]);
$query = doquery("UPDATE {{table}} SET slot".$_POST["slot"]."name='$newname',slot".$_POST["slot"]."id='".$droprow["id"]."',$new1[0]='".$userrow[$new1[0]]."',$new2[0]='".$userrow[$new2[0]]."',attackpower='".$userrow["attackpower"]."',defensepower='".$userrow["defensepower"]."',dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
}
$page = "The item has been equipped. You can now continue <a href=\"index.php\">exploring</a>.";
display($page, "Item Drop");
}
$attributearray = array("maxhp"=>"Max HP",
"maxmp"=>"Max MP",
"maxtp"=>"Max TP",
"defensepower"=>"Defense Power",
"attackpower"=>"Attack Power",
"strength"=>"Strength",
"dexterity"=>"Dexterity",
"expbonus"=>"Experience Bonus",
"goldbonus"=>"Gold Bonus");
$page = "The monster dropped the following item: <b>".$droprow["name"]."</b><br /><br />";
$page .= "This item has the following attribute(s):<br />";
$attribute1 = explode(",",$droprow["attribute1"]);
$page .= $attributearray[$attribute1[0]];
if ($attribute1[1] > 0) { $page .= " +" . $attribute1[1] . "<br />"; } else { $page .= $attribute1[1] . "<br />"; }
if ($droprow["attribute2"] != "X") {
$attribute2 = explode(",",$droprow["attribute2"]);
$page .= $attributearray[$attribute2[0]];
if ($attribute2[1] > 0) { $page .= " +" . $attribute2[1] . "<br />"; } else { $page .= $attribute2[1] . "<br />"; }
}
$page .= "<br />Select an inventory slot from the list below to equip this item. If the inventory slot is already full, the old item will be discarded.";
$page .= "<form action=\"index.php?do=drop\" method=\"post\"><select name=\"slot\"><option value=\"0\">Choose One</option><option value=\"1\">Slot 1: ".$userrow["slot1name"]."</option><option value=\"2\">Slot 2: ".$userrow["slot2name"]."</option><option value=\"3\">Slot 3: ".$userrow["slot3name"]."</option></select> <input type=\"submit\" name=\"submit\" value=\"Submit\" /></form>";
$page .= "You may also choose to just continue <a href=\"index.php\">exploring</a> and give up this item.";
display($page, "Item Drop");
}
function dead() {
$page = "<b>You have died.</b><br /><br />As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points to continue your journey.<br /><br />You may now continue back to <a href=\"index.php\">town</a>, and we hope you fair better next time.";
}
?>

97
forum.php Normal file
View File

@ -0,0 +1,97 @@
<?php // forum.php :: Internal forums script for the game.
include('lib.php');
include('login.php');
$link = opendb();
$userrow = checkcookies();
if ($userrow == false) { display("The forum is for registered players only.", "Forum"); die(); }
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
if (isset($_GET["do"])) {
$do = explode(":",$_GET["do"]);
if ($do[0] == "thread") { showthread($do[1], $do[2]); }
elseif ($do[0] == "new") { newthread(); }
elseif ($do[0] == "reply") { reply(); }
elseif ($do[0] == "list") { donothing($do[1]); }
} else { donothing(0); }
function donothing($start=0) {
$query = doquery("SELECT * FROM {{table}} WHERE parent='0' ORDER BY newpostdate DESC LIMIT 20", "forum");
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><th colspan=\"3\" style=\"background-color:#dddddd;\"><center><a href=\"forum.php?do=new\">New Thread</a></center></th></tr><tr><th width=\"50%\" style=\"background-color:#dddddd;\">Thread</th><th width=\"10%\" style=\"background-color:#dddddd;\">Replies</th><th style=\"background-color:#dddddd;\">Last Post</th></tr>\n";
$count = 1;
if (mysql_num_rows($query) == 0) {
$page .= "<tr><td style=\"background-color:#ffffff;\" colspan=\"3\"><b>No threads in forum.</b></td></tr>\n";
} else {
while ($row = mysql_fetch_array($query)) {
if ($count == 1) {
$page .= "<tr><td style=\"background-color:#ffffff;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#ffffff;\">".$row["replies"]."</td><td style=\"background-color:#ffffff;\">".$row["newpostdate"]."</td></tr>\n";
$count = 2;
} else {
$page .= "<tr><td style=\"background-color:#eeeeee;\"><a href=\"forum.php?do=thread:".$row["id"].":0\">".$row["title"]."</a></td><td style=\"background-color:#eeeeee;\">".$row["replies"]."</td><td style=\"background-color:#eeeeee;\">".$row["newpostdate"]."</td></tr>\n";
$count = 1;
}
}
}
$page .= "</table></td></tr></table>";
display($page, "Forum");
}
function showthread($id, $start) {
$query = doquery("SELECT * FROM {{table}} WHERE id='$id' OR parent='$id' ORDER BY id LIMIT $start,15", "forum");
$query2 = doquery("SELECT title FROM {{table}} WHERE id='$id' LIMIT 1", "forum");
$row2 = mysql_fetch_array($query2);
$page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"forum.php\">Forum</a> :: ".$row2["title"]."</b></td></tr>\n";
$count = 1;
while ($row = mysql_fetch_array($query)) {
if ($count == 1) {
$page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
$count = 2;
} else {
$page .= "<tr><td width=\"25%\" style=\"background-color:#eeeeee; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#eeeeee; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n";
$count = 1;
}
}
$page .= "</table></td></tr></table><br />";
$page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br /><form action=\"forum.php?do=reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$row2["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br /><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
display($page, "Forum");
}
function reply() {
global $userrow;
extract($_POST);
$query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),newpostdate=NOW(),author='".$userrow["charname"]."',parent='$parent',replies='0',title='$title',content='$content'", "forum");
$query2 = doquery("UPDATE {{table}} SET newpostdate=NOW(),replies=replies+1 WHERE id='$parent' LIMIT 1", "forum");
header("Location: forum.php?do=thread:$parent:0");
die();
}
function newthread() {
global $userrow;
if (isset($_POST["submit"])) {
extract($_POST);
$query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),newpostdate=NOW(),author='".$userrow["charname"]."',parent='0',replies='0',title='$title',content='$content'", "forum");
header("Location: forum.php");
die();
}
$page = "<table width=\"100%\"><tr><td><b>Make A New Post:</b><br /><br/ ><form action=\"forum.php?do=new\" method=\"post\">Title:<br /><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"50\" /><br /><br />Message:<br /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br /><br /><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
display($page, "Forum");
}
?>

29
heal.php Normal file
View File

@ -0,0 +1,29 @@
<?php // heal.php :: Handles stuff from the Quick Spells menu. (Healing spells only... other spells are handled in fight.php.)
function healspells($id) {
global $userrow;
$userspells = explode(",",$userrow["spells"]);
$spellquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "spells");
$spellrow = mysql_fetch_array($spellquery);
// All the various ways to error out.
if ($userspells[$id] != 1) { display("You have not yet learned this spell. Please go back and try again.", "Error"); die(); }
if ($spellrow["type"] != 1) { display("This is not a healing spell. Please go back and try again.", "Error"); die(); }
if ($userrow["currentmp"] < $spellrow["mp"]) { display("You do not have enough Magic Points to cast this spell. Please go back and try again.", "Error"); die(); }
if ($userrow["currentaction"] == "Fighting") { display("You cannot use the Quick Spells list during a fight. Please go back and select the Healing Spell you wish to use from the Spells box on the main fighting screen to continue.", "Error"); die(); }
if ($userrow["currenthp"] == $userrow["maxhp"]) { display("Your Hit Points are already full. You don't need to use a Healing spell now.", "Error"); die(); }
$newhp = $userrow["currenthp"] + $spellrow["attribute"];
if ($userrow["maxhp"] < $newhp) { $spellrow["attribute"] = $userrow["maxhp"] - $userrow["currenthp"]; $newhp = $userrow["currenthp"] + $spellrow["attribute"]; }
$newmp = $userrow["currentmp"] - $spellrow["mp"];
$updatequery = doquery("UPDATE {{table}} SET currenthp='$newhp', currentmp='$newmp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
display("You have cast the ".$spellrow["name"]." spell, and gained ".$spellrow["attribute"]." Hit Points. You can now continue <a href=\"index.php\">exploring</a>.", "Healing Spell");
die();
}
?>

323
help/help.php Normal file
View File

@ -0,0 +1,323 @@
<?php
include('../lib.php');
$link = opendb();
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? echo $controlrow["gamename"]; ?> Help</title>
<style type="text/css">
body {
background-image: url(../images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body>
<a name="top"></a>
<h1><? echo $controlrow["gamename"]; ?> Help</h1>
[ <a href="../index.php">Return to the game</a> ]
<br /><br /><hr />
<h3>Table of Contents</h3>
<ul>
<li /><a href="#intro">Introduction</a>
<li /><a href="#classes">Character Classes</a>
<li /><a href="#difficulties">Difficulty Levels</a>
<li /><a href="#intown">Playing The Game: In Town</a>
<li /><a href="#exploring">Playing The Game: Exploring & Fighting</a>
<li /><a href="#status">Playing The Game: Status Panels</a>
<li /><a href="#items">Spoilers: Items & Drops</a>
<li /><a href="#monsters">Spoilers: Monsters</a>
<li /><a href="#spells">Spoilers: Spells</a>
<li /><a href="#levels">Spoilers: Levels</a>
<li /><a href="#credits">Credits</a>
</ul>
<hr />
<h3><a name="intro"></a>Introduction</h3>
Firstly, I'd like to say thank you for playing my game. The <i>Dragon Knight</i> game engine is the result of several months of
planning, coding and testing. The original idea was to create a web-based tribute to the NES game, <i>Dragon
Warrior</i>. In its current iteration, only the underlying fighting system really resembles that game, as almost
everything else in DK has been made bigger and better. But you should still recognize bits and pieces as stemming
from <i>Dragon Warrior</i> and other RPGs of old.<br /><br />
This is the first game I've ever written, and it has definitely been a positive experience. It got difficult at
times, admittedly, but it was still a lot of fun to write, and even more fun to play. And I hope to use this
experience so that if I ever want to create another game it will be even better than this one.<br /><br />
If you are a site administrator, and would like to install a copy of DK on your own server, you may visit the
<a href="http://dragon.se7enet.com/dev.php" target="_new">development site</a> for <i>Dragon Knight</i>. This page
includes the downloadable game souce code, as well as some other resources that developers and administrators may
find valuable.<br /><br />
Once again, thanks for playing!<br /><br />
<i>Jamin Seven</i><br />
<i>Dragon Knight creator</i><br />
<a href="http://www.se7enet.com" target="_new">My Homepage</a><br />
<a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight Homepage</a><br ><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="classes"></a>Character Classes</h3>
There are three character classes in the game. The main differences between the classes are what spells you get
access to, the speed with which you level up, and the amount of HP/MP/strength/dexterity you gain per level. Below
is a basic outline of each of the character classes. For more detailed information about the characters, please
view the Levels table at the bottom of this page. Also, note that the outline below refers to the stock class setup
for the game. If your administrator has used his/her own class setup, this information may not be accurate.<br /><br />
<b><? echo $controlrow["class1name"]; ?></b>
<ul>
<li />Fast level-ups
<li />High hit points
<li />High magic points
<li />Low strength
<li />Low dexterity
<li />5 heal spells
<li />5 hurt spells
<li />3 sleep spells
<li />3 +defense spells
<li />0 +attack spells
</ul>
<b><? echo $controlrow["class2name"]; ?></b>
<ul>
<li />Medium level-ups
<li />Medium hit points
<li />Low magic points
<li />High strength
<li />Low dexterity
<li />3 heal spells
<li />3 hurt spells
<li />2 sleep spells
<li />3 +defense spells
<li />3 +attack spells
</ul>
<b><? echo $controlrow["class3name"]; ?></b>
<ul>
<li />Slow level-ups
<li />Medium hit points
<li />Medium magic points
<li />Low strength
<li />High dexterity
<li />4 heal spells
<li />4 hurt spells
<li />3 sleep spells
<li />2 +defense spells
<li />2 +attack spells
</ul>
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="difficulties"></a>Difficulty Levels</h3>
<i><? echo $controlrow["gamename"]; ?></i> includes the ability to play using one of three difficulty levels.
All monster statistics in the game are set at a base number. However, using a difficulty multiplier, certain statistics
are increased. The amount of hit points a monster has goes up, which means it will take longer to kill. But the amount
of experience and gold you gain from killing it also goes up. So the game is a little bit harder, but it is also more
rewarding. The following are the three difficulty levels and their statistic multiplier, which applies to the monster's
HP, experience drop, and gold drop.
<ul>
<li /><? echo $controlrow["diff1name"] . ": <b>" . $controlrow["diff1mod"] . "</b>"; ?>
<li /><? echo $controlrow["diff2name"] . ": <b>" . $controlrow["diff2mod"] . "</b>"; ?>
<li /><? echo $controlrow["diff3name"] . ": <b>" . $controlrow["diff3mod"] . "</b>"; ?>
</ul>
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="intown"></a>Playing The Game: In Town</h3>
When you begin a new game, the first thing you see is the Town screen. Towns serve four primary functions: healing, buying items,
buying maps, and displaying game information.<br /><br />
To heal yourself, click the "Rest at the Inn" link at the top of the town screen. Each town's Inn has a different price - some towns
are cheap, others are expensive. No matter what town you're in, the Inns always serve the same function: they restore your current
hit points, magic points, and travel points to their maximum amounts. Out in the field, you are free to use healing spells to restore
your hit points, but when you run low on magic points, the only way to restore them is at an Inn.<br /><br />
Buying weapons and armor is accomplished through the appropriately-named "Buy Weapons/Armor" link. Not every item is available in
every town, so in order to get the most powerful items, you'll need to explore some of the outer towns. Once you've clicked the link,
you are presented with a list of items available in this town's store. To the left of each item is an icon that represents its type:
weapon, armor or shield. The amount of attack/defense power, as well as the item's price, are displayed to the right of the item name.
You'll notice that some items have a red asterisk (<span class="highlight">*</span>) next to their names. These are items that come
with special attributes that modify other parts of your character profile. See the Items & Drops table at the bottom of this page for
more information about special items.<br /><br />
Maps are the third function in towns. Buying a map to a town places the town in your Travel To box in the left status panel. Once
you've purchased a town's map, you can click its name from your Travel To box and you will jump to that town. Travelling this way
costs travel points, though, and you'll only be able to visit towns if you have enough travel points.<br /><br />
The final function in towns is displaying game information and statistics. This includes the latest news post made by the game
administrator, a list of players who have been online recently, and the Babble Box.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="exploring"></a>Playing The Game: Exploring & Fighting</h3>
Once you're done in town, you are free to start exploring the world. Use the compass buttons on the left status panel to move around.
The game world is basically a big square, divided into four quadrants. Each quadrant is <? echo $controlrow["gamesize"]; ?> spaces
square. The first town is usually located at (0N,0E). Click the North button from the first town, and now you'll be at (1N,0E).
Likewise, if you now click the West button, you'll be at (1N,1W). Monster levels increase with every 5 spaces you move outward
from (0N,0E).<br /><br />
While you're exploring, you will occasionally run into monsters. As in pretty much any other RPG game, you and the monster take turns
hitting each other in an attempt to reduce each other's hit points to zero. Once you run into a monster, the Exploring screen changes
to the Fighting screen.<br /><br />
When a fight begins, you'll see the monster's name and hit points, and the game will ask you for your first command. You then get to
pick whether you want to fight, use a spell, or run away. Note, though, that sometimes the monster has the chance to hit you
first.<br /><br />
The Fight button is pretty straightforward: you attack the monster, and the amount of damage dealt is based on your attack power and
the monster's armor. On top of that, there are two other things that can happen: an Excellent Hit, which doubles your total attack
damage; and a monster dodge, which results in you doing no damage to the monster.<br /><br />
The Spell button allows you to pick an available spell and cast it. See the Spells list at the bottom of this page for more information
about spells.<br /><br />
Finally, there is the Run button, which lets you run away from a fight if the monster is too powerful. Be warned, though: it is
possible for the monster to block you from running and attack you. So if your hit points are low, you may fare better by staying
around monsters that you know can't do much damage to you.<br /><br />
Once you've had your turn, the monster also gets his turn. It is also possible for you to dodge the monster's attack and take no
damage.<br /><br />
The end result of a fight is either you or the monster being knocked down to zero hit points. If you win, the monster dies and will
give you a certain amount of experience and gold. There is also a chance that the monster will drop an item, which you can put into
one of the three inventory slots to give you extra points in your character profile. If you lose and die, half of your gold is taken
away - however, you are given back a few hit points to help you make it back to town (for example, if you don't have enough gold to
pay for an Inn, and need to kill a couple low-level monsters to get the money).<br /><br />
When the fight is over, you can continue exploring until you find another monster to beat into submission.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="status"></a>Playing The Game: Status Panels</h3>
There are two status panels on the game screen: left and right.<br /><br />
The left panel inclues your current location and play status (In Town, Exploring, Fighting), compass buttons for movement, and the
Travel To list for jumping between towns. At the bottom of the left panel is also a list of game functions.<br /><br />
The right panel displays some character statistics, your inventory, and quick spells.<br /><br />
The Character section shows the most important character statistics. It also displays the status bars for your current hit points,
magic points and travel points. These status bars are colored either green, yellow or red depending on your current amount of each
stat. There is also a link to pop up your list of extended statistics, which shows more detailed character information.<br /><br />
The Fast Spells section lists any Heal spells you've learned. You may use these links any time you are in town or exploring to cast
the heal spell. These may not be used during fights, however - you have to use the Spells box on the fight screen for that.
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="items"></a>Spoilers: Items & Drops</h3>
<a href="items.php">Click here</a> for the Items & Drops spoiler page.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="monsters"></a>Spoilers: Monsters</h3>
<a href="monsters.php">Click here</a> for the Monsters spoiler page.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="spells"></a>Spoilers: Spells</h3>
<a href="spells.php">Click here</a> for the Spells spoiler page.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="levels"></a>Spoilers: Levels</h3>
<a href="levels.php">Click here</a> for the Levels spoiler page.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br /><hr />
<h3><a name="credits"></a>Credits</h3>
<ul>
<li /><b>All program code and stock graphics for the game were created by Jamin Seven</b>.<br /><br />
<li />Major props go to a few people on the PHP manual site, for help with various chunks of code. The specific people are listed in the source code.<br /><br />
<li />Super monkey love goes to Enix and the developers of <i>Dragon Warrior</i>. If it weren't for you guys, my game never would have been made.<br /><br />
<li />Mega props go to Dalez from GameFAQs for his DW3 experience chart, which was where I got my experience levels from.<br /><br />
<li />Mad crazy ninja love goes to the following people for help and support throughout the development process:<br /><br />
<b>Ideas:</b> (whether they got used or not)
<ul>
<li />kushet
<li />lghtning
<li />Ebolamonkey3000
<li />Crimson Scythe
<li />SilDeath
</ul><br />
<b>Beta Testing:</b> (forums name if applicable, character name otherwise)
<ul>
<li />Ebolamonkey3000
<li />lisi
<li />Junglist
<li />Crimson Scythe
<li />Sk8erpunk69
<li />lghtning
<li />kushet
<li />SilDeath
<li />lowrider4life
<li />dubiin
<li />Sam Wise The Great
</ul><br />
<li />Apologies and lots of happy naked love to anyone I forgot.<br /><br />
<li />And of course, thanks to <b>you</b> for playing my game!<br /><br />
<li /><a href="../index.php?do=ninja">NINJA!</a>
</ul>
[ <a href="#top">Top</a> ]
<br /><br /><hr /><br />
Please visit the following sites for more information:<br />
<a href="http://www.se7enet.com" target="_new">Se7enet</a> (Jamin's homepage)<br />
<a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a> (official DK homepage)<br />
<a href="http://forums.se7enet.com" target="_new">Forums</a> (official DK forums)<br /><br />
All original coding and graphics for the <i>Dragon Knight</i> game engine are &copy; 2003-2004 by Jamin Seven.<br /><br />
[ <a href="#top">Top</a> ]
<br /><br />
<table class="copyright" width="100%"><tr>
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">&copy; 2003-2004 by renderse7en</td>
</tr></table>
</body>
</html>

155
help/items.php Normal file
View File

@ -0,0 +1,155 @@
<?php
include('../lib.php');
$link = opendb();
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? echo $controlrow["gamename"]; ?> Help</title>
<style type="text/css">
body {
background-image: url(../images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body>
<a name="top"></a>
<h1><? echo $controlrow["gamename"]; ?> Help: Items & Drops</h1>
[ <a href="help.php">Return to Help</a> | <a href="../index.php">Return to the game</a> ]
<br /><br /><hr />
<table width="60%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="5" bgcolor="#ffffff"><center><b>Items</b></center></td></tr>
<tr><td><b>Type</b></td><td><b>Name</b></td><td><b>Cost</b></td><td><b>Attribute</b></td><td><b>Special</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "items");
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["type"] == 1) { $image = "weapon"; $power = "Attack"; } elseif ($itemsrow["type"] == 2) { $image = "armor"; $power = "Defense"; } else { $image = "shield"; $power = "Defense"; }
if ($itemsrow["special"] != "X") {
$special = explode(",",$itemsrow["special"]);
if ($special[0] == "maxhp") { $attr = "Max HP"; }
elseif ($special[0] == "maxmp") { $attr = "Max MP"; }
elseif ($special[0] == "maxtp") { $attr = "Max TP"; }
elseif ($special[0] == "goldbonus") { $attr = "Gold Bonus (%)"; }
elseif ($special[0] == "expbonus") { $attr = "Experience Bonus (%)"; }
elseif ($special[0] == "strength") { $attr = "Strength"; }
elseif ($special[0] == "dexterity") { $attr = "Dexterity"; }
elseif ($special[0] == "attackpower") { $attr = "Attack Power"; }
elseif ($special[0] == "defensepower") { $attr = "Defense Power"; }
else { $attr = $special[0]; }
if ($special[1] > 0) { $stat = "+" . $special[1]; } else { $stat = $special[1]; }
$bigspecial = "$attr $stat";
} else { $bigspecial = "<span class=\"light\">None</span>"; }
echo "<tr><td $color width=\"5%\"><img src=\"../images/icon_$image.gif\" alt=\"$image\"></td><td $color width=\"30%\">".$itemsrow["name"]."</td><td $color width=\"20%\">".$itemsrow["buycost"]." Gold</td><td $color width=\"20%\">".$itemsrow["attribute"]." $power Power</td><td $color width=\"25%\">$bigspecial</td></tr>\n";
}
?>
</table>
<br />
<br />
<table width="60%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="4" bgcolor="#ffffff"><center><b>Drops</b></center></td></tr>
<tr><td><b>Name</b></td><td><b>Monster Level</b></td><td><b>Attribute 1</b></td><td><b>Attribute 2</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "drops");
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["attribute1"] != "X") {
$special1 = explode(",",$itemsrow["attribute1"]);
if ($special1[0] == "maxhp") { $attr1 = "Max HP"; }
elseif ($special1[0] == "maxmp") { $attr1 = "Max MP"; }
elseif ($special1[0] == "maxtp") { $attr1 = "Max TP"; }
elseif ($special1[0] == "goldbonus") { $attr1 = "Gold Bonus (%)"; }
elseif ($special1[0] == "expbonus") { $attr1 = "Experience Bonus (%)"; }
elseif ($special1[0] == "strength") { $attr1 = "Strength"; }
elseif ($special1[0] == "dexterity") { $attr1 = "Dexterity"; }
elseif ($special1[0] == "attackpower") { $attr1 = "Attack Power"; }
elseif ($special1[0] == "defensepower") { $attr1 = "Defense Power"; }
else { $attr1 = $special1[0]; }
if ($special1[1] > 0) { $stat1 = "+" . $special1[1]; } else { $stat1 = $special1[1]; }
$bigspecial1 = "$attr1 $stat1";
} else { $bigspecial1 = "<span class=\"light\">None</span>"; }
if ($itemsrow["attribute2"] != "X") {
$special2 = explode(",",$itemsrow["attribute2"]);
if ($special2[0] == "maxhp") { $attr2 = "Max HP"; }
elseif ($special2[0] == "maxmp") { $attr2 = "Max MP"; }
elseif ($special2[0] == "maxtp") { $attr2 = "Max TP"; }
elseif ($special2[0] == "goldbonus") { $attr2 = "Gold Bonus (%)"; }
elseif ($special2[0] == "expbonus") { $attr2 = "Experience Bonus (%)"; }
elseif ($special2[0] == "strength") { $attr2 = "Strength"; }
elseif ($special2[0] == "dexterity") { $attr2 = "Dexterity"; }
elseif ($special2[0] == "attackpower") { $attr2 = "Attack Power"; }
elseif ($special2[0] == "defensepower") { $attr2 = "Defense Power"; }
else { $attr2 = $special2[0]; }
if ($special2[1] > 0) { $stat2 = "+" . $special2[1]; } else { $stat2 = $special2[1]; }
$bigspecial2 = "$attr2 $stat2";
} else { $bigspecial2 = "<span class=\"light\">None</span>"; }
echo "<tr><td $color width=\"25%\">".$itemsrow["name"]."</td><td $color width=\"15%\">".$itemsrow["mlevel"]."</td><td $color width=\"30%\">$bigspecial1</td><td $color width=\"30%\">$bigspecial2</td></tr>\n";
}
?>
</table>
<br />
<table class="copyright" width="100%"><tr>
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">&copy; 2003-2004 by renderse7en</td>
</tr></table>
</body>
</html>

141
help/levels.php Normal file
View File

@ -0,0 +1,141 @@
<?php
include('../lib.php');
$link = opendb();
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? echo $controlrow["gamename"]; ?> Help</title>
<style type="text/css">
body {
background-image: url(../images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body>
<a name="top"></a>
<h1><? echo $controlrow["gamename"]; ?> Help: Levels</h1>
[ <a href="help.php">Return to Help</a> | <a href="../index.php">Return to the game</a> ]
<br /><br /><hr />
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class1name"]; ?> Levels</b></center></td></tr>
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT id,1_exp,1_hp,1_mp,1_tp,1_strength,1_dexterity,1_spells FROM {{table}} ORDER BY id", "levels");
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
$spells = array();
while ($spellsrow = mysql_fetch_array($spellsquery)) {
$spells[$spellsrow["id"]] = $spellsrow;
}
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["1_spells"] != 0) { $spell = $spells[$itemsrow["1_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["1_exp"])."</td><td $color width=\"12%\">".$itemsrow["1_hp"]."</td><td $color width=\"12%\">".$itemsrow["1_mp"]."</td><td $color width=\"12%\">".$itemsrow["1_tp"]."</td><td $color width=\"12%\">".$itemsrow["1_strength"]."</td><td $color width=\"12%\">".$itemsrow["1_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
}
?>
</table>
<br /><br />
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class2name"]; ?> Levels</b></center></td></tr>
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT id,2_exp,2_hp,2_mp,2_tp,2_strength,2_dexterity,2_spells FROM {{table}} ORDER BY id", "levels");
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
$spells = array();
while ($spellsrow = mysql_fetch_array($spellsquery)) {
$spells[$spellsrow["id"]] = $spellsrow;
}
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["2_spells"] != 0) { $spell = $spells[$itemsrow["2_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["2_exp"])."</td><td $color width=\"12%\">".$itemsrow["2_hp"]."</td><td $color width=\"12%\">".$itemsrow["2_mp"]."</td><td $color width=\"12%\">".$itemsrow["2_tp"]."</td><td $color width=\"12%\">".$itemsrow["2_strength"]."</td><td $color width=\"12%\">".$itemsrow["2_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
}
?>
</table>
<br /><br />
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="8" bgcolor="#ffffff"><center><b><? echo $controlrow["class3name"]; ?> Levels</b></center></td></tr>
<tr><td><b>Level</b><td><b>Exp.</b></td><td><b>HP</b></td><td><b>MP</b></td><td><b>TP</b></td><td><b>Strength</b></td><td><b>Dexterity</b></td><td><b>Spell</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT id,3_exp,3_hp,3_mp,3_tp,3_strength,3_dexterity,3_spells FROM {{table}} ORDER BY id", "levels");
$spellsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
$spells = array();
while ($spellsrow = mysql_fetch_array($spellsquery)) {
$spells[$spellsrow["id"]] = $spellsrow;
}
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["3_spells"] != 0) { $spell = $spells[$itemsrow["3_spells"]]["name"]; } else { $spell = "<span class=\"light\">None</span>"; }
if ($itemsrow["id"] != 100) { echo "<tr><td $color width=\"12%\">".$itemsrow["id"]."</td><td $color width=\"12%\">".number_format($itemsrow["3_exp"])."</td><td $color width=\"12%\">".$itemsrow["3_hp"]."</td><td $color width=\"12%\">".$itemsrow["3_mp"]."</td><td $color width=\"12%\">".$itemsrow["3_tp"]."</td><td $color width=\"12%\">".$itemsrow["3_strength"]."</td><td $color width=\"12%\">".$itemsrow["3_dexterity"]."</td><td $color width=\"12%\">$spell</td></tr>\n"; }
}
?>
</table>
<br />
Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level.
<br /><br />
<table class="copyright" width="100%"><tr>
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">&copy; 2003-2004 by renderse7en</td>
</tr></table>
</body>
</html>

96
help/monsters.php Normal file
View File

@ -0,0 +1,96 @@
<?php
include('../lib.php');
$link = opendb();
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? echo $controlrow["gamename"]; ?> Help</title>
<style type="text/css">
body {
background-image: url(../images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body>
<a name="top"></a>
<h1><? echo $controlrow["gamename"]; ?> Help: Monsters</h1>
[ <a href="help.php">Return to Help</a> | <a href="../index.php">Return to the game</a> ]
<br /><br /><hr />
<table width="75%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="8" bgcolor="#ffffff"><center><b>Monsters</b></center></td></tr>
<tr><td><b>Name</b></td><td><b>Max HP</b></td><td><b>Max Damage</b></td><td><b>Armor</b></td><td><b>Level</b></td><td><b>Max Exp.</b></td><td><b>Max Gold</b></td><td><b>Immunity</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "monsters");
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["immune"] == 0) { $immune = "<span class=\"light\">None</span>"; } elseif ($itemsrow["immune"] == 1) { $immune = "Hurt"; } else { $immune = "Hurt & Sleep"; }
echo "<tr><td $color width=\"30%\">".$itemsrow["name"]."</td><td $color width=\"10%\">".$itemsrow["maxhp"]."</td><td $color width=\"10%\">".$itemsrow["maxdam"]."</td><td $color width=\"10%\">".$itemsrow["armor"]."</td><td $color width=\"10%\">".$itemsrow["level"]."</td><td $color width=\"10%\">".$itemsrow["maxexp"]."</td><td $color width=\"10%\">".$itemsrow["maxgold"]."</td><td $color width=\"20%\">$immune</td></tr>\n";
}
?>
</table>
<br />
<table class="copyright" width="100%"><tr>
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">&copy; 2003-2004 by renderse7en</td>
</tr></table>
</body>
</html>

106
help/spells.php Normal file
View File

@ -0,0 +1,106 @@
<?php
include('../lib.php');
$link = opendb();
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? echo $controlrow["gamename"]; ?> Help</title>
<style type="text/css">
body {
background-image: url(../images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body>
<a name="top"></a>
<h1><? echo $controlrow["gamename"]; ?> Help: Spells</h1>
[ <a href="help.php">Return to Help</a> | <a href="../index.php">Return to the game</a> ]
<br /><br /><hr />
<table width="50%" style="border: solid 1px black" cellspacing="0" cellpadding="0">
<tr><td colspan="8" bgcolor="#ffffff"><center><b>Spells</b></center></td></tr>
<tr><td><b>Name</b></td><td><b>Cost</b></td><td><b>Type</b></td><td><b>Attribute</b></td></tr>
<?
$count = 1;
$itemsquery = doquery("SELECT * FROM {{table}} ORDER BY id", "spells");
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($count == 1) { $color = "bgcolor=\"#ffffff\""; $count = 2; } else { $color = ""; $count = 1; }
if ($itemsrow["type"] == 1) { $type = "Heal"; }
elseif ($itemsrow["type"] == 2) { $type = "Hurt"; }
elseif ($itemsrow["type"] == 3) { $type = "Sleep"; }
elseif ($itemsrow["type"] == 4) { $type = "+Damage (%)"; }
elseif ($itemsrow["type"] == 5) { $type = "+Defense (%)"; }
echo "<tr><td $color width=\"25%\">".$itemsrow["name"]."</td><td $color width=\"25%\">".$itemsrow["mp"]."</td><td $color width=\"25%\">$type</td><td $color width=\"25%\">".$itemsrow["attribute"]."</td></tr>\n";
}
?>
</table>
<ul>
<li /><b>Heal</b> spells always give you the maximum amount possible, until your current HP is full.
<li /><b>Hurt</b> spells deal X damage (not always the maximum) to the monster, regardless of the monster's armor.
<li /><b>Sleep</b> spells put the monster to sleep. The monster has an X in 15 chance of remaining asleep each turn.
<li /><b>+Damage</b> spells increase your total attack damage by X percent until the end of the fight.
<li /><b>+Defense</b> spells reduce the total damage you take from the monster by X percent until the end of each fight.
</ul>
<table class="copyright" width="100%"><tr>
<td width="50%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="50%" align="center">&copy; 2003-2004 by renderse7en</td>
</tr></table>
</body>
</html>

BIN
images/background.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
images/background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
images/bars_green.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

BIN
images/bars_red.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

BIN
images/bars_yellow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

BIN
images/button_character.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

BIN
images/button_functions.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

BIN
images/button_help.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

BIN
images/button_inventory.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

BIN
images/button_location.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

BIN
images/button_login.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

BIN
images/button_logout.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

BIN
images/button_register.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

BIN
images/button_shoutbox.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

BIN
images/button_spells.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

BIN
images/button_status.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

BIN
images/button_towns.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

BIN
images/compass_01.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
images/compass_02.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
images/compass_03.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
images/compass_04.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
images/dkforumsbutton.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
images/help_exploring.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/help_fighting.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
images/icon_armor.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

BIN
images/icon_shield.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

BIN
images/icon_weapon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

BIN
images/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
images/title_exploring.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/title_fighting.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

BIN
images/town_1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/town_2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/town_3.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/town_4.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/town_5.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/town_6.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
images/town_7.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/town_8.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

271
index.php Normal file
View File

@ -0,0 +1,271 @@
<?php // index.php :: Primary program script, evil alien overlord, you decide.
include('lib.php');
include('login.php');
$link = opendb();
$userrow = checkcookies();
if ($userrow == false) { header("Location: login.php?do=login"); die(); }
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
if ($controlrow["gameopen"] == 0) { display("The game is currently closed for maintanence. Please check back later.","Game Closed"); die(); }
if (isset($_GET["do"])) {
$do = explode(":",$_GET["do"]);
// Town functions.
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] == "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() {
global $userrow;
if ($userrow["currentaction"] == "In Town") {
$page = dotown();
$title = "In Town";
} elseif ($userrow["currentaction"] == "Exploring") {
$page = doexplore();
$title = "Exploring";
} elseif ($userrow["currentaction"] == "Fighting") {
$page = dofight();
$title = "Fighting";
}
display($page, $title);
}
function dotown() { // Spit out the main town page.
global $userrow, $numqueries;
$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"); }
$townrow = mysql_fetch_array($townquery);
// News box. Grab latest news entry and display it. Something a little more graceful coming soon maybe.
$newsquery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 1", "news");
$newsrow = mysql_fetch_array($newsquery);
$townrow["news"] = "<span class=\"light\">[".prettydate($newsrow["postdate"])."]</span><br />".nl2br($newsrow["content"]);
// Who's Online. Currently just members. Guests maybe later.
$onlinequery = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' ORDER BY charname", "users");
$townrow["whosonline"] = "There are <b>" . mysql_num_rows($onlinequery) . "</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($townrow["whosonline"], ", ");
$page = gettemplate("towns");
$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;
}
function dofight() { // Redirect to fighting.
header("Location: index.php?do=fight");
}
function showchar() {
global $userrow, $controlrow;
// Format various userrow stuffs.
$userrow["experience"] = number_format($userrow["experience"]);
$userrow["gold"] = number_format($userrow["gold"]);
if ($userrow["expbonus"] > 0) {
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
} elseif ($userrow["expbonus"] < 0) {
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
} else { $userrow["plusexp"] = ""; }
if ($userrow["goldbonus"] > 0) {
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
} elseif ($userrow["goldbonus"] < 0) {
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
} else { $userrow["plusgold"] = ""; }
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
$levelrow = mysql_fetch_array($levelquery);
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
$userspells = explode(",",$userrow["spells"]);
$userrow["magiclist"] = "";
while ($spellrow = mysql_fetch_array($spellquery)) {
if ($userspells[$spellrow["id"]] == 1) {
$userrow["magiclist"] .= $spellrow["name"] . "<br />";
}
}
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
// 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";
$charsheet = gettemplate("showchar");
$page = $xml . gettemplate("minimal");
$array = array("content"=>parsetemplate($charsheet, $userrow), "title"=>"Character Information");
echo parsetemplate($page, $array);
die();
}
function onlinechar($id) {
global $controlrow;
$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"); }
// Format various userrow stuffs.
$userrow["experience"] = number_format($userrow["experience"]);
$userrow["gold"] = number_format($userrow["gold"]);
if ($userrow["expbonus"] > 0) {
$userrow["plusexp"] = "<span class=\"light\">(+".$userrow["expbonus"]."%)</span>";
} elseif ($userrow["expbonus"] < 0) {
$userrow["plusexp"] = "<span class=\"light\">(".$userrow["expbonus"]."%)</span>";
} else { $userrow["plusexp"] = ""; }
if ($userrow["goldbonus"] > 0) {
$userrow["plusgold"] = "<span class=\"light\">(+".$userrow["goldbonus"]."%)</span>";
} elseif ($userrow["goldbonus"] < 0) {
$userrow["plusgold"] = "<span class=\"light\">(".$userrow["goldbonus"]."%)</span>";
} else { $userrow["plusgold"] = ""; }
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
$levelrow = mysql_fetch_array($levelquery);
$userrow["nextlevel"] = number_format($levelrow[$userrow["charclass"]."_exp"]);
if ($userrow["charclass"] == 1) { $userrow["charclass"] = $controlrow["class1name"]; }
elseif ($userrow["charclass"] == 2) { $userrow["charclass"] = $controlrow["class2name"]; }
elseif ($userrow["charclass"] == 3) { $userrow["charclass"] = $controlrow["class3name"]; }
if ($userrow["difficulty"] == 1) { $userrow["difficulty"] = $controlrow["diff1name"]; }
elseif ($userrow["difficulty"] == 2) { $userrow["difficulty"] = $controlrow["diff2name"]; }
elseif ($userrow["difficulty"] == 3) { $userrow["difficulty"] = $controlrow["diff3name"]; }
$spellquery = doquery("SELECT id,name FROM {{table}}","spells");
$userspells = explode(",",$userrow["spells"]);
$userrow["magiclist"] = "";
while ($spellrow = mysql_fetch_array($spellquery)) {
if ($userspells[$spellrow["id"]] == 1) {
$userrow["magiclist"] .= $spellrow["name"] . "<br />";
}
}
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
// 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";
$charsheet = gettemplate("onlinechar");
$page = parsetemplate($charsheet, $userrow);
display($page, "Character Information");
}
function showmap() {
global $userrow;
// 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";
$page = $xml . gettemplate("minimal");
$array = array("content"=>"Map coming soon.", "title"=>"Map");
echo parsetemplate($page, $array);
die();
}
function babblebox() {
global $userrow;
if (isset($_POST["submit"])) {
$safecontent = my_htmlspecialchars($_POST["babble"]);
if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing.
} else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='".$userrow["charname"]."',babble='$safecontent'", "babble"); }
header("Location: index.php?do=babblebox");
die();
}
$babblebox = array("content"=>"");
$bg = 1;
$babblequery = doquery("SELECT * FROM {{table}} ORDER BY id LIMIT 20", "babble");
while ($babblerow = mysql_fetch_array($babblequery)) {
if ($bg == 1) { $babblebox["content"] .= "<div style=\"width:98%; background-color:#eeeeee;\">[<b>".$babblerow["author"]."</b>] ".$babblerow["babble"]."</div>\n"; $bg = 2; }
else { $babblebox["content"] .= "<div style=\"width:98%; background-color:#ffffff;\">[<b>".$babblerow["author"]."</b>] ".stripslashes($babblerow["babble"])."</div>\n"; $bg = 1; }
}
$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.
$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";
$page = $xml . gettemplate("babblebox");
echo parsetemplate($page, $babblebox);
die();
}
function ninja() {
header("Location: http://www.se7enet.com/img/shirtninja.jpg");
}
?>

779
install.php Normal file
View File

@ -0,0 +1,779 @@
<?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(); }
else { first(); }
} else { first(); }
// Thanks to Predrag Supurovic from php.net for this function!
function dobatch ($p_query, $p_transaction_safe = true) {
if ($p_transaction_safe) {
$p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
};
$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',
`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',
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);
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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0',
`towns` varchar(50) NOT NULL default '0,1,0,0,0,0,0,0,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',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!
</body>
</html>
END;
echo $page;
die();
}
?>

213
lib.php Normal file
View File

@ -0,0 +1,213 @@
<?php // lib.php :: Common functions used throughout the program.
$starttime = getmicrotime();
$numqueries = 0;
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;
}
function gettemplate($templatename) { // SQL query for the template.
$filename = "templates/" . $templatename . ".php";
include("$filename");
return $template;
}
function parsetemplate($template, $array) { // Replace template with proper content.
foreach($array as $a => $b) {
$template = str_replace("{{{$a}}}", $b, $template);
}
return $template;
}
function getmicrotime() { // Used for timing script operations.
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
function prettydate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
}
function prettyforumdate($uglydate) { // Change the MySQL date format (YYYY-MM-DD) into something friendlier.
return date("F j, Y", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4)));
}
function is_email($email) { // Thanks to "mail(at)philipp-louis.de" from php.net!
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
}
function my_htmlspecialchars($text) { // Thanks to "etymxris at yahoo dot com" from php.net!
$ALLOWABLE_TAGS = array("b", "i", "u", "p", "blockquote", "ol", "ul", "li");
static $PATTERNS = array();
static $REPLACEMENTS = array();
if (count($PATTERNS) == 0) {
foreach ($ALLOWABLE_TAGS as $tag) {
$PATTERNS[] = "/&lt;$tag&gt;/i";
$PATTERNS[] = "/&lt;\/$tag&gt;/i";
$REPLACEMENTS[] = "<$tag>";
$REPLACEMENTS[] = "</$tag>";
}
}
$result = str_replace(array(">", "<", "\"", "'"),
array("&gt;", "&lt;", "&quot;", "&#039;"),
$text);
$result = preg_replace($PATTERNS, $REPLACEMENTS, $result);
return $result;
}
function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true, $badstart=false) { // Finalize page and output to browser.
include('config.php');
global $numqueries, $userrow, $controlrow;
if (!isset($controlrow)) {
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
}
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 ($leftnav == true) { $leftnav = gettemplate("leftnav"); } else { $leftnav = ""; }
if ($topnav == true) {
$topnav = "<a href=\"login.php?do=logout\"><img src=\"images/button_logout.gif\" alt=\"Log Out\" title=\"Log Out\" border=\"0\" /></a> <a href=\"help/help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" title=\"Help\" border=\"0\" /></a>";
} 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/help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" title=\"Help\" border=\"0\" /></a>";
}
if (isset($userrow)) {
// Get userrow again, in case something has been updated.
$userquery = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["id"]."' LIMIT 1", "users");
unset($userrow);
$userrow = mysql_fetch_array($userquery);
// Current town name.
if ($userrow["currentaction"] == "In Town") {
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
$townrow = mysql_fetch_array($townquery);
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
} else {
$userrow["currenttown"] = "";
}
if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; }
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 />"; }
// Format various userrow stuffs...
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"; }
$userrow["experience"] = number_format($userrow["experience"]);
$userrow["gold"] = number_format($userrow["gold"]);
if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=\"admin/admin.php\">Admin</a><br />"; } else { $userrow["adminlink"] = ""; }
// HP/MP/TP bars.
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
if ($userrow["maxmp"] != 0) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100); } else { $statmp = 0; }
$stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);
$stattable = "<table width=\"100\"><tr><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($stathp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; }
if ($stathp < 66 && $stathp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; }
if ($stathp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($statmp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; }
if ($statmp < 66 && $statmp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; }
if ($statmp < 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($stattp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; }
if ($stattp < 66 && $stattp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; }
if ($stattp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td>\n";
$stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n";
$userrow["statbars"] = $stattable;
// 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["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");
$userspells = explode(",",$userrow["spells"]);
$userrow["magiclist"] = "";
while ($spellrow = mysql_fetch_array($spellquery)) {
if ($userspells[$spellrow["id"]] == 1 && $spellrow["type"] == 1) {
$userrow["magiclist"] .= "<a href=\"index.php?do=spell:".$spellrow["id"]."\">".$spellrow["name"]."</a><br />";
}
}
if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; }
// Travel To list.
$townslist = explode(",",$userrow["towns"]);
$townquery2 = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
$userrow["townslist"] = "";
while ($townrow2 = mysql_fetch_array($townquery2)) {
if ($townslist[$townrow2["id"]] == 1) { $userrow["townslist"] .= "<a href=\"index.php?do=gotown:".$townrow2["id"]."\">".$townrow2["name"]."</a><br />\n"; }
}
} else {
$userrow = array();
}
$finalarray = array(
"dkgamename"=>$controlrow["gamename"],
"title"=>$title,
"content"=>$content,
"rightnav"=>parsetemplate($rightnav,$userrow),
"leftnav"=>parsetemplate($leftnav,$userrow),
"topnav"=>$topnav,
"totaltime"=>round(getmicrotime() - $starttime, 4),
"numqueries"=>$numqueries,
"version"=>$version,
"build"=>$build);
$page = parsetemplate($template, $finalarray);
$page = $xml . $page;
if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); }
echo $page;
die();
}
?>

72
login.php Normal file
View File

@ -0,0 +1,72 @@
<?php // login.php :: Handles logins and cookies.
if (isset($_GET["do"])) {
if ($_GET["do"] == "login") { login(); }
elseif ($_GET["do"] == "logout") { logout(); }
}
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;
}
function login() {
include('lib.php');
include('config.php');
$starttime = getmicrotime();
$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, $starttime);
}
function logout() {
setcookie("dkgame", "", time()-100000, "/", "", 0);
header("Location: login.php?do=login");
die();
}
?>

78
templates/admin.php Normal file
View File

@ -0,0 +1,78 @@
<?php
$template = <<<THEVERYENDOFYOU
<head>
<title>{{title}}</title>
<style type="text/css">
body {
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body><center>
<table width="90%"><tr>
<td width="150" style="border-right: solid 1px black;">
<b><u>DK Administration</u></b><br /><br />
<b>Links:</b><br />
<a href="admin.php">Admin Home</a><br />
<a href="../index.php">Game Home</a><br /><br />
<b>Primary Data:</b><br />
<a href="admin.php?do=main">Main Settings</a><br />
<a href="admin.php?do=news">Add News Post</a><br />
<a href="admin.php?do=users">Edit Users</a><br /><br />
<b>Game Data:</b><br />
<a href="admin.php?do=items">Edit Items</a><br />
<a href="admin.php?do=drops">Edit Drops</a><br />
<a href="admin.php?do=towns">Edit Towns</a><br />
<a href="admin.php?do=monsters">Edit Monsters</a><br />
<a href="admin.php?do=levels">Edit Levels</a><br />
<a href="admin.php?do=spells">Edit Spells</a><br />
</td><td>
{{content}}
</td></tr></table>
<br />
<table class="copyright" width="90%"><tr>
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">&copy; 2003 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}}, {{build}}</td>
</center></body>
</html>
THEVERYENDOFYOU;
?>

34
templates/babblebox.php Normal file
View File

@ -0,0 +1,34 @@
<?php
$template = <<<THEVERYENDOFYOU
<head>
<title>shoutbox</title>
<style type="text/css">
body {
background-image: url(images/background.jpg);
color: black;
font: 11px verdana;
margins: 0px;
padding: 0px;
}
div {
padding: 2px;
border: solid 1px black;
margin: 2px;
text-align: left;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
</style>
</head>
<body onload="window.scrollTo(0,99999)">
{{content}}
</body>
</html>
THEVERYENDOFYOU;
?>

14
templates/fight.php Normal file
View File

@ -0,0 +1,14 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%">
<tr><td class="title"><img src="images/title_fighting.gif" alt="Fighting" /></td></tr>
<tr><td>
You are fighting a <b>{{monstername}}</b><br /><br />
{{monsterhp}}
{{yourturn}}
{{monsterturn}}
{{command}}
</td></tr>
</table>
THEVERYENDOFYOU;
?>

38
templates/leftnav.php Normal file
View File

@ -0,0 +1,38 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%">
<tr><td class="title"><img src="images/button_location.gif" alt="Location" title="Location" /></td></tr>
<tr><td>
Currently: {{currentaction}}<br />
Latitude: {{latitude}}<br />
Longitude: {{longitude}}<br /><br />
<form action="index.php?do=move" method="post">
<center>
<input name="north" type="submit" value="North" /><br />
<input name="west" type="submit" value="West" /><input name="east" type="submit" value="East" /><br />
<input name="south" type="submit" value="South" />
</center>
</form>
</td></tr>
</table><br />
<table width="100%">
<tr><td class="title"><img src="images/button_towns.gif" alt="Towns" title="Towns" /></td></tr>
<tr><td>
{{currenttown}}
Travel To:<br />
{{townslist}}
</td></tr>
</table><br />
<table width="100%">
<tr><td class="title"><img src="images/button_functions.gif" alt="Functions" title="Functions" /></td></tr>
<tr><td>
{{forumslink}}
{{adminlink}}
<a href="login.php?do=logout">Log Out</a><br />
<a href="help/help.php">Help</a>
</td></tr>
</table><br />
THEVERYENDOFYOU;
?>

13
templates/login.php Normal file
View File

@ -0,0 +1,13 @@
<?php
$template = <<<THEVERYENDOFYOU
<form action="login.php?do=login" method="post">
<table width="75%">
<tr><td width="30%">Username:</td><td><input type="text" size="30" name="username" /></td></tr>
<tr><td>Password:</td><td><input type="password" size="30" name="password" /></td></tr>
<tr><td>Remember me?</td><td><input type="checkbox" name="rememberme" value="yes" /> Yes</td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Log In" /></td></tr>
<tr><td colspan="2">Checking the "Remember Me" option will store your login information in a cookie so you don't have to enter it next time you get online.<br /><br />Want to play? You gotta <a href="users.php?do=register">register your own character.</a></td></tr>
</table>
</form>
THEVERYENDOFYOU;
?>

68
templates/minimal.php Normal file
View File

@ -0,0 +1,68 @@
<?php
$template = <<<THEVERYENDOFYOU
<head>
<title>{{title}}</title>
<style type="text/css">
body {
background-image: url(images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 150px;
border-right: solid 2px black;
}
td.right {
width: 150px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
</head>
<body><center>
{{content}}
</center></body>
</html>
THEVERYENDOFYOU;
?>

41
templates/onlinechar.php Normal file
View File

@ -0,0 +1,41 @@
<?php
$template = <<<THEVERYENDOFYOU
Here is the character profile for <b>{{charname}}</b>.<br /><br />
When you're finished, you may <a href="index.php">return to town</a>.<br /><br />
<table width="200">
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
<tr><td>
<b>{{charname}}</b><br /><br />
Difficulty: {{difficulty}}<br />
Class: {{charclass}}<br /><br />
Level: {{level}}<br />
Experience: {{experience}}<br />
Gold: {{gold}}<br />
Hit Points: {{currenthp}} / {{maxhp}}<br />
Magic Points: {{currentmp}} / {{maxmp}}<br />
Travel Points: {{currenttp}} / {{maxtp}}<br /><br />
Strength: {{strength}}<br />
Dexterity: {{dexterity}}<br />
Attack Power: {{attackpower}}<br />
Defense Power: {{defensepower}}<br />
</td></tr>
</table><br />
<table width="200">
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
<tr><td>
<table width="100%">
<tr><td><img src="images/icon_weapon.gif" alt="Weapon" title="Weapon" /></td><td width="100%">Weapon: {{weaponname}}</td></tr>
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
</table>
Slot 1: {{slot1name}}<br />
Slot 2: {{slot2name}}<br />
Slot 3: {{slot3name}}
</td></tr>
</table><br />
THEVERYENDOFYOU;
?>

86
templates/primary.php Normal file
View File

@ -0,0 +1,86 @@
<?php
$template = <<<THEVERYENDOFYOU
<head>
<title>{{title}}</title>
<style type="text/css">
body {
background-image: url(images/background.jpg);
color: black;
font: 11px verdana;
}
table {
border-style: none;
padding: 0px;
font: 11px verdana;
}
td {
border-style: none;
padding: 3px;
vertical-align: top;
}
td.top {
border-bottom: solid 2px black;
}
td.left {
width: 180px;
border-right: solid 2px black;
}
td.right {
width: 180px;
border-left: solid 2px black;
}
a {
color: #663300;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #330000;
}
.small {
font: 10px verdana;
}
.highlight {
color: red;
}
.light {
color: #999999;
}
.title {
border: solid 1px black;
background-color: #eeeeee;
font-weight: bold;
padding: 5px;
margin: 3px;
}
.copyright {
border: solid 1px black;
background-color: #eeeeee;
font: 10px verdana;
}
</style>
<script>
function opencharpopup(){
var popurl="index.php?do=showchar"
winpops=window.open(popurl,"","width=210,height=500,scrollbars")
}
</script>
</head>
<body><center>
<table cellspacing="0" width="90%"><tr>
<td class="top" colspan="3">
<table width="100%"><tr><td><img src="images/logo.gif" alt="{{dkgamename}}" title="{{dkgamename}}" border="0" /></td><td style="text-align:right; vertical-align:middle;">{{topnav}}</td></tr></table>
</td>
</tr><tr>
<td class="left">{{leftnav}}</td>
<td class="middle">{{content}}</td>
<td class="right">{{rightnav}}</td>
</tr>
</table><br />
<table class="copyright" width="90%"><tr>
<td width="25%" align="center">Powered by <a href="http://dragon.se7enet.com/dev.php" target="_new">Dragon Knight</a></td><td width="25%" align="center">&copy; 2003-2004 by renderse7en</td><td width="25%" align="center">{{totaltime}} Seconds, {{numqueries}} Queries</td><td width="25%" align="center">Version {{version}} {{build}}</td>
</tr></table>
</center></body>
</html>
THEVERYENDOFYOU;
?>

18
templates/register.php Normal file
View File

@ -0,0 +1,18 @@
<?php
$template = <<<THEVERYENDOFYOU
<form action="users.php?do=register" method="post">
<table width="80%">
<tr><td width="20%">Username:</td><td><input type="text" name="username" size="30" maxlength="30" /><br /><br /><br /></td></tr>
<tr><td>Password:</td><td><input type="password" name="password1" size="30" maxlength="30" /></td></tr>
<tr><td>Verify Password:</td><td><input type="password" name="password2" size="30" maxlength="30" /><br /><br /><br /></td></tr>
<tr><td>Email Address:</td><td><input type="text" name="email1" size="30" maxlength="100" /></td></tr>
<tr><td>Verify Email:</td><td><input type="text" name="email2" size="30" maxlength="100" /><br /><br /><br /></td></tr>
<tr><td>Character Name:</td><td><input type="text" name="charname" size="30" maxlength="30" /></td></tr>
<tr><td>Character Class:</td><td><select name="charclass"><option value="1">{{class1name}}</option><option value="2">{{class2name}}</option><option value="3">{{class3name}}</option></select></td></tr>
<tr><td>Difficulty:</td><td><select name="difficulty"><option value="1">{{diff1name}}</option><option value="2">{{diff2name}}</option><option value="3">{{diff3name}}</option></select></td></tr>
<tr><td colspan="2">See <a href="help.php">Help</a> for more information about character classes and difficulty levels.<br /><br /></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /></td></tr>
</table>
</form>
THEVERYENDOFYOU;
?>

39
templates/rightnav.php Normal file
View File

@ -0,0 +1,39 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%">
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
<tr><td>
<b>{{charname}}</b><br />
Level: {{level}}<br />
Exp: {{experience}}<br />
Gold: {{gold}}<br />
HP: {{currenthp}}<br />
MP: {{currentmp}}<br />
TP: {{currenttp}}<br />
{{statbars}}<br />
<a href="javascript:opencharpopup()">Extended Stats</a>
</td></tr>
</table><br />
<table width="100%">
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
<tr><td>
<table width="100%">
<tr><td><img src="images/icon_weapon.gif" alt="Weapon" title="Weapon" /></td><td width="100%">Weapon: {{weaponname}}</td></tr>
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
</table>
Slot 1: {{slot1name}}<br />
Slot 2: {{slot2name}}<br />
Slot 3: {{slot3name}}
</td></tr>
</table><br />
<table width="100%">
<tr><td class="title"><img src="images/button_fastspells.gif" alt="Fast Spells" title="Fast Spells" /></td></tr>
<tr><td>
{{magiclist}}
</td></tr>
</table><br />
THEVERYENDOFYOU;
?>

47
templates/showchar.php Normal file
View File

@ -0,0 +1,47 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%">
<tr><td class="title"><img src="images/button_character.gif" alt="Character" title="Character" /></td></tr>
<tr><td>
<b>{{charname}}</b><br /><br />
Difficulty: {{difficulty}}<br />
Class: {{charclass}}<br /><br />
Level: {{level}}<br />
Experience: {{experience}} {{plusexp}}<br />
Next Level: {{nextlevel}}<br />
Gold: {{gold}} {{plusgold}}<br />
Hit Points: {{currenthp}} / {{maxhp}}<br />
Magic Points: {{currentmp}} / {{maxmp}}<br />
Travel Points: {{currenttp}} / {{maxtp}}<br /><br />
Strength: {{strength}}<br />
Dexterity: {{dexterity}}<br />
Attack Power: {{attackpower}}<br />
Defense Power: {{defensepower}}<br />
</td></tr>
</table><br />
<table width="100%">
<tr><td class="title"><img src="images/button_inventory.gif" alt="Inventory" title="Inventory" /></td></tr>
<tr><td>
<table width="100%">
<tr><td><img src="images/icon_weapon.gif" alt="Weapon" title="Weapon" /></td><td width="100%">Weapon: {{weaponname}}</td></tr>
<tr><td><img src="images/icon_armor.gif" alt="Armor" title="Armor" /></td><td width="100%">Armor: {{armorname}}</td></tr>
<tr><td><img src="images/icon_shield.gif" alt="Shield" title="Shield" /></td><td width="100%">Shield: {{shieldname}}</td></tr>
</table>
Slot 1: {{slot1name}}<br />
Slot 2: {{slot2name}}<br />
Slot 3: {{slot3name}}
</td></tr>
</table><br />
<table width="100%">
<tr><td class="title"><img src="images/button_spells.gif" alt="Spells" title="Spells" /></td></tr>
<tr><td>
{{magiclist}}
</td></tr>
</table><br />
THEVERYENDOFYOU;
?>

27
templates/towns.php Normal file
View File

@ -0,0 +1,27 @@
<?php
$template = <<<THEVERYENDOFYOU
<table width="100%">
<tr><td class="title"><img src="images/town_{{id}}.gif" alt="Welcome to {{name}}" title="Welcome to {{name}}" /></td></tr>
<tr><td>
<b>Town Options:</b><br />
<ul>
<li /><a href="index.php?do=inn">Rest at the Inn</a>
<li /><a href="index.php?do=buy">Buy Weapons/Armor</a>
<li /><a href="index.php?do=maps">Buy Maps</a>
</ul>
</td></tr>
<tr><td><center>
<table width="95%">
<tr><td class="title">Latest News</td></tr>
<tr><td>{{news}}</td></tr>
</table>
<br />
<table width="95%">
<tr><td class="title" width="50%">Who's Online</td><td class="title">Babble Box</td></tr>
<tr><td>{{whosonline}}<br /><br /></td>
<td><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></td></tr>
</table>
</td></tr>
</table>
THEVERYENDOFYOU;
?>

367
towns.php Normal file
View File

@ -0,0 +1,367 @@
<?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.
global $userrow, $numqueries;
$townquery = doquery("SELECT name,innprice FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
$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 (isset($_POST["submit"])) {
$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");
$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.";
} elseif (isset($_POST["cancel"])) {
header("Location: index.php"); die();
} else {
$title = "Inn";
$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 .= "<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 .= "</form>\n";
}
display($page, $title);
}
function buy() { // Displays a list of available items for purchase.
global $userrow, $numqueries;
$townquery = doquery("SELECT name,itemslist FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
$townrow = mysql_fetch_array($townquery);
$itemslist = explode(",",$townrow["itemslist"]);
$querystring = "";
foreach($itemslist as $a=>$b) {
$querystring .= "id='$b' OR ";
}
$querystring = rtrim($querystring, " OR ");
$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 .= "<table width=\"80%\">\n";
while ($itemsrow = mysql_fetch_array($itemsquery)) {
if ($itemsrow["type"] == 1) { $attrib = "Attack Power:"; } else { $attrib = "Defense Power:"; }
$page .= "<tr><td width=\"4%\">";
if ($itemsrow["type"] == 1) { $page .= "<img src=\"images/icon_weapon.gif\" alt=\"weapon\" /></td>"; }
if ($itemsrow["type"] == 2) { $page .= "<img src=\"images/icon_armor.gif\" alt=\"armor\" /></td>"; }
if ($itemsrow["type"] == 3) { $page .= "<img src=\"images/icon_shield.gif\" alt=\"shield\" /></td>"; }
if ($userrow["weaponid"] == $itemsrow["id"] || $userrow["armorid"] == $itemsrow["id"] || $userrow["shieldid"] == $itemsrow["id"]) {
$page .= "<td width=\"32%\"><span class=\"light\">".$itemsrow["name"]."</span></td><td width=\"32%\"><span class=\"light\">$attrib ".$itemsrow["attribute"]."</span></td><td width=\"32%\"><span class=\"light\">Already purchased</span></td></tr>\n";
} else {
if ($itemsrow["special"] != "X") { $specialdot = "<span class=\"highlight\">&#42;</span>"; } else { $specialdot = ""; }
$page .= "<td width=\"32%\"><b><a href=\"index.php?do=buy2:".$itemsrow["id"]."\">".$itemsrow["name"]."</a>$specialdot</b></td><td width=\"32%\">$attrib <b>".$itemsrow["attribute"]."</b></td><td width=\"32%\">Price: <b>".$itemsrow["buycost"]." gold</b></td></tr>\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";
$title = "Buy Items";
display($page, $title);
}
function buy2($id) { // Confirm user's intent to purchase item.
global $userrow, $numqueries;
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
$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 ($itemsrow["type"] == 1) {
if ($userrow["weaponid"] != 0) {
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
$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>";
} else {
$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) {
if ($userrow["armorid"] != 0) {
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
$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>";
} else {
$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) {
if ($userrow["shieldid"] != 0) {
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
$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>";
} else {
$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";
display($page, $title);
}
function buy3($id) { // Update user profile with new item & stats.
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
global $userrow;
$itemsquery = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "items");
$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 ($itemsrow["type"] == 1) { // weapon
// Check if they already have an item in the slot.
if ($userrow["weaponid"] != 0) {
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["weaponid"]."' LIMIT 1", "items");
$itemsrow2 = mysql_fetch_array($itemsquery2);
} else {
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
}
// Special item fields.
$specialchange1 = "";
$specialchange2 = "";
if ($itemsrow["special"] != "X") {
$special = explode(",",$itemsrow["special"]);
$tochange = $special[0];
$userrow[$tochange] = $userrow[$tochange] + $special[1];
$specialchange1 = "$tochange='".$userrow[$tochange]."',";
if ($tochange == "strength") { $userrow["attackpower"] += $special[1]; }
if ($tochange == "dexterity") { $userrow["defensepower"] += $special[1]; }
}
if ($itemsrow2["special"] != "X") {
$special2 = explode(",",$itemsrow2["special"]);
$tochange2 = $special2[0];
$userrow[$tochange2] = $userrow[$tochange2] - $special2[1];
$specialchange2 = "$tochange2='".$userrow[$tochange2]."',";
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
}
// New stats.
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
$newattack = $userrow["attackpower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
$newid = $itemsrow["id"];
$newname = $itemsrow["name"];
$userid = $userrow["id"];
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["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
// 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");
} elseif ($itemsrow["type"] == 2) { // Armor
// Check if they already have an item in the slot.
if ($userrow["armorid"] != 0) {
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["armorid"]."' LIMIT 1", "items");
$itemsrow2 = mysql_fetch_array($itemsquery2);
} else {
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
}
// Special item fields.
$specialchange1 = "";
$specialchange2 = "";
if ($itemsrow["special"] != "X") {
$special = explode(",",$itemsrow["special"]);
$tochange = $special[0];
$userrow[$tochange] = $userrow[$tochange] + $special[1];
$specialchange1 = "$tochange='".$userrow[$tochange]."',";
if ($tochange == "strength") { $userrow["attackpower"] += $special[1]; }
if ($tochange == "dexterity") { $userrow["defensepower"] += $special[1]; }
}
if ($itemsrow2["special"] != "X") {
$special2 = explode(",",$itemsrow2["special"]);
$tochange2 = $special2[0];
$userrow[$tochange2] = $userrow[$tochange2] - $special2[1];
$specialchange2 = "$tochange2='".$userrow[$tochange2]."',";
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
}
// New stats.
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
$newid = $itemsrow["id"];
$newname = $itemsrow["name"];
$userid = $userrow["id"];
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["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
// 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");
} elseif ($itemsrow["type"] == 3) { // Shield
// Check if they already have an item in the slot.
if ($userrow["shieldid"] != 0) {
$itemsquery2 = doquery("SELECT * FROM {{table}} WHERE id='".$userrow["shieldid"]."' LIMIT 1", "items");
$itemsrow2 = mysql_fetch_array($itemsquery2);
} else {
$itemsrow2 = array("attribute"=>0,"buycost"=>0,"special"=>"X");
}
// Special item fields.
$specialchange1 = "";
$specialchange2 = "";
if ($itemsrow["special"] != "X") {
$special = explode(",",$itemsrow["special"]);
$tochange = $special[0];
$userrow[$tochange] = $userrow[$tochange] + $special[1];
$specialchange1 = "$tochange='".$userrow[$tochange]."',";
if ($tochange == "strength") { $userrow["attackpower"] += $special[1]; }
if ($tochange == "dexterity") { $userrow["defensepower"] += $special[1]; }
}
if ($itemsrow2["special"] != "X") {
$special2 = explode(",",$itemsrow2["special"]);
$tochange2 = $special2[0];
$userrow[$tochange2] = $userrow[$tochange2] - $special2[1];
$specialchange2 = "$tochange2='".$userrow[$tochange2]."',";
if ($tochange2 == "strength") { $userrow["attackpower"] -= $special2[1]; }
if ($tochange2 == "dexterity") { $userrow["defensepower"] -= $special2[1]; }
}
// New stats.
$newgold = $userrow["gold"] + ceil($itemsrow2["buycost"]/2) - $itemsrow["buycost"];
$newdefense = $userrow["defensepower"] + $itemsrow["attribute"] - $itemsrow2["attribute"];
$newid = $itemsrow["id"];
$newname = $itemsrow["name"];
$userid = $userrow["id"];
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["currenttp"] > $userrow["maxtp"]) { $newtp = $userrow["maxtp"]; } else { $newtp = $userrow["currenttp"]; }
// 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");
}
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.
global $userrow, $numqueries;
$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 .= "Click a town name to purchase its map.<br /><br />\n";
$page .= "<table width=\"90%\">\n";
$townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns");
while ($townrow = mysql_fetch_array($townquery)) {
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 ($mappedtowns[$townrow["id"]] == 0) {
$page .= "<tr><td width=\"25%\"><a href=\"index.php?do=maps2:".$townrow["id"]."\">".$townrow["name"]."</a></td><td width=\"25%\">Price: ".$townrow["mapprice"]." gold</td><td width=\"50%\" colspan=\"2\">Buy map to reveal details.</td></tr>\n";
} 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 .= "</table><br />\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");
}
function maps2($id) { // Confirm user's intent to purchase map.
global $userrow, $numqueries;
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
$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(); }
$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");
}
function maps3($id) { // Add new map to user's profile.
if (isset($_POST["cancel"])) { header("Location: index.php"); die(); }
global $userrow, $numqueries;
$townquery = doquery("SELECT name,mapprice FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
$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(); }
$mappedtowns = explode(",",$userrow["towns"]);
$mappedtowns[$id] = 1;
$mappedtowns = implode(",",$mappedtowns);
$newgold = $userrow["gold"] - $townrow["mapprice"];
$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");
}
function travelto($id, $usepoints=true) { // Send a user to a town from the Travel To menu.
global $userrow, $numqueries;
$townquery = doquery("SELECT name,travelpoints,latitude,longitude FROM {{table}} WHERE id='$id' LIMIT 1", "towns");
$townrow = mysql_fetch_array($townquery);
if ($usepoints==true) {
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();
}
}
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"]; }
$newlat = $townrow["latitude"];
$newlon = $townrow["longitude"];
$newid = $userrow["id"];
// If they got here by exploring, add this town to their map.
$mapped = explode(",",$userrow["towns"]);
if ($mapped[$id] == 0) {
$mapped[$id] = 1;
$mapped = "towns='".implode(",",$mapped)."',";
} else {
$mapped = "";
}
$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>.";
display($page, "Travel To");
}
?>

99
users.php Normal file
View File

@ -0,0 +1,99 @@
<?php // users.php :: Handles user account functions.
include('lib.php');
$link = opendb();
if (isset($_GET["do"])) {
$do = $_GET["do"];
if ($do == "register") { register(); }
}
function register() { // Register a new account.
$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);
if (isset($_POST["submit"])) {
extract($_POST);
$errors = 0; $errorlist = "";
// Process username.
if ($username == "") { $errors++; $errorlist .= "Username field is required.<br />"; }
if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.<br />"; } // Thanks to "Carlos Pires" from php.net!
$usernamequery = mysql_query("SELECT username FROM dk_users WHERE username='$username' LIMIT 1");
if (mysql_num_rows($usernamequery) > 0) { $errors++; $errorlist .= "Username already taken - unique username required.<br />"; }
// Process email address.
if ($email1 == "" || $email2 == "") { $errors++; $errorlist .= "Email fields are required.<br />"; }
if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.<br />"; }
if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.<br />"; }
$emailquery = mysql_query("SELECT email FROM dk_users WHERE email='$email1' LIMIT 1");
if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.<br />"; }
// Process password.
if ($password1 != $password2) { $errors++; $errorlist .= "Passwords don't match.<br />"; }
$password = md5($password1);
if ($errors == 0) {
$verifycode = "";
for ($i=0; $i<8; $i++) {
$verifycode .= chr(rand(65,90));
}
$query = doquery("INSERT INTO {{table}} SET id='',regdate=NOW(),verify='$verifycode',username='$username',password='$password',email='$email1',charname='$charname',charclass='$charclass',difficulty='$difficulty'", "users") or die(mysql_error());
//if (sendregmail($email1, $verifycode)) {
$page = "Your account was created successfully.<br /><br />You may now continue to the <a href=\"login.php?do=login\">Log In</a> page and start playing ".$controlrow["gamename"]."!";
//} else {
// $page = "Your account was created successfully.<br /><br />However, there was a problem sending your verification email. Please check with the game administrator to help resolve this problem.<br /><br />You may now continue to the <a href=\"login.php?do=login\">Log In</a> page and start playing ".$controlrow["gamename"]."!";
//}
} else {
$page = "The following error(s) occurred when your account was being made:<br /><span style=\"color:red;\">$errorlist</span><br />Please go back and try again.";
}
} else {
$page = gettemplate("register");
$page = parsetemplate($page, $controlrow);
}
$topnav = "<a href=\"login.php?do=login\"><img src=\"images/button_login.gif\" alt=\"Log In\" border=\"0\" /></a><a href=\"users.php?do=register\"><img src=\"images/button_register.gif\" alt=\"Register\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Help\" border=\"0\" /></a>";
display($page, "Register", false, false, false);
}
function sendregmail($emailaddress, $vercode) {
include('config.php');
extract($appsettings);
$headers = "";
$headers .= "From: $adminname<$adminemail>\n";
$headers .= "X-Sender: <$adminemail>\n";
$headers .= "Return-Path: $adminname<$adminemail>\n";
$headers .= "X-Mailer: PHP\n";
$email = <<<END
You or someone using your email address recently signed up for an account on the $gamename server, located at $gameurl.
This email is sent to verify your registration email. Next time you log into the game, please visit the User Settings page and enter the following code into the Account Verification field:
$vercode
If you were not the person who signed up for the game, please disregard this message. You will not be emailed again.
END;
$status = mail($emailaddress, "$gamename Account Verification", $email, $headers);
return $status;
}
?>