diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..1a8a231 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,140 @@ +DRAGON SCOURGE +Changelog + +***** BETA TWO ***** +12.10.2005 - Build 12 (Eggs): +- Members can now leave the Guild without requiring an officer to demote them to zero. +- Rank 5 members can now edit/update Guild settings. +- # of Members is now set to 1 when a Guild is created, and updated correctly when an application is approved. +- The Guild founder is now notified via the Post Office when someone applies to join. +- Members can now arbitrarily deposit money to the Guild bank. +- You can no longer send guild money to yourself. Checks and balances, man! +- Fixed image format selection so that it actually works. +- Removed Language selection from account registration/settings. + +12.02.2005 - Build 11 (Chopsticks): +- Added guilds/clans. +- Fixed bug with 0 or 1 shouts. +- Removed an unused table row from extended profile. +- Users can now select PNG or GIF formats for item/monster images in their Account Settings. +- Added $controlrow option to enable/disable item/monster images (setting up for the Premium/Standard versions). +- New set of item images in town (to replace the ones I stole from Diablo II). +- Items in town are now created based on min/max levels for the town, instead of the user's exact level. +- Greatly expanded the list of base items. +- Fighting now has chances for excellent hit (double damage) and monster dodging (zero damage). + + +***** BETA ONE ***** + +11.10.2005 - Build 10 (Fingers): +- Map image has now been replaced with a fully dynamic Flash movie to prevent cache issues. +- Babblebox now refreshes itself every 45 seconds. + +11.07.2005 - Build 09 (Billiards): +- Fixed spell return bug that would cause SQL errors in PVP. +- Removed hard-coded avatar image sizes. +- Fixed the "death by 0hp monster" bug. +- Fixed reply bug in the Post Office. +- Post Office should now check for sent gold AND postage when calculating for the error message. +- Entering pvp.php and ending up in the dowait() function properly shows fightrow variables. +- Monsters no longer have magic defense. (This is for balance testing. Some monsters will still end up with some eventually.) + +11.02.2005 - Build 08 (Magic): +- Spending level points now increments current hp/mp as well as max hp/mp. +- Improved error handling in users.php. +- Character creation screen now properly displays max avatar filesize. +- Challenging for duels is now moved to town.php, so that pvp.php can *never* run without a valid currentpvp number in $userrow. +- You no longer get stranded in the duel screen if the other player declines the challenge. +- You can no longer challenge yourself (or any other character on your account) to a duel. +- The "No" button on the Inn screen now works properly. +- Removed "jewel" slot from onlinechar, since jewels are not currently implemented. +- Shields and helmets now display properly in profile and onlinechar. +- $controlrow is now properly retrieved while a user is not logged in. +- Hall of Fame experience points are now run through number_format(). +- Fixed addslashes_deep() to actually add slashes, instead of strip them. + +10.24.2005 - Build 07 (Lucky): +- Increased error checking to prevent pvp.php from running without the proper variables in place. +- Closed up travel/map loophole that lets you jump to places without owning the map. +- Fixed a possible error in an empty Post Office outbox. +- All "Please go back and try again" error messages now link back to index.php. +- Avatar system changes: + * External avatars are no longer allowed. + * Max avatar size (bytes) is now a changeable controlrow variable. + * Uploading a new avatar now deletes your old one to save server space. + * File extensions are no longer case sensitive. +- Botcheck system changes: + * Closed up loophole that let you keep exploring without verifying the image text. + * Images are now generated with random filenames to prevent old images from showing up. + * Images are now deleted after successful verification. + +10.22.2005 - Build 06 (Courtney): +- Added Spells. +- Added PVP. +- Various minor bugfixes/changes that I can't remember cuz I wasn't updating this as I went along. +- Intra-account money transfers are limited to 10% of the user's gold. +- Increased size of pop-up map. + +***** ALPHA TWO ***** + +5.6.2005 - Build 05 (Lifesavers): +- Added live image map with town/player locations. +- Added Babblebox. +- Added Who's Online. +- Fixed improper table with for IE6. +- Moved the scrollable div tag into the primary template and out of the sub templates. +- Removed a possible infinite loop in the anti-macro function. +- Added "Return to [Town|Game]" links to the templates that were missing them. +- Fixed a problem with the Top 10 list if there was only one character in the game. +- Character names are (once again) limited to alphanumerics, to prevent annoying database issues. (Regex has been altered to allow spaces & hyphens, though.) + +4.23.2005 - Build 04 (Golf): +- Added image-based compass navigation. +- Fights happen slightly less often now (1/5 rather than 1/4). +- Added anti-macro image verification for protection against space robots. + +4.1.2005 - Build 03 (Holy Hand Grenade): +- Fixed problem that prevented users from registering. +- Fixed exploit in the Bank and Post Office that allowed users to withdraw/deposit/send negative numbers. +- Added God Mode cheat: index.php?do=iddqd + +3.29.2005 - Build 02 (Loser): +- Characters are now separated from Accounts, to allow multiple chars (4) on one account. +- Added account settings (changing password/email/language). +- Increased security on POST/GET/COOKIE arrays. +- You can no longer send a Letter to yourself. + +3.28.2005 - Build 01 (Binary): +- Fixed shield/helmet item slot number mixup. +- Fixed rounding problem when applying gold/exp bonuses. +- Fixed Level Points template problem. +- Added the Hall of Fame (Top 10 list). +- Added the Post Office (private messaging + money transfers). + +3.25.2005 - Build 00 (MI5): +- Complete ground-up rewrite. Build numbers reset to 00. Everything is new again. + + +***** ALPHA ONE ***** + +8.2.2004 - Build 23 (johnny): +- Fixed bug that prevented people from buying items. +- Fixed URL cheat that allowed people to buy any item in the game. +- Fixed bug that could cause negative damage to monsters (ie. heal them). + +7.30.2004 - Build 22 (catch): +- Removed dev site link from ?do=version. +- Added changelog link to ?do=version. +- Fixed URL cheat that allowed people to get healed for free. +- Fixed number_format for gold/exp on the charprofile screen. + +7.28.2004 - Build 21 (beer): +- Fixed problem with having occasional monster hp values as decimals instead of integers. +- Language name values are now properly lowercased for storage. +- Added "Not Working Yet" messages for arena/onlinechar/help. +- Fixed a problem with the fight screen showing the wrong player lat/lon values. +- Fixed a problem with users getting stuck off edge of the map. +- Added language indexes for x_submit and x_reset. + +7.19.2004 - Build 20 (pr0n): +- Initial public testing release. \ No newline at end of file diff --git a/config.php b/config.php new file mode 100644 index 0000000..1e30d25 --- /dev/null +++ b/config.php @@ -0,0 +1,11 @@ + "localhost", // MySQL server name. (Usually localhost.) + "user" => "", // MySQL username. + "pass" => "", // MySQL password. + "name" => "", // MySQL database name. + "prefix" => "", // Prefix for table names. + "secretword" => ""); // Secret word used when hashing information for cookies. + +?> \ No newline at end of file diff --git a/cookies.php b/cookies.php new file mode 100644 index 0000000..81c22d7 --- /dev/null +++ b/cookies.php @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/explore.php b/explore.php new file mode 100644 index 0000000..4976697 --- /dev/null +++ b/explore.php @@ -0,0 +1,151 @@ +go back and try again."); + } + } + + // Breakout for towns. + $query = doquery("SELECT * FROM {{table}} WHERE world='".$userrow["world"]."' AND latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns"); + $row = dorow($query); + if ($row != false) { + $townslist = explode(",",$userrow["townslist"]); + if (!in_array($row["id"], $townslist)) { + $userrow["townslist"] .= ",".$row["id"]; + $string .= ", townslist='".$userrow["townslist"]."'"; + } + doquery("UPDATE {{table}} SET currentaction='In Town' $string WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Exploring", parsetemplate(gettemplate("town_enter"), $row)); + } + + // Decide if we want to pick a fight with someone. + if (rand(1,5) == 1 && $userrow["currentaction"] != "In Town") { + doquery("UPDATE {{table}} SET currentaction='Fighting' $string WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + die(header("Location: fight.php")); + } + + // Random check for protection against macro bots. + if ($controlrow["botcheck"] > 0) { + if (rand(1,$controlrow["botcheck"]) == 1) { + botkillah(); + } + } + + // If we've gotten this far, nothing has happened. + $userrow["currentaction"] = "Exploring"; + doquery("UPDATE {{table}} SET currentaction='Exploring' $string WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Exploring", gettemplate("explore")); + +} + +function travel($id) { // Move them with the Travel To list. + + global $userrow, $worldrow; + + if ($userrow["currentpvp"] != 0) { die(header("Location: pvp.php")); } + if ($userrow["currentaction"] == "PVP") { die(header("Location: pvp.php")); } + if ($userrow["currentaction"] == "Fighting") { die(header("Location: fight.php")); } + if ($userrow["exploreverify"] != "") { botkillah(); } + + if (!is_numeric($id)) { err("Invalid action. Please go back and try again."); } + $query = doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "towns"); + $row = dorow($query); + + // Errors. + if ($userrow["currenttp"] < $row["travelpoints"]) { err("You do not have enough Travel Points to travel to this town. Please go back and try again."); } + if ($userrow["world"] != $row["world"]) { err("You can only travel to towns in ".$worldrow["name"].". Please go back and try again."); } + if ($userrow["latitude"] == $row["latitude"] && $userrow["longitude"] == $row["longitude"] && $userrow["world"] == $row["world"]) { err("You are already in ".$row["name"].". You do not need to travel there.

