diff --git a/admin/admin.php b/admin/admin.php new file mode 100644 index 0000000..a48585c --- /dev/null +++ b/admin/admin.php @@ -0,0 +1,896 @@ +game 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.

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 phpMyAdmin. Also, you may want to have a copy of the Dragon Knight development kit, available from the Dragon Knight homepage.

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.
"; } + if (($gamesize % 5) != 0) { $errors++; $errorlist .= "Map size must be divisible by five.
"; } + if (!is_numeric($gamesize)) { $errors++; $errorlist .= "Map size must be a number.
"; } + if ($forumtype == 2 && $forumaddress == "") { $errors++; $errorlist .= "You must specify a forum address when using the External setting.
"; } + if ($class1name == "") { $errors++; $errorlist .= "Class 1 name is required.
"; } + if ($class2name == "") { $errors++; $errorlist .= "Class 2 name is required.
"; } + if ($class3name == "") { $errors++; $errorlist .= "Class 3 name is required.
"; } + if ($diff1name == "") { $errors++; $errorlist .= "Difficulty 1 name is required.
"; } + if ($diff2name == "") { $errors++; $errorlist .= "Difficulty 2 name is required.
"; } + if ($diff3name == "") { $errors++; $errorlist .= "Difficulty 3 name is required.
"; } + if ($diff2mod == "") { $errors++; $errorlist .= "Difficulty 2 value is required.
"; } + if ($diff3mod == "") { $errors++; $errorlist .= "Difficulty 3 value is required.
"; } + + 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("Errors:
$errorlist

Please go back and try again.", "Main Settings"); + } + } + + global $controlrow; + +$page = <<Main Settings
+These options control several major settings for the overall game engine.

+
+ + + + + + + + + + + + + + + +
Game Open:
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.
Game Name:
Default is "Dragon Knight". Change this if you want to change to call your game something different.
Map Size:
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.
Forum Type:
'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.
External Forum:
If the above value is set to 'External,' please specify the complete URL to your forums here.
Page Compression:
Enable page compression if it is supported by your server, and this will greatly reduce the amount of bandwidth required by the game.
Class 1 Name:
Class 2 Name:
Class 3 Name:
Difficulty 1 Name:
Difficulty 2 Name:
Difficulty 2 Value:
Default is 1.2. Specify factoral value for medium difficulty here.
Difficulty 3 Name:
Difficulty 3 Value:
Default is 1.5. Specify factoral value for hard difficulty here.
+ +
+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 = "Edit Items
Click an item's name to edit it.

\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { $page .= "\n"; $count = 2; } + else { $page .= "\n"; $count = 1; } + } + if (mysql_num_rows($query) == 0) { $page .= "\n"; } + $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No items found.
"; + display($page, "Edit Items"); + +} + +function edititem($id) { + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } + if ($buycost == "") { $errors++; $errorlist .= "Cost is required.
"; } + if (!is_numeric($buycost)) { $errors++; $errorlist .= "Cost must be a number.
"; } + if ($attribute == "") { $errors++; $errorlist .= "Attribute is required.
"; } + if (!is_numeric($attribute)) { $errors++; $errorlist .= "Attribute must be a number.
"; } + 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("Errors:
$errorlist

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 = <<Edit Items

+
+ + + + + + + +
ID:{{id}}
Name:
Type:
Cost: gold
Attribute:
How much the item adds to total attackpower (weapons) or defensepower (armor/shields).
Special:
Should be either a special code or X to disable. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.
+ +
+Special Codes:
+Special codes can be added in the item's Special field to give it extra user attributes. Special codes are in the format attribute,value. Attribute 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. Value 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 maxhp,50.

+Suggested user fields for special codes:
+maxhp - max hit points
+maxmp - max magic points
+maxtp - max travel points
+goldbonus - gold bonus, in percent
+expbonus - experience bonus, in percent
+strength - strength (which also adds to attackpower)
+dexterity - dexterity (which also adds to defensepower)
+attackpower - total attack power
+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 = "Edit Drops
Click an item's name to edit it.

\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { $page .= "\n"; $count = 2; } + else { $page .= "\n"; $count = 1; } + } + if (mysql_num_rows($query) == 0) { $page .= "\n"; } + $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No items found.
"; + display($page, "Edit Drops"); + +} + +function editdrop($id) { + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } + if ($mlevel == "") { $errors++; $errorlist .= "Monster level is required.
"; } + if (!is_numeric($mlevel)) { $errors++; $errorlist .= "Monster level must be a number.
"; } + if ($attribute1 == "" || $attribute1 == " " || $attribute1 == "X") { $errors++; $errorlist .= "First attribute is required.
"; } + 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("Errors:
$errorlist

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 = <<Edit Drops

+
+ + + + + + +
ID:{{id}}
Name:
Monster Level:
Minimum monster level that will drop this item.
Attribute 1:
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.
Attribute 2:
Should be either a special code or X to disable. Edit this field very carefully because mistakes to formatting or field names can create problems in the game.
+ +
+Special Codes:
+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 attribute,value. Attribute 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. Value 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 maxhp,50.

+Suggested user fields for special codes:
+maxhp - max hit points
+maxmp - max magic points
+maxtp - max travel points
+goldbonus - gold bonus, in percent
+expbonus - experience bonus, in percent
+strength - strength (which also adds to attackpower)
+dexterity - dexterity (which also adds to defensepower)
+attackpower - total attack power
+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 = "Edit Towns
Click an town's name to edit it.

\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { $page .= "\n"; $count = 2; } + else { $page .= "\n"; $count = 1; } + } + if (mysql_num_rows($query) == 0) { $page .= "\n"; } + $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No towns found.
"; + display($page, "Edit Towns"); + +} + +function edittown($id) { + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } + if ($latitude == "") { $errors++; $errorlist .= "Latitude is required.
"; } + if (!is_numeric($latitude)) { $errors++; $errorlist .= "Latitude must be a number.
"; } + if ($longitude == "") { $errors++; $errorlist .= "Longitude is required.
"; } + if (!is_numeric($longitude)) { $errors++; $errorlist .= "Longitude must be a number.
"; } + if ($innprice == "") { $errors++; $errorlist .= "Inn Price is required.
"; } + if (!is_numeric($innprice)) { $errors++; $errorlist .= "Inn Price must be a number.
"; } + if ($mapprice == "") { $errors++; $errorlist .= "Map Price is required.
"; } + if (!is_numeric($mapprice)) { $errors++; $errorlist .= "Map Price must be a number.
"; } + + if ($travelpoints == "") { $errors++; $errorlist .= "Travel Points is required.
"; } + if (!is_numeric($travelpoints)) { $errors++; $errorlist .= "Travel Points must be a number.
"; } + if ($itemslist == "") { $errors++; $errorlist .= "Items List is required.
"; } + + 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("Errors:
$errorlist

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 = <<Edit Towns

+
+ + + + + + + + + +
ID:{{id}}
Name:
Latitude:
Positive or negative integer.
Longitude:
Positive or negative integer.
Inn Price: gold
Map Price: gold
How much it costs to buy the map to this town.
Travel Points:
How many TP are consumed when travelling to this town.
Items List:
Comma-separated list of item ID numbers available for purchase at this town. (Example: 1,2,3,6,9,10,13,20)
+ +
+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 = "Edit Monsters
"; + + if (($controlrow["gamesize"]/5) != $statrow["level"]) { + $page .= "Note: 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.

"; + } else { $page .= "Monster level and map size match. No further actions are required for map compatibility.

"; } + + $page .= "Click an monster's name to edit it.

\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { $page .= "\n"; $count = 2; } + else { $page .= "\n"; $count = 1; } + } + if (mysql_num_rows($query) == 0) { $page .= "\n"; } + $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No towns found.
"; + display($page, "Edit Monster"); + +} + +function editmonster($id) { + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } + if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.
"; } + if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.
"; } + if ($maxdam == "") { $errors++; $errorlist .= "Max Damage is required.
"; } + if (!is_numeric($maxdam)) { $errors++; $errorlist .= "Max Damage must be a number.
"; } + if ($armor == "") { $errors++; $errorlist .= "Armor is required.
"; } + if (!is_numeric($armor)) { $errors++; $errorlist .= "Armor must be a number.
"; } + if ($level == "") { $errors++; $errorlist .= "Monster Level is required.
"; } + if (!is_numeric($level)) { $errors++; $errorlist .= "Monster Level must be a number.
"; } + if ($maxexp == "") { $errors++; $errorlist .= "Max Exp is required.
"; } + if (!is_numeric($maxexp)) { $errors++; $errorlist .= "Max Exp must be a number.
"; } + if ($maxgold == "") { $errors++; $errorlist .= "Max Gold is required.
"; } + if (!is_numeric($maxgold)) { $errors++; $errorlist .= "Max Gold must be a number.
"; } + + 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("Errors:
$errorlist

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 = <<Edit Monsters

+
+ + + + + + + + + + +
ID:{{id}}
Name:
Max Hit Points:
Max Damage:
Compares to player's attackpower.
Armor:
Compares to player's defensepower.
Monster Level:
Determines spawn location and item drops.
Max Experience:
Max experience gained from defeating monster.
Max Gold:
Max gold gained from defeating monster.
Immunity:
Some monsters may not be hurt by certain spells.
+ +
+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 = "Edit Spells
Click an spell's name to edit it.

\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { $page .= "\n"; $count = 2; } + else { $page .= "\n"; $count = 1; } + } + if (mysql_num_rows($query) == 0) { $page .= "\n"; } + $page .= "
".$row["id"]."".$row["name"]."
".$row["id"]."".$row["name"]."
No spells found.
"; + display($page, "Edit Spells"); + +} + +function editspell($id) { + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + if ($name == "") { $errors++; $errorlist .= "Name is required.
"; } + if ($mp == "") { $errors++; $errorlist .= "MP is required.
"; } + if (!is_numeric($mp)) { $errors++; $errorlist .= "MP must be a number.
"; } + if ($attribute == "") { $errors++; $errorlist .= "Attribute is required.
"; } + if (!is_numeric($attribute)) { $errors++; $errorlist .= "Attribute must be a number.
"; } + + 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("Errors:
$errorlist

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 = <<Edit Spells

+
+ + + + + + +
ID:{{id}}
Name:
Magic Points:
MP required to cast spell.
Attribute:
Numeric value of the spell's effect. Ties with type, below.
Type:
- Heal gives player back [attribute] hit points.
- Hurt deals [attribute] damage to monster.
- Sleep keeps monster from attacking ([attribute] is monster's chance out of 15 to stay asleep each turn).
- Uber Attack increases total attack damage by [attribute] percent.
- Uber Defense increases total defense from attack by [attribute] percent.
+ +
+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 .= "\n"; + } + +$page = <<Edit Levels
Select a level number from the dropdown box to edit it.

+
+ + +
+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.
"; } + if ($_POST["1_hp"] == "") { $errors++; $errorlist .= "Class 1 HP is required.
"; } + if ($_POST["1_mp"] == "") { $errors++; $errorlist .= "Class 1 MP is required.
"; } + if ($_POST["1_tp"] == "") { $errors++; $errorlist .= "Class 1 TP is required.
"; } + if ($_POST["1_strength"] == "") { $errors++; $errorlist .= "Class 1 Strength is required.
"; } + if ($_POST["1_dexterity"] == "") { $errors++; $errorlist .= "Class 1 Dexterity is required.
"; } + if ($_POST["1_spells"] == "") { $errors++; $errorlist .= "Class 1 Spells is required.
"; } + if (!is_numeric($_POST["1_exp"])) { $errors++; $errorlist .= "Class 1 Experience must be a number.
"; } + if (!is_numeric($_POST["1_hp"])) { $errors++; $errorlist .= "Class 1 HP must be a number.
"; } + if (!is_numeric($_POST["1_mp"])) { $errors++; $errorlist .= "Class 1 MP must be a number.
"; } + if (!is_numeric($_POST["1_tp"])) { $errors++; $errorlist .= "Class 1 TP must be a number.
"; } + if (!is_numeric($_POST["1_strength"])) { $errors++; $errorlist .= "Class 1 Strength must be a number.
"; } + if (!is_numeric($_POST["1_dexterity"])) { $errors++; $errorlist .= "Class 1 Dexterity must be a number.
"; } + if (!is_numeric($_POST["1_spells"])) { $errors++; $errorlist .= "Class 1 Spells must be a number.
"; } + + if ($_POST["2_exp"] == "") { $errors++; $errorlist .= "Class 2 Experience is required.
"; } + if ($_POST["2_hp"] == "") { $errors++; $errorlist .= "Class 2 HP is required.
"; } + if ($_POST["2_mp"] == "") { $errors++; $errorlist .= "Class 2 MP is required.
"; } + if ($_POST["2_tp"] == "") { $errors++; $errorlist .= "Class 2 TP is required.
"; } + if ($_POST["2_strength"] == "") { $errors++; $errorlist .= "Class 2 Strength is required.
"; } + if ($_POST["2_dexterity"] == "") { $errors++; $errorlist .= "Class 2 Dexterity is required.
"; } + if ($_POST["2_spells"] == "") { $errors++; $errorlist .= "Class 2 Spells is required.
"; } + if (!is_numeric($_POST["2_exp"])) { $errors++; $errorlist .= "Class 2 Experience must be a number.
"; } + if (!is_numeric($_POST["2_hp"])) { $errors++; $errorlist .= "Class 2 HP must be a number.
"; } + if (!is_numeric($_POST["2_mp"])) { $errors++; $errorlist .= "Class 2 MP must be a number.
"; } + if (!is_numeric($_POST["2_tp"])) { $errors++; $errorlist .= "Class 2 TP must be a number.
"; } + if (!is_numeric($_POST["2_strength"])) { $errors++; $errorlist .= "Class 2 Strength must be a number.
"; } + if (!is_numeric($_POST["2_dexterity"])) { $errors++; $errorlist .= "Class 2 Dexterity must be a number.
"; } + if (!is_numeric($_POST["2_spells"])) { $errors++; $errorlist .= "Class 2 Spells must be a number.
"; } + + if ($_POST["3_exp"] == "") { $errors++; $errorlist .= "Class 3 Experience is required.
"; } + if ($_POST["3_hp"] == "") { $errors++; $errorlist .= "Class 3 HP is required.
"; } + if ($_POST["3_mp"] == "") { $errors++; $errorlist .= "Class 3 MP is required.
"; } + if ($_POST["3_tp"] == "") { $errors++; $errorlist .= "Class 3 TP is required.
"; } + if ($_POST["3_strength"] == "") { $errors++; $errorlist .= "Class 3 Strength is required.
"; } + if ($_POST["3_dexterity"] == "") { $errors++; $errorlist .= "Class 3 Dexterity is required.
"; } + if ($_POST["3_spells"] == "") { $errors++; $errorlist .= "Class 3 Spells is required.
"; } + if (!is_numeric($_POST["3_exp"])) { $errors++; $errorlist .= "Class 3 Experience must be a number.
"; } + if (!is_numeric($_POST["3_hp"])) { $errors++; $errorlist .= "Class 3 HP must be a number.
"; } + if (!is_numeric($_POST["3_mp"])) { $errors++; $errorlist .= "Class 3 MP must be a number.
"; } + if (!is_numeric($_POST["3_tp"])) { $errors++; $errorlist .= "Class 3 TP must be a number.
"; } + if (!is_numeric($_POST["3_strength"])) { $errors++; $errorlist .= "Class 3 Strength must be a number.
"; } + if (!is_numeric($_POST["3_dexterity"])) { $errors++; $errorlist .= "Class 3 Dexterity must be a number.
"; } + if (!is_numeric($_POST["3_spells"])) { $errors++; $errorlist .= "Class 3 Spells must be a number.
"; } + + if ($errors == 0) { +$updatequery = <<Errors:
$errorlist

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 = <<Edit Levels

+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.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID:{{id}}
 
$class1name Experience:
$class1name HP:
$class1name MP:
$class1name TP:
$class1name Strength:
$class1name Dexterity:
$class1name Spells:
 
$class2name Experience:
$class2name HP:
$class2name MP:
$class2name TP:
$class2name Strength:
$class2name Dexterity:
$class2name Spells:
 