Click here to return to the main town screen."); } + $townslist = explode(",",$userrow["townslist"]); + if (!in_array($id,$townslist)) { err("You have not purchased the map to this town. Please go back and try again."); } + + // Now move them. + $userrow["longitude"] = $row["longitude"]; + $userrow["latitude"] = $row["latitude"]; + $userrow["currenttp"] -= $row["travelpoints"]; + $query = doquery("UPDATE {{table}} SET latitude='".$userrow["latitude"]."', longitude='".$userrow["longitude"]."', currenttp='".$userrow["currenttp"]."', currentaction='In Town' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Exploring", parsetemplate(gettemplate("town_enter"), $row)); + +} + +function botkillah() { // Bust a cap in the asses of macro bots. Word. + + global $userrow; + + if (isset($_POST["submit"])) { + + if (strtoupper($_POST["verify"]) == $userrow["exploreverify"]) { + $query = doquery("UPDATE {{table}} SET exploreverify='',exploreverifyimage='' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + unlink("images/botcheck/".$userrow["exploreverifyimage"]); + die(header("Location: index.php")); + } else { + $query = doquery("UPDATE {{table}} SET explorefailed=explorefailed+1 WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + die(header("Location: index.php?do=humanity")); + } + + } else { + + if ($userrow["exploreverify"] == "") { + + // Thanks to phpNoise for the tutorial on this - http://www.phpnoise.com/tutorials/1/2 + // Image setup. + $im = ImageCreate(200, 40); + $white = ImageColorAllocate($im, 240, 240, 240); + $black = ImageColorAllocate($im, 102, 51, 0); + + // Get us some random text. + $new_string = ""; + for($i=0; $i<6; $i++) { + $new_string .= chr(rand(65,90)); + } + + // Finalize, update userrow & output. + ImageFill($im, 0, 0, $white); + ImageString($im, 5, rand(10,120), rand(5,25), $new_string, $black); + $randomext = ""; + for($i=0; $i<8; $i++) { $randomext .= rand(0,9); } + ImagePNG($im, "images/botcheck/$randomext".".png"); + ImageDestroy($im); + $query = doquery("UPDATE {{table}} SET exploreverify='$new_string',exploreverifyimage='$randomext".".png' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + + $pagerow["exploreverifyimage"] = $randomext.".png"; + + } else { $pagerow["exploreverifyimage"] = $userrow["exploreverifyimage"]; } + + display("Anti-Macro Verification", parsetemplate(gettemplate("explore_verify"),$pagerow)); + + } + +} + +?> \ No newline at end of file diff --git a/extras/install.sql b/extras/install.sql new file mode 100644 index 0000000..10e55ee --- /dev/null +++ b/extras/install.sql @@ -0,0 +1,866 @@ +-- phpMyAdmin SQL Dump +-- version 2.6.0-pl3 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Dec 10, 2005 at 03:15 PM +-- Server version: 4.1.14 +-- PHP Version: 5.0.5 +-- +-- Database: `scourge2` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_accounts` +-- + +CREATE TABLE `sx_accounts` ( + `id` int(10) unsigned NOT NULL auto_increment, + `username` varchar(30) NOT NULL default '', + `password` varchar(32) NOT NULL default '', + `emailaddress` varchar(50) NOT NULL default '', + `verifycode` varchar(8) NOT NULL default '', + `regdate` datetime NOT NULL default '0000-00-00 00:00:00', + `regip` varchar(16) NOT NULL default '', + `authlevel` tinyint(3) unsigned NOT NULL default '1', + `language` varchar(30) NOT NULL default '', + `characters` tinyint(3) unsigned NOT NULL default '0', + `activechar` int(10) unsigned NOT NULL default '0', + `imageformat` varchar(4) NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_babblebox` +-- + +CREATE TABLE `sx_babblebox` ( + `id` int(11) unsigned NOT NULL auto_increment, + `posttime` datetime NOT NULL default '0000-00-00 00:00:00', + `charname` varchar(30) NOT NULL default '', + `charid` int(11) unsigned NOT NULL default '0', + `content` varchar(255) NOT NULL default '', + `guild` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_babblebox` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_classes` +-- + +CREATE TABLE `sx_classes` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `expbonus` tinyint(3) unsigned NOT NULL default '0', + `goldbonus` tinyint(3) unsigned NOT NULL default '0', + `damageperstrength` float unsigned NOT NULL default '0', + `hpperdexterity` float unsigned NOT NULL default '0', + `mpperenergy` float unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_classes` +-- + +INSERT INTO `sx_classes` VALUES (1, 'Barbarian', 0, 0, 2, 1.5, 1); +INSERT INTO `sx_classes` VALUES (2, 'Sorceress', 0, 0, 1, 1.5, 2); +INSERT INTO `sx_classes` VALUES (3, 'Paladin', 0, 0, 1.5, 2, 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_control` +-- + +CREATE TABLE `sx_control` ( + `id` tinyint(3) unsigned NOT NULL auto_increment, + `gamename` varchar(50) NOT NULL default '', + `gameopen` tinyint(3) unsigned NOT NULL default '0', + `gamepath` varchar(200) NOT NULL default '', + `forumtype` tinyint(3) unsigned NOT NULL default '0', + `forumurl` varchar(200) NOT NULL default '', + `avatarpath` varchar(200) NOT NULL default '', + `avatarurl` varchar(200) NOT NULL default '', + `avatarmaxsize` int(10) unsigned NOT NULL default '0', + `showshout` tinyint(3) unsigned NOT NULL default '0', + `showonline` tinyint(3) unsigned NOT NULL default '0', + `shownews` tinyint(3) unsigned NOT NULL default '0', + `showimages` tinyint(3) unsigned NOT NULL default '0', + `verifyemail` tinyint(3) unsigned NOT NULL default '0', + `compression` tinyint(3) unsigned NOT NULL default '0', + `debug` tinyint(3) unsigned NOT NULL default '0', + `logerrors` tinyint(3) unsigned NOT NULL default '0', + `botcheck` tinyint(3) unsigned NOT NULL default '0', + `pvprefresh` int(10) NOT NULL default '0', + `pvptimeout` int(10) NOT NULL default '0', + `guildstartup` int(10) unsigned NOT NULL default '100000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_control` +-- + +INSERT INTO `sx_control` VALUES (1, 'Dragon Scourge', 1, 'd:\\server\\docroot\\scourge\\', 1, 'http://se7enet.com/ubbthreads/ubbthreads.php', 'd:\\server\\docroot\\scourge\\images\\users\\', 'http://localhost/scourge/images/users/', 15000, 1, 1, 1, 1, 0, 1, 1, 1, 100, 15, 600, 100000); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_difficulties` +-- + +CREATE TABLE `sx_difficulties` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `expbonus` tinyint(3) unsigned NOT NULL default '0', + `goldbonus` tinyint(3) unsigned NOT NULL default '0', + `multiplier` float NOT NULL default '0', + `deathpenalty` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_difficulties` +-- + +INSERT INTO `sx_difficulties` VALUES (1, 'Easy', 0, 0, 1, 0); +INSERT INTO `sx_difficulties` VALUES (2, 'Medium', 3, 3, 1.5, 3); +INSERT INTO `sx_difficulties` VALUES (3, 'Hard', 5, 5, 2, 7); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_guildapps` +-- + +CREATE TABLE `sx_guildapps` ( + `id` int(10) unsigned NOT NULL auto_increment, + `guild` int(10) unsigned NOT NULL default '0', + `charid` int(10) unsigned NOT NULL default '0', + `charname` varchar(30) NOT NULL default '', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_guildapps` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_guilds` +-- + +CREATE TABLE `sx_guilds` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `tagline` varchar(4) NOT NULL default '', + `color1` varchar(7) NOT NULL default '', + `color2` varchar(7) NOT NULL default '', + `members` int(10) unsigned NOT NULL default '0', + `founder` int(10) unsigned NOT NULL default '0', + `bank` int(10) unsigned NOT NULL default '0', + `joincost` int(10) unsigned NOT NULL default '0', + `image` varchar(30) NOT NULL default '', + `rank1` varchar(30) NOT NULL default '', + `rank2` varchar(30) NOT NULL default '', + `rank3` varchar(30) NOT NULL default '', + `rank4` varchar(30) NOT NULL default '', + `rank5` varchar(30) NOT NULL default '', + `isactive` tinyint(3) unsigned NOT NULL default '0', + `statement` text NOT NULL, + `news` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_guilds` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_itembase` +-- + +CREATE TABLE `sx_itembase` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `slotnumber` tinyint(3) unsigned NOT NULL default '0', + `unique` tinyint(3) unsigned NOT NULL default '0', + `willdrop` tinyint(3) unsigned NOT NULL default '0', + `buycost` int(10) unsigned NOT NULL default '0', + `sellcost` int(10) unsigned NOT NULL default '0', + `reqlevel` smallint(5) unsigned NOT NULL default '0', + `reqstrength` smallint(5) unsigned NOT NULL default '0', + `reqdexterity` smallint(5) unsigned NOT NULL default '0', + `reqenergy` smallint(5) unsigned NOT NULL default '0', + `basename` varchar(50) NOT NULL default '', + `baseattr` smallint(5) unsigned NOT NULL default '0', + `mod1name` varchar(50) NOT NULL default '', + `mod1attr` smallint(5) unsigned NOT NULL default '0', + `mod2name` varchar(50) NOT NULL default '', + `mod2attr` smallint(5) unsigned NOT NULL default '0', + `mod3name` varchar(50) NOT NULL default '', + `mod3attr` smallint(5) unsigned NOT NULL default '0', + `mod4name` varchar(50) NOT NULL default '', + `mod4attr` smallint(5) unsigned NOT NULL default '0', + `mod5name` varchar(50) NOT NULL default '', + `mod5attr` smallint(5) unsigned NOT NULL default '0', + `mod6name` varchar(50) NOT NULL default '', + `mod6attr` smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_itembase` +-- + +INSERT INTO `sx_itembase` VALUES (1, 'Pointy Stick', 1, 0, 1, 10, 5, 1, 0, 0, 0, 'physattack', 3, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (2, 'Big Stick', 1, 0, 1, 15, 8, 1, 0, 0, 0, 'physattack', 4, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (3, 'Dagger', 1, 0, 1, 20, 10, 1, 0, 0, 0, 'physattack', 5, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (4, 'Hand Axe', 1, 0, 1, 30, 15, 1, 0, 0, 0, 'physattack', 7, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (5, 'Leg Bone', 1, 0, 1, 40, 20, 1, 0, 0, 0, 'physattack', 8, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (6, 'Dirk', 1, 0, 1, 60, 30, 3, 10, 0, 0, 'physattack', 10, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (7, 'Small Axe', 1, 0, 1, 80, 40, 3, 10, 0, 0, 'physattack', 11, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (8, 'Club', 1, 0, 1, 110, 55, 3, 15, 0, 0, 'physattack', 12, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (9, 'Kris', 1, 0, 1, 140, 70, 3, 15, 0, 0, 'physattack', 15, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (10, 'Light Axe', 1, 0, 1, 180, 90, 5, 20, 0, 0, 'physattack', 18, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (11, 'Spiked Club', 1, 0, 1, 220, 110, 5, 20, 0, 0, 'physattack', 20, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (12, 'Cudgel', 1, 0, 1, 270, 135, 5, 25, 0, 0, 'physattack', 23, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (13, 'Stiletto', 1, 0, 1, 330, 165, 7, 25, 0, 0, 'physattack', 25, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (14, 'Pick Axe', 1, 0, 1, 400, 200, 9, 30, 0, 0, 'physattack', 30, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (15, 'Nailed Club', 1, 0, 1, 480, 240, 11, 30, 0, 0, 'physattack', 30, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (16, 'Cutlass', 1, 0, 1, 570, 285, 13, 35, 0, 0, 'physattack', 35, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (17, 'Bayonet', 1, 0, 1, 670, 335, 15, 35, 0, 0, 'physattack', 38, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (18, 'Tomahawk', 1, 0, 1, 800, 400, 17, 40, 0, 0, 'physattack', 40, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (19, 'Light Mace', 1, 0, 1, 950, 475, 19, 40, 0, 0, 'physattack', 43, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (20, 'Falchion', 1, 0, 1, 1200, 600, 21, 45, 0, 0, 'physattack', 45, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (21, 'Foil', 1, 0, 1, 1400, 700, 23, 50, 0, 0, 'physattack', 48, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (22, 'Short Sword', 1, 0, 1, 1600, 800, 25, 50, 0, 0, 'physattack', 50, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (23, 'Double Axe', 1, 0, 1, 1900, 950, 27, 60, 0, 0, 'physattack', 55, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (24, 'Mace', 1, 0, 1, 2300, 1150, 29, 60, 0, 0, 'physattack', 60, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (25, 'Scimitar', 1, 0, 1, 2800, 1400, 31, 70, 0, 0, 'physattack', 65, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (26, 'Bardiche', 1, 0, 1, 3400, 1700, 33, 70, 0, 0, 'physattack', 70, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (27, 'Knobbed Mace', 1, 0, 1, 4100, 2050, 35, 80, 0, 0, 'physattack', 75, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (28, 'Rapier', 1, 0, 1, 4900, 2450, 37, 90, 0, 0, 'physattack', 85, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (29, 'Morning Star', 1, 0, 1, 5800, 2900, 39, 100, 0, 0, 'physattack', 95, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (30, 'Battle Axe', 1, 0, 1, 6800, 3400, 41, 110, 0, 0, 'physattack', 105, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (31, 'Saber', 1, 0, 1, 7800, 3900, 43, 120, 0, 0, 'physattack', 115, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (32, 'Francisca', 1, 0, 1, 9000, 4500, 45, 130, 0, 0, 'physattack', 125, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (33, 'Flanged Mace', 1, 0, 1, 10000, 5000, 47, 140, 0, 0, 'physattack', 135, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (34, 'Broadsword', 1, 0, 1, 11000, 5500, 49, 150, 0, 0, 'physattack', 145, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (35, 'War Axe', 1, 0, 1, 12500, 6250, 51, 165, 0, 0, 'physattack', 155, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (36, 'Trench Mace', 1, 0, 1, 14000, 7000, 53, 180, 0, 0, 'physattack', 165, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (37, 'Long Sword', 1, 0, 1, 15500, 7750, 55, 195, 0, 0, 'physattack', 180, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (38, 'Broad Axe', 1, 0, 1, 17000, 8500, 57, 210, 0, 0, 'physattack', 195, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (39, 'Flail', 1, 0, 1, 18500, 9250, 59, 225, 0, 0, 'physattack', 210, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (40, 'Claymore', 1, 0, 1, 20000, 10000, 61, 240, 0, 0, 'physattack', 225, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (41, 'Poleaxe', 1, 0, 1, 21500, 10750, 63, 255, 0, 0, 'physattack', 240, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (42, 'War Hammer', 1, 0, 1, 23000, 11500, 65, 270, 0, 0, 'physattack', 255, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (43, 'Katana', 1, 0, 1, 24500, 12250, 67, 285, 0, 0, 'physattack', 270, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (44, 'Scythe', 1, 0, 1, 26000, 13000, 69, 300, 0, 0, 'physattack', 280, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (45, 'Zweihander', 1, 0, 1, 27500, 13750, 71, 315, 0, 0, 'physattack', 295, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (46, 'Halberd', 1, 0, 1, 29000, 14500, 73, 330, 0, 0, 'physattack', 310, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (47, 'Flamberge', 1, 0, 1, 30000, 15000, 75, 345, 0, 0, 'physattack', 330, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (48, 'Great Axe', 1, 0, 1, 32000, 16000, 77, 360, 0, 0, 'physattack', 345, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (49, 'Great Sword', 1, 0, 1, 34000, 17000, 79, 375, 0, 0, 'physattack', 360, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (50, 'Giant Axe', 1, 0, 1, 36000, 18000, 81, 390, 0, 0, 'physattack', 380, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (51, 'Giant Maul', 1, 0, 1, 38000, 19000, 83, 405, 0, 0, 'physattack', 400, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (52, 'Skivvies', 2, 0, 1, 20, 10, 1, 0, 0, 0, 'physdefense', 2, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (53, 'Cloak', 2, 0, 1, 30, 15, 1, 0, 0, 0, 'physdefense', 3, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (54, 'Cloth Armor', 2, 0, 1, 40, 20, 1, 0, 0, 0, 'physdefense', 3, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (55, 'Quilted Coat', 2, 0, 1, 50, 25, 1, 0, 0, 0, 'physdefense', 5, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (56, 'Quilted Armor', 2, 0, 1, 70, 35, 1, 0, 0, 0, 'physdefense', 5, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (57, 'Leather Coat', 2, 0, 1, 90, 45, 3, 5, 6, 0, 'physdefense', 6, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (58, 'Leather Hauberk', 2, 0, 1, 110, 55, 3, 5, 6, 0, 'physdefense', 7, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (59, 'Leather Coat', 2, 0, 1, 150, 75, 3, 8, 10, 0, 'physdefense', 8, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (60, 'Hard Leather Armor', 2, 0, 1, 190, 95, 3, 8, 10, 0, 'physdefense', 9, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (61, 'Riveted Leather Armor', 2, 0, 1, 230, 115, 5, 10, 12, 0, 'physdefense', 11, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (62, 'Spiked Leather Armor', 2, 0, 1, 270, 135, 5, 10, 12, 0, 'physdefense', 12, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (63, 'Light Chain Mail', 2, 0, 1, 310, 155, 5, 13, 16, 0, 'physdefense', 14, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (64, 'Heavy Chain Mail', 2, 0, 1, 360, 180, 7, 13, 16, 0, 'physdefense', 15, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (65, 'Chain Mail Shirt', 2, 0, 1, 420, 210, 9, 15, 18, 0, 'physdefense', 18, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (66, 'Chain Mail Hauberk', 2, 0, 1, 500, 250, 11, 15, 18, 0, 'physdefense', 18, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (67, 'Full Chain Mail', 2, 0, 1, 580, 290, 13, 18, 22, 0, 'physdefense', 21, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (68, 'Light Plate Mail', 2, 0, 1, 680, 340, 15, 18, 22, 0, 'physdefense', 23, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (69, 'Heavy Plate Mail', 2, 0, 1, 800, 400, 17, 20, 24, 0, 'physdefense', 24, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (70, 'Plate Mail Shirt', 2, 0, 1, 950, 475, 19, 20, 24, 0, 'physdefense', 26, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (71, 'Plate Mail Hauberk', 2, 0, 1, 1200, 600, 21, 23, 28, 0, 'physdefense', 27, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (72, 'Full Plate Mail', 2, 0, 1, 1500, 750, 23, 25, 30, 0, 'physdefense', 29, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (73, 'Light Scale Mail', 2, 0, 1, 1800, 900, 25, 25, 30, 0, 'physdefense', 30, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (74, 'Heavy Scale Mail', 2, 0, 1, 2400, 1200, 27, 30, 36, 0, 'physdefense', 33, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (75, 'Scale Mail Shirt', 2, 0, 1, 2800, 1400, 29, 30, 36, 0, 'physdefense', 36, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (76, 'Scale Mail Hauberk', 2, 0, 1, 3500, 1750, 31, 35, 42, 0, 'physdefense', 39, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (77, 'Full Scale Mail', 2, 0, 1, 4800, 2400, 33, 35, 42, 0, 'physdefense', 42, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (78, 'Copper Breastplate', 2, 0, 1, 6000, 3000, 35, 40, 48, 0, 'physdefense', 45, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (79, 'Bronze Breastplate', 2, 0, 1, 7500, 3750, 37, 45, 54, 0, 'physdefense', 50, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (80, 'Iron Breastplate', 2, 0, 1, 9000, 4500, 39, 50, 60, 0, 'physdefense', 56, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (81, 'Steel Breastplate', 2, 0, 1, 10500, 5250, 41, 55, 66, 0, 'physdefense', 62, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (82, 'Titanium Breastplate', 2, 0, 1, 12000, 6000, 43, 60, 72, 0, 'physdefense', 68, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (83, 'Copper Field Plate', 2, 0, 1, 14000, 7000, 45, 65, 78, 0, 'physdefense', 74, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (84, 'Bronze Field Plate', 2, 0, 1, 16000, 8000, 47, 70, 84, 0, 'physdefense', 80, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (85, 'Iron Field Plate', 2, 0, 1, 18000, 9000, 49, 75, 90, 0, 'physdefense', 86, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (86, 'Steel Field Plate', 2, 0, 1, 20000, 10000, 51, 83, 100, 0, 'physdefense', 92, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (87, 'Titanium Field Plate', 2, 0, 1, 24000, 12000, 53, 90, 108, 0, 'physdefense', 98, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (88, 'Copper Articulated Plate', 2, 0, 1, 28000, 14000, 55, 98, 118, 0, 'physdefense', 106, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (89, 'Bronze Articulated Plate', 2, 0, 1, 32000, 16000, 57, 105, 126, 0, 'physdefense', 115, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (90, 'Iron Articulated Plate', 2, 0, 1, 36000, 18000, 59, 113, 136, 0, 'physdefense', 124, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (91, 'Steel Articulated Plate', 2, 0, 1, 40000, 20000, 61, 120, 144, 0, 'physdefense', 133, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (92, 'Titanium Articulated Plate', 2, 0, 1, 45000, 22500, 63, 128, 154, 0, 'physdefense', 142, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (93, 'Copper Battle Armor', 2, 0, 1, 50000, 25000, 65, 135, 162, 0, 'physdefense', 150, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (94, 'Bronze Battle Armor', 2, 0, 1, 55000, 27500, 67, 143, 172, 0, 'physdefense', 159, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (95, 'Iron Battle Armor', 2, 0, 1, 60000, 30000, 69, 150, 180, 0, 'physdefense', 165, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (96, 'Steel Battle Armor', 2, 0, 1, 65000, 32500, 71, 158, 190, 0, 'physdefense', 174, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (97, 'Titanium Battle Armor', 2, 0, 1, 70000, 35000, 73, 165, 198, 0, 'physdefense', 183, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (98, 'Copper Gothic Plate', 2, 0, 1, 75000, 37500, 75, 173, 208, 0, 'physdefense', 195, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (99, 'Bronze Gothic Plate', 2, 0, 1, 80000, 40000, 77, 180, 216, 0, 'physdefense', 203, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (100, 'Iron Gothic Plate', 2, 0, 1, 85000, 42500, 79, 188, 226, 0, 'physdefense', 212, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (101, 'Steel Gothic Plate', 2, 0, 1, 90000, 45000, 81, 195, 234, 0, 'physdefense', 224, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (102, 'Titanium Gothic Plate', 2, 0, 1, 95000, 47500, 83, 203, 244, 0, 'physdefense', 236, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (103, 'Leather Buckler', 4, 0, 1, 25, 13, 1, 0, 0, 0, 'physdefense', 3, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (104, 'Wood Buckler', 4, 0, 1, 50, 25, 1, 0, 0, 0, 'physdefense', 5, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (105, 'Steel Buckler', 4, 0, 1, 75, 38, 1, 0, 0, 0, 'physdefense', 7, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (106, 'Titanium Buckler', 4, 0, 1, 100, 50, 1, 0, 0, 0, 'physdefense', 8, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (107, 'Leather Targe', 4, 0, 1, 150, 75, 3, 0, 5, 0, 'physdefense', 11, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (108, 'Wood Targe', 4, 0, 1, 200, 100, 3, 0, 10, 0, 'physdefense', 12, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (109, 'Steel Targe', 4, 0, 1, 300, 150, 5, 0, 15, 0, 'physdefense', 15, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (110, 'Titanium Targe', 4, 0, 1, 400, 200, 5, 0, 20, 0, 'physdefense', 18, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (111, 'Small Aspis', 4, 0, 1, 600, 300, 8, 0, 25, 0, 'physdefense', 21, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (112, 'Large Aspis', 4, 0, 1, 800, 400, 11, 0, 35, 0, 'physdefense', 23, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (113, 'Full Aspis', 4, 0, 1, 1200, 600, 14, 0, 45, 0, 'physdefense', 26, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (114, 'Great Aspis', 4, 0, 1, 1500, 750, 17, 0, 55, 0, 'physdefense', 27, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (115, 'Small Kite Shield', 4, 0, 1, 2000, 1000, 20, 0, 65, 0, 'physdefense', 30, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (116, 'Large Kite Shield', 4, 0, 1, 2500, 1250, 23, 0, 80, 0, 'physdefense', 36, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (117, 'Full Kite Shield', 4, 0, 1, 3000, 1500, 26, 0, 95, 0, 'physdefense', 39, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (118, 'Great Kite Shield', 4, 0, 1, 4000, 2000, 29, 0, 110, 0, 'physdefense', 45, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (119, 'Small Heater Shield', 4, 0, 1, 5000, 2500, 31, 0, 130, 0, 'physdefense', 56, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (120, 'Large Heater Shield', 4, 0, 1, 6000, 3000, 34, 0, 150, 0, 'physdefense', 62, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (121, 'Full Heater Shield', 4, 0, 1, 8000, 4000, 37, 0, 170, 0, 'physdefense', 74, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (122, 'Great Heater Shield', 4, 0, 1, 10000, 5000, 40, 0, 190, 0, 'physdefense', 80, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (123, 'Small Scuta', 4, 0, 1, 12000, 6000, 43, 0, 210, 0, 'physdefense', 86, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (124, 'Large Scuta', 4, 0, 1, 15000, 7500, 46, 0, 230, 0, 'physdefense', 98, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (125, 'Full Scuta', 4, 0, 1, 18000, 9000, 49, 0, 250, 0, 'physdefense', 106, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (126, 'Great Scuta', 4, 0, 1, 22000, 11000, 51, 0, 270, 0, 'physdefense', 115, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (127, 'Small Pavise', 4, 0, 1, 26000, 13000, 54, 0, 300, 0, 'physdefense', 133, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (128, 'Large Pavise', 4, 0, 1, 30000, 15000, 57, 0, 320, 0, 'physdefense', 142, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (129, 'Full Pavise', 4, 0, 1, 35000, 17500, 60, 0, 340, 0, 'physdefense', 159, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (130, 'Great Pavise', 4, 0, 1, 40000, 20000, 65, 0, 360, 0, 'physdefense', 165, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (131, 'Small Heraldic Shield', 4, 0, 1, 45000, 22500, 70, 0, 380, 0, 'physdefense', 183, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (132, 'Large Heraldic Shield', 4, 0, 1, 50000, 25000, 75, 0, 400, 0, 'physdefense', 195, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (133, 'Full Heraldic Shield', 4, 0, 1, 55000, 27500, 80, 0, 420, 0, 'physdefense', 212, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (134, 'Great Heraldic Shield', 4, 0, 1, 60000, 30000, 85, 0, 440, 0, 'physdefense', 236, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (135, 'Leather Cap', 3, 0, 1, 20, 10, 1, 0, 0, 0, 'physdefense', 2, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (136, 'Copper Cap', 3, 0, 1, 40, 20, 1, 0, 0, 0, 'physdefense', 3, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (137, 'Bronze Cap', 3, 0, 1, 60, 30, 1, 0, 0, 0, 'physdefense', 5, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (138, 'Steel Cap', 3, 0, 1, 80, 40, 1, 0, 0, 0, 'physdefense', 5, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (139, 'Titanium Cap', 3, 0, 1, 110, 55, 1, 0, 0, 0, 'physdefense', 7, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (140, 'Leather Skull Cap', 3, 0, 1, 140, 70, 3, 5, 6, 0, 'physdefense', 8, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (141, 'Copper Skull Cap', 3, 0, 1, 170, 85, 3, 5, 6, 0, 'physdefense', 9, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (142, 'Bronze Skull Cap', 3, 0, 1, 200, 100, 3, 8, 10, 0, 'physdefense', 11, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (143, 'Steel Skull Cap', 3, 0, 1, 240, 120, 5, 10, 12, 0, 'physdefense', 13, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (144, 'Titanium Skull Cap', 3, 0, 1, 280, 140, 5, 10, 12, 0, 'physdefense', 14, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (145, 'Copper Helm', 3, 0, 1, 330, 165, 5, 13, 16, 0, 'physdefense', 16, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (146, 'Bronze Helm', 3, 0, 1, 380, 190, 8, 13, 16, 0, 'physdefense', 16, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (147, 'Iron Helm', 3, 0, 1, 440, 220, 11, 15, 18, 0, 'physdefense', 18, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (148, 'Steel Helm', 3, 0, 1, 500, 250, 14, 18, 22, 0, 'physdefense', 22, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (149, 'Titanium Helm', 3, 0, 1, 600, 300, 17, 18, 22, 0, 'physdefense', 23, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (150, 'Copper Corinthian Helmet', 3, 0, 1, 700, 350, 20, 20, 24, 0, 'physdefense', 27, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (151, 'Bronze Corinthian Helmet', 3, 0, 1, 850, 425, 23, 23, 28, 0, 'physdefense', 33, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (152, 'Iron Corinthian Helmet', 3, 0, 1, 1000, 500, 26, 25, 30, 0, 'physdefense', 37, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (153, 'Steel Corinthian Helmet', 3, 0, 1, 2000, 1000, 29, 25, 30, 0, 'physdefense', 44, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (154, 'Titanium Corinthian Helmet', 3, 0, 1, 3200, 1600, 31, 30, 36, 0, 'physdefense', 48, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (155, 'Copper Sallet', 3, 0, 1, 4400, 2200, 34, 30, 36, 0, 'physdefense', 51, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (156, 'Bronze Sallet', 3, 0, 1, 6000, 3000, 37, 35, 42, 0, 'physdefense', 58, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (157, 'Iron Sallet', 3, 0, 1, 7000, 3500, 40, 35, 42, 0, 'physdefense', 63, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (158, 'Steel Sallet', 3, 0, 1, 8000, 4000, 43, 40, 48, 0, 'physdefense', 68, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (159, 'Titanium Sallet', 3, 0, 1, 10000, 5000, 46, 45, 54, 0, 'physdefense', 79, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (160, 'Copper Bascinet', 3, 0, 1, 12000, 6000, 49, 50, 60, 0, 'physdefense', 84, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (161, 'Bronze Bascinet', 3, 0, 1, 15000, 7500, 51, 55, 66, 0, 'physdefense', 94, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (162, 'Iron Bascinet', 3, 0, 1, 18000, 9000, 54, 60, 72, 0, 'physdefense', 98, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (163, 'Steel Bascinet', 3, 0, 1, 22000, 11000, 57, 65, 78, 0, 'physdefense', 108, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (164, 'Titanium Bascinet', 3, 0, 1, 26000, 13000, 60, 70, 84, 0, 'physdefense', 115, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (165, 'Copper Horned Helm', 3, 0, 1, 30000, 15000, 65, 75, 90, 0, 'physdefense', 125, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (166, 'Bronze Horned Helm', 3, 0, 1, 35000, 17500, 70, 83, 100, 0, 'physdefense', 139, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (167, 'Iron Horned Helm', 3, 0, 1, 40000, 20000, 75, 90, 108, 0, 'physdefense', 145, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (168, 'Steel Horned Helm', 3, 0, 1, 45000, 22500, 80, 98, 118, 0, 'physdefense', 160, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); +INSERT INTO `sx_itembase` VALUES (169, 'Titanium Horned Helm', 3, 0, 1, 50000, 25000, 85, 105, 126, 0, 'physdefense', 175, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_itemmodnames` +-- + +CREATE TABLE `sx_itemmodnames` ( + `id` int(10) unsigned NOT NULL auto_increment, + `fieldname` varchar(50) NOT NULL default '', + `prettyname` varchar(50) NOT NULL default '', + `percent` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_itemmodnames` +-- + +INSERT INTO `sx_itemmodnames` VALUES (1, 'expbonus', 'Experience Bonus', 1); +INSERT INTO `sx_itemmodnames` VALUES (2, 'goldbonus', 'Gold Bonus', 1); +INSERT INTO `sx_itemmodnames` VALUES (3, 'maxhp', 'Max HP', 0); +INSERT INTO `sx_itemmodnames` VALUES (4, 'maxmp', 'Max MP', 0); +INSERT INTO `sx_itemmodnames` VALUES (5, 'maxtp', 'Max TP', 0); +INSERT INTO `sx_itemmodnames` VALUES (6, 'strength', 'Strength', 0); +INSERT INTO `sx_itemmodnames` VALUES (7, 'dexterity', 'Dexterity', 0); +INSERT INTO `sx_itemmodnames` VALUES (8, 'energy', 'Energy', 0); +INSERT INTO `sx_itemmodnames` VALUES (9, 'physattack', 'Physical Attack', 0); +INSERT INTO `sx_itemmodnames` VALUES (10, 'physdefense', 'Physical Defense', 0); +INSERT INTO `sx_itemmodnames` VALUES (11, 'magicattack', 'Magic Attack', 0); +INSERT INTO `sx_itemmodnames` VALUES (12, 'magicdefense', 'Magid Defense', 0); +INSERT INTO `sx_itemmodnames` VALUES (13, 'fireattack', 'Fire Attack', 0); +INSERT INTO `sx_itemmodnames` VALUES (14, 'firedefense', 'Fire Defense', 0); +INSERT INTO `sx_itemmodnames` VALUES (15, 'lightattack', 'Lightning Attack', 0); +INSERT INTO `sx_itemmodnames` VALUES (16, 'lightdefense', 'Lightning Defense', 0); +INSERT INTO `sx_itemmodnames` VALUES (17, 'hpleech', 'HP Leech', 1); +INSERT INTO `sx_itemmodnames` VALUES (18, 'mpleech', 'MP Leech', 1); +INSERT INTO `sx_itemmodnames` VALUES (19, 'hpgain', 'HP Per Kill', 0); +INSERT INTO `sx_itemmodnames` VALUES (20, 'mpgain', 'MP Per Kill', 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_itemprefixes` +-- + +CREATE TABLE `sx_itemprefixes` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `slotnumber` tinyint(3) unsigned NOT NULL default '0', + `unique` tinyint(3) unsigned NOT NULL default '0', + `willdrop` tinyint(3) unsigned NOT NULL default '0', + `buycost` int(10) unsigned NOT NULL default '0', + `sellcost` int(10) unsigned NOT NULL default '0', + `reqlevel` smallint(5) unsigned NOT NULL default '0', + `reqstrength` smallint(5) unsigned NOT NULL default '0', + `reqdexterity` smallint(5) unsigned NOT NULL default '0', + `reqenergy` smallint(5) unsigned NOT NULL default '0', + `basename` varchar(50) NOT NULL default '', + `baseattr` smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_itemprefixes` +-- + +INSERT INTO `sx_itemprefixes` VALUES (1, 'Sharp', 1, 0, 0, 5, 3, 1, 0, 0, 0, 'physattack', 2); +INSERT INTO `sx_itemprefixes` VALUES (2, 'Magic', 1, 0, 0, 8, 4, 1, 0, 0, 0, 'magicattack', 5); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_itemsuffixes` +-- + +CREATE TABLE `sx_itemsuffixes` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(50) NOT NULL default '', + `slotnumber` tinyint(3) unsigned NOT NULL default '0', + `unique` tinyint(3) unsigned NOT NULL default '0', + `willdrop` tinyint(3) unsigned NOT NULL default '0', + `buycost` int(10) unsigned NOT NULL default '0', + `sellcost` int(10) unsigned NOT NULL default '0', + `reqlevel` smallint(5) unsigned NOT NULL default '0', + `reqstrength` smallint(5) unsigned NOT NULL default '0', + `reqdexterity` smallint(5) unsigned NOT NULL default '0', + `reqenergy` smallint(5) unsigned NOT NULL default '0', + `basename` varchar(50) NOT NULL default '', + `baseattr` smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_itemsuffixes` +-- + +INSERT INTO `sx_itemsuffixes` VALUES (1, 'of the Vampire', 1, 0, 0, 5, 3, 1, 0, 0, 0, 'hpleech', 5); +INSERT INTO `sx_itemsuffixes` VALUES (2, 'of the Bear', 1, 0, 0, 5, 3, 1, 0, 0, 0, 'strength', 5); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_messages` +-- + +CREATE TABLE `sx_messages` ( + `id` int(10) unsigned NOT NULL auto_increment, + `postdate` datetime NOT NULL default '0000-00-00 00:00:00', + `senderid` int(10) unsigned NOT NULL default '0', + `sendername` varchar(30) NOT NULL default '', + `recipientid` int(10) unsigned NOT NULL default '0', + `recipientname` varchar(30) NOT NULL default '', + `status` tinyint(3) unsigned NOT NULL default '0', + `title` varchar(200) NOT NULL default '', + `message` text NOT NULL, + `gold` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_messages` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_monsters` +-- + +CREATE TABLE `sx_monsters` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(30) NOT NULL default '', + `world` tinyint(3) unsigned NOT NULL default '0', + `level` smallint(5) unsigned NOT NULL default '0', + `maxexp` int(10) unsigned NOT NULL default '0', + `maxgold` int(10) unsigned NOT NULL default '0', + `maxhp` smallint(5) unsigned NOT NULL default '0', + `physattack` smallint(5) unsigned NOT NULL default '0', + `physdefense` smallint(5) unsigned NOT NULL default '0', + `magicattack` smallint(5) unsigned NOT NULL default '0', + `magicdefense` smallint(5) unsigned NOT NULL default '0', + `fireattack` smallint(5) unsigned NOT NULL default '0', + `firedefense` smallint(5) unsigned NOT NULL default '0', + `lightattack` smallint(5) unsigned NOT NULL default '0', + `lightdefense` smallint(5) unsigned NOT NULL default '0', + `spell1` smallint(5) unsigned NOT NULL default '0', + `spell2` smallint(5) unsigned NOT NULL default '0', + `spellimmune1` smallint(5) unsigned NOT NULL default '0', + `spellimmune2` smallint(5) unsigned NOT NULL default '0', + `boss` tinyint(3) unsigned NOT NULL default '0', + `hpleech` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_monsters` +-- + +INSERT INTO `sx_monsters` VALUES (1, 'Small Slime', 1, 1, 3, 2, 3, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (2, 'Shade', 1, 1, 4, 2, 3, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (3, 'Slime', 1, 2, 5, 3, 4, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (4, 'Small Drake', 1, 2, 6, 3, 5, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (5, 'Skeleton', 1, 3, 7, 4, 7, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (6, 'Haunt', 1, 3, 8, 4, 8, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (7, 'Big Slime', 1, 4, 9, 5, 10, 33, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (8, 'Drake', 1, 4, 10, 5, 11, 36, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (9, 'Ghost', 1, 5, 11, 6, 12, 39, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (10, 'Bee', 1, 5, 12, 6, 12, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (11, 'Scorpion', 1, 6, 14, 7, 13, 45, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (12, 'Dawk', 1, 6, 16, 8, 15, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (13, 'Nymph', 1, 7, 18, 9, 16, 54, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (14, 'Ember', 1, 7, 20, 10, 17, 59, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (15, 'Daydream', 1, 8, 22, 11, 18, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (16, 'Wasp', 1, 8, 24, 12, 20, 68, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (17, 'Shadow', 1, 9, 26, 13, 22, 72, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (18, 'Harpy', 1, 9, 28, 14, 24, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (19, 'Air Elemental', 1, 10, 30, 15, 26, 81, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (20, 'Rogue', 1, 10, 32, 16, 29, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (21, 'Lynx', 1, 11, 35, 18, 32, 90, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (22, 'Trickster', 1, 11, 38, 19, 35, 95, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (23, 'Goblin', 1, 12, 41, 21, 35, 99, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (24, 'Charmer', 1, 12, 44, 22, 38, 53, 53, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (25, 'Raven', 1, 13, 47, 24, 41, 108, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (26, 'Bobcat', 1, 13, 50, 25, 44, 113, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (27, 'Lycan', 1, 14, 53, 27, 48, 119, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (28, 'Fiend', 1, 14, 56, 28, 52, 125, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (29, 'Liche', 1, 15, 59, 30, 56, 131, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (30, 'Dawkin', 1, 15, 62, 31, 60, 137, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (31, 'Anarchist', 1, 16, 66, 33, 64, 143, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (32, 'Hellcat', 1, 16, 70, 35, 68, 149, 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (33, 'Fallen Cherub', 1, 17, 74, 37, 72, 155, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (34, 'Grey Wolf', 1, 17, 78, 39, 76, 161, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (35, 'Black Bear', 1, 18, 82, 41, 80, 167, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (36, 'Knight', 1, 18, 86, 43, 84, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (37, 'Giant', 1, 19, 90, 45, 88, 179, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (38, 'Young Wyrm', 1, 19, 94, 47, 92, 185, 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (39, 'Lesser Devil', 1, 20, 98, 49, 96, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (40, 'Lesser Demon', 1, 20, 102, 51, 100, 197, 197, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +INSERT INTO `sx_monsters` VALUES (41, 'Razora', 1, 99, 300, 150, 200, 203, 203, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_pvp` +-- + +CREATE TABLE `sx_pvp` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `player1id` int(10) unsigned NOT NULL default '0', + `player2id` int(10) unsigned NOT NULL default '0', + `player1name` varchar(30) NOT NULL default '', + `player2name` varchar(30) NOT NULL default '', + `playerturn` int(10) unsigned NOT NULL default '0', + `accepted` tinyint(3) unsigned NOT NULL default '0', + `turntime` timestamp NOT NULL, + `fightrow` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_pvp` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_spells` +-- + +CREATE TABLE `sx_spells` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(30) NOT NULL default '', + `fname` varchar(30) NOT NULL default '', + `value` int(10) unsigned NOT NULL default '0', + `mp` int(10) unsigned NOT NULL default '0', + `minlevel` int(10) unsigned NOT NULL default '0', + `classonly` int(10) unsigned NOT NULL default '0', + `classexclude` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_spells` +-- + +INSERT INTO `sx_spells` VALUES (1, 'Heal 1', 'heal', 5, 2, 5, 2, 0); +INSERT INTO `sx_spells` VALUES (2, 'Heal 2', 'heal', 10, 5, 10, 0, 0); +INSERT INTO `sx_spells` VALUES (3, 'Heal 3', 'heal', 20, 10, 15, 0, 0); +INSERT INTO `sx_spells` VALUES (4, 'Heal 4', 'heal', 30, 15, 20, 0, 0); +INSERT INTO `sx_spells` VALUES (5, 'Heal 5', 'heal', 45, 25, 25, 0, 0); +INSERT INTO `sx_spells` VALUES (6, 'Heal 6', 'heal', 60, 35, 30, 0, 0); +INSERT INTO `sx_spells` VALUES (7, 'Heal 7', 'heal', 80, 50, 35, 3, 0); +INSERT INTO `sx_spells` VALUES (8, 'Heal 8', 'heal', 100, 75, 40, 3, 0); +INSERT INTO `sx_spells` VALUES (9, 'Heal 9', 'heal', 150, 100, 45, 3, 0); +INSERT INTO `sx_spells` VALUES (10, 'Heal 10', 'heal', 200, 150, 50, 3, 0); +INSERT INTO `sx_spells` VALUES (11, 'Hurt 1', 'hurt', 5, 2, 5, 0, 0); +INSERT INTO `sx_spells` VALUES (12, 'Hurt 2', 'hurt', 10, 5, 10, 0, 0); +INSERT INTO `sx_spells` VALUES (13, 'Hurt 3', 'hurt', 15, 7, 15, 0, 0); +INSERT INTO `sx_spells` VALUES (14, 'Hurt 4', 'hurt', 25, 12, 20, 0, 0); +INSERT INTO `sx_spells` VALUES (15, 'Hurt 5', 'hurt', 35, 20, 25, 0, 0); +INSERT INTO `sx_spells` VALUES (16, 'Hurt 6', 'hurt', 50, 30, 30, 0, 0); +INSERT INTO `sx_spells` VALUES (17, 'Hurt 7', 'hurt', 65, 40, 35, 3, 0); +INSERT INTO `sx_spells` VALUES (18, 'Hurt 8', 'hurt', 85, 50, 40, 3, 0); +INSERT INTO `sx_spells` VALUES (19, 'Hurt 9', 'hurt', 105, 65, 45, 3, 0); +INSERT INTO `sx_spells` VALUES (20, 'Hurt 10', 'hurt', 130, 80, 50, 3, 0); +INSERT INTO `sx_spells` VALUES (21, 'Sleep 1', 'sleep', 80, 20, 10, 0, 0); +INSERT INTO `sx_spells` VALUES (22, 'Sleep 2', 'sleep', 60, 35, 20, 0, 0); +INSERT INTO `sx_spells` VALUES (23, 'Sleep 3', 'sleep', 40, 50, 30, 2, 0); +INSERT INTO `sx_spells` VALUES (24, 'Sleep 4', 'sleep', 20, 75, 40, 2, 0); +INSERT INTO `sx_spells` VALUES (25, 'Sleep 5', 'sleep', 5, 100, 50, 2, 0); +INSERT INTO `sx_spells` VALUES (26, 'Fire 1', 'fire', 5, 2, 5, 0, 0); +INSERT INTO `sx_spells` VALUES (27, 'Fire 2', 'fire', 10, 5, 10, 0, 0); +INSERT INTO `sx_spells` VALUES (28, 'Fire 3', 'fire', 15, 7, 15, 0, 0); +INSERT INTO `sx_spells` VALUES (29, 'Fire 4', 'fire', 25, 12, 20, 0, 0); +INSERT INTO `sx_spells` VALUES (30, 'Fire 5', 'fire', 35, 20, 25, 0, 0); +INSERT INTO `sx_spells` VALUES (31, 'Fire 6', 'fire', 50, 30, 30, 0, 0); +INSERT INTO `sx_spells` VALUES (32, 'Fire 7', 'fire', 65, 40, 35, 2, 0); +INSERT INTO `sx_spells` VALUES (33, 'Fire 8', 'fire', 85, 50, 40, 2, 0); +INSERT INTO `sx_spells` VALUES (34, 'Fire 9', 'fire', 105, 65, 45, 2, 0); +INSERT INTO `sx_spells` VALUES (35, 'Fire 10', 'fire', 130, 80, 50, 2, 0); +INSERT INTO `sx_spells` VALUES (36, 'Lightning 1', 'light', 5, 2, 5, 0, 0); +INSERT INTO `sx_spells` VALUES (37, 'Lightning 2', 'light', 10, 5, 10, 0, 0); +INSERT INTO `sx_spells` VALUES (38, 'Lightning 3', 'light', 15, 7, 15, 0, 0); +INSERT INTO `sx_spells` VALUES (39, 'Lightning 4', 'light', 25, 12, 20, 0, 0); +INSERT INTO `sx_spells` VALUES (40, 'Lightning 5', 'light', 35, 20, 25, 0, 0); +INSERT INTO `sx_spells` VALUES (41, 'Lightning 6', 'light', 50, 30, 30, 0, 0); +INSERT INTO `sx_spells` VALUES (42, 'Lightning 7', 'light', 65, 40, 35, 2, 0); +INSERT INTO `sx_spells` VALUES (43, 'Lightning 8', 'light', 85, 50, 40, 2, 0); +INSERT INTO `sx_spells` VALUES (44, 'Lightning 9', 'light', 105, 65, 45, 2, 0); +INSERT INTO `sx_spells` VALUES (45, 'Lightning 10', 'light', 130, 80, 50, 2, 0); +INSERT INTO `sx_spells` VALUES (46, 'Prismatic Blast 1', 'prism', 2, 2, 5, 0, 0); +INSERT INTO `sx_spells` VALUES (47, 'Prismatic Blast 2', 'prism', 5, 5, 10, 0, 0); +INSERT INTO `sx_spells` VALUES (48, 'Prismatic Blast 3', 'prism', 10, 7, 15, 0, 0); +INSERT INTO `sx_spells` VALUES (49, 'Prismatic Blast 4', 'prism', 15, 12, 20, 0, 0); +INSERT INTO `sx_spells` VALUES (50, 'Prismatic Blast 5', 'prism', 15, 20, 25, 0, 0); +INSERT INTO `sx_spells` VALUES (51, 'Prismatic Blast 6', 'prism', 20, 30, 30, 0, 0); +INSERT INTO `sx_spells` VALUES (52, 'Prismatic Blast 7', 'prism', 25, 40, 35, 0, 1); +INSERT INTO `sx_spells` VALUES (53, 'Prismatic Blast 8', 'prism', 30, 50, 40, 0, 1); +INSERT INTO `sx_spells` VALUES (54, 'Prismatic Blast 9', 'prism', 35, 65, 45, 0, 1); +INSERT INTO `sx_spells` VALUES (55, 'Prismatic Blast 10', 'prism', 40, 80, 50, 0, 1); +INSERT INTO `sx_spells` VALUES (56, 'Stone Skin 1', 'stone', 5, 10, 10, 1, 0); +INSERT INTO `sx_spells` VALUES (57, 'Stone Skin 2', 'stone', 10, 20, 20, 1, 0); +INSERT INTO `sx_spells` VALUES (58, 'Stone Skin 3', 'stone', 20, 30, 30, 1, 0); +INSERT INTO `sx_spells` VALUES (59, 'Stone Skin 4', 'stone', 35, 40, 40, 1, 0); +INSERT INTO `sx_spells` VALUES (60, 'Stone Skin 5', 'stone', 50, 50, 50, 1, 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_towns` +-- + +CREATE TABLE `sx_towns` ( + `id` tinyint(3) unsigned NOT NULL auto_increment, + `name` varchar(30) NOT NULL default '', + `world` tinyint(3) unsigned NOT NULL default '0', + `latitude` smallint(6) NOT NULL default '0', + `longitude` smallint(6) NOT NULL default '0', + `innprice` tinyint(4) NOT NULL default '0', + `mapprice` smallint(6) NOT NULL default '0', + `travelpoints` smallint(5) unsigned NOT NULL default '0', + `itemminlvl` int(10) unsigned NOT NULL default '0', + `itemmaxlvl` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_towns` +-- + +INSERT INTO `sx_towns` VALUES (1, 'Middleton', 1, 0, 0, 5, 0, 0, 1, 5); +INSERT INTO `sx_towns` VALUES (2, 'Norfolk', 1, 25, 25, 10, 25, 5, 3, 9); +INSERT INTO `sx_towns` VALUES (3, 'Calentia', 1, 50, -50, 25, 50, 15, 6, 14); +INSERT INTO `sx_towns` VALUES (4, 'Resmark', 1, -75, 75, 40, 100, 30, 11, 19); +INSERT INTO `sx_towns` VALUES (5, 'Erdricksburg', 1, 99, 99, 60, 500, 50, 16, 25); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_users` +-- + +CREATE TABLE `sx_users` ( + `id` int(10) unsigned NOT NULL auto_increment, + `account` int(10) unsigned NOT NULL default '0', + `birthdate` datetime NOT NULL default '0000-00-00 00:00:00', + `lastip` varchar(16) NOT NULL default '', + `onlinetime` datetime NOT NULL default '0000-00-00 00:00:00', + `exploreverify` varchar(6) NOT NULL default '', + `exploreverifyimage` varchar(12) NOT NULL default '', + `explorefailed` int(10) unsigned NOT NULL default '0', + `charname` varchar(30) NOT NULL default '', + `charclass` tinyint(3) unsigned NOT NULL default '0', + `charpicture` varchar(100) NOT NULL default '', + `difficulty` float unsigned NOT NULL default '1', + `deathpenalty` tinyint(3) unsigned NOT NULL default '0', + `latitude` smallint(6) NOT NULL default '0', + `longitude` smallint(6) NOT NULL default '0', + `story` tinyint(3) unsigned NOT NULL default '1', + `world` tinyint(3) unsigned NOT NULL default '1', + `guild` int(10) unsigned NOT NULL default '0', + `guildrank` int(10) unsigned NOT NULL default '0', + `guildtag` varchar(4) NOT NULL default '', + `tagcolor` varchar(7) NOT NULL default '', + `namecolor` varchar(7) NOT NULL default '', + `level` smallint(5) unsigned NOT NULL default '1', + `levelup` int(10) unsigned NOT NULL default '0', + `levelspell` int(10) unsigned NOT NULL default '0', + `experience` int(10) unsigned NOT NULL default '0', + `expbonus` tinyint(4) NOT NULL default '0', + `gold` int(10) unsigned NOT NULL default '150', + `goldbonus` tinyint(4) NOT NULL default '0', + `bank` int(10) unsigned NOT NULL default '0', + `maxhp` smallint(5) unsigned NOT NULL default '15', + `maxmp` smallint(5) unsigned NOT NULL default '5', + `maxtp` smallint(5) unsigned NOT NULL default '5', + `currenthp` smallint(5) unsigned NOT NULL default '15', + `currentmp` smallint(5) unsigned NOT NULL default '5', + `currenttp` smallint(5) unsigned NOT NULL default '5', + `strength` smallint(5) unsigned NOT NULL default '0', + `dexterity` smallint(5) unsigned NOT NULL default '0', + `energy` smallint(5) unsigned NOT NULL default '0', + `physattack` smallint(5) unsigned NOT NULL default '5', + `physdefense` smallint(5) unsigned NOT NULL default '5', + `magicattack` smallint(5) unsigned NOT NULL default '0', + `magicdefense` smallint(5) unsigned NOT NULL default '0', + `fireattack` smallint(5) unsigned NOT NULL default '0', + `firedefense` smallint(5) unsigned NOT NULL default '0', + `lightattack` smallint(5) unsigned NOT NULL default '0', + `lightdefense` smallint(5) unsigned NOT NULL default '0', + `spellslist` varchar(200) NOT NULL default '0', + `townslist` varchar(200) NOT NULL default '0,1', + `currentpvp` bigint(20) unsigned NOT NULL default '0', + `currentaction` varchar(30) NOT NULL default 'In Town', + `currentfight` tinyint(3) unsigned NOT NULL default '0', + `currentmonsterid` smallint(5) unsigned NOT NULL default '0', + `currentmonsterhp` smallint(5) unsigned NOT NULL default '0', + `currentmonstersleep` tinyint(3) unsigned NOT NULL default '0', + `item1idstring` varchar(10) NOT NULL default '0', + `item2idstring` varchar(10) NOT NULL default '0', + `item3idstring` varchar(10) NOT NULL default '0', + `item4idstring` varchar(10) NOT NULL default '0', + `item5idstring` varchar(10) NOT NULL default '0', + `item6idstring` varchar(10) NOT NULL default '0', + `item1name` varchar(200) NOT NULL default '', + `item2name` varchar(200) NOT NULL default '', + `item3name` varchar(200) NOT NULL default '', + `item4name` varchar(200) NOT NULL default '', + `item5name` varchar(200) NOT NULL default '', + `item6name` varchar(200) NOT NULL default '', + `spell1id` int(10) unsigned NOT NULL default '0', + `spell2id` int(10) unsigned NOT NULL default '0', + `spell3id` int(10) unsigned NOT NULL default '0', + `spell4id` int(10) unsigned NOT NULL default '0', + `spell5id` int(10) unsigned NOT NULL default '0', + `spell6id` int(10) unsigned NOT NULL default '0', + `spell7id` int(10) unsigned NOT NULL default '0', + `spell8id` int(10) unsigned NOT NULL default '0', + `spell9id` int(10) unsigned NOT NULL default '0', + `spell10id` int(10) unsigned NOT NULL default '0', + `spell1name` varchar(30) NOT NULL default '', + `spell2name` varchar(30) NOT NULL default '', + `spell3name` varchar(30) NOT NULL default '', + `spell4name` varchar(30) NOT NULL default '', + `spell5name` varchar(30) NOT NULL default '', + `spell6name` varchar(30) NOT NULL default '', + `spell7name` varchar(30) NOT NULL default '', + `spell8name` varchar(30) NOT NULL default '', + `spell9name` varchar(30) NOT NULL default '', + `spell10name` varchar(30) NOT NULL default '', + `hpleech` tinyint(3) unsigned NOT NULL default '0', + `mpleech` tinyint(3) unsigned NOT NULL default '0', + `hpgain` tinyint(3) unsigned NOT NULL default '0', + `mpgain` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + FULLTEXT KEY `item1name` (`item1name`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_users` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sx_worlds` +-- + +CREATE TABLE `sx_worlds` ( + `id` smallint(5) unsigned NOT NULL auto_increment, + `name` varchar(30) NOT NULL default '', + `size` smallint(5) unsigned NOT NULL default '0', + `bossid` mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `sx_worlds` +-- + +INSERT INTO `sx_worlds` VALUES (1, 'Raenslide', 100, 1); +INSERT INTO `sx_worlds` VALUES (2, 'Lorenfall', 100, 0); +INSERT INTO `sx_worlds` VALUES (3, 'Borderlands', 100, 0); +INSERT INTO `sx_worlds` VALUES (4, 'Inferno', 100, 0); +INSERT INTO `sx_worlds` VALUES (5, 'Unreality', 100, 0); \ No newline at end of file diff --git a/extras/map.fla b/extras/map.fla new file mode 100644 index 0000000..e4a41df Binary files /dev/null and b/extras/map.fla differ diff --git a/extras/mapmini.fla b/extras/mapmini.fla new file mode 100644 index 0000000..f7f1709 Binary files /dev/null and b/extras/mapmini.fla differ diff --git a/fight.php b/fight.php new file mode 100644 index 0000000..c12309d --- /dev/null +++ b/fight.php @@ -0,0 +1,357 @@ += $minlevel AND level <= $maxlevel ORDER BY RAND() LIMIT 1", "monsters"); + $monsterrow = dorow($monsterquery); + + $userrow["currentmonsterhp"] = (ceil(rand($monsterrow["maxhp"] * .75, $monsterrow["maxhp"]) * $userrow["difficulty"])); + $userrow["currentmonsterid"] = $monsterrow["id"]; + $userrow["currentaction"] = "Fighting"; + updateuserrow(); + dofight(); + +} + +function dofight() { + + global $userrow, $monsterrow, $fightrow, $spells; + + if (isset($_POST["fight"])) { + + playerturn(); + if ($userrow["currentmonsterhp"] <= 0) { youwin(); } + monsterturn(); + if ($userrow["currenthp"] <= 0) { youlose(); } + updateuserrow(); + + $pagerow = array( + "message"=>$fightrow["message"], + "monstername"=>$monsterrow["name"], + "monsterhp"=>$userrow["currentmonsterhp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"], + "monsterphysdamage"=>$fightrow["monsterphysdamage"], + "monstermagicdamage"=>$fightrow["monstermagicdamage"], + "monsterfiredamage"=>$fightrow["monsterfiredamage"], + "monsterlightdamage"=>$fightrow["monsterlightdamage"]); + $pagerow["spells"] = dospellslist(); + display("Fighting",parsetemplate(gettemplate("fight_turn"),$pagerow)); + + } elseif (isset($_POST["spell"])) { + + if (! is_numeric($_POST["spellid"])) { err("Invalid spell selection."); } + $isavailable = 0; + for ($i = 1; $i < 11; $i++) { + if ($userrow["spell".$i."id"] == $_POST["spellid"]) { $isavailable = 1; } + } + if ($isavailable == 0) { err("You don't have that spell."); } + + include("spells.php"); + $castspell = $spells[$_POST["spellid"]]["fname"]($_POST["spellid"]); + $userrow["currentmonsterhp"] -= ($fightrow["playerphysdamage"] + $fightrow["playermagicdamage"] + $fightrow["playerfiredamage"] + $fightrow["playerlightdamage"]); + if ($userrow["currentmonsterhp"] <= 0) { youwin(); } + monsterturn(); + if ($userrow["currenthp"] <= 0) { youlose(); } + updateuserrow(); + + $pagerow = array( + "message"=>$castspell, + "monstername"=>$monsterrow["name"], + "monsterhp"=>$userrow["currentmonsterhp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"], + "monsterphysdamage"=>$fightrow["monsterphysdamage"], + "monstermagicdamage"=>$fightrow["monstermagicdamage"], + "monsterfiredamage"=>$fightrow["monsterfiredamage"], + "monsterlightdamage"=>$fightrow["monsterlightdamage"]); + $pagerow["spells"] = dospellslist(); + display("Fighting",parsetemplate(gettemplate("fight_turn"),$pagerow)); + + } elseif (isset($_POST["run"])) { + + $userrow["currentaction"] = "Exploring"; + $userrow["currentmonsterid"] = 0; + $userrow["currentmonsterhp"] = 0; + updateuserrow(); + die(header("Location: index.php")); + + } else { + + $pagerow = array( + "monstername"=>$monsterrow["name"], + "monsterhp"=>$userrow["currentmonsterhp"]); + $pagerow["spells"] = dospellslist(); + display("Fighting",parsetemplate(gettemplate("fight_new"),$pagerow)); + + } + +} + +function playerturn() { + + global $userrow, $monsterrow, $fightrow; + + // Calculate all damages. + if ($userrow["physattack"] != 0) { + $physhit = ceil(rand($userrow["physattack"]*.75, $userrow["physattack"]) / 3); + $physblock = ceil(rand($monsterrow["physdefense"]*.75, $monsterrow["physdefense"]) / 3); + $fightrow["playerphysdamage"] = max($physhit - $physblock, 1); + } + + if ($userrow["magicattack"] != 0) { + $magichit = ceil(rand($userrow["magicattack"]*.75, $userrow["magicattack"]) / 3); + $magicblock = ceil(rand($monsterrow["magicdefense"]*.75, $monsterrow["magicdefense"]) / 3); + $fightrow["playermagicdamage"] = max($magichit - $magicblock, 0); + } + + if ($userrow["fireattack"] != 0) { + $firehit = ceil(rand($userrow["fireattack"]*.75, $userrow["fireattack"]) / 3); + $fireblock = ceil(rand($monsterrow["firedefense"]*.75, $monsterrow["firedefense"]) / 3); + $fightrow["playerfiredamage"] = max($firehit - $fireblock, 0); + } + + if ($userrow["lightattack"] != 0) { + $lighthit = ceil(rand($userrow["lightattack"]*.75, $userrow["lightattack"]) / 3); + $lightblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 3); + $fightrow["playerlightdamage"] = max($lighthit - $lightblock, 0); + } + + // Chance to make an excellent hit. + $toexcellent = rand(0,150); + if ($toexcellent <= sqrt($userrow["strength"])) { + $fightrow["playerphysdamage"] *= 2; + $fightrow["playermagicdamage"] *= 2; + $fightrow["playerfiredamage"] *= 2; + $fightrow["playerlightdamage"] *= 2; + $fightrow["message"] = "Excellent hit!
"; + } + + // Chance for monster to dodge. + $tododge = rand(0,200); + if ($tododge <= sqrt($monsterrow["physdefense"])) { + $fightrow["playerphysdamage"] = 0; + $fightrow["playermagicdamage"] = 0; + $fightrow["playerfiredamage"] = 0; + $fightrow["playerlightdamage"] = 0; + $fightrow["message"] = "The monster dodged your hit!
"; + } + + // Now we add Per Turn mods. + hpleech("player"); + mpleech("player"); + + // Subtract all damage from monster's hp. + $userrow["currentmonsterhp"] -= ($fightrow["playerphysdamage"] + $fightrow["playermagicdamage"] + $fightrow["playerfiredamage"] + $fightrow["playerlightdamage"]); + +} + +function monsterturn() { + + global $userrow, $monsterrow, $fightrow; + + if ($monsterrow["physattack"] != 0) { + $physhit = ceil((rand($monsterrow["physattack"]*.75, $monsterrow["physattack"]) / 3) * $userrow["difficulty"]); + $physblock = ceil(rand($userrow["physdefense"]*.75, $userrow["physdefense"]) / 3); + $fightrow["monsterphysdamage"] = max($physhit - $physblock, 1); // Have to do at least 1 physical damage. + } + + if ($monsterrow["magicattack"] != 0) { + $magichit = ceil((rand($monsterrow["magicattack"]*.75, $monsterrow["magicattack"]) / 3) * $userrow["difficulty"]); + $magicblock = ceil(rand($userrow["magicdefense"]*.75, $userrow["magicdefense"]) / 3); + $fightrow["monstermagicdamage"] = max($magichit - $magicblock, 0); + } + + if ($monsterrow["fireattack"] != 0) { + $firehit = ((rand($monsterrow["fireattack"]*.75, $monsterrow["fireattack"]) / 3) * $userrow["difficulty"]); + $fireblock = ceil(rand($userrow["firedefense"]*.75, $userrow["firedefense"]) / 3); + $fightrow["monsterfiredamage"] = max($firehit - $fireblock, 0); + } + + if ($monsterrow["lightattack"] != 0) { + $lighthit = ceil((rand($monsterrow["lightattack"]*.75, $monsterrow["lightattack"]) / 3) * $userrow["difficulty"]); + $lightblock = ceil(rand($userrow["lightdefense"]*.75, $userrow["lightdefense"]) / 3); + $fightrow["monsterlightdamage"] = max($lighthit - $lightblock, 0); + } + + // Now we add Per Turn mods. + hpleech("monster"); + + // Subtract all damage from player's hp. + $userrow["currenthp"] -= ($fightrow["monsterphysdamage"] + $fightrow["monstermagicdamage"] + $fightrow["monsterfiredamage"] + $fightrow["monsterlightdamage"]); + +} + +function youwin() { + + global $userrow, $monsterrow, $fightrow; + + $template = "fight_win"; + + $newexp = ceil(rand($monsterrow["maxexp"]*.75, $monsterrow["maxexp"]) * (1 + ($userrow["expbonus"] / 100))); + $newgold = ceil(rand($monsterrow["maxgold"]*.75, $monsterrow["maxgold"]) * (1 + ($userrow["goldbonus"] / 100))); + $userrow["experience"] += $newexp; + $userrow["gold"] += $newgold; + $userrow["currentaction"] = "Exploring"; + $userrow["currentfight"] = 0; + $userrow["currentmonsterid"] = 0; + $userrow["currentmonsterhp"] = 0; + if ($monsterrow["boss"] == 1) { + $userrow["story"]++; + } + + // Now we add Per Kill mods. + hpgain(); + mpgain(); + + // Check for new levelup. + if ($userrow["experience"] >= dolevels($userrow["level"]+1)) { + $template = "fight_levelup"; + $userrow["level"]++; + $userrow["levelup"] += 5; + $userrow["maxtp"] += 5; + $userrow["currenthp"] = $userrow["maxhp"]; + $userrow["currentmp"] = $userrow["maxmp"]; + $userrow["currenttp"] = $userrow["maxtp"]; + if (($userrow["level"] % 5 == 0)) { $userrow["levelspell"]++; $template = "fight_levelupspell"; } + } + + // Update for new stats. + updateuserrow(); + + // And we're done. + $pagerow = array( + "message"=>$fightrow["message"], + "monstername"=>$monsterrow["name"], + "monsterhp"=>$userrow["currentmonsterhp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"], + "monsterphysdamage"=>$fightrow["monsterphysdamage"], + "monstermagicdamage"=>$fightrow["monstermagicdamage"], + "monsterfiredamage"=>$fightrow["monsterfiredamage"], + "monsterlightdamage"=>$fightrow["monsterlightdamage"], + "newexp"=>$newexp, + "newgold"=>$newgold); + display("Victory!",parsetemplate(gettemplate($template),$pagerow)); + +} + +function youlose() { + + global $userrow, $monsterrow, $fightrow; + + // First take away half the gold. + $userrow["gold"] = ceil($userrow["gold"] / 2); + + // Then take away experience. + $thislevel = dolevels($userrow["level"]); + $nextlevel = dolevels($userrow["level"]+1); + $userrow["experience"] -= ceil((($nextlevel - $thislevel) / 100) * $userrow["deathpenalty"]); + + // And we're done. + $pagerow = array( + "message"=>$fightrow["message"], + "monstername"=>$monsterrow["name"], + "monsterhp"=>$userrow["currentmonsterhp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"], + "monsterphysdamage"=>$fightrow["monsterphysdamage"], + "monstermagicdamage"=>$fightrow["monstermagicdamage"], + "monsterfiredamage"=>$fightrow["monsterfiredamage"], + "monsterlightdamage"=>$fightrow["monsterlightdamage"], + "deathpenalty"=>$userrow["deathpenalty"]); + + // Then put them in town & reset fight stuff. + $userrow["latitude"] = 0; + $userrow["longitude"] = 0; + $userrow["currentaction"] = "In Town"; + $userrow["currentfight"] = 0; + $userrow["currentmonsterid"] = 0; + $userrow["currentmonsterhp"] = 0; + $userrow["currenthp"] = ceil($userrow["maxhp"] / 4); + + // Update. + updateuserrow(); + + display("Thou Art Dead.",parsetemplate(gettemplate("fight_lose"),$pagerow)); + +} + +function dolevels($level) { + + $leveltotal = 15; + $leveladd = 15; + $i = 2; + while ($i < $level) { + $levelstart = $leveltotal; + if ($i < 4) { + $leveladd = ceil($leveladd * 2.0); + } elseif ($i < 13) { + $leveladd = floor($leveladd * 1.45); + } elseif ($i < 40) { + $leveladd = floor($leveladd * 1.20); + } elseif ($i < 60) { + $leveladd = 150000; + } elseif ($i < 80) { + $leveladd = 200000; + } elseif ($i < 100) { + $leveladd = 300000; + } elseif ($i >= 100) { + $leveladd = 500000; + } + $leveltotal = $levelstart + $leveladd; + $i++; + } + return $leveltotal; + +} + +function dospellslist() { + + global $userrow, $spells; + $options = ""; + for ($i = 1; $i < 11; $i++) { + if ($userrow["spell".$i."id"] != 0) { + $options .= "\n"; + } + } + if ($options != "") { + $list = " "; + } else { $list = ""; } + return $list; + +} + +?> \ No newline at end of file diff --git a/fightmods.php b/fightmods.php new file mode 100644 index 0000000..fbac85f --- /dev/null +++ b/fightmods.php @@ -0,0 +1,64 @@ + $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; } + } else { + $userrow["currentmonsterhp"] += floor(($fightrow["monsterphysdamage"]+$fightrow["monstermagicdamage"]+$fightrow["monsterfiredamage"]+$fightrow["monsterlightdamage"]) * ($monsterrow["hpleech"]/100)); + if ($userrow["currentmonsterhp"] > $monsterrow["maxhp"]) { $userrow["currentmonsterhp"] = $monsterrow["maxhp"]; } + } + +} + +function mpleech() { + + /*********** + Description: A percentage of the final damage is given back to the player's MP. + Occurs: Per Turn. + Applies To: Player only. + ***********/ + + global $userrow, $fightrow; + $userrow["currentmp"] += floor(($fightrow["playerphysdamage"]+$fightrow["playermagicdamage"]+$fightrow["playerfiredamage"]+$fightrow["playerlightdamage"]) * ($userrow["mpleech"]/100)); + if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; } + +} + +function hpgain() { + + /*********** + Description: A fixed number is added to player's HP. + Occurs: Per Kill. + Applies To: Player only. + ***********/ + + global $userrow, $fightrow; + $userrow["currenthp"] += $userrow["hpgain"]; + if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; } + +} + +function mpgain() { + + /*********** + Description: A fixed number is added to player's MP. + Occurs: Per Kill. + Applies To: Player only. + ***********/ + + global $userrow, $fightrow; + $userrow["currentmp"] += $userrow["mpgain"]; + if ($userrow["currentmp"] > $userrow["maxmp"]) { $userrow["currentmp"] = $userrow["maxmp"]; } + +} + +?> \ No newline at end of file diff --git a/globals.php b/globals.php new file mode 100644 index 0000000..ec45d8b --- /dev/null +++ b/globals.php @@ -0,0 +1,50 @@ +0, + "playermagicdamage"=>0, + "playerfiredamage"=>0, + "playerlightdamage"=>0, + "monsterphysdamage"=>0, + "monstermagicdamage"=>0, + "monsterfiredamage"=>0, + "monsterlightdamage"=>0, + "message"=>""); + +?> \ No newline at end of file diff --git a/guilds.php b/guilds.php new file mode 100644 index 0000000..a910219 --- /dev/null +++ b/guilds.php @@ -0,0 +1,484 @@ +"; + $bgcolor = "background-color: #ffffff;"; + if (mysql_num_rows($guilds) > 0) { + while ($guildrow = mysql_fetch_array($guilds)) { + $row["guildlist"] .= "[".$guildrow["tagline"]."] ".$guildrow["name"]."Apply to Join | Member List\n"; + if ($bgcolor == "background-color: #ffffff;") { $bgcolor = "background-color: #dddddd;"; } else { $bgcolor = "background-color: #ffffff;"; } + } + } else { + $row["guildlist"] .= "No Guilds have been created yet."; + } + + $row["guildlist"] .= "
"; + display("Guild Hall", parsetemplate(gettemplate("guild_list"), $row)); + +} + +function guildhome() { + + global $userrow; + + if ($userrow["guild"] == 0) { err("You are not yet a member of any Guild. Please go back and try again."); } + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + + switch($userrow["guildrank"]) { + case 1: $template = "guild_homelow"; break; + case 2: $template = "guild_homelow"; break; + case 3: $template = "guild_homelow"; break; + case 4: $template = "guild_homemid"; break; + case 5: $template = "guild_homehigh"; break; + default: $template = "guild_homelow"; break; + } + + // Setup Babblebox. + $pagerow["babblebox"] = "
Guild Babblebox
\n"; + + // Setup Bank. + $pagerow["bank"] = number_format($guild["bank"]); + + // Pull memberslist for select box. + $members = doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."' ORDER BY guildrank", "users"); + $pagerow["memberselect"] = ""; + + // Pull applications for selectbox. + $apps = doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."' ORDER BY id", "guildapps"); + if (mysql_num_rows($apps) > 0) { + $pagerow["appselect"] = "
"; + } else { + $pagerow["appselect"] = "No new applications."; + } + + // Set up everything else. + if (trim($guild["news"]) != "") { + $pagerow["news"] = nl2br($guild["news"]); + } else { $pagerow["news"] = "No news yet."; } + + $title = "[".$guild["tagline"]."] ".$guild["name"]; + display($title, parsetemplate(gettemplate($template),$pagerow)); + +} + +function guildcreate() { + + global $controlrow, $userrow; + + // Errors. + if ($userrow["gold"] < $controlrow["guildstartup"]) { err("You do not have enough gold to create a Guild. Starting your own Guild requires ".number_format($controlrow["guildstartup"])." gold. Please go back and try again."); } + if ($userrow["guild"] != 0) { err("You are already a member of another Guild. You must renounce your current membership before starting your own Guild. Please go back and try again."); } + $appquery = doquery("SELECT * FROM {{table}} WHERE charid='".$userrow["id"]."' LIMIT 1", "guildapps"); + if (mysql_num_rows($appquery) != 0) { err("You have already applied to join another Guild. Please go back and try again."); } + + if (isset($_POST["submit"])) { + + extract($_POST); + + // Errors. + $errors = 0; $errorlist = ""; + if (preg_match("/[^A-z\ 0-9_\-]/", $name)==1) { $errors++; $errorlist .= "Guild names can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank1)==1) { $errors++; $errorlist .= "Rank 1 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank2)==1) { $errors++; $errorlist .= "Rank 2 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank3)==1) { $errors++; $errorlist .= "Rank 3 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank4)==1) { $errors++; $errorlist .= "Rank 4 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank5)==1) { $errors++; $errorlist .= "Rank 5 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z0-9_\-]/", $tagline)==1) { $errors++; $errorlist .= "Guild taglines must be alphanumeric.
"; } // Thanks to "Carlos Pires" from php.net! + if (trim($name) == "") { $errors++; $errorlist .= "Guild name is required.
"; } + if (trim($tagline) == "") { $errors++; $errorlist .= "Tagline is required.
"; } + if (trim($color1) == "#") { $errors++; $errorlist .= "Tagline color is required.
"; } + if (strlen($color1) < 7) { $errors++; $errorlist .= "Tagline color must be 7 characters long.
"; } + if (trim($color2) == "#") { $errors++; $errorlist .= "Name color is required.
"; } + if (strlen($color2) < 7) { $errors++; $errorlist .= "Name color must be 7 characters long.
"; } + if (trim($joincost) == "") { $errors++; $errorlist .= "Cost to join is required.
"; } + if (!is_numeric($joincost)) { $errors++; $errorlist .= "Cost to join must be a number.
"; } + if (trim($rank1) == "") { $errors++; $errorlist .= "Rank 1 is required.
"; } + if (trim($rank2) == "") { $errors++; $errorlist .= "Rank 2 is required.
"; } + if (trim($rank3) == "") { $errors++; $errorlist .= "Rank 3 is required.
"; } + if (trim($rank4) == "") { $errors++; $errorlist .= "Rank 4 is required.
"; } + if (trim($rank5) == "") { $errors++; $errorlist .= "Rank 5 is required.
"; } + + // Should be fine. Go on and create it. + if ($errors == 0) { + $querystring = ""; + unset($_POST["submit"]); + foreach($_POST as $a => $b) { + $querystring .= "$a='$b',"; + } + $querystring .= "id='',isactive='1',founder='".$userrow["id"]."', members='1'"; + $query = doquery("INSERT INTO {{table}} SET $querystring", "guilds"); + + // Now update the Founder's userrow. + $query = doquery("UPDATE {{table}} SET gold=gold-".$controlrow["guildstartup"].", guild='".mysql_insert_id()."',guildrank='5',guildtag='$tagline',tagcolor='$color1',namecolor='$color2' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + + // And we're done. + display("Create a Guild", "Your guild was successfully created.

You may now return to the game."); + + } else { + + // Die gracefully on errors. + err("The following error(s) occurred when your account was being made:
$errorlist
Please go back and try again."); + + } + + } + + $row["guildstartup"] = number_format($controlrow["guildstartup"]); + display("Create a Guild", parsetemplate(gettemplate("guild_create"), $row)); + +} + +function guildedit() { + + global $userrow; + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + + // Errors. + if ($userrow["guildrank"] < 5) { err("You do not have permission to edit the Guild settings. Please go back and try again."); } + + if (isset($_POST["submit"])) { + + extract($_POST); + + // Errors. + $errors = 0; $errorlist = ""; + if (preg_match("/[^A-z\ 0-9_\-]/", $rank1)==1) { $errors++; $errorlist .= "Rank 1 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank2)==1) { $errors++; $errorlist .= "Rank 2 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank3)==1) { $errors++; $errorlist .= "Rank 3 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank4)==1) { $errors++; $errorlist .= "Rank 4 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + if (preg_match("/[^A-z\ 0-9_\-]/", $rank5)==1) { $errors++; $errorlist .= "Rank 5 can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + //if (preg_match("/#[a-fA-F0-9]/", $color1)==1) { $errors++; $errorlist .= "Tagline color does not appear to be a valid HTML color code.
"; } + //if (preg_match("/#[a-fA-F0-9]/", $color2)==1) { $errors++; $errorlist .= "Name color does not appear to be a valid HTML color code.
"; } + if (trim($color1) == "#") { $errors++; $errorlist .= "Tagline color is required.
"; } + if (strlen($color1) != 7) { $errors++; $errorlist .= "Tagline color must be 7 characters long.
"; } + if (trim($color2) == "#") { $errors++; $errorlist .= "Name color is required.
"; } + if (strlen($color2) != 7) { $errors++; $errorlist .= "Name color must be 7 characters long.
"; } + if (trim($joincost) == "") { $errors++; $errorlist .= "Cost to join is required.
"; } + if (!is_numeric($joincost)) { $errors++; $errorlist .= "Cost to join must be a number.
"; } + if (trim($rank1) == "") { $errors++; $errorlist .= "Rank 1 is required.
"; } + if (trim($rank2) == "") { $errors++; $errorlist .= "Rank 2 is required.
"; } + if (trim($rank3) == "") { $errors++; $errorlist .= "Rank 3 is required.
"; } + if (trim($rank4) == "") { $errors++; $errorlist .= "Rank 4 is required.
"; } + if (trim($rank5) == "") { $errors++; $errorlist .= "Rank 5 is required.
"; } + + // Should be fine. Go on and create it. + if ($errors == 0) { + $querystring = ""; + unset($_POST["submit"]); + foreach($_POST as $a => $b) { + $querystring .= "$a='$b',"; + } + $querystring .= "id=id"; + $query = doquery("UPDATE {{table}} SET $querystring WHERE id='".$guild["id"]."'", "guilds"); + $updatemem = doquery("UPDATE {{table}} SET namecolor='$color2', tagcolor='$color1' WHERE guild='".$guild["id"]."'", "users"); + + // And we're done. + display("Edit Guild", "Your guild was successfully edited.

You may now return to town or to your Guild Hall."); + + } else { + + // Die gracefully on errors. + err("The following error(s) occurred when your account was being made:
$errorlist
Please go back and try again."); + + } + + } + + display("Edit Guild", parsetemplate(gettemplate("guild_edit"), $guild)); + +} + +function guildapp() { + + global $userrow; + + $id = $_GET["id"]; + if (!is_numeric($id)) { err("Invalid input. Please go back and try again."); } + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "guilds")); + if ($guild == false) { err("Invalid input. Please go back and try again."); } + + // Errors. + if ($userrow["gold"] < $guild["joincost"]) { err("You do not have enough gold to join this Guild. Joining this Guild requires ".number_format($guild["joincost"])." gold. Please go back and try again."); } + if ($userrow["guild"] != 0) { err("You are already a member of another Guild. You must renounce your current membership before joining this Guild. Please go back and try again."); } + $appquery = doquery("SELECT * FROM {{table}} WHERE charid='".$userrow["id"]."' LIMIT 1", "guildapps"); + if (mysql_num_rows($appquery) != 0) { err("You have already applied to join another Guild. Please go back and try again."); } + + if (isset($_POST["yes"])) { + + $query = doquery("INSERT INTO {{table}} SET id='',guild='$id',charid='".$userrow["id"]."',charname='".$userrow["charname"]."'", "guildapps"); + $update = doquery("UPDATE {{table}} SET bank=bank+".$guild["joincost"]." WHERE id='".$guild["id"]."' LIMIT 1", "guilds"); + $updatemem = doquery("UPDATE {{table}} SET gold=gold-".$guild["joincost"]." WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='".$guild["founder"]."', recipientname='Guild Leader', status='0', title='New Guild Application', message='Someone has applied to join your Guild.

Do not reply to this message!', gold='0'", "messages"); + display("Join a Guild", "Thank you for applying to this Guild. If the Guild Leader approves your application, you will be notified via the Post Office.

You may now return to the game."); + + } elseif (isset($_POST["no"])) { + + die(header("Location: index.php?do=guilds")); + + } else { + + $guild["joincost"] = number_format($guild["joincost"]); + $guild["statement"] = nl2br($guild["statement"]); + display("Join a Guild", parsetemplate(gettemplate("guild_apply"), $guild)); + + } + +} + +function guildmembers() { + + $id = $_GET["id"]; + if (!is_numeric($id)) { err("Invalid input. Please go back and try again."); } + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='$id' LIMIT 1", "guilds")); + if ($guild == false) { err("Invalid input. Please go back and try again."); } + + $query = doquery("SELECT * FROM {{table}} WHERE guild='$id' ORDER BY guildrank DESC", "users"); + $row["guildmembers"] = "\n"; + $bgcolor = "background-color: #ffffff;"; + if (mysql_num_rows($query) > 0) { + while ($guildrow = mysql_fetch_array($query)) { + $row["guildmembers"] .= "\n"; + if ($bgcolor == "background-color: #ffffff;") { $bgcolor = "background-color: #dddddd;"; } else { $bgcolor = "background-color: #ffffff;"; } + } + } else { + $row["guildmembers"] .= ""; + } + $row["guildmembers"] .= "
NameRank
[".$guild["tagline"]."]".$guildrow["charname"]."".$guild["rank".$guildrow["guildrank"]]."
This Guild has no members yet.

"; + $row["name"] = $guild["name"]; + display("Guild Hall", parsetemplate(gettemplate("guild_members"), $row)); + +} + +function guildbank() { + + global $userrow; + extract($_POST); + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + + + if (isset($_POST["out"])) { + + $member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users")); + + // Errors. + if ($userrow["guildrank"] < 4) { err("You do not have permission to distribute Guild funds. Please go back and try again."); } + if (!is_numeric($charid)) { err("Invalid input. Please go back and try again."); } + if (!is_numeric($gold)) { err("Invalid input. Please go back and try again."); } + if ($gold < 0) { err("You can't send a negative amount of gold. Please go back and try again."); } + if ($gold > $guild["bank"]) { err("Your Guild does not have that much gold in the bank. Please go back and try again."); } + if ($member == false) { err("Invalid input. Please go back and try again."); } + if ($member["guild"] != $userrow["guild"]) { err("That player is not in your Guild. Please go back and try again."); } + if ($member["id"] == $userrow["id"]) { err("You cannot send Guild money to yourself. Please go back and try again."); } + + // Do stuff. + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Money from your Guild', message='Your Guild has sent you money from the Guild Bank.

Do not reply to this message!', gold='$gold'", "messages"); + $update = doquery("UPDATE {{table}} SET bank=bank-$gold WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"); + display("Post Office", gettemplate("mailbox_sent")); + + } elseif (isset($_POST["in"])) { + + // Errors. + if (!is_numeric($_POST["golddeposit"])) { err("Invalid action. Please go back and try again."); } + if ($_POST["golddeposit"] < 1) { err("Deposit amount must be greater than 0."); } + if ($_POST["golddeposit"] > $userrow["gold"]) { err("You do not have that much money in your pocket."); } + + // Do stuff. + $update = doquery("UPDATE {{table}} SET bank=bank+".$_POST["golddeposit"]." WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"); + $updatemem = doquery("UPDATE {{table}} SET gold=gold-".$_POST["golddeposit"]." WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Guild Bank", "Thank you for depositing money to the Guild Bank.