$class3name Experience:
$class3name HP:
$class3name MP:
$class3name TP:
$class3name Strength:
$class3name Dexterity:
$class3name Spells:
+ +
+END; + + $page = parsetemplate($page, $row); + display($page, "Edit Levels"); + +} + +function users() { + + $query = doquery("SELECT id,username FROM {{table}} ORDER BY id", "users"); + $page = "Edit Users
Click a username to edit the account.

\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { $page .= "\n"; $count = 2; } + else { $page .= "\n"; $count = 1; } + } + if (mysql_num_rows($query) == 0) { $page .= "\n"; } + $page .= "
".$row["id"]."".$row["username"]."
".$row["id"]."".$row["username"]."
No spells found.
"; + display($page, "Edit Users"); + +} + +function edituser($id) { + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + if ($email == "") { $errors++; $errorlist .= "Email is required.
"; } + if ($verify == "") { $errors++; $errorlist .= "Verify is required.
"; } + if ($charname == "") { $errors++; $errorlist .= "Character Name is required.
"; } + if ($authlevel == "") { $errors++; $errorlist .= "Auth Level is required.
"; } + if ($latitude == "") { $errors++; $errorlist .= "Latitude is required.
"; } + if ($longitude == "") { $errors++; $errorlist .= "Longitude is required.
"; } + if ($difficulty == "") { $errors++; $errorlist .= "Difficulty is required.
"; } + if ($charclass == "") { $errors++; $errorlist .= "Character Class is required.
"; } + if ($currentaction == "") { $errors++; $errorlist .= "Current Action is required.
"; } + if ($currentfight == "") { $errors++; $errorlist .= "Current Fight is required.
"; } + + if ($currentmonster == "") { $errors++; $errorlist .= "Current Monster is required.
"; } + if ($currentmonsterhp == "") { $errors++; $errorlist .= "Current Monster HP is required.
"; } + if ($currentmonstersleep == "") { $errors++; $errorlist .= "Current Monster Sleep is required.
"; } + if ($currentmonsterimmune == "") { $errors++; $errorlist .= "Current Monster Immune is required.
"; } + if ($currentuberdamage == "") { $errors++; $errorlist .= "Current Uber Damage is required.
"; } + if ($currentuberdefense == "") { $errors++; $errorlist .= "Current Uber Defense is required.
"; } + if ($currenthp == "") { $errors++; $errorlist .= "Current HP is required.
"; } + if ($currentmp == "") { $errors++; $errorlist .= "Current MP is required.
"; } + if ($currenttp == "") { $errors++; $errorlist .= "Current TP is required.
"; } + if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.
"; } + + if ($maxmp == "") { $errors++; $errorlist .= "Max MP is required.
"; } + if ($maxtp == "") { $errors++; $errorlist .= "Max TP is required.
"; } + if ($level == "") { $errors++; $errorlist .= "Level is required.
"; } + if ($gold == "") { $errors++; $errorlist .= "Gold is required.
"; } + if ($experience == "") { $errors++; $errorlist .= "Experience is required.
"; } + if ($goldbonus == "") { $errors++; $errorlist .= "Gold Bonus is required.
"; } + if ($expbonus == "") { $errors++; $errorlist .= "Experience Bonus is required.
"; } + if ($strength == "") { $errors++; $errorlist .= "Strength is required.
"; } + if ($dexterity == "") { $errors++; $errorlist .= "Dexterity is required.
"; } + if ($attackpower == "") { $errors++; $errorlist .= "Attack Power is required.
"; } + + if ($defensepower == "") { $errors++; $errorlist .= "Defense Power is required.
"; } + if ($weaponid == "") { $errors++; $errorlist .= "Weapon ID is required.
"; } + if ($armorid == "") { $errors++; $errorlist .= "Armor ID is required.
"; } + if ($shieldid == "") { $errors++; $errorlist .= "Shield ID is required.
"; } + if ($slot1id == "") { $errors++; $errorlist .= "Slot 1 ID is required.
"; } + if ($slot2id == "") { $errors++; $errorlist .= "Slot 2 ID is required.
"; } + if ($slot3id == "") { $errors++; $errorlist .= "Slot 3 ID is required.
"; } + if ($weaponname == "") { $errors++; $errorlist .= "Weapon Name is required.
"; } + if ($armorname == "") { $errors++; $errorlist .= "Armor Name is required.
"; } + if ($shieldname == "") { $errors++; $errorlist .= "Shield Name is required.
"; } + + if ($slot1name == "") { $errors++; $errorlist .= "Slot 1 Name is required.
"; } + if ($slot2name == "") { $errors++; $errorlist .= "Slot 2 Name is required.
"; } + if ($slot3name == "") { $errors++; $errorlist .= "Slot 3 Name is required.
"; } + if ($dropcode == "") { $errors++; $errorlist .= "Drop Code is required.
"; } + if ($spells == "") { $errors++; $errorlist .= "Spells is required.
"; } + if ($towns == "") { $errors++; $errorlist .= "Towns is required.
"; } + + if (!is_numeric($authlevel)) { $errors++; $errorlist .= "Auth Level must be a number.
"; } + if (!is_numeric($latitude)) { $errors++; $errorlist .= "Latitude must be a number.
"; } + if (!is_numeric($longitude)) { $errors++; $errorlist .= "Longitude must be a number.
"; } + if (!is_numeric($difficulty)) { $errors++; $errorlist .= "Difficulty must be a number.
"; } + if (!is_numeric($charclass)) { $errors++; $errorlist .= "Character Class must be a number.
"; } + if (!is_numeric($currentfight)) { $errors++; $errorlist .= "Current Fight must be a number.
"; } + if (!is_numeric($currentmonster)) { $errors++; $errorlist .= "Current Monster must be a number.
"; } + if (!is_numeric($currentmonsterhp)) { $errors++; $errorlist .= "Current Monster HP must be a number.
"; } + if (!is_numeric($currentmonstersleep)) { $errors++; $errorlist .= "Current Monster Sleep must be a number.
"; } + + if (!is_numeric($currentmonsterimmune)) { $errors++; $errorlist .= "Current Monster Immune must be a number.
"; } + if (!is_numeric($currentuberdamage)) { $errors++; $errorlist .= "Current Uber Damage must be a number.
"; } + if (!is_numeric($currentuberdefense)) { $errors++; $errorlist .= "Current Uber Defense must be a number.
"; } + if (!is_numeric($currenthp)) { $errors++; $errorlist .= "Current HP must be a number.
"; } + if (!is_numeric($currentmp)) { $errors++; $errorlist .= "Current MP must be a number.
"; } + if (!is_numeric($currenttp)) { $errors++; $errorlist .= "Current TP must be a number.
"; } + if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.
"; } + if (!is_numeric($maxmp)) { $errors++; $errorlist .= "Max MP must be a number.
"; } + if (!is_numeric($maxtp)) { $errors++; $errorlist .= "Max TP must be a number.
"; } + if (!is_numeric($level)) { $errors++; $errorlist .= "Level must be a number.
"; } + + if (!is_numeric($gold)) { $errors++; $errorlist .= "Gold must be a number.
"; } + if (!is_numeric($experience)) { $errors++; $errorlist .= "Experience must be a number.
"; } + if (!is_numeric($goldbonus)) { $errors++; $errorlist .= "Gold Bonus must be a number.
"; } + if (!is_numeric($expbonus)) { $errors++; $errorlist .= "Experience Bonus must be a number.
"; } + if (!is_numeric($strength)) { $errors++; $errorlist .= "Strength must be a number.
"; } + if (!is_numeric($dexterity)) { $errors++; $errorlist .= "Dexterity must be a number.
"; } + if (!is_numeric($attackpower)) { $errors++; $errorlist .= "Attack Power must be a number.
"; } + if (!is_numeric($defensepower)) { $errors++; $errorlist .= "Defense Power must be a number.
"; } + if (!is_numeric($weaponid)) { $errors++; $errorlist .= "Weapon ID must be a number.
"; } + if (!is_numeric($armorid)) { $errors++; $errorlist .= "Armor ID must be a number.
"; } + + if (!is_numeric($shieldid)) { $errors++; $errorlist .= "Shield ID must be a number.
"; } + if (!is_numeric($slot1id)) { $errors++; $errorlist .= "Slot 1 ID must be a number.
"; } + if (!is_numeric($slot2id)) { $errors++; $errorlist .= "Slot 2 ID must be a number.
"; } + if (!is_numeric($slot3id)) { $errors++; $errorlist .= "Slot 3 ID must be a number.
"; } + if (!is_numeric($dropcode)) { $errors++; $errorlist .= "Drop Code must be a number.
"; } + + if ($errors == 0) { +$updatequery = <<Errors:
$errorlist

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 = <<Edit Users

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID:{{id}}
Username:{{username}}
Email:
Verify:
Character Name:
Register Date:{{regdate}}
Last Online:{{onlinetime}}
Auth Level:
 
Latitude:
Longitude:
Difficulty:
Character Class:
 
Current Action:
Current Fight:
Current Monster:
Current Monster HP:
Current Monster Sleep:
Current Monster Immune:
Current Uber Damage:
Current Uber Defense:
 
Current HP:
Current MP:
Current TP:
Max HP:
Max MP:
Max TP:
 