You may now return to Town or to your Guild Hall."); + + } + +} + +function guildpromote() { + + global $userrow; + extract($_POST); + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + $member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users")); + + if (isset($_POST["promote"])) { + + // Errors. + if ($userrow["guildrank"] < 4) { err("You do not have permission to promote members. Please go back and try again."); } + if ($userrow["guildrank"] == 4 && $member["guildrank"] >= 3) { err("You do not have permission to promote this member any higher. Please go back and try again."); } + if ($member["guildrank"] == 5) { err("This member cannot be promoted any higher. Please go back and try again."); } + if ($member == false) { err("Invalid input. Please go back and try again."); } + if ($member["guild"] != $userrow["guild"]) { err("That player is not in your Guild. Please go back and try again."); } + + // Do stuff. + $update = doquery("UPDATE {{table}} SET guildrank=guildrank+1 WHERE id='$charid' LIMIT 1", "users"); + + } elseif (isset($_POST["demote"])) { + + // Errors. + if ($userrow["guildrank"] < 4) { err("You do not have permission to demote members. Please go back and try again."); } + if ($userrow["guildrank"] == 4 && $member["guildrank"] > 3) { err("You do not have permission to demote this member. Please go back and try again."); } + if ($userrow["id"] == $member["id"]) { err("You cannot demote yourself. Please go back and try again."); } + if ($member == false) { err("Invalid input. Please go back and try again."); } + if ($member["guild"] != $userrow["guild"]) { err("That player is not in your Guild. Please go back and try again."); } + if ($member["guildrank"] == 1) { guildremove(); } + + // Do stuff. + $update = doquery("UPDATE {{table}} SET guildrank=guildrank-1 WHERE id='$charid' LIMIT 1", "users"); + + } + + display("Guild Ranks", "Thank you for promoting/demoting this user.

You may now return to Town or to your Guild Hall."); + +} + +function guildapprove() { + + global $userrow; + extract($_POST); + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + $member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users")); + $app = dorow(doquery("SELECT * FROM {{table}} WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1", "guildapps")); + + // Errors. + if ($userrow["guildrank"] < 4) { err("You do not have permission to approve new members. Please go back and try again."); } + if ($app == false) { err("Invalid input. Please go back and try again."); } + + // Do stuff. + if (isset($_POST["approve"])) { + $updatemem = doquery("UPDATE {{table}} SET guild='".$userrow["guild"]."', guildrank='1', guildtag='".$guild["tagline"]."', tagcolor='".$guild["color1"]."', namecolor='".$guild["color2"]."' WHERE id='".$app["charid"]."' LIMIT 1", "users"); + $updateguild = doquery("UPDATE {{table}} SET members=members+1 WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"); + $deleteapp = doquery("DELETE FROM {{table}} WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1", "guildapps"); + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Approval', message='The Guild has approved you for membership, and you are now a member of ".$guild["name"].". Congratulations!

Do not reply to this message!', gold='0'", "messages"); + display("Approve Members", "Thank you for approving this user.

You may now return to Town or to your Guild Hall."); + } else { + $deleteapp = doquery("DELETE FROM {{table}} WHERE guild='".$userrow["guild"]."' AND charid='$charid' LIMIT 1", "guildapps"); + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Denial', message='The Guild has denied your application for membership. Sorry.

Do not reply to this message!', gold='0'", "messages"); + display("Approve Members", "Thank you for denying this user.

You may now return to Town or to your Guild Hall."); + } + +} + +function guildremove() { + + global $userrow; + extract($_POST); + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + $member = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charid' LIMIT 1", "users")); + + if (isset($_POST["yes"])) { + + $update = doquery("UPDATE {{table}} SET members=members-1 WHERE id='".$guild["id"]."' LIMIT 1", "guilds"); + $updatemem = doquery("UPDATE {{table}} SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE id='$charid' LIMIT 1", "users"); + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='$charid', recipientname='".$member["charname"]."', status='0', title='Guild Removal', message='The Guild has removed you from their membership. Sorry.

Do not reply to this message!', gold='0'", "messages"); + display("Remove Members", "Thank you for removing this user.

You may now return to Town or to your Guild Hall."); + + } elseif (isset($_POST["no"])) { + + die(header("Location: index.php?do=guildhome")); + + } + + + $pagerow["charid"] = $charid; + $pagerow["charname"] = $member["charname"]; + display("Remove Member", parsetemplate(gettemplate("guild_remove"), $pagerow)); + +} + +function guildnews() { + + global $userrow; + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + + // Errors. + if ($userrow["guildrank"] < 5) { err("You do not have permission to edit Guild news. Please go back and try again."); } + + if (isset($_POST["submit"])) { + + $query = doquery("UPDATE {{table}} SET news='".$_POST["news"]."' WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"); + display("Guild News", "Thank you for updating your Guild News.

You may now return to Town or to your Guild Hall."); + + } + + if (trim($guild["news"]) == "") { $guild["news"] = "No news yet."; } + display("Guild News", parsetemplate(gettemplate("guild_news"), $guild)); + +} + +function guilddisband() { + + global $userrow; + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + + // Errors. + if ($userrow["id"] != $guild["founder"]) { err("You do not have permission to disband the Guild. Please go back and try again."); } + + if (isset($_POST["yes"])) { + + $query = doquery("SELECT * FROM {{table}} WHERE guild='".$guild["id"]."'", "users"); + while ($row = mysql_fetch_array($query)) { + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='0', sendername='".$guild["name"]."', recipientid='".$row["id"]."', recipientname='".$row["charname"]."', status='0', title='Guild Disbanded', message='Your Guild leader has chosen to disband the guild. Your member status has been reset, and you can now apply to join another guild if you wish.

Do not reply to this message!', gold='0'", "messages"); + } + $updatemem = doquery("UPDATE {{table}} SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE guild='".$guild["id"]."'", "users"); + $delete = doquery("DELETE FROM {{table}} WHERE id='".$guild["id"]."'", "guilds"); + $deletebb = doquery("DELETE FROM {{table}} WHERE guild='".$guild["id"]."'", "babblebox"); + display("Disband Guild", "Thank you for disbanding your Guild.

You may now return to Town."); + + } elseif (isset($_POST["no"])) { + + die(header("Location: index.php?do=guildhome")); + + } + + display("Disband Guild", gettemplate("guild_disband")); + +} + +function guildleave() { + + global $userrow; + + $guild = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds")); + + if (isset($_POST["yes"])) { + + $updatemem = doquery("UPDATE {{table}} SET guild='0', guildrank='0', guildtag='', tagcolor='', namecolor='' WHERE id='".$userrow["id"]."'", "users"); + $update = doquery("UPDATE {{table}} SET members=members-1 WHERE id='".$userrow["guild"]."' LIMIT 1", "guilds"); + display("Leave Guild", "Thank you for leaving your Guild.

You may now return to Town."); + + } elseif (isset($_POST["no"])) { + + die(header("Location: index.php?do=guildhome")); + + } + + display("Leave Guild", gettemplate("guild_leave")); + +} + +?> \ No newline at end of file diff --git a/images/Thumbs.db b/images/Thumbs.db new file mode 100644 index 0000000..fa34c89 Binary files /dev/null and b/images/Thumbs.db 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/background1.jpg b/images/background1.jpg new file mode 100644 index 0000000..5e8693f Binary files /dev/null and b/images/background1.jpg differ diff --git a/images/background2.jpg b/images/background2.jpg new file mode 100644 index 0000000..800a5cd Binary files /dev/null and b/images/background2.jpg differ diff --git a/images/background3.jpg b/images/background3.jpg new file mode 100644 index 0000000..b7da387 Binary files /dev/null and b/images/background3.jpg differ diff --git a/images/background4.jpg b/images/background4.jpg new file mode 100644 index 0000000..c7646dc Binary files /dev/null and b/images/background4.jpg differ diff --git a/images/background5.jpg b/images/background5.jpg new file mode 100644 index 0000000..49a973c Binary files /dev/null and b/images/background5.jpg differ diff --git a/images/bars_green.gif b/images/bars_green.gif new file mode 100644 index 0000000..dec0c0a Binary files /dev/null and b/images/bars_green.gif differ diff --git a/images/bars_greenend.gif b/images/bars_greenend.gif new file mode 100644 index 0000000..c9a70be Binary files /dev/null and b/images/bars_greenend.gif differ diff --git a/images/bars_grey.gif b/images/bars_grey.gif new file mode 100644 index 0000000..7fe1185 Binary files /dev/null and b/images/bars_grey.gif differ diff --git a/images/bars_red.gif b/images/bars_red.gif new file mode 100644 index 0000000..87fa00e Binary files /dev/null and b/images/bars_red.gif differ diff --git a/images/bars_redend.gif b/images/bars_redend.gif new file mode 100644 index 0000000..ad4ea06 Binary files /dev/null and b/images/bars_redend.gif differ diff --git a/images/bars_yellow.gif b/images/bars_yellow.gif new file mode 100644 index 0000000..252aece Binary files /dev/null and b/images/bars_yellow.gif differ diff --git a/images/bars_yellowend.gif b/images/bars_yellowend.gif new file mode 100644 index 0000000..1340f58 Binary files /dev/null and b/images/bars_yellowend.gif differ diff --git a/images/compass_01.png b/images/compass_01.png new file mode 100644 index 0000000..5e055df Binary files /dev/null and b/images/compass_01.png differ diff --git a/images/compass_02.png b/images/compass_02.png new file mode 100644 index 0000000..6f965a2 Binary files /dev/null and b/images/compass_02.png differ diff --git a/images/compass_03.png b/images/compass_03.png new file mode 100644 index 0000000..ffb79bc Binary files /dev/null and b/images/compass_03.png differ diff --git a/images/compass_04.png b/images/compass_04.png new file mode 100644 index 0000000..c131c2d Binary files /dev/null and b/images/compass_04.png differ diff --git a/images/cup.gif b/images/cup.gif new file mode 100644 index 0000000..ea80561 Binary files /dev/null and b/images/cup.gif differ diff --git a/images/items/1.gif b/images/items/1.gif new file mode 100644 index 0000000..a010b26 Binary files /dev/null and b/images/items/1.gif differ diff --git a/images/items/1.png b/images/items/1.png new file mode 100644 index 0000000..59aa0df Binary files /dev/null and b/images/items/1.png differ diff --git a/images/items/2.gif b/images/items/2.gif new file mode 100644 index 0000000..af5461a Binary files /dev/null and b/images/items/2.gif differ diff --git a/images/items/2.png b/images/items/2.png new file mode 100644 index 0000000..c3dddc6 Binary files /dev/null and b/images/items/2.png differ diff --git a/images/items/3.gif b/images/items/3.gif new file mode 100644 index 0000000..b4737c3 Binary files /dev/null and b/images/items/3.gif differ diff --git a/images/items/3.png b/images/items/3.png new file mode 100644 index 0000000..4ee7269 Binary files /dev/null and b/images/items/3.png differ diff --git a/images/items/4.gif b/images/items/4.gif new file mode 100644 index 0000000..679fbf9 Binary files /dev/null and b/images/items/4.gif differ diff --git a/images/items/4.png b/images/items/4.png new file mode 100644 index 0000000..720ef1d Binary files /dev/null and b/images/items/4.png differ diff --git a/images/items/Thumbs.db b/images/items/Thumbs.db new file mode 100644 index 0000000..002e49b Binary files /dev/null and b/images/items/Thumbs.db differ diff --git a/images/items/noimage.gif b/images/items/noimage.gif new file mode 100644 index 0000000..a6bfc99 Binary files /dev/null and b/images/items/noimage.gif differ diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..833f5be Binary files /dev/null and b/images/logo.png differ diff --git a/images/spacer.gif b/images/spacer.gif new file mode 100644 index 0000000..5bfd67a Binary files /dev/null and b/images/spacer.gif differ diff --git a/images/town_bank.png b/images/town_bank.png new file mode 100644 index 0000000..09a1ff8 Binary files /dev/null and b/images/town_bank.png differ diff --git a/images/town_buy.png b/images/town_buy.png new file mode 100644 index 0000000..8c21dc5 Binary files /dev/null and b/images/town_buy.png differ diff --git a/images/town_duel.png b/images/town_duel.png new file mode 100644 index 0000000..6009336 Binary files /dev/null and b/images/town_duel.png differ diff --git a/images/town_gamble.png b/images/town_gamble.png new file mode 100644 index 0000000..d2f5df7 Binary files /dev/null and b/images/town_gamble.png differ diff --git a/images/town_guilds.png b/images/town_guilds.png new file mode 100644 index 0000000..46dc7ef Binary files /dev/null and b/images/town_guilds.png differ diff --git a/images/town_hall.png b/images/town_hall.png new file mode 100644 index 0000000..a96608f Binary files /dev/null and b/images/town_hall.png differ diff --git a/images/town_inn.png b/images/town_inn.png new file mode 100644 index 0000000..8ef3dad Binary files /dev/null and b/images/town_inn.png differ diff --git a/images/town_maps.png b/images/town_maps.png new file mode 100644 index 0000000..d13536e Binary files /dev/null and b/images/town_maps.png differ diff --git a/images/town_post.png b/images/town_post.png new file mode 100644 index 0000000..337a39c Binary files /dev/null and b/images/town_post.png differ diff --git a/images/users/Thumbs.db b/images/users/Thumbs.db new file mode 100644 index 0000000..179cb3b Binary files /dev/null and b/images/users/Thumbs.db differ diff --git a/images/users/nopicture.gif b/images/users/nopicture.gif new file mode 100644 index 0000000..b712b72 Binary files /dev/null and b/images/users/nopicture.gif differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..502731e --- /dev/null +++ b/index.php @@ -0,0 +1,81 @@ + \ No newline at end of file diff --git a/lib.php b/lib.php new file mode 100644 index 0000000..bfe67fd --- /dev/null +++ b/lib.php @@ -0,0 +1,225 @@ +
$query"); + $numqueries++; + return $sqlquery; + +} + +function dorow($sqlquery) { // Abstraction layer part deux. + + switch(mysql_num_rows($sqlquery)) { + case 0: + $row = false; + break; + case 1: + $row = mysql_fetch_array($sqlquery, MYSQL_ASSOC); + break; + default: + $row = array(); + while ($array = mysql_fetch_array($sqlquery, MYSQL_ASSOC)) { + $row[] = $array; + } + } + return $row; + +} + +function gettemplate($templatename) { // SQL query for the template. + + $filename = "templates/" . $templatename . ".php"; + include("$filename"); + return $template; + +} + +function parsetemplate($template, $array) { // Replace template with proper content. Also does languages. + + foreach($array as $a => $b) { + $template = str_replace("{{{$a}}}", $b, $template); + } + return $template; + +} + +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\<\b\\r \/\>G:i", mktime(0,0,0,substr($uglydate, 5, 2),substr($uglydate, 8, 2),substr($uglydate, 0, 4))); + +} + +function getmicrotime() { // Used for timing script operations. + + list($usec, $sec) = explode(" ",microtime()); + return ((float)$usec + (float)$sec); + +} + +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 stripslashes_deep($value) { + + $value = is_array($value) ? + array_map('stripslashes_deep', $value) : + stripslashes($value); + return $value; + +} + +function addslashes_deep($value) { + + $value = is_array($value) ? + array_map('addslashes_deep', $value) : + addslashes($value); + return $value; + +} + +function makesafe($d) { + + $d = str_replace("\t","",$d); + $d = str_replace("<","<",$d); + $d = str_replace(">",">",$d); + $d = str_replace("\n","",$d); + $d = str_replace("|","??",$d); + $d = str_replace(" ","  ",$d); + return $d; + +} + +function err($error, $system = false, $panels = true) { // Basic little error handler. + + display("Error", $error, $panels); +/* + // Don't display major system errors (sql errors). + if ($system == true) { + if ($handle = fopen("errorlog/errorlog.txt", 'a')) { + $written = fwrite($handle, $error."\n"); + fclose($handle); + } + if ($written != false) { + display("Error", "A critical game system error has occurred.

Please have the game administrator check the game error logs and fix the problem.

Please go back and try again."); + } else { + display("Error", "A critical game system error has occurred. Additionally, an error occurred when trying to create a game error log entry. Please have the game administrator check the server logs and fix the problem.

Please go back and try again."); + } + } else { + display("Error", $error); + } +*/ +} + +function updateuserrow() { + + global $userrow; + + $querystring = ""; + foreach($userrow as $a=>$b) { + $querystring .= "$a='$b',"; + } + $querystring = rtrim($querystring, ","); + + $query = doquery("UPDATE {{table}} SET $querystring WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + +} + +function display($title, $content, $panels = true) { // Finalize page and output to browser. + + include('config.php'); + global $controlrow, $userrow, $worldrow, $numqueries, $starttime, $version, $build; + + if (!isset($controlrow)) { + $controlrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control")); + } + + // Make page tags for XHTML validation. + $page = "\n" + . "\n" + . "\n"; + $page .= gettemplate("primary"); + + // Setup for primary page array indexes. + $row = array(); + $row["gamename"] = $controlrow["gamename"]; + $row["pagetitle"] = $title; + $row["background"] = "background"; + $row["version"] = $version; + $row["numqueries"] = $numqueries; + $row["totaltime"] = round(getmicrotime()-$starttime,4); + $row["content"] = $content; + + // Setup for side panels. + include("panels.php"); + if ($panels == true) { + $row["leftnav"] = panelleft(); + $row["rightnav"] = panelright(); + $row["topnav"] = paneltop(true); + $row["bottomnav"] = panelbottom(); + $row["middlenav"] = panelmiddle(); + } else { + $row["leftnav"] = ""; + $row["rightnav"] = ""; + $row["topnav"] = paneltop(false); + $row["bottomnav"] = ""; + } + + //if(md5_file("templates/primary.php") != "0aeec5eb64ff875a697142528afe8fc7") { die("Primary template modified. Cannot continue."); } + + // Finalize control array for output. + $page = parsetemplate($page, $row); + + 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..c913d20 --- /dev/null +++ b/login.php @@ -0,0 +1,49 @@ +go back and try again.", false, false); } + if ($row["password"] != md5($password)) { err("Invalid password. Please go back and try again.", false, false); } + + // Finish. + $newcookie = $row["id"] . " " . $username . " " . md5($row["password"] . "--" . $dbsettings["secretword"]); + if (isset($remember)) { $expiretime = time()+31536000; $newcookie .= " 1"; } else { $expiretime = 0; $newcookie .= " 0"; } + setcookie("scourge", $newcookie, $expiretime, "/", "", 0); + die(header("Location: index.php")); + + } else { + + display("Log In", gettemplate("login"), false); + + } + +} + +function logout() { + + setcookie("scourge", "", (time()-3600), "/", "", 0); + die(header("Location: login.php?do=login")); + +} + +?> \ No newline at end of file diff --git a/mailbox.php b/mailbox.php new file mode 100644 index 0000000..6445b42 --- /dev/null +++ b/mailbox.php @@ -0,0 +1,217 @@ +\n"; + + if (mysql_num_rows($messagequery) == 0) { + $row["messages"] .= "You do not have any messages."; + } elseif (mysql_num_rows($messagequery) == 1) { + if ($messages["status"] == 0) { $messages["new"] = "*"; } else { $messages["new"] = ""; } + if ($messages["gold"] != 0) { $messages["money"] = "\$"; } else { $messages["money"] = ""; } + $row["messages"] .= parsetemplate(gettemplate("mailbox_listrow"), $messages); + } else { + foreach($messages as $a=>$b) { + if ($b["status"] == 0) { $b["new"] = "*"; } else { $b["new"] = ""; } + if ($b["gold"] != 0) { $b["money"] = "\$"; } else { $b["money"] = ""; } + $row["messages"] .= parsetemplate(gettemplate("mailbox_listrow"), $b); + } + } + + $row["messages"] .= "
\n"; + display("Post Office", parsetemplate(gettemplate("mailbox_list"), $row)); + +} + +function outbox() { + + global $userrow; + + $messagequery = doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE senderid='".$userrow["id"]."' ORDER BY postdate DESC", "messages"); + $messages = dorow($messagequery); + $row["messages"] = "\n"; + + if (mysql_num_rows($messagequery) == 0) { + $row["messages"] .= ""; + } elseif (mysql_num_rows($messagequery) == 1) { + $row["messages"] .= parsetemplate(gettemplate("mailbox_listoutrow"), $messages); + } else { + foreach($messages as $a=>$b) { + $row["messages"] .= parsetemplate(gettemplate("mailbox_listoutrow"), $b); + } + } + + $row["messages"] .= "
You do not have any sent messages.

\n"; + display("Post Office", parsetemplate(gettemplate("mailbox_listout"), $row)); + +} + +function letter() { + + global $userrow; + + if (!is_numeric($_GET["id"])) { err("Invalid action. Please go back and try again."); } + $message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages")); + if ($message == false) { err("Invalid action. Please go back and try again."); } + if ($message["recipientid"] != $userrow["id"]) { err("Invalid action. Please go back and try again."); } + + // Handle money transfers. + $message["moneytransfer"] = ""; + if ($message["gold"] != 0) { + $userrow["gold"] += $message["gold"]; + $message["moneytransfer"] = "You have received ".$message["gold"]." Gold with this message.
"; + updateuserrow(); + } + + // Reset status to old, and gold to zero, so they can't keep reading the message to get more money. + if ($message["status"] == 0) { + $statusquery = doquery("UPDATE {{table}} SET status='1', gold='0' WHERE id='".$_GET["id"]."' LIMIT 1", "messages"); + } + + // Pull the sender's userrow so we can show avatars. + $sender = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$message["senderid"]."' LIMIT 1", "users")); + if ($sender["charpicture"] != "") { + $message["senderavatar"] = "\"".$sender["charname"]."\""; + } else { + $message["senderavatar"] = "\"".$sender["charname"]."\""; + } + + $message["message"] = nl2br($message["message"]); + display("Post Office", parsetemplate(gettemplate("mailbox_letter"), $message)); + +} + +function letterout() { + + global $userrow; + + if (!is_numeric($_GET["id"])) { err("Invalid action. Please go back and try again."); } + $message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages")); + if ($message == false) { err("Invalid action. Please go back and try again."); } + if ($message["senderid"] != $userrow["id"]) { err("Invalid action. Please go back and try again."); } + + $message["message"] = nl2br($message["message"]); + display("Post Office", parsetemplate(gettemplate("mailbox_letterout"), $message)); + +} + +function mailnew() { + + global $userrow; + + if (isset($_POST["submit"])) { + + // Check for errors. + extract($_POST); + $errors = 0; $errorlist = ""; + if ($userrow["gold"] < 5) { $errors++; $errorlist .= "You do not have enough gold to cover the postage fee.
"; } + $checkuser = dorow(doquery("SELECT * FROM {{table}} WHERE charname='$recipient' LIMIT 1", "users")); + if ($checkuser == false) { $errors++; $errorlist .= "There is no player with that Character Name.
"; } + if (trim($gold) != "") { + if (!is_numeric($gold)) { $errors++; $errorlist .= "The Send Gold field must be a number.
"; } + if ($gold < 1) { $errors++; $errorlist .= "Money Transfer amount must be greater than 0.
"; } + if ($userrow["gold"] < $gold + 5) { $errors++; $errorlist .= "You don't have that much gold to send.
"; } + if ($userrow["account"] == $checkuser["account"] && $gold >= ($userrow["gold"] / 10)) { $errors++; $errorlist .= "You are only allowed to send up to 10% of your gold to another character on your account.
"; } + } + if ($recipient == $userrow["charname"]) { $errors++; $errorlist .= "You cannot send a message to yourself. That would be a waste of 5 gold, dummy!"; } + if (trim($title) == "") { $errors++; $errorlist .= "You must enter a Subject.
"; } + + if ($errors == 0) { + + // Subtract gold. + $userrow["gold"] -= 5; + if (trim($gold) != "") { $userrow["gold"] -= $gold; } + updateuserrow(); + + // And send the message. + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='".$userrow["id"]."', sendername='".$userrow["charname"]."', recipientid='".$checkuser["id"]."', recipientname='$recipient', status='0', title='$title', message='$message', gold='$gold'", "messages"); + display("Post Office", gettemplate("mailbox_sent")); + + } else { + + // Die gracefully on errors. + err("The following error(s) occurred when trying to send your letter:
$errorlist
Please go back and try again."); + + } + + } + + display("Post Office", gettemplate("mailbox_new")); + +} + +function mailreply() { + + global $userrow; + + if (!is_numeric($_GET["id"])) { err("Invalid action. Please go back and try again."); } + $origmessage = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages")); + if ($origmessage == false) { err("Invalid action. Please go back and try again."); } + if ($origmessage["recipientid"] != $userrow["id"]) { err("Invalid action. Please go back and try again."); } + + if (isset($_POST["submit"])) { + + // Check for errors. + extract($_POST); + $errors = 0; $errorlist = ""; + if ($userrow["gold"] < 5) { $errors++; $errorlist .= "You do not have enough gold to cover the postage fee.
"; } + $checkuser = dorow(doquery("SELECT * FROM {{table}} WHERE charname='".$origmessage["sendername"]."' LIMIT 1", "users")); + if ($checkuser == false) { $errors++; $errorlist .= "There is no player with that Character Name.
"; } + if (trim($gold) != "") { + if (!is_numeric($gold)) { $errors++; $errorlist .= "The Send Gold field must be a number.
"; } + if ($gold < 1) { $errors++; $errorlist .= "Money Transfer amount must be greater than 0.
"; } + if ($userrow["gold"] < $gold + 5) { $errors++; $errorlist .= "You don't have that much gold to send.
"; } + if ($userrow["account"] == $checkuser["account"] && $gold >= ($userrow["gold"] / 10)) { $errors++; $errorlist .= "You are only allowed to send up to 10% of your gold to another character on your account.
"; } + } + if (trim($title) == "") { $errors++; $errorlist .= "You must enter a Subject.
"; } + + if ($errors == 0) { + + // Subtract gold. + $userrow["gold"] -= 5; + if (trim($gold) != "") { $userrow["gold"] -= $gold; } + updateuserrow(); + + // And send the message. + $send = doquery("INSERT INTO {{table}} SET id='', postdate=NOW(), senderid='".$userrow["id"]."', sendername='".$userrow["charname"]."', recipientid='".$origmessage["senderid"]."', recipientname='".$origmessage["sendername"]."', status='0', title='$title', message='$message', gold='$gold'", "messages"); + display("Post Office", gettemplate("mailbox_sent")); + + } else { + + // Die gracefully on errors. + err("The following error(s) occurred when trying to send your letter:
$errorlist
Please go back and try again."); + + } + + } + + + + $origmessage["message"] = nl2br($origmessage["message"]); + display("Post Office", parsetemplate(gettemplate("mailbox_reply"), $origmessage)); + +} + +function maildelete() { + + global $userrow; + + if (!is_numeric($_GET["id"])) { err("Invalid action. Please go back and try again."); } + $message = dorow(doquery("SELECT *, DATE_FORMAT(postdate, '%m.%d.%Y ~ %H:%i') AS fpostdate FROM {{table}} WHERE id='".$_GET["id"]."' LIMIT 1", "messages")); + if ($message == false) { err("Invalid action. Please go back and try again."); } + if ($message["recipientid"] != $userrow["id"]) { err("Invalid action. Please go back and try again."); } + + $delete = doquery("DELETE FROM {{table}} WHERE id='".$_GET["id"]."'", "messages"); + die(header("Location: index.php?do=mailbox")); + +} + +?> \ No newline at end of file diff --git a/mainindex.php b/mainindex.php new file mode 100644 index 0000000..96ab037 --- /dev/null +++ b/mainindex.php @@ -0,0 +1,49 @@ + + + + +Dragon Scourge Beta + + +
+ + + + + + + + +
+ Dragon Scourge Beta +
+ Please read THIS POST on the forums before playing the game! This is very important, and if you don't read it, monkeys will come and eat your genitals.

+ Once you've done that, you are more than happy to...

+ Play Dragon Scourge. +
+ + + + + + + +
+ + Dragon Scourge © 2003-2005 by renderse7en +
+
+ \ No newline at end of file diff --git a/map.php b/map.php new file mode 100644 index 0000000..49ffc64 --- /dev/null +++ b/map.php @@ -0,0 +1,49 @@ +$b) { + $lat = $b["latitude"]; + $lon = $b["longitude"]; + if ($lat >= 0) { $y = ceil(($worldrow["size"] - $lat) * $perpix); } else { $y = 250 + ceil(($lat * -1) * $perpix); } + if ($lon >= 0) { $x = 250 + ceil($lon * $perpix); } else { $x = ceil(($worldrow["size"] + $lon) * $perpix); } + $text .= "town".$count."_x=".$x."&"; + $text .= "town".$count."_y=".$y."&"; + $text .= "town".$count."_name=".$b["name"]."&"; + $count++; +} + +// Then do your character. +$lat = $userrow["latitude"]; +$lon = $userrow["longitude"]; +if ($lat >= 0) { $y = ceil(($worldrow["size"] - $lat) * $perpix); } else { $y = 250 + ceil(($lat * -1) * $perpix); } +if ($lon >= 0) { $x = 250 + ceil($lon * $perpix); } else { $x = ceil(($worldrow["size"] + $lon) * $perpix); } +$text .= "player_x=".$x."&"; +$text .= "player_y=".$y."&"; +$text .= "player_name=".$userrow["charname"]."&"; + +$users = doquery("SELECT * FROM {{table}} WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'", "users"); +$text .= "users=".mysql_num_rows($users)."&"; +$count = 0; +while ($b = mysql_fetch_array($users)) { + $lat = $b["latitude"]; + $lon = $b["longitude"]; + if ($lat >= 0) { $y = ceil(($worldrow["size"] - $lat) * $perpix); } else { $y = 250 + ceil(($lat * -1) * $perpix); } + if ($lon >= 0) { $x = 250 + ceil($lon * $perpix); } else { $x = ceil(($worldrow["size"] + $lon) * $perpix); } + $text .= "user".$count."_x=".$x."&"; + $text .= "user".$count."_y=".$y."&"; + $text .= "user".$count."_name=".$b["charname"]."&"; + $count++; +} + +echo($text); + +?> \ No newline at end of file diff --git a/map.swf b/map.swf new file mode 100644 index 0000000..cf3271b Binary files /dev/null and b/map.swf differ diff --git a/mapmini.php b/mapmini.php new file mode 100644 index 0000000..61878fc --- /dev/null +++ b/mapmini.php @@ -0,0 +1,46 @@ +$b) { + $lat = $b["latitude"]; + $lon = $b["longitude"]; + if ($lat >= 0) { $y = ceil(($worldrow["size"] - $lat) * $perpix); } else { $y = 50 + ceil(($lat * -1) * $perpix); } + if ($lon >= 0) { $x = 50 + ceil($lon * $perpix); } else { $x = ceil(($worldrow["size"] + $lon) * $perpix); } + $text .= "town".$count."_x=".$x."&"; + $text .= "town".$count."_y=".$y."&"; + $count++; +} + +// Then do your character. +$lat = $userrow["latitude"]; +$lon = $userrow["longitude"]; +if ($lat >= 0) { $y = ceil(($worldrow["size"] - $lat) * $perpix); } else { $y = 50 + ceil(($lat * -1) * $perpix); } +if ($lon >= 0) { $x = 50 + ceil($lon * $perpix); } else { $x = ceil(($worldrow["size"] + $lon) * $perpix); } +$text .= "player_x=".$x."&"; +$text .= "player_y=".$y."&"; + +$users = doquery("SELECT * FROM {{table}} WHERE world='".$worldrow["id"]."' AND UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND id != '".$userrow["id"]."'", "users"); +$text .= "users=".mysql_num_rows($users)."&"; +$count = 0; +while ($b = mysql_fetch_array($users)) { + $lat = $b["latitude"]; + $lon = $b["longitude"]; + if ($lat >= 0) { $y = ceil(($worldrow["size"] - $lat) * $perpix); } else { $y = 50 + ceil(($lat * -1) * $perpix); } + if ($lon >= 0) { $x = 50 + ceil($lon * $perpix); } else { $x = ceil(($worldrow["size"] + $lon) * $perpix); } + $text .= "user".$count."_x=".$x."&"; + $text .= "user".$count."_y=".$y."&"; + $count++; +} + +echo($text); + +?> \ No newline at end of file diff --git a/mapmini.swf b/mapmini.swf new file mode 100644 index 0000000..90b3598 Binary files /dev/null and b/mapmini.swf differ diff --git a/misc.php b/misc.php new file mode 100644 index 0000000..c869067 --- /dev/null +++ b/misc.php @@ -0,0 +1,94 @@ +---Trent Reznor"; + display("LMFAO!", $page); + +} + +function version() { + + global $version, $bname, $bdate, $bnumber; + +$page = << +Version Number:$version +Build Number:$bnumber +Build Name:$bname +Build Date:$bdate +View the Changelog + +END; + + display("Version Information",$page); + +} + +function babblebox2() { + + global $userrow, $controlrow; + + if (isset($_GET["g"])) { + if (!is_numeric($_GET["g"])) { err("Invalid input."); } + $g = "WHERE guild='".$_GET["g"]."'"; + $g2 = ", guild='".$_GET["g"]."'"; + $row["guild"] = "&g=".$_GET["g"]; + } else { + $g = "WHERE guild='0'"; + $row["guild"] = ""; + } + + if (isset($_POST["babble"])) { + + // Add new shout. + if (trim($_POST["babble"]) != "") { + $insert = doquery("INSERT INTO {{table}} SET id='', posttime=NOW(), charid='".$userrow["id"]."', charname='".$userrow["charname"]."', content='".$_POST["babble"]."' $g2", "babblebox"); + } + + // Only keep 20 shouts in DB at any one time. + $check = doquery("SELECT * FROM {{table}} $g", "babblebox"); + if (mysql_num_rows($check) > 20) { + $delete1 = dorow(doquery("SELECT id FROM {{table}} $g ORDER BY id LIMIT 1", "babblebox")); + $delete2 = doquery("DELETE FROM {{table}} WHERE id='".$delete1["id"]."' LIMIT 1", "babblebox"); + } + + // And we're done. + die(header("Location: index.php?do=babblebox".$row["guild"])); + + } + + $shouts = doquery("SELECT * FROM {{table}} $g ORDER BY id LIMIT 20", "babblebox"); + $row["shouts"] = ""; + $background = 1; + if (mysql_num_rows($shouts) > 0) { + while ($b = mysql_fetch_array($shouts)) { + $row["shouts"] .= "
[".$b["charname"]."] ".$b["content"]."
\n"; + if ($background == 1) { $background = 2; } else { $background = 1; } + } + } else { + $row["shouts"] = "
No shouts.
"; + } + + $page = parsetemplate(gettemplate("misc_babblebox"),$row); + if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); } + echo $page; + die(); + +} + +function showmap() { + + global $controlrow; + + $page = gettemplate("misc_showmap"); + if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); } + echo $page; + die(); + +} + + +?> \ No newline at end of file diff --git a/panels.php b/panels.php new file mode 100644 index 0000000..9c1812e --- /dev/null +++ b/panels.php @@ -0,0 +1,197 @@ +$b) { + $townstring .= "id='$b' OR "; + } + $townstring = rtrim($townstring, " OR "); + $townstring .= ") AND world='".$userrow["world"]."'"; + + // Then we do the query. + $traveltoquery = doquery("SELECT id,name FROM {{table}} WHERE $townstring ORDER BY id", "towns"); + $traveltorow = dorow($traveltoquery); + + // Finally we build the link list. + if ($userrow["townslist"] != "0,1") { // Multiple towns means multiple arrays. + foreach($traveltorow as $c=>$d) { + $row["travelto"] .= "".$d["name"]."
\n"; + } + } else { // One town means one array. + $row["travelto"] .= "".$traveltorow["name"]."
\n"; + } + + // And then we're done with this panel. + return parsetemplate(gettemplate("panels_left"), $row); + +} + +function panelright() { + + global $controlrow; + $row["babblebox"] = ""; + $row["whosonline"] = ""; + + // Babblebox. + if ($controlrow["showshout"] == 1) { + $row["babblebox"] = "
Babblebox
"; + $row["babblebox"] .= ""; + } + + // Who's Online. + if ($controlrow["showonline"] == 1) { + $row["whosonline"] = "
Who's Online
"; + $users = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."'", "users"); + $number = mysql_num_rows($users); + $row["whosonline"] .= "There are $number user(s) online within the last 10 minutes: "; + while($b = mysql_fetch_array($users)) { + if ($b["guild"] != 0) { + $charname = "[".$b["guildtag"]."]".$b["charname"].""; + } else { + $charname = $b["charname"]; + } + $row["whosonline"] .= "$charname, "; + } + $row["whosonline"] = rtrim($row["whosonline"], ", "); + } + + // And then we're done with this panel. + return parsetemplate(gettemplate("panels_right"), $row); + +} + +function paneltop($loggedin = true) { + + global $acctrow, $userrow; + if ($loggedin == true || isset($acctrow)) { + + if ($userrow == false) { $userrow["charname"] = "No Characters Yet"; } + if ($acctrow["authlevel"] == 2) { $admin = " (Admin)"; } else { $admin = ""; } + if ($userrow["guild"] != 0) { + $charname = "[".$userrow["guildtag"]."]".$userrow["charname"].""; + } else { + $charname = $userrow["charname"]; + } + $top = "
\n
$charname$admin
\n"; + $top .= "[ Log Out | Account | Characters | Help ]\n"; + $top .= "
\n"; + + } else { + + $top = "
\n
Not Logged In
\n"; + $top .= "[ Log In | Register | Help ]\n"; + $top .= "
\n"; + + } + + return $top; + +} + +function panelbottom() { + + global $userrow; + $row = array(); + + if ($userrow["charpicture"] != "") { + $row["charpicture"] = $userrow["charpicture"]; + } else { + $row["charpicture"] = "images/users/nopicture.gif"; + } + + $row["level"] = $userrow["level"]; + if ($userrow["levelup"] > 0) { $row["levelup"] = "(".$userrow["levelup"]." LP)"; } else { $row["levelup"] = ""; } + if ($userrow["levelspell"] > 0) { $row["levelspell"] = "(".$userrow["levelspell"]." SP)"; } else { $row["levelspell"] = ""; } + $row["experience"] = number_format($userrow["experience"]); + $row["gold"] = number_format($userrow["gold"]); + $row["weapon"] = $userrow["item1name"]; + $row["armor"] = $userrow["item2name"]; + $row["helmet"] = $userrow["item3name"]; + $row["shield"] = $userrow["item4name"]; + $row["hpbar"] = statusbars("hp", $userrow["currenthp"], $userrow["maxhp"]); + $row["mpbar"] = statusbars("mp", $userrow["currentmp"], $userrow["maxmp"]); + $row["tpbar"] = statusbars("tp", $userrow["currenttp"], $userrow["maxtp"]); + + + return parsetemplate(gettemplate("panels_bottom"),$row); + +} + +function panelmiddle() { + + global $userrow, $townrow, $worldrow; + + + + return gettemplate("panels_middle"); + +} + +function statusbars($stat, $current, $max) { + + $row = array(); + switch ($stat) { + case "hp": + $row["bigname"] = "Hit Points"; + $row["littlename"] = "HP"; + break; + case "mp": + $row["bigname"] = "Magic Points"; + $row["littlename"] = "MP"; + break; + case "tp": + $row["bigname"] = "Travel Points"; + $row["littlename"] = "TP"; + break; + case "exp": + $row["bigname"] = "Experience"; + $row["littlename"] = "Exp"; + break; + } + + $row["width"] = ceil(($current / $max) * 100); + if ($row["width"] >= 66) { $row["color"] = "green"; } + if ($row["width"] < 66 && $row["width"] >= 33) { $row["color"] = "yellow"; } + if ($row["width"] < 33) { $row["color"] = "red"; } + + $row["current"] = $current; + $row["max"] = $max; + return parsetemplate(gettemplate("statusbars"),$row); + +} + +?> \ No newline at end of file diff --git a/pvp.php b/pvp.php new file mode 100644 index 0000000..8d7decd --- /dev/null +++ b/pvp.php @@ -0,0 +1,411 @@ +"; + } else { + $newuserrow["avatar"] = "\"".$newuserrow["charname"]."\""; + } + + if (isset($_POST["yes"])) { + + $query = doquery("UPDATE {{table}} SET accepted='1' WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"); + $query = doquery("UPDATE {{table}} SET currentaction='Duelling' WHERE id='".$pvp["player1id"]."' OR id='".$pvp["player2id"]."' LIMIT 2", "users"); + dofight(); + + } elseif (isset($_POST["no"])) { + + $query = doquery("UPDATE {{table}} SET accepted='2',playerturn=player1id WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp"); + $query = doquery("UPDATE {{table}} SET currentaction='In Town', currentpvp='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Duel Challenge",parsetemplate(gettemplate("pvp_decline"),$newuserrow)); + + } else { + + display("Duel Challenge",parsetemplate(gettemplate("pvp_challenged"),$newuserrow)); + + } + +} + +function dowait() { + + global $userrow, $monsterrow, $fightrow; + $pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp")); + + // "monsterrow" now becomes the other player's character. + if ($pvp["player1id"] == $userrow["id"]) { + $monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player2id"]."' LIMIT 1", "users")); + } else { + $monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users")); + } + + $pagerow = array( + "message"=>$fightrow["message"], + "charname"=>$monsterrow["charname"], + "currenthp"=>$monsterrow["currenthp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"]); + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Duelling",parsetemplate(gettemplate("pvp_wait"),$pagerow)); + +} + +function dofight() { + + global $userrow, $monsterrow, $fightrow, $spells; + $pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp")); + + // "monsterrow" now becomes the other player's character. + if ($pvp["player1id"] == $userrow["id"]) { + $nextplayer = $pvp["player2id"]; + $monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player2id"]."' LIMIT 1", "users")); + } else { + $nextplayer = $pvp["player1id"]; + $monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users")); + } + + if (isset($_POST["fight"])) { + + playerturn(); + if ($monsterrow["currenthp"] <= 0) { youwin(); } + updateopponent(); + + $fightrowimploded = $fightrow["playerphysdamage"].",".$fightrow["playermagicdamage"].",".$fightrow["playerfiredamage"].",".$fightrow["playerlightdamage"].",".$fightrow["message"]; + $query = doquery("UPDATE {{table}} SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1", "pvp"); + + $pagerow = array( + "message"=>$fightrow["message"], + "charname"=>$monsterrow["charname"], + "currenthp"=>$monsterrow["currenthp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"]); + $pagerow["spells"] = dospellslist(); + + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Duelling",parsetemplate(gettemplate("pvp_wait"),$pagerow)); + + } elseif (isset($_POST["spell"])) { + + if (! is_numeric($_POST["spellid"])) { err("Invalid spell selection."); } + $isavailable = 0; + for ($i = 1; $i < 11; $i++) { + if ($userrow["spell".$i."id"] == $_POST["spellid"]) { $isavailable = 1; } + } + if ($isavailable == 0) { err("You don't have that spell."); } + + include("spells.php"); + $fightrow["message"] = $spells[$_POST["spellid"]]["fname"]($_POST["spellid"]); + $monsterrow["currenthp"] -= ($fightrow["playerphysdamage"] + $fightrow["playermagicdamage"] + $fightrow["playerfiredamage"] + $fightrow["playerlightdamage"]); + if ($monsterrow["currenthp"] <= 0) { youwin(); } + updateopponent(); + + $fightrowimploded = $fightrow["playerphysdamage"].",".$fightrow["playermagicdamage"].",".$fightrow["playerfiredamage"].",".$fightrow["playerlightdamage"].",".$fightrow["message"]; + $query = doquery("UPDATE {{table}} SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1", "pvp"); + + $pagerow = array( + "message"=>$fightrow["message"], + "charname"=>$monsterrow["charname"], + "currenthp"=>$monsterrow["currenthp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"]); + $pagerow["spells"] = dospellslist(); + + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Fighting",parsetemplate(gettemplate("pvp_wait"),$pagerow)); + + } + + if ($pvp["fightrow"] != "") { + + $tempfightrow = explode(",",$pvp["fightrow"]); + $fightrow["playerphysdamage"] = $tempfightrow[0]; + $fightrow["playermagicdamage"] = $tempfightrow[1]; + $fightrow["playerfiredamage"] = $tempfightrow[2]; + $fightrow["playerlightdamage"] = $tempfightrow[3]; + $fightrow["message"] = $tempfightrow[4]; + + $pagerow = array( + "message"=>$fightrow["message"], + "charname"=>$monsterrow["charname"], + "currenthp"=>$monsterrow["currenthp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"]); + $pagerow["spells"] = dospellslist(); + + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Duelling",parsetemplate(gettemplate("pvp_turn"),$pagerow)); + + } else { + + $pagerow = array( + "charname"=>$monsterrow["charname"], + "currenthp"=>$monsterrow["currenthp"]); + $pagerow["spells"] = dospellslist(); + + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Duelling",parsetemplate(gettemplate("pvp_new"),$pagerow)); + + } + +} + +function playerturn() { + + global $userrow, $monsterrow, $fightrow; + + // Calculate all damages. + if ($userrow["physattack"] != 0) { + $physhit = ceil(rand($userrow["physattack"]*.75, $userrow["physattack"]) / 3); + $physblock = ceil(rand($monsterrow["physdefense"]*.75, $monsterrow["physdefense"]) / 3); + $fightrow["playerphysdamage"] = max($physhit - $physblock, 0); + } else { $fightrow["playerphysdamage"] = 0; } + + if ($userrow["magicattack"] != 0) { + $magichit = ceil(rand($userrow["magicattack"]*.75, $userrow["magicattack"]) / 3); + $magicblock = ceil(rand($monsterrow["magicdefense"]*.75, $monsterrow["magicdefense"]) / 3); + $fightrow["playermagicdamage"] = max($magichit - $magicblock, 0); + } else { $fightrow["playermagicdamage"] = 0; } + + if ($userrow["fireattack"] != 0) { + $firehit = ceil(rand($userrow["fireattack"]*.75, $userrow["fireattack"]) / 3); + $fireblock = ceil(rand($monsterrow["firedefense"]*.75, $monsterrow["firedefense"]) / 3); + $fightrow["playerfiredamage"] = max($firehit - $fireblock, 0); + } else { $fightrow["playerfiredamage"] = 0; } + + if ($userrow["lightattack"] != 0) { + $lighthit = ceil(rand($userrow["lightattack"]*.75, $userrow["lightattack"]) / 3); + $lightblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 3); + $fightrow["playerlightdamage"] = max($lighthit - $lightblock, 0); + } else { $fightrow["playerlightdamage"] = 0; } + + // Chance to make an excellent hit. + $toexcellent = rand(0,150); + if ($toexcellent <= sqrt($userrow["strength"])) { + $fightrow["playerphysdamage"] *= 2; + $fightrow["playermagicdamage"] *= 2; + $fightrow["playerfiredamage"] *= 2; + $fightrow["playerlightdamage"] *= 2; + $fightrow["message"] = "Excellent hit!
"; + } + + // Chance for monster to dodge. + $tododge = rand(0,200); + if ($tododge <= sqrt($monsterrow["physdefense"])) { + $fightrow["playerphysdamage"] = 0; + $fightrow["playermagicdamage"] = 0; + $fightrow["playerfiredamage"] = 0; + $fightrow["playerlightdamage"] = 0; + $fightrow["message"] = "".$monsterrow["charname"]." dodged the hit!
"; + } + + // Now we add Per Turn mods. + hpleech("player"); + mpleech("player"); + + // Subtract all damage from monster's hp. + $monsterrow["currenthp"] -= ($fightrow["playerphysdamage"] + $fightrow["playermagicdamage"] + $fightrow["playerfiredamage"] + $fightrow["playerlightdamage"]); + +} + +function youwin() { + + global $userrow, $monsterrow, $fightrow; + $pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp")); + + // "monsterrow" now becomes the other player's character. + if ($pvp["player1id"] == $userrow["id"]) { + $nextplayer = $pvp["player2id"]; + } else { + $nextplayer = $pvp["player1id"]; + } + + $template = "pvp_win"; + + $userrow["currentaction"] = "In Town"; + $userrow["currentfight"] = 0; + $userrow["currentpvp"] = 0; + + // Now we add Per Kill mods. + hpgain(); + mpgain(); + + // Update for new stats. + updateopponent(); + updateuserrow(); + $fightrowimploded = $fightrow["playerphysdamage"].",".$fightrow["playermagicdamage"].",".$fightrow["playerfiredamage"].",".$fightrow["playerlightdamage"].",".$fightrow["message"]; + $query = doquery("UPDATE {{table}} SET fightrow='$fightrowimploded', playerturn='$nextplayer' WHERE id='".$pvp["id"]."' LIMIT 1", "pvp"); + + // And we're done. + $pagerow = array( + "message"=>$fightrow["message"], + "monstername"=>$monsterrow["charname"], + "monsterhp"=>$userrow["currentmonsterhp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"]); + + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Victory!",parsetemplate(gettemplate($template),$pagerow)); + +} + +function youlose() { + + global $userrow, $monsterrow, $fightrow; + $pvp = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["currentpvp"]."' LIMIT 1", "pvp")); + + if ($pvp["player1id"] == $userrow["id"]) { + $monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player2id"]."' LIMIT 1", "users")); + } else { + $monsterrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$pvp["player1id"]."' LIMIT 1", "users")); + } + + $tempfightrow = explode(",",$pvp["fightrow"]); + $fightrow["playerphysdamage"] = $tempfightrow[0]; + $fightrow["playermagicdamage"] = $tempfightrow[1]; + $fightrow["playerfiredamage"] = $tempfightrow[2]; + $fightrow["playerlightdamage"] = $tempfightrow[3]; + $fightrow["message"] = $tempfightrow[4]; + + // Then put them in town & reset fight stuff. + $userrow["currentaction"] = "In Town"; + $userrow["currentfight"] = 0; + $userrow["currentpvp"] = 0; + $userrow["currenthp"] = ceil($userrow["maxhp"] / 4); + + // Update. + updateuserrow(); + $query = doquery("DELETE FROM {{table}} WHERE id='".$pvp["id"]."' LIMIT 1", "pvp"); + + // And we're done. + $pagerow = array( + "message"=>$fightrow["message"], + "monstername"=>$monsterrow["charname"], + "monsterhp"=>$userrow["currentmonsterhp"], + "playerphysdamage"=>$fightrow["playerphysdamage"], + "playermagicdamage"=>$fightrow["playermagicdamage"], + "playerfiredamage"=>$fightrow["playerfiredamage"], + "playerlightdamage"=>$fightrow["playerlightdamage"]); + + if ($monsterrow["charpicture"] != "") { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } else { + $pagerow["avatar"] = "\"".$monsterrow["charname"]."\""; + } + + display("Thou Art Dead.",parsetemplate(gettemplate("pvp_lose"),$pagerow)); + +} + +function updateopponent() { + + global $monsterrow; + + $querystring = ""; + foreach($monsterrow as $a=>$b) { + $querystring .= "$a='$b',"; + } + $querystring = rtrim($querystring, ","); + + $query = doquery("UPDATE {{table}} SET $querystring WHERE id='".$monsterrow["id"]."' LIMIT 1", "users"); + +} + +function dospellslist() { + + global $userrow, $spells; + $options = ""; + for ($i = 1; $i < 11; $i++) { + if ($userrow["spell".$i."id"] != 0) { + $options .= "\n"; + } + } + if ($options != "") { + $list = " "; + } else { $list = ""; } + return $list; + +} + +?> \ No newline at end of file diff --git a/pvpmini.php b/pvpmini.php new file mode 100644 index 0000000..dad1c29 --- /dev/null +++ b/pvpmini.php @@ -0,0 +1,54 @@ +
This window will refresh to the main screen in ".$controlrow["pvprefresh"]." seconds."; + $pagerow["target"] = "_top"; + $pagerow["parentreload"] = "onload=\"setTimeout('top.location.href=\'index.php\'',".($controlrow["pvprefresh"] * 1000).")\""; + $pagerow["metareload"] = ""; + + $page = parsetemplate(gettemplate("pvp_mini"),$pagerow); + if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); } + echo $page; + die(); + +} + +// No timeout so check for whose turn it is. +if ($row["playerturn"] == $userrow["id"]) { + + $pagerow["content"] = "Please hold while this window refreshes to the game screen..."; + $pagerow["target"] = "_top"; + $pagerow["metareload"] = ""; + $pagerow["parentreload"] = "onload=\"setTimeout('top.location.href=\'pvp.php\'',".($controlrow["pvprefresh"] * 100).")\""; + $pagerow["metareload"] = ""; + + $page = parsetemplate(gettemplate("pvp_mini"),$pagerow); + if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); } + echo $page; + die(); + +} else { + + $pagerow["content"] = "Waiting for player to respond..."; + $pagerow["target"] = "_self"; + $pagerow["parentreload"] = ""; + $pagerow["metareload"] = ""; + + $page = parsetemplate(gettemplate("pvp_mini"),$pagerow); + if ($controlrow["compression"] == 1) { ob_start("ob_gzhandler"); } + echo $page; + die(); + +} + +?> \ No newline at end of file diff --git a/spells.php b/spells.php new file mode 100644 index 0000000..eaf111e --- /dev/null +++ b/spells.php @@ -0,0 +1,97 @@ +Spell Failed: You do not have enough MP to cast that spell.
"; $failed = 1; } + + if ($failed == 0) { + $userrow["currenthp"] += $spells[$id]["value"]; + $userrow["currentmp"] -= $spells[$id]["mp"]; + if ($userrow["currenthp"] > $userrow["maxhp"]) { $userrow["currenthp"] = $userrow["maxhp"]; } + $return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " and gains " . $spells[$id]["value"] . " HP.
"; + } + + return($return); + +} + +function hurt($id) { + + global $userrow, $monsterrow, $fightrow, $spells; + + $failed = 0; + if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "Spell Failed: You do not have enough MP to cast that spell.
"; $failed = 1; } + + if ($failed == 0) { + $userrow["currentmp"] -= $spells[$id]["mp"]; + $magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"])); + $magicblock = ceil(rand($monsterrow["magicdefense"]*.75, $monsterrow["magicdefense"]) / 5); + $fightrow["playermagicdamage"] = max($magichit - $magicblock, 0); + $return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playermagicdamage"] . " damage.
"; + } + + return($return); + +} + +function fire($id) { + + global $userrow, $monsterrow, $fightrow, $spells; + + $failed = 0; + if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "Spell Failed: You do not have enough MP to cast that spell.
"; $failed = 1; } + + if ($failed == 0) { + $userrow["currentmp"] -= $spells[$id]["mp"]; + $magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"])); + $magicblock = ceil(rand($monsterrow["firedefense"]*.75, $monsterrow["firedefense"]) / 5); + $fightrow["playerfiredamage"] = max($magichit - $magicblock, 0); + $return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playerfiredamage"] . " damage.
"; + } + + return($return); + +} + +function light($id) { + + global $userrow, $monsterrow, $fightrow, $spells; + + $failed = 0; + if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "Spell Failed: You do not have enough MP to cast that spell.
"; $failed = 1; } + + if ($failed == 0) { + $userrow["currentmp"] -= $spells[$id]["mp"]; + $magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"])); + $magicblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 5); + $fightrow["playerlightdamage"] = max($magichit - $magicblock, 0); + $return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playerlightdamage"] . " damage.
"; + } + + return($return); + +} + +function prism($id) { + + global $userrow, $monsterrow, $fightrow, $spells; + + $failed = 0; + if ($userrow["currentmp"] < $spells[$id]["mp"]) { $return = "Spell Failed: You do not have enough MP to cast that spell.
"; $failed = 1; } + + if ($failed == 0) { + $userrow["currentmp"] -= $spells[$id]["mp"]; + $magichit = ceil(rand($spells[$id]["value"]*.75, $spells[$id]["value"])); + $magicblock = ceil(rand($monsterrow["lightdefense"]*.75, $monsterrow["lightdefense"]) / 5); + $fightrow["playerlightdamage"] = max($magichit - $magicblock, 0); + $return = $userrow["charname"] . " casts " . $spells[$id]["name"] . " for " . $fightrow["playerlightdamage"] . " damage.
"; + } + + return($return); + +} + +?> \ No newline at end of file diff --git a/templates/botcheck.php b/templates/botcheck.php new file mode 100644 index 0000000..80e96ed --- /dev/null +++ b/templates/botcheck.php @@ -0,0 +1,12 @@ + +{{images}}
+
+ + +END; + +?> \ No newline at end of file diff --git a/templates/explore.php b/templates/explore.php new file mode 100644 index 0000000..e37ebed --- /dev/null +++ b/templates/explore.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/templates/explore_verify.php b/templates/explore_verify.php new file mode 100644 index 0000000..44c0d6a --- /dev/null +++ b/templates/explore_verify.php @@ -0,0 +1,12 @@ + +In order to prevent macros and robots from abusing the game, you must verify that you are able to read the following image. Please enter the 6 character code you see in the image into the form box below to continue playing. Thank you.