Level:
Gold:
Experience:
Gold Bonus:
Experience Bonus:
Strength:
Dexterity:
Attack Power:
Defense Power:
 
Weapon ID:
Armor ID:
Shield ID:
Slot 1 ID:
Slot 2 ID:
Slot 3 ID:
Weapon Name:
Armor Name:
Shield Name:
Slot 1 Name:
Slot 2 Name:
Slot 3 Name:
 
Drop Code:
Spells:
Towns:
+ +
+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.
"; } + + if ($errors == 0) { + $query = doquery("INSERT INTO {{table}} SET id='',postdate=NOW(),content='$content'", "news"); + display("News post added.","Add News"); + } else { + display("Errors:
$errorlist

Please go back and try again.", "Add News"); + } + + } + +$page = <<Add A News Post

+
+Type your post below and then click Submit to add it.
+
+ +
+END; + + display($page, "Add News"); + +} + +?> \ No newline at end of file diff --git a/admin/install.php b/admin/install.php new file mode 100644 index 0000000..d4ae6dd --- /dev/null +++ b/admin/install.php @@ -0,0 +1,589 @@ +"; + +mysql_query("INSERT INTO '$prefix_babble' VALUES (1, '12:00:00', 'Test', 'First babble.')") or die(mysql_error()); +echo "Populated Babblebox table.
"; + +$query2 = <<"; + +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.
"; + +$query3 = <<"; + +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.
"; + +$query4 = <<"; + +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.
"; + +$query5 = <<"; + +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.
"; + +$query6 = <<"; + +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.
"; + +$query7 = <<"; + +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.
"; + +$query8 = <<"; + +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.
"; + +$query9 = <<"; + +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.
"; + +$query10 = <<"; + +echo "INSTALL COMPLETE."; + +} + +?> \ No newline at end of file diff --git a/admin/lib.php b/admin/lib.php new file mode 100644 index 0000000..cc67674 --- /dev/null +++ b/admin/lib.php @@ -0,0 +1,147 @@ + $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[] = "/<$tag>/i"; + $PATTERNS[] = "/<\/$tag>/i"; + $REPLACEMENTS[] = "<$tag>"; + $REPLACEMENTS[] = ""; + } + } + + $result = str_replace(array(">", "<", "\"", "'"), + array(">", "<", """, "'"), + $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 = "\n" + . "\n" + . "\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(); + +} + +?> \ No newline at end of file diff --git a/config.php b/config.php new file mode 100644 index 0000000..70a431e --- /dev/null +++ b/config.php @@ -0,0 +1,16 @@ + "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 = ""; + +?> \ No newline at end of file diff --git a/explore.php b/explore.php new file mode 100644 index 0000000..252ee96 --- /dev/null +++ b/explore.php @@ -0,0 +1,37 @@ + $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"); + +} + +?> \ No newline at end of file diff --git a/fight.php b/fight.php new file mode 100644 index 0000000..1fe141a --- /dev/null +++ b/fight.php @@ -0,0 +1,531 @@ +".$spellrow["name"]."\n"; + } + } + if ($pagearray["magiclist"] == "") { $pagearray["magiclist"] = "\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!

"; + $pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "

"; + $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.
"; + } else { + $pagearray["monsterturn"] .= "The monster is still asleep.
"; + } + } + 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.
"; + $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.

"; + $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!
"; } + $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.
"; + $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.

"; + $userrow["currentmonsterhp"] -= $monsterdamage; + $pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "

"; + 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.
"; + } else { + $pagearray["monsterturn"] .= "The monster is still asleep.
"; + } + } + 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.
"; + $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.

"; + $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.

"; + } 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.

"; + } else { + $pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.

"; + } + $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.

"; + } else { + $pagearray["yourturn"] = "You have cast the ".$newspellrow["name"]." spell, but the monster is immune to it.

"; + } + $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.

"; + } 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.

"; + } + + $pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "

"; + 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.
"; + } else { + $pagearray["monsterturn"] .= "The monster is still asleep.
"; + } + } + 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.
"; + $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.

"; + $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!

"; + $pagearray["monsterhp"] = "Monster's HP: " . $userrow["currentmonsterhp"] . "

"; + $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.
"; + } else { + $pagearray["monsterturn"] .= "The monster is still asleep.
"; + } + } + 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.
"; + $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.

"; + $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"] . "

"; + $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; + $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"] = "You have died.

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.

You may now continue back to town, 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.
"; + } else { $spelltext = ""; $newspell=""; } + + $page = "Congratulations. You have defeated the ".$monsterrow["name"].".
You gain $exp experience.
You gain $gold gold.

You have gained a level!

You gain ".$levelrow[$userrow["charclass"]."_hp"]." hit points.
You gain ".$levelrow[$userrow["charclass"]."_mp"]." magic points.
You gain ".$levelrow[$userrow["charclass"]."_tp"]." travel points.
You gain ".$levelrow[$userrow["charclass"]."_strength"]." strength.
You gain ".$levelrow[$userrow["charclass"]."_dexterity"]." dexterity.
$spelltext
You can now continue exploring."; + $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"].".
You gain $exp experience.
You gain $gold gold.

"; + + 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. Click here to reveal and equip the item, or you may also move on and continue exploring."; + } else { + $dropcode = ""; + $page .= "You can now continue exploring."; + } + + $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 exploring."; + 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: ".$droprow["name"]."

"; + $page .= "This item has the following attribute(s):
"; + + $attribute1 = explode(",",$droprow["attribute1"]); + $page .= $attributearray[$attribute1[0]]; + if ($attribute1[1] > 0) { $page .= " +" . $attribute1[1] . "
"; } else { $page .= $attribute1[1] . "
"; } + + if ($droprow["attribute2"] != "X") { + $attribute2 = explode(",",$droprow["attribute2"]); + $page .= $attributearray[$attribute2[0]]; + if ($attribute2[1] > 0) { $page .= " +" . $attribute2[1] . "
"; } else { $page .= $attribute2[1] . "
"; } + } + + $page .= "
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 .= "
"; + $page .= "You may also choose to just continue exploring and give up this item."; + + display($page, "Item Drop"); + +} + + +function dead() { + + $page = "You have died.

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.

You may now continue back to town, and we hope you fair better next time."; + +} + + + +?> \ No newline at end of file diff --git a/forum.php b/forum.php new file mode 100644 index 0000000..9f748de --- /dev/null +++ b/forum.php @@ -0,0 +1,97 @@ +\n"; + $count = 1; + if (mysql_num_rows($query) == 0) { + $page .= "\n"; + } else { + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { + $page .= "\n"; + $count = 2; + } else { + $page .= "\n"; + $count = 1; + } + } + } + $page .= "
New Thread
ThreadRepliesLast Post
No threads in forum.
".$row["title"]."".$row["replies"]."".$row["newpostdate"]."
".$row["title"]."".$row["replies"]."".$row["newpostdate"]."
"; + + 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 = "
\n"; + $count = 1; + while ($row = mysql_fetch_array($query)) { + if ($count == 1) { + $page .= "\n"; + $count = 2; + } else { + $page .= "\n"; + $count = 1; + } + } + $page .= "
Forum :: ".$row2["title"]."
".$row["author"]."

".prettyforumdate($row["postdate"])."
".nl2br($row["content"])."
".$row["author"]."

".prettyforumdate($row["postdate"])."
".nl2br($row["content"])."

"; + $page .= "
Reply To This Thread:

"; + + 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 = "
Make A New Post:

Title:


Message:


"; + display($page, "Forum"); + +} + +?> \ No newline at end of file diff --git a/heal.php b/heal.php new file mode 100644 index 0000000..d569f6c --- /dev/null +++ b/heal.php @@ -0,0 +1,29 @@ +exploring.", "Healing Spell"); + die(); + +} + +?> \ No newline at end of file diff --git a/help/help.php b/help/help.php new file mode 100644 index 0000000..9d2f13f --- /dev/null +++ b/help/help.php @@ -0,0 +1,323 @@ + + + + + +<? echo $controlrow["gamename"]; ?> Help + + + + +

Help

+[ Return to the game ] + +


+ +

Table of Contents

+ + +
+ +

Introduction

+Firstly, I'd like to say thank you for playing my game. The Dragon Knight 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, Dragon +Warrior. 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 Dragon Warrior and other RPGs of old.

+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.

+If you are a site administrator, and would like to install a copy of DK on your own server, you may visit the +development site for Dragon Knight. This page +includes the downloadable game souce code, as well as some other resources that developers and administrators may +find valuable.

+Once again, thanks for playing!

+Jamin Seven
+Dragon Knight creator
+My Homepage
+Dragon Knight Homepage

+[ Top ] + +


+ +

Character Classes

+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.

+ +
    +
  • Fast level-ups +
  • High hit points +
  • High magic points +
  • Low strength +
  • Low dexterity +
  • 5 heal spells +
  • 5 hurt spells +
  • 3 sleep spells +
  • 3 +defense spells +
  • 0 +attack spells +
+ +
    +
  • Medium level-ups +
  • Medium hit points +
  • Low magic points +
  • High strength +
  • Low dexterity +
  • 3 heal spells +
  • 3 hurt spells +
  • 2 sleep spells +
  • 3 +defense spells +
  • 3 +attack spells +
+ +
    +
  • Slow level-ups +
  • Medium hit points +
  • Medium magic points +
  • Low strength +
  • High dexterity +
  • 4 heal spells +
  • 4 hurt spells +
  • 3 sleep spells +
  • 2 +defense spells +
  • 2 +attack spells +
+[ Top ] + +


+ +

Difficulty Levels

+ 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. +
    +
  • " . $controlrow["diff1mod"] . ""; ?> +
  • " . $controlrow["diff2mod"] . ""; ?> +
  • " . $controlrow["diff3mod"] . ""; ?> +
+[ Top ] + +


+ +

Playing The Game: In Town

+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.

+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.

+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 (*) 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.

+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.

+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.

+[ Top ] + +


+ +

Playing The Game: Exploring & Fighting

+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 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).

+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.

+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.

+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.

+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.

+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.

+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.

+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).

+When the fight is over, you can continue exploring until you find another monster to beat into submission.

+[ Top ] + +


+ +

Playing The Game: Status Panels

+There are two status panels on the game screen: left and right.

+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.

+The right panel displays some character statistics, your inventory, and quick spells.

+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.

+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. +[ Top ] + +


+ +

Spoilers: Items & Drops

+Click here for the Items & Drops spoiler page.

+[ Top ] + +


+ +

Spoilers: Monsters

+Click here for the Monsters spoiler page.

+[ Top ] + +


+ +

Spoilers: Spells

+Click here for the Spells spoiler page.

+[ Top ] + +


+ +

Spoilers: Levels

+Click here for the Levels spoiler page.

+[ Top ] + +


+ +

Credits

+
    +
  • All program code and stock graphics for the game were created by Jamin Seven.

    +
  • 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.

    +
  • Super monkey love goes to Enix and the developers of Dragon Warrior. If it weren't for you guys, my game never would have been made.

    +
  • Mega props go to Dalez from GameFAQs for his DW3 experience chart, which was where I got my experience levels from.

    +
  • Mad crazy ninja love goes to the following people for help and support throughout the development process:

    +Ideas: (whether they got used or not) +
      +
    • kushet +
    • lghtning +
    • Ebolamonkey3000 +
    • Crimson Scythe +
    • SilDeath +

    +Beta Testing: (forums name if applicable, character name otherwise) +
      +
    • Ebolamonkey3000 +
    • lisi +
    • Junglist +
    • Crimson Scythe +
    • Sk8erpunk69 +
    • lghtning +
    • kushet +
    • SilDeath +
    • lowrider4life +
    • dubiin +
    • Sam Wise The Great +

    +
  • Apologies and lots of happy naked love to anyone I forgot.

    +
  • And of course, thanks to you for playing my game!

    +
  • NINJA! +
+[ Top ] + +



+ +Please visit the following sites for more information:
+Se7enet (Jamin's homepage)
+Dragon Knight (official DK homepage)
+Forums (official DK forums)

+All original coding and graphics for the Dragon Knight game engine are © 2003-2004 by Jamin Seven.

+[ Top ] +

+ + + + + \ No newline at end of file diff --git a/help/items.php b/help/items.php new file mode 100644 index 0000000..f8f9d62 --- /dev/null +++ b/help/items.php @@ -0,0 +1,155 @@ + + + + + +<? echo $controlrow["gamename"]; ?> Help + + + + +

Help: Items & Drops

+[ Return to Help | Return to the game ] + +


+ + + + + 0) { $stat = "+" . $special[1]; } else { $stat = $special[1]; } + $bigspecial = "$attr $stat"; + } else { $bigspecial = "None"; } + echo "\n"; +} +?> +
Items
TypeNameCostAttributeSpecial
\"$image\"".$itemsrow["name"]."".$itemsrow["buycost"]." Gold".$itemsrow["attribute"]." $power Power$bigspecial
+
+
+ + + + 0) { $stat1 = "+" . $special1[1]; } else { $stat1 = $special1[1]; } + $bigspecial1 = "$attr1 $stat1"; + } else { $bigspecial1 = "None"; } + 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 = "None"; } + echo "\n"; +} +?> +
Drops
NameMonster LevelAttribute 1Attribute 2
".$itemsrow["name"]."".$itemsrow["mlevel"]."$bigspecial1$bigspecial2
+
+ + + + + \ No newline at end of file diff --git a/help/levels.php b/help/levels.php new file mode 100644 index 0000000..15c1d39 --- /dev/null +++ b/help/levels.php @@ -0,0 +1,141 @@ + + + + + +<? echo $controlrow["gamename"]; ?> Help + + + + +

Help: Levels

+[ Return to Help | Return to the game ] + +


+ + + + +None"; } + if ($itemsrow["id"] != 100) { echo "\n"; } +} +?> +
Levels
LevelExp.HPMPTPStrengthDexteritySpell
".$itemsrow["id"]."".number_format($itemsrow["1_exp"])."".$itemsrow["1_hp"]."".$itemsrow["1_mp"]."".$itemsrow["1_tp"]."".$itemsrow["1_strength"]."".$itemsrow["1_dexterity"]."$spell
+

+ + + +None"; } + if ($itemsrow["id"] != 100) { echo "\n"; } +} +?> +
Levels
LevelExp.HPMPTPStrengthDexteritySpell
".$itemsrow["id"]."".number_format($itemsrow["2_exp"])."".$itemsrow["2_hp"]."".$itemsrow["2_mp"]."".$itemsrow["2_tp"]."".$itemsrow["2_strength"]."".$itemsrow["2_dexterity"]."$spell
+

+ + + +None"; } + if ($itemsrow["id"] != 100) { echo "\n"; } +} +?> +
Levels
LevelExp.HPMPTPStrengthDexteritySpell
".$itemsrow["id"]."".number_format($itemsrow["3_exp"])."".$itemsrow["3_hp"]."".$itemsrow["3_mp"]."".$itemsrow["3_tp"]."".$itemsrow["3_strength"]."".$itemsrow["3_dexterity"]."$spell
+
+Experience points listed are total values up until that point. All other values are just the new amount that you gain for each level. +

+ + + + + \ No newline at end of file diff --git a/help/monsters.php b/help/monsters.php new file mode 100644 index 0000000..896f3fe --- /dev/null +++ b/help/monsters.php @@ -0,0 +1,96 @@ + + + + + +<? echo $controlrow["gamename"]; ?> Help + + + + +

Help: Monsters

+[ Return to Help | Return to the game ] + +


+ + + + +None"; } elseif ($itemsrow["immune"] == 1) { $immune = "Hurt"; } else { $immune = "Hurt & Sleep"; } + echo "\n"; +} +?> +
Monsters
NameMax HPMax DamageArmorLevelMax Exp.Max GoldImmunity
".$itemsrow["name"]."".$itemsrow["maxhp"]."".$itemsrow["maxdam"]."".$itemsrow["armor"]."".$itemsrow["level"]."".$itemsrow["maxexp"]."".$itemsrow["maxgold"]."$immune
+
+ + + + + \ No newline at end of file diff --git a/help/spells.php b/help/spells.php new file mode 100644 index 0000000..4b2e891 --- /dev/null +++ b/help/spells.php @@ -0,0 +1,106 @@ + + + + + +<? echo $controlrow["gamename"]; ?> Help + + + + +

Help: Spells

+[ Return to Help | Return to the game ] + +


+ + + + +\n"; +} +?> +
Spells
NameCostTypeAttribute
".$itemsrow["name"]."".$itemsrow["mp"]."$type".$itemsrow["attribute"]."
+
    +
  • Heal spells always give you the maximum amount possible, until your current HP is full. +
  • Hurt spells deal X damage (not always the maximum) to the monster, regardless of the monster's armor. +
  • Sleep spells put the monster to sleep. The monster has an X in 15 chance of remaining asleep each turn. +
  • +Damage spells increase your total attack damage by X percent until the end of the fight. +
  • +Defense spells reduce the total damage you take from the monster by X percent until the end of each fight. +
+ + + + + \ No newline at end of file diff --git a/images/background.gif b/images/background.gif new file mode 100644 index 0000000..6024b97 Binary files /dev/null and b/images/background.gif differ diff --git a/images/background.jpg b/images/background.jpg new file mode 100644 index 0000000..b4bd6cd Binary files /dev/null and b/images/background.jpg differ diff --git a/images/bars_green.gif b/images/bars_green.gif new file mode 100644 index 0000000..32349da Binary files /dev/null and b/images/bars_green.gif differ diff --git a/images/bars_red.gif b/images/bars_red.gif new file mode 100644 index 0000000..c92630d Binary files /dev/null and b/images/bars_red.gif differ diff --git a/images/bars_yellow.gif b/images/bars_yellow.gif new file mode 100644 index 0000000..628ecae Binary files /dev/null and b/images/bars_yellow.gif differ diff --git a/images/button_character.gif b/images/button_character.gif new file mode 100644 index 0000000..4f2ad5d Binary files /dev/null and b/images/button_character.gif differ diff --git a/images/button_fastspells.gif b/images/button_fastspells.gif new file mode 100644 index 0000000..6b7f276 Binary files /dev/null and b/images/button_fastspells.gif differ diff --git a/images/button_functions.gif b/images/button_functions.gif new file mode 100644 index 0000000..fc89266 Binary files /dev/null and b/images/button_functions.gif differ diff --git a/images/button_help.gif b/images/button_help.gif new file mode 100644 index 0000000..b108da7 Binary files /dev/null and b/images/button_help.gif differ diff --git a/images/button_inventory.gif b/images/button_inventory.gif new file mode 100644 index 0000000..da49874 Binary files /dev/null and b/images/button_inventory.gif differ diff --git a/images/button_location.gif b/images/button_location.gif new file mode 100644 index 0000000..0dbe494 Binary files /dev/null and b/images/button_location.gif differ diff --git a/images/button_login.gif b/images/button_login.gif new file mode 100644 index 0000000..89c612a Binary files /dev/null and b/images/button_login.gif differ diff --git a/images/button_logout.gif b/images/button_logout.gif new file mode 100644 index 0000000..c2343c5 Binary files /dev/null and b/images/button_logout.gif differ diff --git a/images/button_register.gif b/images/button_register.gif new file mode 100644 index 0000000..e635590 Binary files /dev/null and b/images/button_register.gif differ diff --git a/images/button_shoutbox.gif b/images/button_shoutbox.gif new file mode 100644 index 0000000..4180f8e Binary files /dev/null and b/images/button_shoutbox.gif differ diff --git a/images/button_spells.gif b/images/button_spells.gif new file mode 100644 index 0000000..7946150 Binary files /dev/null and b/images/button_spells.gif differ diff --git a/images/button_status.gif b/images/button_status.gif new file mode 100644 index 0000000..eb77375 Binary files /dev/null and b/images/button_status.gif differ diff --git a/images/button_towns.gif b/images/button_towns.gif new file mode 100644 index 0000000..8080ee2 Binary files /dev/null and b/images/button_towns.gif differ diff --git a/images/compass_01.gif b/images/compass_01.gif new file mode 100644 index 0000000..b10ff4d Binary files /dev/null and b/images/compass_01.gif differ diff --git a/images/compass_02.gif b/images/compass_02.gif new file mode 100644 index 0000000..27eb65f Binary files /dev/null and b/images/compass_02.gif differ diff --git a/images/compass_03.gif b/images/compass_03.gif new file mode 100644 index 0000000..5bec95f Binary files /dev/null and b/images/compass_03.gif differ diff --git a/images/compass_04.gif b/images/compass_04.gif new file mode 100644 index 0000000..0bcc342 Binary files /dev/null and b/images/compass_04.gif differ diff --git a/images/dkforumsbutton.gif b/images/dkforumsbutton.gif new file mode 100644 index 0000000..c0afd40 Binary files /dev/null and b/images/dkforumsbutton.gif differ diff --git a/images/help_exploring.jpg b/images/help_exploring.jpg new file mode 100644 index 0000000..c96fd72 Binary files /dev/null and b/images/help_exploring.jpg differ diff --git a/images/help_fighting.jpg b/images/help_fighting.jpg new file mode 100644 index 0000000..829dd5c Binary files /dev/null and b/images/help_fighting.jpg differ diff --git a/images/icon_armor.gif b/images/icon_armor.gif new file mode 100644 index 0000000..c00f854 Binary files /dev/null and b/images/icon_armor.gif differ diff --git a/images/icon_shield.gif b/images/icon_shield.gif new file mode 100644 index 0000000..27270d1 Binary files /dev/null and b/images/icon_shield.gif differ diff --git a/images/icon_weapon.gif b/images/icon_weapon.gif new file mode 100644 index 0000000..0e6db0b Binary files /dev/null and b/images/icon_weapon.gif differ diff --git a/images/logo.gif b/images/logo.gif new file mode 100644 index 0000000..7468262 Binary files /dev/null and b/images/logo.gif differ diff --git a/images/title_exploring.gif b/images/title_exploring.gif new file mode 100644 index 0000000..362f864 Binary files /dev/null and b/images/title_exploring.gif differ diff --git a/images/title_fighting.gif b/images/title_fighting.gif new file mode 100644 index 0000000..c0ced2c Binary files /dev/null and b/images/title_fighting.gif differ diff --git a/images/town_1.gif b/images/town_1.gif new file mode 100644 index 0000000..8ea7af3 Binary files /dev/null and b/images/town_1.gif differ diff --git a/images/town_2.gif b/images/town_2.gif new file mode 100644 index 0000000..46d3824 Binary files /dev/null and b/images/town_2.gif differ diff --git a/images/town_3.gif b/images/town_3.gif new file mode 100644 index 0000000..ea68f94 Binary files /dev/null and b/images/town_3.gif differ diff --git a/images/town_4.gif b/images/town_4.gif new file mode 100644 index 0000000..f58edb6 Binary files /dev/null and b/images/town_4.gif differ diff --git a/images/town_5.gif b/images/town_5.gif new file mode 100644 index 0000000..623bbdc Binary files /dev/null and b/images/town_5.gif differ diff --git a/images/town_6.gif b/images/town_6.gif new file mode 100644 index 0000000..b1118a4 Binary files /dev/null and b/images/town_6.gif differ diff --git a/images/town_7.gif b/images/town_7.gif new file mode 100644 index 0000000..7ee30fd Binary files /dev/null and b/images/town_7.gif differ diff --git a/images/town_8.gif b/images/town_8.gif new file mode 100644 index 0000000..f00aee9 Binary files /dev/null and b/images/town_8.gif differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..6e54306 --- /dev/null +++ b/index.php @@ -0,0 +1,271 @@ +[".prettydate($newsrow["postdate"])."]
".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 " . mysql_num_rows($onlinequery) . " user(s) online within the last 10 minutes: "; + while ($onlinerow = mysql_fetch_array($onlinequery)) { $townrow["whosonline"] .= "".$onlinerow["charname"]."" . ", "; } + $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 = << +Exploring + +You are exploring the map, and nothing has happened. Continue exploring using the direction buttons or the Travel To menus. + + +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"] = "(+".$userrow["expbonus"]."%)"; + } elseif ($userrow["expbonus"] < 0) { + $userrow["plusexp"] = "(".$userrow["expbonus"]."%)"; + } else { $userrow["plusexp"] = ""; } + if ($userrow["goldbonus"] > 0) { + $userrow["plusgold"] = "(+".$userrow["goldbonus"]."%)"; + } elseif ($userrow["goldbonus"] < 0) { + $userrow["plusgold"] = "(".$userrow["goldbonus"]."%)"; + } 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"] . "
"; + } + } + if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; } + + // Make page tags for XHTML validation. + $xml = "\n" + . "\n" + . "\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"] = "(+".$userrow["expbonus"]."%)"; + } elseif ($userrow["expbonus"] < 0) { + $userrow["plusexp"] = "(".$userrow["expbonus"]."%)"; + } else { $userrow["plusexp"] = ""; } + if ($userrow["goldbonus"] > 0) { + $userrow["plusgold"] = "(+".$userrow["goldbonus"]."%)"; + } elseif ($userrow["goldbonus"] < 0) { + $userrow["plusgold"] = "(".$userrow["goldbonus"]."%)"; + } 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"] . "
"; + } + } + if ($userrow["magiclist"] == "") { $userrow["magiclist"] = "None"; } + + // Make page tags for XHTML validation. + $xml = "\n" + . "\n" + . "\n"; + + $charsheet = gettemplate("onlinechar"); + $page = parsetemplate($charsheet, $userrow); + display($page, "Character Information"); + +} + +function showmap() { + + global $userrow; + + // Make page tags for XHTML validation. + $xml = "\n" + . "\n" + . "\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"] .= "
[".$babblerow["author"]."] ".$babblerow["babble"]."
\n"; $bg = 2; } + else { $babblebox["content"] .= "
[".$babblerow["author"]."] ".stripslashes($babblerow["babble"])."
\n"; $bg = 1; } + } + $babblebox["content"] .= "

"; + + // Make page tags for XHTML validation. + $xml = "\n" + . "\n" + . "\n"; + $page = $xml . gettemplate("babblebox"); + echo parsetemplate($page, $babblebox); + die(); + +} + +function ninja() { + header("Location: http://www.se7enet.com/img/shirtninja.jpg"); +} + +?> \ No newline at end of file diff --git a/install.php b/install.php new file mode 100644 index 0000000..8ec40ca --- /dev/null +++ b/install.php @@ -0,0 +1,779 @@ + + +Dragon Knight Installation + + +Dragon Knight Installation: Page One

+NOTE: 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.

+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.

+You have two options for database setup: complete or partial. +
    +
  • Complete Setup includes table structure and all default data (items, drops, monsters, levels, spells, towns) - after complete setup, the game is totally ready to run. +
  • Partial Setup 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. +
+Click the appropriate button below for your preferred installation method.

+
+
- OR -
+
+ + +END; +echo $page; +die(); + +} + +function second() { // Second page - set up the database tables. + + global $dbsettings; + echo "Dragon Knight InstallationDragon Knight Installation: Page Two

"; + $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 = <<"; } else { echo "Error creating Babble Box table."; } +unset($query); + +$query = <<"; } else { echo "Error creating Control table."; } +unset($query); + +$query = <<"; } else { echo "Error populating Control table."; } +unset($query); + +$query = <<"; } else { echo "Error creating Drops table."; } +unset($query); + +if ($full == true) { +$query = <<"; } else { echo "Error populating Drops table."; } +unset($query); +} + +$query = <<"; } else { echo "Error creating Forum table."; } +unset($query); + +$query = <<"; } else { echo "Error creating Items table."; } +unset($query); + +if ($full == true) { +$query = <<"; } else { echo "Error populating Items table."; } +unset($query); +} + +$query = <<"; } else { echo "Error creating Levels table."; } +unset($query); + +if ($full == true) { +$query = <<"; } else { echo "Error populating Levels table."; } +unset($query); +} + +$query = <<"; } else { echo "Error creating Monsters table."; } +unset($query); + +if ($full == true) { +$query = <<"; } else { echo "Error populating Monsters table."; } +unset($query); +} + +$query = <<"; } else { echo "Error creating News table."; } +unset($query); + +$query = <<"; } else { echo "Error populating News table."; } +unset($query); + +$query = <<"; } else { echo "Error creating Spells table."; } +unset($query); + +if ($full == true) { +$query = <<"; } else { echo "Error populating Spells table."; } +unset($query); +} + +$query = <<"; } else { echo "Error creating Towns table."; } +unset($query); + +if ($full == true) { +$query = <<"; } else { echo "Error populating Towns table."; } +unset($query); +} + +$query = <<"; } else { echo "Error creating Users table."; } +unset($query); + + global $start; + $time = round((getmicrotime() - $start), 4); + echo "
Database setup complete in $time seconds.

Click here to continue with installation."; + die(); + +} + +function third() { // Third page: gather user info for admin account. + +$page = << + +Dragon Knight Installation + + +Dragon Knight Installation: Page Three

+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.

+
+ + + + + + + + + + +
Username:


Password:
Verify Password:


Email Address:
Verify Email:


Character Name:
Character Class:
Difficulty:
+
+ + +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 = << + +Dragon Knight Installation + + +Dragon Knight Installation: Page Four

+Your admin account was created successfully. Installation is complete.

+Be sure to delete install.php from your Dragon Knight directory for security purposes.

+You are now ready to play the game. 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.

+Thank you for using Dragon Knight! + + +END; + + echo $page; + die(); + +} + +?> \ No newline at end of file diff --git a/lib.php b/lib.php new file mode 100644 index 0000000..5508d56 --- /dev/null +++ b/lib.php @@ -0,0 +1,213 @@ + $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[] = "/<$tag>/i"; + $PATTERNS[] = "/<\/$tag>/i"; + $REPLACEMENTS[] = "<$tag>"; + $REPLACEMENTS[] = ""; + } + } + + $result = str_replace(array(">", "<", "\"", "'"), + array(">", "<", """, "'"), + $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 = "\n" + . "\n" + . "\n"; + + $template = gettemplate("primary"); + + if ($rightnav == true) { $rightnav = gettemplate("rightnav"); } else { $rightnav = ""; } + if ($leftnav == true) { $leftnav = gettemplate("leftnav"); } else { $leftnav = ""; } + if ($topnav == true) { + $topnav = "\"Log \"Help\""; + } else { + $topnav = "\"Log \"Register\" \"Help\""; + } + + 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 ".$townrow["name"].".

"; + } else { + $userrow["currenttown"] = ""; + } + + if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; } + elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "Forum
"; } + elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "Forum
"; } + + // 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"] = "Admin
"; } 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 = "\n"; + $stattable .= "
\n"; + $stattable .= "
\n"; + if ($stathp >= 66) { $stattable .= "
\"\"
"; } + if ($stathp < 66 && $stathp >= 33) { $stattable .= "
\"\"
"; } + if ($stathp < 33) { $stattable .= "
\"\"
"; } + $stattable .= "
\n"; + $stattable .= "
\n"; + if ($statmp >= 66) { $stattable .= "
\"\"
"; } + if ($statmp < 66 && $statmp >= 33) { $stattable .= "
\"\"
"; } + if ($statmp < 33) { $stattable .= "
\"\"
"; } + $stattable .= "
\n"; + $stattable .= "
\n"; + if ($stattp >= 66) { $stattable .= "
\"\"
"; } + if ($stattp < 66 && $stattp >= 33) { $stattable .= "
\"\"
"; } + if ($stattp < 33) { $stattable .= "
\"\"
"; } + $stattable .= "
HPMPTP
\n"; + $userrow["statbars"] = $stattable; + + // Now make numbers stand out if they're low. + if ($userrow["currenthp"] <= ($userrow["maxhp"]/5)) { $userrow["currenthp"] = "*".$userrow["currenthp"]."*"; } + if ($userrow["currentmp"] <= ($userrow["maxmp"]/5)) { $userrow["currentmp"] = "*".$userrow["currentmp"]."*"; } + + $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"] .= "".$spellrow["name"]."
"; + } + } + 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"] .= "".$townrow2["name"]."
\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(); + +} + +?> \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..a7905f8 --- /dev/null +++ b/login.php @@ -0,0 +1,72 @@ + \ No newline at end of file diff --git a/templates/admin.php b/templates/admin.php new file mode 100644 index 0000000..bec5ff9 --- /dev/null +++ b/templates/admin.php @@ -0,0 +1,78 @@ + +{{title}} + + +
+ +
+DK Administration

+Links:
+Admin Home
+Game Home

+Primary Data:
+Main Settings
+Add News Post
+Edit Users

+Game Data:
+Edit Items
+Edit Drops
+Edit Towns
+Edit Monsters
+Edit Levels
+Edit Spells
+
+{{content}} +
+
+ + + + +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/babblebox.php b/templates/babblebox.php new file mode 100644 index 0000000..b0d5df1 --- /dev/null +++ b/templates/babblebox.php @@ -0,0 +1,34 @@ + +shoutbox + + + +{{content}} + + +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/fight.php b/templates/fight.php new file mode 100644 index 0000000..ac049be --- /dev/null +++ b/templates/fight.php @@ -0,0 +1,14 @@ + + + + +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/leftnav.php b/templates/leftnav.php new file mode 100644 index 0000000..4f13737 --- /dev/null +++ b/templates/leftnav.php @@ -0,0 +1,38 @@ + +Location + +Currently: {{currentaction}}
+Latitude: {{latitude}}
+Longitude: {{longitude}}

+
+
+
+
+ +
+
+ +
+ + + + +
Towns
+{{currenttown}} +Travel To:
+{{townslist}} +

+ + + + +
Functions
+{{forumslink}} +{{adminlink}} +Log Out
+Help +

+THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/login.php b/templates/login.php new file mode 100644 index 0000000..0663509 --- /dev/null +++ b/templates/login.php @@ -0,0 +1,13 @@ + + + + + + + +
Username:
Password:
Remember me? Yes
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.