+Human Verification

+Verification Code:
+ + +END; + +?> \ No newline at end of file diff --git a/templates/fight_level.php b/templates/fight_level.php new file mode 100644 index 0000000..eea972b --- /dev/null +++ b/templates/fight_level.php @@ -0,0 +1,13 @@ +{{monstername}}.

+{{message}} +You attack the monster for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+You have defeated the {{monstername}}.
+You gain {{newexp}} Experience.
+You gain {{newgold}} Gold.

+You may now continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/fight_levelup.php b/templates/fight_levelup.php new file mode 100644 index 0000000..c967a4e --- /dev/null +++ b/templates/fight_levelup.php @@ -0,0 +1,15 @@ +{{monstername}}.

+{{message}} +You attack the monster for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+You have defeated the {{monstername}}.
+You gain {{newexp}} Experience.
+You gain {{newgold}} Gold.

+You have gained a level! You have 5 Level Points to spend on your character
+Level points can be accessed in your Extended Profile.


+You may now continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/fight_levelupspell.php b/templates/fight_levelupspell.php new file mode 100644 index 0000000..be57108 --- /dev/null +++ b/templates/fight_levelupspell.php @@ -0,0 +1,15 @@ +{{monstername}}.

+{{message}} +You attack the monster for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+You have defeated the {{monstername}}.
+You gain {{newexp}} Experience.
+You gain {{newgold}} Gold.

+You have gained a level! You have 5 Level Points and 1 Spell Point to spend on your character
+Level points can be accessed in your Extended Profile.


+You may now continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/fight_lose.php b/templates/fight_lose.php new file mode 100644 index 0000000..c14e23a --- /dev/null +++ b/templates/fight_lose.php @@ -0,0 +1,14 @@ +{{monstername}}.
+Monster's HP: {{monsterhp}}

+{{message}} +You attack the monster for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+The monster attacks you for ({{monsterphysdamage}}|{{monstermagicdamage}}|{{monsterfiredamage}}|{{monsterlightdamage}}) damage.

+You have died.

+As a consequence, you've lost half of your gold and {{deathpenalty}} percent of your experience. You have been sent to town given back a portion of your hit points to continue your journey.

+You may now continue playing, and you should probably hope that you fair better next time. +END; + +?> \ No newline at end of file diff --git a/templates/fight_new.php b/templates/fight_new.php new file mode 100644 index 0000000..91d189c --- /dev/null +++ b/templates/fight_new.php @@ -0,0 +1,14 @@ +{{monstername}}.
+Monster's HP: {{monsterhp}}

+Command? +
+
+{{spells}}
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/fight_turn.php b/templates/fight_turn.php new file mode 100644 index 0000000..4a21728 --- /dev/null +++ b/templates/fight_turn.php @@ -0,0 +1,17 @@ +{{monstername}}.
+Monster's HP: {{monsterhp}}

+{{message}} +You attack the monster for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+The monster attacks you for ({{monsterphysdamage}}|{{monstermagicdamage}}|{{monsterfiredamage}}|{{monsterlightdamage}}) damage.

+Command? +
+
+{{spells}}
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/fight_win.php b/templates/fight_win.php new file mode 100644 index 0000000..eea972b --- /dev/null +++ b/templates/fight_win.php @@ -0,0 +1,13 @@ +{{monstername}}.

+{{message}} +You attack the monster for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+You have defeated the {{monstername}}.
+You gain {{newexp}} Experience.
+You gain {{newgold}} Gold.

+You may now continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/guild_apply.php b/templates/guild_apply.php new file mode 100644 index 0000000..53991ac --- /dev/null +++ b/templates/guild_apply.php @@ -0,0 +1,15 @@ + +
+Guild Statement for {{name}}:

+{{statement}} +


+Applying for this Guild costs {{joincost}} gold. This is non-refundable. Are you sure you want to apply to this Guild?

+
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/guild_create.php b/templates/guild_create.php new file mode 100644 index 0000000..e6f7b61 --- /dev/null +++ b/templates/guild_create.php @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + +
Name:
Your Guild's full name.


Tagline:
A short abbreviation or tagline for your Guild. For example, if your Guild name is "Lords of Carnage," your tagline might be "LoC." This will appear in brackets in front of each member's name.


Name Color:
HTML color code used to display the name of your Guild, and the names of each member.
(Click here for a list of color codes.)


Tagline Color:
HTML color code used to display your Guild's tagline.
(Click here for a list of color codes.)


Cost to Join:
How much gold it will cost for a member to join your guild.


Rank 1 Title:
Lowest ranking Guild member's title.


Rank 2 Title:
2nd ranking Guild member's title.


Rank 3 Title:
3rd ranking Guild member's title.


Rank 4 Title:
4th ranking Guild member's title. These are sub-leaders for your Guild.


Rank 5 Title:
Highest ranking Guild member's title. This will be your title, as well as any other member you promote to this rank.


Opening Statement
Your Guild's introduction statement or creed.
NOTES: The cost for creating a guild is {{guildstartup}} gold.

Ranks 1 through 3 are nominal only and are all treated identically in the game. Rank 4 members can distribute Guild funds, promote other members up to Rank 3, and demote/remove members. Rank 5 members are Guild Leaders, and can do all Rank 4 tasks as well as promote members to ranks 4 and 5, and disband the Guild.
+ +END; + +?> \ No newline at end of file diff --git a/templates/guild_disband.php b/templates/guild_disband.php new file mode 100644 index 0000000..4596f69 --- /dev/null +++ b/templates/guild_disband.php @@ -0,0 +1,10 @@ +
+
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/guild_edit.php b/templates/guild_edit.php new file mode 100644 index 0000000..feb5b92 --- /dev/null +++ b/templates/guild_edit.php @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + +
Name:{{name}}


Tagline:{{tagline}}


Name Color:
HTML color code used to display the name of your Guild, and the names of each member.
(Click here for a list of color codes.)


Tagline Color:
HTML color code used to display your Guild's tagline.
(Click here for a list of color codes.)


Cost to Join:
How much gold it will cost for a member to join your guild.


Rank 1 Title:
Lowest ranking Guild member's title.


Rank 2 Title:
2nd ranking Guild member's title.


Rank 3 Title:
3rd ranking Guild member's title.


Rank 4 Title:
4th ranking Guild member's title. These are sub-leaders for your Guild.


Rank 5 Title:
Highest ranking Guild member's title. This will be your title, as well as any other member you promote to this rank.


Opening Statement
Your Guild's introduction statement or creed.
+ +END; + +?> \ No newline at end of file diff --git a/templates/guild_homehigh.php b/templates/guild_homehigh.php new file mode 100644 index 0000000..e457def --- /dev/null +++ b/templates/guild_homehigh.php @@ -0,0 +1,52 @@ + + + + + + + + + + +
+
News
+
+{{news}}

+Edit +
+
+{{babblebox}} +
+
Bank
+Your Guild has {{bank}} gold.
+
+Send Gold to {{memberselect}}
+Deposit Gold +
+
+
Member Ranks
+Select a member to promote/demote.

+
+{{memberselect}}
+
+
+
Applications
+Select a user to approve/deny.

+
+{{appselect}} +
+
+
More Guild Functions
+ +


+You may also return to town or the Guild List. +END; + +?> \ No newline at end of file diff --git a/templates/guild_homelow.php b/templates/guild_homelow.php new file mode 100644 index 0000000..d345e98 --- /dev/null +++ b/templates/guild_homelow.php @@ -0,0 +1,34 @@ + + + + + + + +
+
News
+
+{{news}}

+Edit +
+
+{{babblebox}} +
+
Bank
+Your Guild has {{bank}} gold.
+
+Deposit Gold +
+
+
More Guild Functions
+ +


+You may also return to town or the Guild List. +END; + +?> \ No newline at end of file diff --git a/templates/guild_homemid.php b/templates/guild_homemid.php new file mode 100644 index 0000000..e457def --- /dev/null +++ b/templates/guild_homemid.php @@ -0,0 +1,52 @@ + + + + + + + + + + +
+
News
+
+{{news}}

+Edit +
+
+{{babblebox}} +
+
Bank
+Your Guild has {{bank}} gold.
+
+Send Gold to {{memberselect}}
+Deposit Gold +
+
+
Member Ranks
+Select a member to promote/demote.

+
+{{memberselect}}
+
+
+
Applications
+Select a user to approve/deny.

+
+{{appselect}} +
+
+
More Guild Functions
+ +


+You may also return to town or the Guild List. +END; + +?> \ No newline at end of file diff --git a/templates/guild_leave.php b/templates/guild_leave.php new file mode 100644 index 0000000..76101c7 --- /dev/null +++ b/templates/guild_leave.php @@ -0,0 +1,10 @@ +
+
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/guild_list.php b/templates/guild_list.php new file mode 100644 index 0000000..a2ec388 --- /dev/null +++ b/templates/guild_list.php @@ -0,0 +1,11 @@ +start your own or submit an application to join one of the Guilds listed below.

+If you are a member of a Guild, you can also continue to your Guild's Hall.

+{{guildlist}} +
+If you've changed your mind, you may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/guild_members.php b/templates/guild_members.php new file mode 100644 index 0000000..f2c8c5d --- /dev/null +++ b/templates/guild_members.php @@ -0,0 +1,10 @@ +{{name}} Members List

+{{guildmembers}} +
+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/guild_news.php b/templates/guild_news.php new file mode 100644 index 0000000..4e19feb --- /dev/null +++ b/templates/guild_news.php @@ -0,0 +1,11 @@ + +Edit your Guild's news/info below.

+
+ + +END; + +?> \ No newline at end of file diff --git a/templates/guild_remove.php b/templates/guild_remove.php new file mode 100644 index 0000000..4b42763 --- /dev/null +++ b/templates/guild_remove.php @@ -0,0 +1,11 @@ +
+
+ + +
+END; + +?> \ No newline at end of file diff --git a/templates/login.php b/templates/login.php new file mode 100644 index 0000000..135fc96 --- /dev/null +++ b/templates/login.php @@ -0,0 +1,14 @@ + + + + + + +
Username:
Password:
Remember Me? Yes.
+ +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_letter.php b/templates/mailbox_letter.php new file mode 100644 index 0000000..a417858 --- /dev/null +++ b/templates/mailbox_letter.php @@ -0,0 +1,18 @@ + + +{{senderavatar}} + +From: {{sendername}}
+Date: {{fpostdate}}
+Subject: {{title}}
+{{moneytransfer}} +
+{{message}}

+Reply | Delete | New Letter | Inbox | Outbox

+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_letterout.php b/templates/mailbox_letterout.php new file mode 100644 index 0000000..3f1576d --- /dev/null +++ b/templates/mailbox_letterout.php @@ -0,0 +1,12 @@ +{{recipientname}}
+Date: {{fpostdate}}
+Subject: {{title}}

+{{message}}

+New Letter | Inbox | Outbox

+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_list.php b/templates/mailbox_list.php new file mode 100644 index 0000000..921829c --- /dev/null +++ b/templates/mailbox_list.php @@ -0,0 +1,13 @@ +
+{{messages}} +* = New Letter.
+$ = Letter contains a Money Transfer.

+
+New Letter | Inbox | Outbox

+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_listout.php b/templates/mailbox_listout.php new file mode 100644 index 0000000..09d8fe8 --- /dev/null +++ b/templates/mailbox_listout.php @@ -0,0 +1,11 @@ +
+{{messages}} +
+New Letter | Inbox | Outbox

+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_listoutrow.php b/templates/mailbox_listoutrow.php new file mode 100644 index 0000000..77e2184 --- /dev/null +++ b/templates/mailbox_listoutrow.php @@ -0,0 +1,11 @@ + +{{title}} +To: {{recipientname}} +{{fpostdate}} + +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_listrow.php b/templates/mailbox_listrow.php new file mode 100644 index 0000000..3b051ed --- /dev/null +++ b/templates/mailbox_listrow.php @@ -0,0 +1,11 @@ + +{{new}}{{money}}{{title}} +From: {{sendername}} +{{fpostdate}} + +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_new.php b/templates/mailbox_new.php new file mode 100644 index 0000000..33d344a --- /dev/null +++ b/templates/mailbox_new.php @@ -0,0 +1,24 @@ +* are required. +The Send Gold field allows you to attach money to the letter, which will be given to the recipient when they read it.

+Note that there is a 5 Gold postage fee for sending all letters.

+
+ + + + + + +
To:* (Character Name)
Subject:*
Send Gold:
+Message:
+ +
+
+
+New Letter | Inbox | Outbox

+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_reply.php b/templates/mailbox_reply.php new file mode 100644 index 0000000..6d453f4 --- /dev/null +++ b/templates/mailbox_reply.php @@ -0,0 +1,25 @@ +* are required. +The Send Gold field allows you to attach money to the letter, which will be given to the recipient when they read it.

+Note that there is a 5 Gold postage fee for sending all letters.

+
+ + + + + + +
To:{{sendername}}
Subject:*
Send Gold:
+Message:
+ +
+

+Original Message:

+{{message}}

+New Letter | Inbox | Outbox

+You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/mailbox_sent.php b/templates/mailbox_sent.php new file mode 100644 index 0000000..bf8ef31 --- /dev/null +++ b/templates/mailbox_sent.php @@ -0,0 +1,8 @@ +
+You may now go back to your Mailbox or return to Town. +END; + +?> \ No newline at end of file diff --git a/templates/misc_babblebox.php b/templates/misc_babblebox.php new file mode 100644 index 0000000..c5d4a58 --- /dev/null +++ b/templates/misc_babblebox.php @@ -0,0 +1,35 @@ + + +Babblebox + + + +{{shouts}} +
+
+ +
+
+ + +END; + +?> \ No newline at end of file diff --git a/templates/misc_showmap.php b/templates/misc_showmap.php new file mode 100644 index 0000000..966d4f8 --- /dev/null +++ b/templates/misc_showmap.php @@ -0,0 +1,35 @@ + +Map + + +
+
+ + + + +
+Town | You | Player +
+ +END; + +?> \ No newline at end of file diff --git a/templates/panels_bottom.php b/templates/panels_bottom.php new file mode 100644 index 0000000..aee6bea --- /dev/null +++ b/templates/panels_bottom.php @@ -0,0 +1,39 @@ + + + + + + + + +
Level: {{level}}
+ Exp: {{experience}}
+ Gold: {{gold}}
+ Extended Profile +
+ + {{levelup}}
+ {{levelspell}} + + + + + + + +
Weapon:
Armor:
Helmet:
Shield:
{{weapon}}
{{armor}}
{{helmet}}
{{shield}}
+ + + + + +
{{hpbar}}
{{mpbar}}
{{tpbar}}
+ + + +END; + +?> \ No newline at end of file diff --git a/templates/panels_left.php b/templates/panels_left.php new file mode 100644 index 0000000..07d717c --- /dev/null +++ b/templates/panels_left.php @@ -0,0 +1,25 @@ +Location +{{action}} {{townname}}
+Realm: {{worldname}}
+Latitude: {{latitude}}
+Longitude: {{longitude}}

+
+North
+WestEast
+South

+
+ + + + +
+
+
Travel To
+{{travelto}} + +END; + +?> \ No newline at end of file diff --git a/templates/panels_middle.php b/templates/panels_middle.php new file mode 100644 index 0000000..b669397 --- /dev/null +++ b/templates/panels_middle.php @@ -0,0 +1,14 @@ + + + + + + + + +END; + +?> \ No newline at end of file diff --git a/templates/panels_right.php b/templates/panels_right.php new file mode 100644 index 0000000..4c1ac01 --- /dev/null +++ b/templates/panels_right.php @@ -0,0 +1,9 @@ +
+{{whosonline}} +END; + +?> \ No newline at end of file diff --git a/templates/primary.php b/templates/primary.php new file mode 100644 index 0000000..f150713 --- /dev/null +++ b/templates/primary.php @@ -0,0 +1,80 @@ + +{{gamename}} :: {{pagetitle}} + + +
+ + + + + + + + + + + + + +
+
+ {{gamename}} + + {{topnav}} +
+
+
+ {{leftnav}} +
+
+
{{pagetitle}}
+ {{content}} +
+
+
+ {{rightnav}} +
{{bottomnav}}
+ + + + + +
+ Version {{version}} / {{numqueries}} Queries / {{totaltime}} Seconds + + Dragon Scourge © 2003-2005 by renderse7en +
+
+ +END; + +?> \ No newline at end of file diff --git a/templates/primary_min.php b/templates/primary_min.php new file mode 100644 index 0000000..5e76c85 --- /dev/null +++ b/templates/primary_min.php @@ -0,0 +1,29 @@ + +{{gamename}} :: {{pagetitle}} + + + +{{content}} + + +END; + +?> \ No newline at end of file diff --git a/templates/primary_new.php b/templates/primary_new.php new file mode 100644 index 0000000..2a0455f --- /dev/null +++ b/templates/primary_new.php @@ -0,0 +1,85 @@ + +{{gamename}} :: {{pagetitle}} + + +
+ + + + + + + + + + + + + + + + +
+ + + +
{{topnav}}
+
+{{leftnav}} +
+
+
{{pagetitle}}
+{{content}} +
+
+{{rightnav}} +
{{middlenav}}
+
+{{bottomnav}} +
+
+ + + + + +
Version {{version}} / {{numqueries}} Queries / {{totaltime}} SecondsDragon Scourge © 2003-2005 by renderse7en
+ +
+ +END; + +?> \ No newline at end of file diff --git a/templates/pvp_challenge.php b/templates/pvp_challenge.php new file mode 100644 index 0000000..96f74fa --- /dev/null +++ b/templates/pvp_challenge.php @@ -0,0 +1,8 @@ +
+ +END; + +?> \ No newline at end of file diff --git a/templates/pvp_challenged.php b/templates/pvp_challenged.php new file mode 100644 index 0000000..df2f83e --- /dev/null +++ b/templates/pvp_challenged.php @@ -0,0 +1,11 @@ + +You have been challenged to a duel by {{charname}} (Level {{level}}). Do you accept?

+
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/pvp_decline.php b/templates/pvp_decline.php new file mode 100644 index 0000000..911aec0 --- /dev/null +++ b/templates/pvp_decline.php @@ -0,0 +1,8 @@ +
+Click here to return to the game. +END; + +?> \ No newline at end of file diff --git a/templates/pvp_declined.php b/templates/pvp_declined.php new file mode 100644 index 0000000..13aa5d8 --- /dev/null +++ b/templates/pvp_declined.php @@ -0,0 +1,8 @@ +
+Click here to return to the game. +END; + +?> \ No newline at end of file diff --git a/templates/pvp_lose.php b/templates/pvp_lose.php new file mode 100644 index 0000000..9f50b64 --- /dev/null +++ b/templates/pvp_lose.php @@ -0,0 +1,13 @@ + +You are fighting {{monstername}}.
+{{message}} +{{monstername}} attacks you for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+You have died.

+You have been sent to town given back a portion of your hit points to continue your journey.

+You may now continue playing, and you should probably hope that you fair better next time. +END; + +?> \ No newline at end of file diff --git a/templates/pvp_mini.php b/templates/pvp_mini.php new file mode 100644 index 0000000..2ae3783 --- /dev/null +++ b/templates/pvp_mini.php @@ -0,0 +1,17 @@ + +{{metareload}} + + + + +{{content}} + + +END; + +?> \ No newline at end of file diff --git a/templates/pvp_new.php b/templates/pvp_new.php new file mode 100644 index 0000000..546e516 --- /dev/null +++ b/templates/pvp_new.php @@ -0,0 +1,15 @@ + +You are fighting {{charname}}.
+{{charname}}'s HP: {{currenthp}}

+Command? +
+
+{{spells}}
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/pvp_turn.php b/templates/pvp_turn.php new file mode 100644 index 0000000..478049b --- /dev/null +++ b/templates/pvp_turn.php @@ -0,0 +1,17 @@ + +You are fighting {{charname}}.
+{{charname}}'s HP: {{currenthp}}

+{{message}} +{{charname}} attacks you for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+Command? +
+
+{{spells}}
+ +
+END; + +?> \ No newline at end of file diff --git a/templates/pvp_wait.php b/templates/pvp_wait.php new file mode 100644 index 0000000..0edfe50 --- /dev/null +++ b/templates/pvp_wait.php @@ -0,0 +1,12 @@ + +You are fighting {{charname}}.
+{{charname}}'s HP: {{currenthp}}

+{{message}} +You attack {{charname}} for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+ +END; + +?> \ No newline at end of file diff --git a/templates/pvp_win.php b/templates/pvp_win.php new file mode 100644 index 0000000..8742530 --- /dev/null +++ b/templates/pvp_win.php @@ -0,0 +1,12 @@ + +You are fighting {{monstername}}.

+{{message}} +You attack {{monstername}} for ({{playerphysdamage}}|{{playermagicdamage}}|{{playerfiredamage}}|{{playerlightdamage}}) damage.

+You have defeated {{monstername}}.
+You may now return to the game. +END; + +?> \ No newline at end of file diff --git a/templates/statusbars.php b/templates/statusbars.php new file mode 100644 index 0000000..c72de0c --- /dev/null +++ b/templates/statusbars.php @@ -0,0 +1,8 @@ +{{littlename}}: +
 {{current}} / {{max}} +END; + +?> \ No newline at end of file diff --git a/templates/town.php b/templates/town.php new file mode 100644 index 0000000..852e53a --- /dev/null +++ b/templates/town.php @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + +
Stay at the Inn




Buy Weapons and Armor




Buy Maps




Duelling Grounds




Deposit/Withdraw Gold at the Bank
Enter the Post Office
{{unread}}
Enter the Gambling Hall
View the Hall of Fame
Enter the Guild Hall
+ +END; + +?> \ No newline at end of file diff --git a/templates/town_bank1.php b/templates/town_bank1.php new file mode 100644 index 0000000..04b2f88 --- /dev/null +++ b/templates/town_bank1.php @@ -0,0 +1,13 @@ +
+You are currently storing {{formatbank}} gold in the bank, and you are carrying {{formatgold}} gold in your pocket.

+
+Enter an amount and then click the Deposit or Withdraw button:
+ +
+If you've changed your mind, you may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/town_bank2.php b/templates/town_bank2.php new file mode 100644 index 0000000..026fd3d --- /dev/null +++ b/templates/town_bank2.php @@ -0,0 +1,9 @@ +
+You are now storing {{formatbank}} gold in the bank, and you are carrying {{formatgold}} gold in your pocket.

+You may return to town, or use the direction buttons to continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/town_buy1.php b/templates/town_buy1.php new file mode 100644 index 0000000..5dd3fbc --- /dev/null +++ b/templates/town_buy1.php @@ -0,0 +1,12 @@ +
+Click an item's name to purchase it.

+The following items are available in this town:

+{{itemtable}} +
+If you've changed your mind, you may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/town_buy2_empty.php b/templates/town_buy2_empty.php new file mode 100644 index 0000000..8ac4fea --- /dev/null +++ b/templates/town_buy2_empty.php @@ -0,0 +1,8 @@ +
+
+END; + +?> \ No newline at end of file diff --git a/templates/town_buy2_full.php b/templates/town_buy2_full.php new file mode 100644 index 0000000..6185967 --- /dev/null +++ b/templates/town_buy2_full.php @@ -0,0 +1,8 @@ +
+
+END; + +?> \ No newline at end of file diff --git a/templates/town_buy3.php b/templates/town_buy3.php new file mode 100644 index 0000000..38deb79 --- /dev/null +++ b/templates/town_buy3.php @@ -0,0 +1,8 @@ +
+You may return to town, or use the direction buttons to continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/town_buy_itemrow.php b/templates/town_buy_itemrow.php new file mode 100644 index 0000000..0c6d3cf --- /dev/null +++ b/templates/town_buy_itemrow.php @@ -0,0 +1,23 @@ + +{{image}} + +{{name}}
+{{attrtype}}: {{basevalue}}
+Price: {{buycost}} Gold
+{{level}} +{{strength}} +{{dexterity}} +{{energy}} +{{itemmods}} +
+ + +
+ + +END; + +?> \ No newline at end of file diff --git a/templates/town_enter.php b/templates/town_enter.php new file mode 100644 index 0000000..dd87197 --- /dev/null +++ b/templates/town_enter.php @@ -0,0 +1,7 @@ +enter this town. +END; + +?> \ No newline at end of file diff --git a/templates/town_gamble1.php b/templates/town_gamble1.php new file mode 100644 index 0000000..a2ce1d7 --- /dev/null +++ b/templates/town_gamble1.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/templates/town_halloffame.php b/templates/town_halloffame.php new file mode 100644 index 0000000..1508eb6 --- /dev/null +++ b/templates/town_halloffame.php @@ -0,0 +1,9 @@ +
+{{halltable}} +You may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/town_halloffamerow.php b/templates/town_halloffamerow.php new file mode 100644 index 0000000..4d1d213 --- /dev/null +++ b/templates/town_halloffamerow.php @@ -0,0 +1,17 @@ + + +

{{number}}

+{{avatar}} + +{{newcharname}}
+Level: {{level}}
+Exp: {{experience}}
+Birthday: {{fregdate}} + + +END; + +?> \ No newline at end of file diff --git a/templates/town_inn1.php b/templates/town_inn1.php new file mode 100644 index 0000000..50d16dd --- /dev/null +++ b/templates/town_inn1.php @@ -0,0 +1,10 @@ +
+A night's rest at this Inn will cost {{innprice}} gold. Is that ok?

+
+If you've changed your mind, you may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/town_inn2.php b/templates/town_inn2.php new file mode 100644 index 0000000..fcc7c03 --- /dev/null +++ b/templates/town_inn2.php @@ -0,0 +1,8 @@ +
+You may return to town, or use the direction buttons on the left to continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/town_map1.php b/templates/town_map1.php new file mode 100644 index 0000000..a7f889a --- /dev/null +++ b/templates/town_map1.php @@ -0,0 +1,10 @@ +
+Click a town name to purchase its map.

+{{maptable}} +If you've changed your mind, you may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/town_map2.php b/templates/town_map2.php new file mode 100644 index 0000000..d265bb1 --- /dev/null +++ b/templates/town_map2.php @@ -0,0 +1,8 @@ +
+
+END; + +?> \ No newline at end of file diff --git a/templates/town_map3.php b/templates/town_map3.php new file mode 100644 index 0000000..b9a6827 --- /dev/null +++ b/templates/town_map3.php @@ -0,0 +1,8 @@ +
+You may return to town, or use the direction buttons to continue exploring. +END; + +?> \ No newline at end of file diff --git a/templates/town_pvplist.php b/templates/town_pvplist.php new file mode 100644 index 0000000..a07f9f4 --- /dev/null +++ b/templates/town_pvplist.php @@ -0,0 +1,9 @@ +
+{{list}}
+If you've changed your mind, you may also return to town. +END; + +?> \ No newline at end of file diff --git a/templates/users_chardelete.php b/templates/users_chardelete.php new file mode 100644 index 0000000..ea1f994 --- /dev/null +++ b/templates/users_chardelete.php @@ -0,0 +1,12 @@ + +Deleting a character is permanent, and any data will be lost forever.

+Are you sure you want to delete this character?

+ + + +END; + +?> \ No newline at end of file diff --git a/templates/users_charedit.php b/templates/users_charedit.php new file mode 100644 index 0000000..34939cf --- /dev/null +++ b/templates/users_charedit.php @@ -0,0 +1,13 @@ + + + + +
Avatar:Upload an avatar:

Avatars must be 50x50 pixels & {{maxsize}}kb or smaller.
JPG, GIF, and PNG file types only.


    or    
+ +You may also continue playing the game or return to the main Characters screen +END; + +?> \ No newline at end of file diff --git a/templates/users_charlist.php b/templates/users_charlist.php new file mode 100644 index 0000000..ce36314 --- /dev/null +++ b/templates/users_charlist.php @@ -0,0 +1,19 @@ +
+Your account currently has {{characters}} characters ({{remaining}} remaining).
+Your current default character is {{activecharname}}.
+{{newcharlink}}
+
+Select a new default character:
+ +
+
+Click on one of your characters from the list below to edit its avatar or delete it from your account.
+{{fullcharlist}} +
+When you're done with your characters, you may continue playing the game. +END; + +?> diff --git a/templates/users_charlistnew.php b/templates/users_charlistnew.php new file mode 100644 index 0000000..05cdd59 --- /dev/null +++ b/templates/users_charlistnew.php @@ -0,0 +1,9 @@ +
+You have not made any characters yet.

+Click here to create your first character. +END; + +?> diff --git a/templates/users_charlistrow.php b/templates/users_charlistrow.php new file mode 100644 index 0000000..4b80b34 --- /dev/null +++ b/templates/users_charlistrow.php @@ -0,0 +1,16 @@ + + +{{avatar}} + +{{charname}} {{isdefault}}
+Level: {{level}}
+Exp: {{experience}}
+Birthday: {{fregdate}}
+ + +END; + +?> \ No newline at end of file diff --git a/templates/users_charnew.php b/templates/users_charnew.php new file mode 100644 index 0000000..d030d26 --- /dev/null +++ b/templates/users_charnew.php @@ -0,0 +1,17 @@ + + + + + + + + +
Character Name:
Character names must be 30 characters or less.


Avatar:Upload an avatar:

Avatars must be 50x50 pixels & {{maxsize}}kb or smaller.
JPG, GIF, and PNG file types only.


Character Class:
Difficulty:
Default Character: Yes.
Place a check in the box if you want your new character to become the current default for your account.

+ +You may also continue playing the game or return to the main Characters screen. +END; + +?> \ No newline at end of file diff --git a/templates/users_levelspell1.php b/templates/users_levelspell1.php new file mode 100644 index 0000000..5c1e30e --- /dev/null +++ b/templates/users_levelspell1.php @@ -0,0 +1,12 @@ +
+You have {{levelspell}} point(s) to spend.

+
+{{spelldropdowns}} + +
+END; + +?> \ No newline at end of file diff --git a/templates/users_levelspell2.php b/templates/users_levelspell2.php new file mode 100644 index 0000000..fd20ae9 --- /dev/null +++ b/templates/users_levelspell2.php @@ -0,0 +1,9 @@ +
+You now have {{levelspell}} points remaining to be used.

+You may now go back to your Extended Profile or continue playing the game. +END; + +?> \ No newline at end of file diff --git a/templates/users_levelup1.php b/templates/users_levelup1.php new file mode 100644 index 0000000..a2b2ecb --- /dev/null +++ b/templates/users_levelup1.php @@ -0,0 +1,16 @@ +
+Class: {{classname}}
+Damage Per Strength: {{damageperstrength}}
+HP Per Dexterity: {{hpperdexterity}}
+MP Per Energy: {{mpperenergy}}

+You have {{levelup}} point(s) to spend.

+
+{{dropdowns}} + +
+END; + +?> \ No newline at end of file diff --git a/templates/users_levelup2.php b/templates/users_levelup2.php new file mode 100644 index 0000000..c865b67 --- /dev/null +++ b/templates/users_levelup2.php @@ -0,0 +1,9 @@ +
+You now have {{levelup}} points remaining to be used.

+You may now go back to your Extended Profile or continue playing the game. +END; + +?> \ No newline at end of file diff --git a/templates/users_onlinechar.php b/templates/users_onlinechar.php new file mode 100644 index 0000000..53a0334 --- /dev/null +++ b/templates/users_onlinechar.php @@ -0,0 +1,42 @@ + + + + + + + +
+
{{profcharpicture}}
{{newcharname}}
+
+Class: {{charclass}}
+Level: {{level}}

+ +Hit Points: {{maxhp}}
+Magic Points: {{maxmp}}

+ +Weapon: {{item1name}}
+Armor: {{item2name}}
+Shield: {{item4name}}
+Helmet: {{item3name}}
+
+Strength: {{strength}}
+Dexterity: {{dexterity}}
+Physical Damage: {{physattack}}
+Physical Defense: {{physdefense}}

+ +Energy: {{energy}}
+Magic Damage: {{magicattack}}
+Magic Defense: {{magicdefense}}

+ +Fire Damage: {{fireattack}}
+Fire Defense: {{firedefense}}

+ +Lightning Damage: {{lightattack}}
+Lightning Defense: {{lightdefense}}

+
Return to the game.
+END; + +?> diff --git a/templates/users_profile.php b/templates/users_profile.php new file mode 100644 index 0000000..da6cf7a --- /dev/null +++ b/templates/users_profile.php @@ -0,0 +1,46 @@ + + + + + + + +
+
{{profcharpicture}}
{{newcharname}}
+
+Class: {{charclass}}
+Gold: {{formatgold}} {{goldbonus}}
+Level: {{level}}
+Experience: {{formatexperience}} {{expbonus}}
+Next Level: {{formatnextlvl}}

+ +Hit Points: {{currenthp}} / {{maxhp}}
+Magic Points: {{currentmp}} / {{maxmp}}
+Travel Points: {{currenttp}} / {{maxtp}}

+ +Weapon: {{item1name}}
+Armor: {{item2name}}
+Shield: {{item4name}}
+Helmet: {{item3name}}
+
+Strength: {{strength}}
+Dexterity: {{dexterity}}
+Physical Damage: {{physattack}}
+Physical Defense: {{physdefense}}

+ +Energy: {{energy}}
+Magic Damage: {{magicattack}}
+Magic Defense: {{magicdefense}}

+ +Fire Damage: {{fireattack}}
+Fire Defense: {{firedefense}}

+ +Lightning Damage: {{lightattack}}
+Lightning Defense: {{lightdefense}}

+
Return to the game.
+END; + +?> diff --git a/templates/users_register1.php b/templates/users_register1.php new file mode 100644 index 0000000..d627899 --- /dev/null +++ b/templates/users_register1.php @@ -0,0 +1,17 @@ + + + + + + + + + +
Username:
Usernames must be 30 alphanumeric characters or less.


Password:
Verify Password:
Passwords must be 30 alphanumeric characters or less.


Email Address:
Verify Email Address:


Image Format:
(Some versions of Internet Explorer may not be compatible with the PNG image format.)
+ +END; + +?> \ No newline at end of file diff --git a/templates/users_settings.php b/templates/users_settings.php new file mode 100644 index 0000000..8d944ae --- /dev/null +++ b/templates/users_settings.php @@ -0,0 +1,20 @@ + + + + + + +
Change Password: +Leave these fields blank if you wish to keep your old password.

+Old Password:

+New Password:

+Verify New Password:

Passwords must be 30 alphanumeric characters or less.


+
Email Address:
Image Format:
(Older versions of Internet Explorer may not be compatible with transparent PNG images. If you notice problems with item and monster images, please select GIF.)
+ +When you're done with your account, you may continue playing the game. +END; + +?> \ No newline at end of file diff --git a/town.php b/town.php new file mode 100644 index 0000000..e07fab9 --- /dev/null +++ b/town.php @@ -0,0 +1,510 @@ + 0) { + $row["unread"] = "(".mysql_num_rows($newpm)." new)"; + } else { + $row["unread"] = ""; + } + display("In Town", parsetemplate(gettemplate("town"), $row)); + +} + +function inn() { // Resting at the inn restores hp/mp/tp. + + global $userrow, $townrow; + + // Errors. + if ($userrow["gold"] < $townrow["innprice"]) { err("You do not have enough gold to stay at the inn. Please go back and try again."); } + if ($userrow["currenthp"] == $userrow["maxhp"] && $userrow["currentmp"] == $userrow["maxmp"] && $userrow["currenttp"] == $userrow["maxtp"]) { err("Your HP, MP and TP are already at their maximum levels. You do not need to stay at the Inn tonight.

Click here to return to the main town screen."); } + + if (isset($_POST["submit"])) { + + // Fill 'er up, my man! + $userrow["currenthp"] = $userrow["maxhp"]; + $userrow["currentmp"] = $userrow["maxmp"]; + $userrow["currenttp"] = $userrow["maxtp"]; + $userrow["gold"] -= $townrow["innprice"]; + $query = doquery("UPDATE {{table}} SET currenthp='".$userrow["maxhp"]."', currentmp='".$userrow["maxmp"]."', currenttp='".$userrow["maxtp"]."', gold='".$userrow["gold"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Rest at the Inn", gettemplate("town_inn2")); + + } elseif (isset($_POST["abortmission"])) { die(header("Location: index.php")); } + + display("Rest at the Inn", parsetemplate(gettemplate("town_inn1"), $townrow)); + +} + +function map() { // Buy maps to towns for the Travel To menu. + + global $userrow; + + if (isset($_POST["three"])) { + + $townquery = doquery("SELECT * FROM {{table}} WHERE id='".$_POST["id"]."' LIMIT 1", "towns"); + $townrow = dorow($townquery); + + if ($userrow["gold"] < $townrow["mapprice"]) { err("You do not have enough gold to buy this map. Please go back and try again."); } + + if ($townrow != false) { + $userrow["townslist"] .= "," . $townrow["id"]; + $userrow["gold"] -= $townrow["mapprice"]; + $query = doquery("UPDATE {{table}} SET townslist='".$userrow["townslist"]."', gold='".$userrow["gold"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); + display("Buy Maps", gettemplate("town_map3")); + } else { + err("Invalid action. Please go back and try again."); + } + + } elseif (isset($_POST["two"])) { + + $townquery = doquery("SELECT * FROM {{table}} WHERE name='".$_POST["two"]."' LIMIT 1", "towns"); + $townrow = dorow($townquery); + + if ($userrow["gold"] < $townrow["mapprice"]) { err("You do not have enough gold to buy this map. Please go back and try again."); } + + if ($townrow != false) { + display("Buy Maps", parsetemplate(gettemplate("town_map2"), $townrow)); + } else { + err("Invalid action. Please go back and try again."); + } + + } else { + + $townquery = doquery("SELECT * FROM {{table}} ORDER BY id", "towns"); + $townrow = dorow($townquery); + $townslist = explode(",",$userrow["townslist"]); + + $row["maptable"] = "
\n"; + foreach($townrow as $a=>$b) { + if (in_array($b["id"], $townslist)) { + if ($b["latitude"] < 0) { $latitude = ($b["latitude"] * -1) . "S"; } else { $latitude = $b["latitude"] . "N"; } + if ($b["longitude"] < 0) { $longitude = ($b["longitude"] * -1) . "W"; } else { $longitude = $b["longitude"] . "E"; } + $row["maptable"] .= "\n"; + } else { + $row["maptable"] .= "\n"; + } + } + $row["maptable"] .= "
Already PurchasedLocation: $latitude, $longitudeTP: ".$b["travelpoints"]."
Price: ".$b["mapprice"]." GoldBuy map to reveal details.
\n"; + display("Buy Maps", parsetemplate(gettemplate("town_map1"), $row)); + + } + +} + +function buy() { // Buy items from merchants. + + /* + 1: Weapon + 2: Armor + 3: Shield + 4: Helmet + 5: Jewel + 6: Stone + */ + + global $userrow, $townrow; + + if (isset($_POST["three"])) { + + $idstring = explode(",",$_POST["idstring"]); + foreach($idstring as $a=>$b) { if(!is_numeric($b)) { err("Invalid action. Please go back and try again."); } } + + // Get database info on new item. + $newbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[1]' LIMIT 1", "itembase")); + $newprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[0]' LIMIT 1", "itemprefixes")); + $newsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[2]' LIMIT 1", "itemsuffixes")); + $premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames")); + + // Format the mod name row. + foreach($premodrow as $a=>$b) { + $modrow[$b["fieldname"]] = $b; + } + + $newfullitem = builditem($newprefix, $newbaseitem, $newsuffix, $modrow); + + // Get database info on old item, if applicable. + if ($userrow["item" . $newbaseitem["slotnumber"] . "idstring"] != "0") { + + $oldidstring = explode(",",$userrow["item" . $newbaseitem["slotnumber"] . "idstring"]); + $oldbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[1]' LIMIT 1", "itembase")); + $oldprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[0]' LIMIT 1", "itemprefixes")); + $oldsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[2]' LIMIT 1", "itemsuffixes")); + $oldfullitem = builditem($oldprefix, $oldbaseitem, $oldsuffix, $modrow); + + } else { $oldfullitem = false; $oldprefix = false; $oldsuffix = false; } + + // Requirements check. + if ($newfullitem["requirements"] == false) { err("You do not meet one or more of the requirements for this item. Please go back and try again."); } + if ($userrow["gold"] < $newfullitem["buycost"]) { err("You do not have enough gold in your pocket to buy this item."); } + + // Now do stuff to userrow (new item only). + $userrow["item" . $newfullitem["slotnumber"] . "idstring"] = $newfullitem["fullid"]; + $userrow["item" . $newfullitem["slotnumber"] . "name"] = $newfullitem["name"]; + $userrow["gold"] -= $newfullitem["buycost"]; + $userrow[$newfullitem["basename"]] += $newfullitem["baseattr"]; + for($j=1; $j<7; $j++) { + if ($newfullitem["mod".$j."name"] != "") { + $userrow[$newfullitem["mod".$j."name"]] += $newfullitem["mod".$j."attr"]; + } + } + if ($newprefix != false) { + $userrow[$newprefix["basename"]] += $newprefix["baseattr"]; + } + if ($newsuffix != false) { + $userrow[$newsuffix["basename"]] += $newsuffix["baseattr"]; + } + + // Do more stuff to userrow (old item only). + if ($oldfullitem != false) { + + $userrow["gold"] += $oldfullitem["sellcost"]; + $userrow[$oldfullitem["basename"]] -= $oldfullitem["baseattr"]; + for($j=1; $j<7; $j++) { + if ($oldfullitem["mod".$j."name"] != "") { + $userrow[$oldfullitem["mod".$j."name"]] -= $oldfullitem["mod".$j."attr"]; + } + } + if ($oldprefix != false) { + $userrow[$oldprefix["basename"]] -= $oldprefix["baseattr"]; + } + if ($oldsuffix != false) { + $userrow[$oldsuffix["basename"]] -= $oldsuffix["baseattr"]; + } + + } + + // And we're done. + updateuserrow(); + display("Buy Weapons & Armor", gettemplate("town_buy3")); + + } elseif (isset($_POST["two"])) { + + $idstring = explode(",",$_POST["idstring"]); + foreach($idstring as $a=>$b) { if(!is_numeric($b)) { err("Invalid action. Please go back and try again."); } } + + // Get database info on new item. + $newbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[1]' LIMIT 1", "itembase")); + $newprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[0]' LIMIT 1", "itemprefixes")); + $newsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$idstring[2]' LIMIT 1", "itemsuffixes")); + $premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames")); + + // Format the mod name row. + foreach($premodrow as $a=>$b) { + $modrow[$b["fieldname"]] = $b; + } + + $newfullitem = builditem($newprefix, $newbaseitem, $newsuffix, $modrow); + + // Get database info on old item, if applicable. + if ($userrow["item" . $newbaseitem["slotnumber"] . "idstring"] != "0") { + + $oldidstring = explode(",",$userrow["item" . $newbaseitem["slotnumber"] . "idstring"]); + $oldbaseitem = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[1]' LIMIT 1", "itembase")); + $oldprefix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[0]' LIMIT 1", "itemprefixes")); + $oldsuffix = dorow(doquery("SELECT * FROM {{table}} WHERE id='$oldidstring[2]' LIMIT 1", "itemsuffixes")); + $oldfullitem = builditem($oldprefix, $oldbaseitem, $oldsuffix, $modrow); + + } else { $oldfullitem = false; } + + // Requirements check. + if ($newfullitem["requirements"] == false) { err("You do not meet one or more of the requirements for this item. Please go back and try again."); } + if ($userrow["gold"] < $newfullitem["buycost"]) { err("You do not have enough gold in your pocket to buy this item."); } + + // Now make a new array to send to the template. + $full = "_empty"; + $row["newname"] = $newfullitem["name"]; + if ($oldfullitem != false) { + $row["oldname"] = $oldfullitem["name"]; + $row["oldsell"] = $oldfullitem["sellcost"]; + $full = "_full"; + } + $row["newidstring"] = $newfullitem["fullid"]; + + // And we're done. + display("Buy Weapons & Armor", parsetemplate(gettemplate("town_buy2" . $full),$row)); + + } else { + + // Grab lots of stuff from the DB. + $itemsrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel>='".$townrow["itemminlvl"]."' AND reqlevel<='".$townrow["itemmaxlvl"]."' ORDER BY RAND() LIMIT 10 ", "itembase")); + $prefixrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel<='".$userrow["level"]."'", "itemprefixes")); + $suffixrow = dorow(doquery("SELECT * FROM {{table}} WHERE reqlevel<='".$userrow["level"]."'", "itemsuffixes")); + $premodrow = dorow(doquery("SELECT * FROM {{table}} ORDER BY id","itemmodnames")); + + // Format the mod name row. + foreach($premodrow as $a=>$b) { + $modrow[$b["fieldname"]] = $b; + } + + // Now build the item table. + $row["itemtable"] = ""; + for($i=0; $i<10; $i++) { + + $baseitem = $itemsrow[rand(0,(sizeof($itemsrow)-1))]; + if (rand(0,1)==1) { $prefix = $prefixrow[rand(0,(sizeof($prefixrow)-1))]; } else { $prefix = false; } + if (rand(0,1)==1) { $suffix = $suffixrow[rand(0,(sizeof($suffixrow)-1))]; } else { $suffix = false; } + $fullitem = builditem($prefix, $baseitem, $suffix, $modrow); + $row["itemtable"] .= parsetemplate(gettemplate("town_buy_itemrow"), $fullitem); + + } + + // And we're done. + display("Buy Weapons & Armor", parsetemplate(gettemplate("town_buy1"),$row)); + + } + +} + +function builditem($prefix, $baseitem, $suffix, $modrow) { + + global $controlrow, $acctrow, $userrow; + + // First setup the basic item attributes. + $baseitem["baseid"] = $baseitem["id"]; + $baseitem["fullid"] = $baseitem["id"]; + $baseitem["attrtype"] = $modrow[$baseitem["basename"]]["prettyname"]; + $baseitem["basevalue"] = $baseitem["baseattr"]; + $baseitem["image"] = ""; + + // Next give pretty names to any item modifiers. + $baseitem["itemmods"] = ""; + for($j=1; $j<7; $j++) { + if ($baseitem["mod".$j."name"] != "") { + $baseitem["itemmods"] .= $modrow[$baseitem["mod".$j."name"]]["prettyname"] . ": +" . $baseitem["mod".$j."attr"]; + if ($modrow[$baseitem["mod".$j."name"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; } + $baseitem["itemmods"] .= "
\n"; + } + } + + // Add prefix mods if applicable. + if ($prefix != false) { + $baseitem["fullid"] = $prefix["id"] . "," . $baseitem["fullid"]; + $baseitem["name"] = $prefix["name"] . " " . $baseitem["name"]; + $baseitem["buycost"] += $prefix["buycost"]; + $baseitem["sellcost"] += $prefix["sellcost"]; + $baseitem["reqlevel"] = max($baseitem["reqlevel"], $prefix["reqlevel"]); + $baseitem["reqstrength"] += $prefix["reqstrength"]; + $baseitem["reqenergy"] += $prefix["reqenergy"]; + $baseitem["reqdexterity"] += $prefix["reqdexterity"]; + $baseitem["itemmods"] .= $modrow[$prefix["basename"]]["prettyname"] . ": +" . $prefix["baseattr"]; + if ($modrow[$prefix["basename"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; } + $baseitem["itemmods"] .= "
\n"; + } else { $baseitem["fullid"] = "0," . $baseitem["fullid"]; } + + // Add suffix mods if applicable. + if ($suffix != false) { + $baseitem["fullid"] .= "," . $suffix["id"]; + $baseitem["name"] .= " " . $suffix["name"]; + $baseitem["buycost"] += $suffix["buycost"]; + $baseitem["sellcost"] += $suffix["sellcost"]; + $baseitem["reqlevel"] = max($baseitem["reqlevel"], $suffix["reqlevel"]); + $baseitem["reqstrength"] += $suffix["reqstrength"]; + $baseitem["reqenergy"] += $suffix["reqenergy"]; + $baseitem["reqdexterity"] += $suffix["reqdexterity"]; + $baseitem["itemmods"] .= $modrow[$suffix["basename"]]["prettyname"] . ": +" . $suffix["baseattr"]; + if ($modrow[$suffix["basename"]]["percent"] == 1) { $baseitem["itemmods"] .= "%"; } + $baseitem["itemmods"] .= "
\n"; + } else { $baseitem["fullid"] .= ",0"; } + + // Check requirements. + $baseitem["requirements"] = true; + if ($baseitem["reqlevel"] == 1) { $baseitem["level"] = ""; } else { + $baseitem["level"] = "Required Level: " . $baseitem["reqlevel"]; + if ($baseitem["reqlevel"] > $userrow["level"]) { + $baseitem["level"] = "".$baseitem["level"].""; + $baseitem["requirements"] = false; + } + $baseitem["level"] .= "
\n"; + } + if ($baseitem["reqstrength"] == 0) { $baseitem["strength"] = ""; } else { + $baseitem["strength"] = "Required Strength: " . $baseitem["reqstrength"]; + if ($baseitem["reqstrength"] > $userrow["strength"]) { + $baseitem["strength"] = "".$baseitem["strength"].""; + $baseitem["requirements"] = false; + } + $baseitem["strength"] .= "
\n"; + } + if ($baseitem["reqdexterity"] == 0) { $baseitem["dexterity"] = ""; } else { + $baseitem["dexterity"] = "Required Dexterity: " . $baseitem["reqdexterity"]; + if ($baseitem["reqdexterity"] > $userrow["dexterity"]) { + $baseitem["dexterity"] = "".$baseitem["dexterity"].""; + $baseitem["requirements"] = false; + } + $baseitem["dexterity"] .= "
\n"; + } + if ($baseitem["reqenergy"] == 0) { $baseitem["energy"] = ""; } else { + $baseitem["energy"] = "Required Energy: " . $baseitem["reqenergy"]; + if ($baseitem["reqenergy"] > $userrow["energy"]) { + $baseitem["energy"] = "".$baseitem["energy"].""; + $baseitem["requirements"] = false; + } + $baseitem["energy"] .= "
\n"; + } + + if ($controlrow["showimages"] == 1) { + $baseitem["image"] = "\"".$baseitem["name"]."\""; + } + + // And send it back. + return $baseitem; + +} + +function gamble() { + + display("Gamble", gettemplate("town_gamble1")); + +} + +function bank() { + + global $userrow; + + if (isset($_POST["withdraw"])) { + + if (!is_numeric($_POST["amount"])) { err("Invalid action. Please go back and try again."); } + if ($_POST["amount"] < 1) { err("Withdrawal amount must be greater than 0."); } + if ($_POST["amount"] > $userrow["bank"]) { err("You do not have that much money in the bank."); } + + $userrow["gold"] += $_POST["amount"]; + $userrow["bank"] -= $_POST["amount"]; + updateuserrow(); + $row["formatbank"] = number_format($userrow["bank"]); + $row["formatgold"] = number_format($userrow["gold"]); + display("Deposit/Withdraw Gold at the Bank", parsetemplate(gettemplate("town_bank2"),$row)); + + } elseif (isset($_POST["deposit"])) { + + if (!is_numeric($_POST["amount"])) { err("Invalid action. Please go back and try again."); } + if ($_POST["amount"] < 1) { err("Deposit amount must be greater than 0."); } + if ($_POST["amount"] > $userrow["gold"]) { err("You do not have that much money in your pocket."); } + + $userrow["gold"] -= $_POST["amount"]; + $userrow["bank"] += $_POST["amount"]; + updateuserrow(); + $row["formatbank"] = number_format($userrow["bank"]); + $row["formatgold"] = number_format($userrow["gold"]); + display("Deposit/Withdraw Gold at the Bank", parsetemplate(gettemplate("town_bank2"),$row)); + + } else { + + $row["formatbank"] = number_format($userrow["bank"]); + $row["formatgold"] = number_format($userrow["gold"]); + + display("Deposit/Withdraw Gold at the Bank", parsetemplate(gettemplate("town_bank1"),$row)); + + } + +} + +function halloffame() { + + $topquery = doquery("SELECT *, DATE_FORMAT(birthdate, '%m.%d.%Y') AS fregdate FROM {{table}} ORDER BY experience DESC LIMIT 10", "users"); + $top = dorow($topquery); + $row["halltable"] = ""; + $i = 1; + + if (mysql_num_rows($topquery) > 1) { + foreach($top as $a=>$b) { + if ($b["charpicture"] != "") { + $b["avatar"] = "\"".$b["charname"]."\""; + } else { + $b["avatar"] = "\"".$b["charname"]."\""; + } + $b["experience"] = number_format($b["experience"]); + $b["number"] = $i; + if ($b["guild"] != 0) { + $charname = "[".$b["guildtag"]."]".$b["charname"].""; + } else { + $charname = $b["charname"]; + } + $b["newcharname"] = $charname; + $row["halltable"] .= parsetemplate(gettemplate("town_halloffamerow"), $b); + $i++; + } + } else { + if ($top["charpicture"] != "") { + $top["avatar"] = "\"".$top["charname"]."\""; + } else { + $top["avatar"] = "\"".$top["charname"]."\""; + } + $top["experience"] = number_format($top["experience"]); + $top["number"] = $i; + if ($top["guild"] != 0) { + $charname = "[".$top["guildtag"]."]".$top["charname"].""; + } else { + $charname = $top["charname"]; + } + $top["newcharname"] = $charname; + $row["halltable"] .= parsetemplate(gettemplate("town_halloffamerow"), $top); + $i++; + } + $row["halltable"] .= "
\n"; + display("Hall of Fame", parsetemplate(gettemplate("town_halloffame"), $row)); + +} + +function duel() { + + global $userrow; + + $query = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-600)."' AND world='".$userrow["world"]."' AND latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' AND id !='".$userrow["id"]."' ORDER BY id", "users"); + $row = dorow($query); + + $list = ""; + if (mysql_num_rows($query) == 0) { + $list .= "There is nobody available to challenge at this time.
"; + } elseif (mysql_num_rows($query) == 1) { + if ($row["guild"] != 0) { + $charname = "[".$row["guildtag"]."]".$row["charname"].""; + } else { + $charname = $row["charname"]; + } + $list .= "$charname (Level ".$row["level"].")
"; + } else { + foreach($row as $a=>$b) { + if ($row["guild"] != 0) { + $charname = "[".$row["guildtag"]."]".$row["charname"].""; + } else { + $charname = $row["charname"]; + } + $list .= "".$b["charname"]." (Level ".$b["level"].")
"; + } + } + + $pagerow["list"] = $list; + display("Duel Challenge", parsetemplate(gettemplate("town_pvplist"),$pagerow)); + +} + +function duelchallenge() { + + global $userrow, $acctrow; + + if(isset($_GET["uid"])) { + if (!is_numeric($_GET["uid"])) { err("Invalid UID."); } + if ($_GET["uid"] == $userrow["id"]) { err("You cannot duel yourself."); } + $newuserrow = dorow(doquery("SELECT *,UNIX_TIMESTAMP(onlinetime) as fonlinetime FROM {{table}} WHERE id='".$_GET["uid"]."' LIMIT 1", "users")); + if ($newuserrow == false) { err("That user doesn't exist."); } + if ($newuserrow["account"] == $userrow["account"]) { err("You cannot duel another character on your own account."); } + if ($newuserrow["fonlinetime"] <= (time() - 600)) { err("That user is not online."); } + if ($newuserrow["currentaction"] != "In Town") { err("That user is busy."); } + if ($newuserrow["latitude"] != $userrow["latitude"] || $newuserrow["longitude"] != $userrow["longitude"]) { err("That user is not in this town."); } + } else { err("Invalid UID."); } + + // No errors, so create the PVP record and update everyone's userrow. + $query = doquery("INSERT INTO {{table}} SET id='',player1id='".$userrow["id"]."',player2id='".$newuserrow["id"]."',player1name='".$userrow["charname"]."',player2name='".$newuserrow["charname"]."',playerturn='".$newuserrow["id"]."',turntime=NOW(),fightrow=''","pvp"); + $query2 = doquery("UPDATE {{table}} SET currentpvp='".mysql_insert_id()."' WHERE id='".$newuserrow["id"]."' OR id='".$userrow["id"]."' LIMIT 2", "users"); + display("Duel Challenge",parsetemplate(gettemplate("pvp_challenge"),$newuserrow)); + +} + + + +?> \ No newline at end of file diff --git a/users.php b/users.php new file mode 100644 index 0000000..999c297 --- /dev/null +++ b/users.php @@ -0,0 +1,628 @@ +"; } + if (preg_match("/[^A-z0-9_\-]/", $username)==1) { $errors++; $errorlist .= "Username must be alphanumeric.
"; } // Thanks to "Carlos Pires" from php.net! + $usernamequery = doquery("SELECT username FROM {{table}} WHERE username='$username' LIMIT 1","accounts"); + if (mysql_num_rows($usernamequery) > 0) { $errors++; $errorlist .= "Username already taken - unique username required.
"; } + + // Process password. + if (trim($password1) == "") { $errors++; $errorlist .= "Password fields is required.
"; } + if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.
"; } // Thanks to "Carlos Pires" from php.net! + if ($password1 != $password2) { $errors++; $errorlist .= "Passwords don't match.
"; } + $password = md5($password1); + + // Process email address. + if (trim($email1) == "") { $errors++; $errorlist .= "Email field is required.
"; } + if ($email1 != $email2) { $errors++; $errorlist .= "Emails don't match.
"; } + if (! is_email($email1)) { $errors++; $errorlist .= "Email isn't valid.
"; } + $emailquery = doquery("SELECT emailaddress FROM {{table}} WHERE emailaddress='$email1' LIMIT 1","accounts"); + if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.
"; } + + // Process other stuff. + if ($imageformat != ".png" && $imageformat != ".gif") { $errors++; $errorlist .= "Invalid input for image format selection.
"; } + + if ($errors == 0) { + + if ($controlrow["verifyemail"] == 1) { + $verifycode = ""; + for ($i=0; $i<8; $i++) { + $verifycode .= chr(rand(65,90)); + } + } else { + $verifycode='1'; + } + + // Now update. + $query = doquery("INSERT INTO {{table}} SET id='',regdate=NOW(),regip='".$_SERVER["REMOTE_ADDR"]."',verifycode='$verifycode',username='$username',password='$password',emailaddress='$email1',language='English',imageformat='$imageformat'", "accounts") or die(mysql_error()); + + // Send confirmation email if necessary. + if ($controlrow["verifyemail"] == 1) { + if (sendregmail($email1, $verifycode) == true) { + $page = "Your account was created successfully.