Want to play? You gotta register your own character.
+ +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/minimal.php b/templates/minimal.php new file mode 100644 index 0000000..520e44f --- /dev/null +++ b/templates/minimal.php @@ -0,0 +1,68 @@ + +{{title}} + + +
+{{content}} +
+ +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/onlinechar.php b/templates/onlinechar.php new file mode 100644 index 0000000..e9763ca --- /dev/null +++ b/templates/onlinechar.php @@ -0,0 +1,41 @@ +{{charname}}.

+When you're finished, you may return to town.

+ + + +
Character
+{{charname}}

+ +Difficulty: {{difficulty}}
+Class: {{charclass}}

+ +Level: {{level}}
+Experience: {{experience}}
+Gold: {{gold}}
+Hit Points: {{currenthp}} / {{maxhp}}
+Magic Points: {{currentmp}} / {{maxmp}}
+Travel Points: {{currenttp}} / {{maxtp}}

+ +Strength: {{strength}}
+Dexterity: {{dexterity}}
+Attack Power: {{attackpower}}
+Defense Power: {{defensepower}}
+

+ + + + +
Inventory
+ + + + +
WeaponWeapon: {{weaponname}}
ArmorArmor: {{armorname}}
ShieldShield: {{shieldname}}
+Slot 1: {{slot1name}}
+Slot 2: {{slot2name}}
+Slot 3: {{slot3name}} +

+THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/primary.php b/templates/primary.php new file mode 100644 index 0000000..3d50017 --- /dev/null +++ b/templates/primary.php @@ -0,0 +1,86 @@ + +{{title}} + + + +
+ + + + + + + +
+
{{dkgamename}}{{topnav}}
+
{{leftnav}}{{content}}{{rightnav}}

+ + + +
+ +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/register.php b/templates/register.php new file mode 100644 index 0000000..b4534f1 --- /dev/null +++ b/templates/register.php @@ -0,0 +1,18 @@ + + + + + + + + + + + + +
Username:


Password:
Verify Password:


Email Address:
Verify Email:


Character Name:
Character Class:
Difficulty:
See Help for more information about character classes and difficulty levels.

+ +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/rightnav.php b/templates/rightnav.php new file mode 100644 index 0000000..f6f422b --- /dev/null +++ b/templates/rightnav.php @@ -0,0 +1,39 @@ + +Character + +{{charname}}
+Level: {{level}}
+Exp: {{experience}}
+Gold: {{gold}}
+HP: {{currenthp}}
+MP: {{currentmp}}
+TP: {{currenttp}}
+{{statbars}}
+Extended Stats + +
+ + + + +
Inventory
+ + + + +
WeaponWeapon: {{weaponname}}
ArmorArmor: {{armorname}}
ShieldShield: {{shieldname}}
+Slot 1: {{slot1name}}
+Slot 2: {{slot2name}}
+Slot 3: {{slot3name}} +

+ + + + +
Fast Spells
+{{magiclist}} +

+THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/showchar.php b/templates/showchar.php new file mode 100644 index 0000000..8eb4418 --- /dev/null +++ b/templates/showchar.php @@ -0,0 +1,47 @@ + +Character + +{{charname}}

+ +Difficulty: {{difficulty}}
+Class: {{charclass}}

+ +Level: {{level}}
+Experience: {{experience}} {{plusexp}}
+Next Level: {{nextlevel}}
+Gold: {{gold}} {{plusgold}}
+Hit Points: {{currenthp}} / {{maxhp}}
+Magic Points: {{currentmp}} / {{maxmp}}
+Travel Points: {{currenttp}} / {{maxtp}}

+ +Strength: {{strength}}
+Dexterity: {{dexterity}}
+Attack Power: {{attackpower}}
+Defense Power: {{defensepower}}
+ +
+ + + + +
Inventory
+ + + + +
WeaponWeapon: {{weaponname}}
ArmorArmor: {{armorname}}
ShieldShield: {{shieldname}}
+Slot 1: {{slot1name}}
+Slot 2: {{slot2name}}
+Slot 3: {{slot3name}} +

+ + + + +
Spells
+{{magiclist}} +

+THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/templates/towns.php b/templates/towns.php new file mode 100644 index 0000000..6b39f0c --- /dev/null +++ b/templates/towns.php @@ -0,0 +1,27 @@ + +Welcome to {{name}} + +Town Options:
+ + +
+ + + +
Latest News
{{news}}
+
+ + + + +
Who's OnlineBabble Box
{{whosonline}}

+ + +THEVERYENDOFYOU; +?> \ No newline at end of file diff --git a/towns.php b/towns.php new file mode 100644 index 0000000..9980c55 --- /dev/null +++ b/towns.php @@ -0,0 +1,367 @@ +
You may return to town, 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.

You may return to town, 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.

\n"; + $page .= "A night's sleep at this Inn will cost you " . $townrow["innprice"] . " gold. Is that ok?

\n"; + $page .= "
\n"; + $page .= " \n"; + $page .= "
\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.

Click an item name to purchase it.

The following items are available at this town:

\n"; + $page .= "\n"; + while ($itemsrow = mysql_fetch_array($itemsquery)) { + if ($itemsrow["type"] == 1) { $attrib = "Attack Power:"; } else { $attrib = "Defense Power:"; } + $page .= ""; } + if ($itemsrow["type"] == 2) { $page .= "\"armor\""; } + if ($itemsrow["type"] == 3) { $page .= "\"shield\""; } + if ($userrow["weaponid"] == $itemsrow["id"] || $userrow["armorid"] == $itemsrow["id"] || $userrow["shieldid"] == $itemsrow["id"]) { + $page .= "\n"; + } else { + if ($itemsrow["special"] != "X") { $specialdot = "*"; } else { $specialdot = ""; } + $page .= "\n"; + } + } + $page .= "
"; + if ($itemsrow["type"] == 1) { $page .= "\"weapon\"".$itemsrow["name"]."$attrib ".$itemsrow["attribute"]."Already purchased
".$itemsrow["name"]."$specialdot$attrib ".$itemsrow["attribute"]."Price: ".$itemsrow["buycost"]." gold

\n"; + $page .= "If you've changed your mind, you may also return back to town.\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.

You may return to town, store, 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?

"; + } else { + $page = "You are buying the ".$itemsrow["name"].", is that ok?

"; + } + } 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?

"; + } else { + $page = "You are buying the ".$itemsrow["name"].", is that ok?

"; + } + } 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?

"; + } else { + $page = "You are buying the ".$itemsrow["name"].", is that ok?

"; + } + } + + $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.

You may return to town, store, 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.

You may return to town, store, 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.

\n"; + $page .= "Click a town name to purchase its map.

\n"; + $page .= "\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 .= "\n"; + } else { + $page .= "\n"; + } + + } + + $page .= "
".$townrow["name"]."Price: ".$townrow["mapprice"]." goldBuy map to reveal details.
".$townrow["name"]."Already mapped.Location: $latitude $longitudeTP: ".$townrow["travelpoints"]."

\n"; + $page .= "If you've changed your mind, you may also return back to town.\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.

You may return to town, store, 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?

"; + + 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.

You may return to town, store, 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.

You may return to town, store, 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. Click here 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 enter this town."; + display($page, "Travel To"); + +} + + +?> \ No newline at end of file diff --git a/users.php b/users.php new file mode 100644 index 0000000..af33a7c --- /dev/null +++ b/users.php @@ -0,0 +1,99 @@ +"; } + if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.
"; } // 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.
"; } + + // Process email address. + if ($email1 == "" || $email2 == "") { $errors++; $errorlist .= "Email fields are required.
"; } + if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.
"; } + if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.
"; } + $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.
"; } + + // Process password. + if ($password1 != $password2) { $errors++; $errorlist .= "Passwords don't match.
"; } + $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.

You may now continue to the Log In page and start playing ".$controlrow["gamename"]."!"; + //} else { + // $page = "Your account was created successfully.

However, there was a problem sending your verification email. Please check with the game administrator to help resolve this problem.

You may now continue to the Log In page and start playing ".$controlrow["gamename"]."!"; + //} + + } else { + + $page = "The following error(s) occurred when your account was being made:
$errorlist
Please go back and try again."; + + } + + } else { + + $page = gettemplate("register"); + $page = parsetemplate($page, $controlrow); + + } + + $topnav = "\"Log\"Register\"\"Help\""; + 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 = << \ No newline at end of file