You should receive an Account Verification email shortly. You will need the verification code contained in that email before you are allowed to log in. Once you have received the email, please visit the Verification Page to enter your code and start playing."; + } 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."; + } + } else { + $page = "Your account was created succesfully.

You may now continue to the Login Page and continue playing ".$controlrow["gamename"]."!"; + } + + } else { + + // Die gracefully on errors. + $page = "The following error(s) occurred when your account was being made:
$errorlist
Please go back and try again."; + + } + + display("Register", $page, false); + + } + + $row["imageformat"] = ""; + display("Register", parsetemplate(gettemplate("users_register1"), $row), false); + +} + +function profile() { + + global $userrow; + $newuserrow = $userrow; + $template = "users_profile"; + + // Setup for viewing other people's profiles. + if(isset($_GET["uid"])) { + if (!is_numeric($_GET["uid"])) { err("Invalid UID."); } + $newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$_GET["uid"]."' LIMIT 1", "users")); + if ($newuserrow == false) { err("No such UID."); } + $template = "users_onlinechar"; + } + + if ($newuserrow["guild"] != 0) { + $newuserrow["newcharname"] = "[".$newuserrow["guildtag"]."]".$newuserrow["charname"].""; + } else { + $newuserrow["newcharname"] = $newuserrow["charname"]; + } + + if ($newuserrow["charpicture"] != "") { + $newuserrow["profcharpicture"] = "\"".$newuserrow["charname"]."\""; + } else { + $newuserrow["profcharpicture"] = "\"".$newuserrow["charname"]."\""; + } + + $newuserrow["formatexperience"] = number_format($newuserrow["experience"]); + $newuserrow["formatgold"] = number_format($newuserrow["gold"]); + + if ($newuserrow["expbonus"] == 0) { $newuserrow["expbonus"] = ""; } else { if ($newuserrow["expbonus"]>0) { $expsign="+"; } else { $expsign=""; } $newuserrow["expbonus"] = "($expsign".$newuserrow["expbonus"]."%)"; } + if ($newuserrow["goldbonus"] == 0) { $newuserrow["goldbonus"] = ""; } else { if ($newuserrow["goldbonus"]>0) { $goldsign="+"; } else { $goldsign=""; }$newuserrow["goldbonus"] = "($goldsign".$newuserrow["goldbonus"]."%)"; } + + // Next level. + $leveltotal = 15; + $leveladd = 15; + $i = 2; + while ($i < ($newuserrow["level"] + 1)) { + $levelstart = $leveltotal; + if ($i < 4) { + $leveladd = ceil($leveladd * 2.0); + } elseif ($i < 13) { + $leveladd = floor($leveladd * 1.45); + } elseif ($i < 40) { + $leveladd = floor($leveladd * 1.20); + } elseif ($i < 60) { + $leveladd = 150000; + } elseif ($i < 80) { + $leveladd = 200000; + } elseif ($i < 100) { + $leveladd = 300000; + } elseif ($i >= 100) { + $leveladd = 500000; + } + $leveltotal = $levelstart + $leveladd; + $i++; + } + $newuserrow["formatnextlvl"] = number_format($leveltotal); + + // Level points. + if ($newuserrow["levelup"] != 0 || $newuserrow["levelspell"] != 0) { $newuserrow["levelpointscharnotice"] = "You have Level/Spell Points available."; } else { $newuserrow["levelpointscharnotice"] = ""; } + + display("Extended Profile",parsetemplate(gettemplate($template),$newuserrow)); + +} + +function settings() { + + global $acctrow; + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + + // Process password. + if (trim($password1) != "") { + if (md5($oldpassword) != $acctrow["password"]) { $errors++; $errorlist .= "Incorrect old password.
"; } + if (preg_match("/[^A-z0-9_\-]/", $password1)==1) { $errors++; $errorlist .= "Password must be alphanumeric.
"; } // Thanks to "Carlos Pires" from php.net! + if ($password1 != $password2) { $errors++; $errorlist .= "New passwords don't match.
"; } + $password = "password='".md5($password1)."',"; + $newpass = true; + } + + // Process email address. + if (trim($email) == "") { $errors++; $errorlist .= "Email field is required.
"; } + if (! is_email($email)) { $errors++; $errorlist .= "Email isn't valid.
"; } + $emailquery = doquery("SELECT emailaddress FROM {{table}} WHERE emailaddress='$email' AND id != '".$acctrow["id"]."' LIMIT 1","accounts"); + if (mysql_num_rows($emailquery) > 0) { $errors++; $errorlist .= "Email already taken - unique email address required.
"; } + + // Process other stuff. + if ($imageformat != ".png" && $imageformat != ".gif") { $errors++; $errorlist .= "Invalid input for image format selection.
"; } + + if ($errors == 0) { + + $query = doquery("UPDATE {{table}} SET $password emailaddress='$email', imageformat='$imageformat' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts"); + + if (isset($newpass)) { + setcookie("scourge", "", (time()-3600), "/", "", 0); + $page = "Your information was updated successfully. Because you changed your password, you have been logged out to avoid cookie errors.

Please use the Log In link above to log back into the game and continue playing."; + unset($GLOBALS["acctrow"]); + display("Account Settings", $page, false); + } else { + $page = "Your information was updated successfully. You may now continue playing."; + display("Account Settings", $page); + } + + } else { + + err("The following error(s) occurred when your account was being made:
$errorlist
Please go back and try again."); + + } + + } + + $row["emailaddress"] = $acctrow["emailaddress"]; + $row["language"] = ""; + if ($acctrow["imageformat"] == ".png") { + $row["imageformat"] = ""; + } else { + $row["imageformat"] = ""; + } + display("Account Settings", parsetemplate(gettemplate("users_settings"), $row)); + +} + +function characters() { + + global $acctrow, $userrow; + + if (isset($_POST["submit"])) { + + // Change the active character for the account. + if (!is_numeric($_POST["makeactive"])) { err("Invalid UID."); } + $newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$_POST["makeactive"]."' LIMIT 1", "users")); + if ($newuserrow == false) { err("No such UID."); } + if ($newuserrow["account"] != $acctrow["id"]) { err("You don't own that UID."); } + $setnewchar = doquery("UPDATE {{table}} SET activechar='".$_POST["makeactive"]."' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts"); + die(header("Location: users.php?do=characters")); + + } + + if ($userrow != false) { + + // Pagerow setup. + $row["characters"] = $acctrow["characters"]; + $row["remaining"] = 4 - $acctrow["characters"]; + $row["activecharname"] = $userrow["charname"]; + $row["selectcharlist"] = ""; + $row["fullcharlist"] = ""; + if($row["characters"] < 4) { + $row["newcharlink"] = "Click here to create a new character.
"; + } else { $row["newcharlink"] = ""; } + + // Grab characters. + $charquery = doquery("SELECT *, DATE_FORMAT(birthdate, '%m.%d.%Y') AS fregdate FROM {{table}} WHERE account='".$acctrow["id"]."' ORDER BY birthdate", "users"); + $charrow = dorow($charquery); + + // Different loop style if there's multiple available characters. + if (mysql_num_rows($charquery) > 1) { + foreach($charrow as $a=>$b) { + + // Default character. + if ($b["id"] == $acctrow["activechar"]) { + + $row["selectcharlist"] .= ""; + + if ($b["charpicture"] != "") { + $b["avatar"] = "\"".$b["charname"]."\""; + } else { + $b["avatar"] = "\"".$b["charname"]."\""; + } + $b["isdefault"] = "(Default)"; + $row["fullcharlist"] .= parsetemplate(gettemplate("users_charlistrow"), $b); + + // Non-default characters. + } else { + + $row["selectcharlist"] .= ""; + + if ($b["charpicture"] != "") { + $b["avatar"] = "\"".$b["charname"]."\""; + } else { + $b["avatar"] = "\"".$b["charname"]."\""; + } + $b["isdefault"] = ""; + $row["fullcharlist"] .= parsetemplate(gettemplate("users_charlistrow"), $b); + + } + } + + } else { + + $row["selectcharlist"] .= ""; + + if ($charrow["charpicture"] != "") { + $charrow["avatar"] = "\"".$charrow["charname"]."\""; + } else { + $charrow["avatar"] = "\"".$charrow["charname"]."\""; + } + $charrow["isdefault"] = ""; + $row["fullcharlist"] .= parsetemplate(gettemplate("users_charlistrow"), $charrow); + + } + + display("Characters", parsetemplate(gettemplate("users_charlist"), $row)); + + } else { + + display("Characters", gettemplate("users_charlistnew")); + + } + +} + +function charnew() { + + global $controlrow, $acctrow; + + if ($acctrow["characters"] >= 4) { err("You are not allowed to make any more new characters."); } + + if (isset($_POST["submit"])) { + + extract($_POST); + $errors = 0; + $errorlist = ""; + + // Process charname. + if (trim($charname) == "") { $errors++; $errorlist .= "Character Name field is required.
"; } + if (preg_match("/[^A-z\ 0-9_\-]/", $charname)==1) { $errors++; $errorlist .= "Character names can only contain letters, numbers, spaces and hyphens.
"; } // Thanks to "Carlos Pires" from php.net! + $characternamequery = doquery("SELECT charname FROM {{table}} WHERE charname='$charname' LIMIT 1","users"); + if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.
"; } + + // Upload new charpicture, if required. + if ($_FILES["intavatar"]["error"] != 4) { + + $allowed = array(".gif",".jpg",".png"); + $type = substr($_FILES["intavatar"]["name"],-4); + + // Errors. + if (!in_array(strtolower($type),$allowed)) { die("Unallowed filetype for avatar."); } + if ($_FILES["intavatar"]["size"] > $controlrow["avatarmaxsize"]) { die("Avatar filesize too big."); } + $imagesize = getimagesize($_FILES["intavatar"]["tmp_name"]); + if (($imagesize[0]>50) || ($imagesize[1]>50)) { die("Avatar dimensions too big."); } + + // Move file and finish. + $randomext = ""; + for($i=0; $i<8; $i++) { $randomext .= rand(0,9); } + $uploadfile = $controlrow["avatarpath"] . $acctrow["username"] . $randomext . $type; + if (!move_uploaded_file($_FILES["intavatar"]["tmp_name"], $uploadfile)) { die("Unable to upload avatar."); } + $newcharpicture = $controlrow["avatarurl"] . $acctrow["username"] . $randomext . $type; + + } + + // Process everything else important. + if (!is_numeric($charclass)) { $errors++; $errorlist .= "Invalid character class.
"; } + if (!is_numeric($difficulty)) { $errors++; $errorlist .= "Invalid character class.
"; } + + // Get bonuses and multipliers from classes/difficulties tables. + $expbonus = 0; + $goldbonus = 0; + $classes = dorow(doquery("SELECT * FROM {{table}} WHERE id='$charclass' LIMIT 1", "classes")); + if ($classes != false) { + $expbonus += $classes["expbonus"]; + $goldbonus += $classes["goldbonus"]; + } else { $errors++; $errorlist .= "Invalid character class"; } + + $difficulties = dorow(doquery("SELECT * FROM {{table}} WHERE id='$difficulty' LIMIT 1", "difficulties")); + if ($difficulties != false) { + $expbonus += $difficulties["expbonus"]; + $goldbonus += $difficulties["goldbonus"]; + $difficulty = $difficulties["multiplier"]; + $deathpenalty = $difficulties["deathpenalty"]; + } else { $errors++; $errorlist .= "Invalid character class"; } + + if ($errors == 0) { + + // Now everything's cool. Create new character row. + $query = doquery("INSERT INTO {{table}} SET id='', account='".$acctrow["id"]."', birthdate=NOW(), lastip='".$_SERVER["REMOTE_ADDR"]."', onlinetime=NOW(), charname='$charname', charpicture='$newcharpicture', charclass='$charclass', difficulty='$difficulty', deathpenalty='$deathpenalty', expbonus='$expbonus', goldbonus='$goldbonus'", "users"); + + // Update account row. + $default = ""; + if (isset($setdefault)) { $default = "activechar='".mysql_insert_id()."', "; } + if ($acctrow["characters"] == 0) { $default = "activechar='".mysql_insert_id()."', "; } + $query2 = doquery("UPDATE {{table}} SET $default characters=characters+1 WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts"); + + // And we're finished. + die(header("Location: users.php?do=characters")); + + } else { + + // Die gracefully on errors. + if ($acctrow["characters"] != 0) { + err("The following error(s) occurred when your character was being made:
$errorlist
Please go back and try again."); + } else { + die("The following error(s) occurred when your character was being made:
$errorlist
Please go back and try again."); + } + + } + + } + + + $classes = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "classes")); + $row["charclass"] = ""; + foreach($classes as $a=>$b) { + $row["charclass"] .= ""; + } + $difficulty = dorow(doquery("SELECT * FROM {{table}} ORDER BY id", "difficulties")); + $row["difficulty"] = ""; + foreach($difficulty as $a=>$b) { + $row["difficulty"] .= ""; + } + + if ($acctrow["characters"] == 0) { $row["defaultenabled"] = "disabled=\"disabled\""; } else { $row["defaultenabled"] = ""; } + $row["maxsize"] = round($controlrow["avatarmaxsize"] / 1000, 1); + + display("Characters", parsetemplate(gettemplate("users_charnew"), $row), false); + +} + +function charedit() { + + global $controlrow, $acctrow; + + // Change the active character for the account. + if (!is_numeric($_GET["uid"])) { err("Invalid UID."); } + $newuserrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$_GET["uid"]."' LIMIT 1", "users")); + if ($newuserrow == false) { err("No such UID."); } + if ($newuserrow["account"] != $acctrow["id"]) { err("You don't own that UID."); } + + if (isset($_POST["submit"])) { + + extract($_POST); + + // Upload new charpicture, if required. + if ($_FILES["intavatar"]["error"] != 4) { + + $allowed = array(".gif",".jpg",".png"); + $type = substr($_FILES["intavatar"]["name"],-4); + + // Errors. + if (!in_array(strtolower($type),$allowed)) { err("Unallowed filetype for avatar."); } + if ($_FILES["intavatar"]["size"] > $controlrow["avatarmaxsize"]) { err("Avatar filesize too big."); } + $imagesize = getimagesize($_FILES["intavatar"]["tmp_name"]); + if (($imagesize[0]>50) || ($imagesize[1]>50)) { err("Avatar dimensions too big."); } + + // Move file and finish. + $randomext = ""; + for($i=0; $i<8; $i++) { $randomext .= rand(0,9); } + $uploadfile = $controlrow["avatarpath"] . $acctrow["username"] . $randomext . $type; + if (!move_uploaded_file($_FILES["intavatar"]["tmp_name"], $uploadfile)) { err("Unable to upload avatar."); } + $newcharpicture = $controlrow["avatarurl"] . $acctrow["username"] . $randomext . $type; + + if ($newuserrow["charpicture"] != "") { + $oldav = ltrim($newuserrow["charpicture"], $controlrow["avatarurl"]); + unlink($controlrow["avatarpath"] . $oldav); + } + + } + + // Now everything's cool. + $query = doquery("UPDATE {{table}} SET charpicture='$newcharpicture' WHERE id='".$newuserrow["id"]."' LIMIT 1", "users"); + die(header("Location: users.php?do=characters")); + + } elseif (isset($_POST["delete"])) { + + if ($acctrow["characters"] == 1) { err("You only have one character on your account. If you wish to delete this character, please make a new one first before trying to delete this one."); } + display("Characters", parsetemplate(gettemplate("users_chardelete"), $newuserrow)); + + } elseif (isset($_POST["ultrakill"])) { + + // First we delete the char. + $query = doquery("DELETE FROM {{table}} WHERE id='".$newuserrow["id"]."'", "users"); + + // Then we gotta update acctrow accordingly. + $query2 = dorow(doquery("SELECT * FROM {{table}} WHERE account='".$acctrow["id"]."' ORDER BY id LIMIT 1", "users")); + $query3 = doquery("UPDATE {{table}} SET characters=characters-1, activechar='".$query2["id"]."' WHERE id='".$acctrow["id"]."' LIMIT 1", "accounts"); + die(header("Location: users.php?do=characters")); + + } elseif (isset($_POST["wimpout"])) { + + die(header("Location: users.php?do=characters")); + + } + + $newuserrow["maxsize"] = round($controlrow["avatarmaxsize"] / 1000, 1); + display("Characters", parsetemplate(gettemplate("users_charedit"), $newuserrow)); + +} + +function levelup() { + + global $userrow; + + if ($userrow["levelup"] == 0) { err("You do not currently have any Level Points to spend."); } + + $classrow = dorow(doquery("SELECT * FROM {{table}} WHERE id='".$userrow["charclass"]."' LIMIT 1", "classes")); + + if (isset($_POST["submit"])) { + + unset($_POST["submit"]); + + // Check to make sure they didn't mess with the input names. + foreach($_POST as $a=>$b) { + if (!is_numeric($a)) { err("Invalid input format."); } + } + + // Loop through and add points where appropriate. + // Note that we loop through the number of points in $userrow, rather than the number of fields. + // This is to ensure that people don't edit the source to just add more fields. + $total = $userrow["levelup"]; + for($i=0; $i<$total; $i++) { + switch($_POST[$i]) { + case "str": + $userrow["strength"]++; + $userrow["physattack"] += (1 * $classrow["damageperstrength"]); + $userrow["levelup"]--; + break; + case "dex": + $userrow["dexterity"]++; + $userrow["maxhp"] += (1 * $classrow["hpperdexterity"]); + $userrow["currenthp"] += (1 * $classrow["hpperdexterity"]); + $userrow["levelup"]--; + break; + case "enr": + $userrow["energy"]++; + $userrow["maxmp"] += (1 * $classrow["mpperenergy"]); + $userrow["currentmp"] += (1 * $classrow["mpperenergy"]); + $userrow["levelup"]--; + break; + default: + break; + } + } + + // Round down any fractions. + $userrow["physattack"] = floor($userrow["physattack"]); + $userrow["maxhp"] = floor($userrow["maxhp"]); + $userrow["maxmp"] = floor($userrow["maxmp"]); + + // Finish. + updateuserrow(); + display("Level Points", parsetemplate(gettemplate("users_levelup2"), $userrow)); + + } else { + + $row["dropdowns"] = ""; + for($i=0; $i<$userrow["levelup"]; $i++) { + $row["dropdowns"] .= "
\n"; + } + $row["classname"] = $classrow["name"]; + $row["damageperstrength"] = $classrow["damageperstrength"]; + $row["hpperdexterity"] = $classrow["hpperdexterity"]; + $row["mpperenergy"] = $classrow["mpperenergy"]; + $row["levelup"] = $userrow["levelup"]; + + display("Level Points", parsetemplate(gettemplate("users_levelup1"), $row)); + + } + +} + +function levelspell() { + + global $userrow, $spells; + + if ($userrow["levelspell"] == 0) { err("You do not currently have any Spell Points to spend."); } + + if (isset($_POST["submit"])) { + + unset($_POST["submit"]); + + // Check to make sure they didn't mess with the input names. + foreach($_POST as $a=>$b) { + $a = ltrim($a,"spelot"); + if (!is_numeric($a)) { err("Invalid input format."); } + } + + // Loop through and add points where appropriate. + // Note that we loop through the number of points in $userrow, rather than the number of fields. + // This is to ensure that people don't edit the source to just add more fields. + $total = $userrow["levelspell"]; + for($i=0; $i<$total; $i++) { + if (!isset($spells[$_POST["spell".$i]])) { err("That spell doesn't exist."); } + $userrow["spell".$_POST["slot".$i]."id"] = $_POST["spell".$i]; + $userrow["spell".$_POST["slot".$i]."name"] = $spells[$_POST["spell".$i]]["name"]; + $userrow["levelspell"]--; + } + + // Finish. + updateuserrow(); + display("Spell Points", parsetemplate(gettemplate("users_levelspell2"), $userrow)); + + } else { + + if ($userrow["levelspell"] != 0) { + $row["spelldropdowns"] = ""; + for ($j=0; $j<$userrow["levelspell"]; $j++) { + $row["spelldropdowns"] .= " goes in
"; + } + $row["spelldropdowns"] .= "
"; + } + + $row["levelspell"] = $userrow["levelspell"]; + + display("Spell Points", parsetemplate(gettemplate("users_levelspell1"), $row)); + + } + +} + +?> \ No newline at end of file